Commit 90f702d6 authored by 18손재민's avatar 18손재민

공격 단어 생성 함수 수정

parent 93dde5b8
......@@ -67,15 +67,18 @@ class WordObject
class AttackWord extends WordObject
{
constructor(text, isStrong)
constructor(text, _wordGrade, isStrong)
{
super(text);
this.wordGrade = _wordGrade;
this.wordWeight = WordReader.getWordWeight(this.wordGrade);
if(WordReader.getWordTyping(playerName) <= 9)
this.wordWeight += this.wordWeight * 0.2 * (WordReader.getWordTyping(playerName) - 9);
this.wordWeight *= isStrong ? 3 : 2;
this.attacker = playerNum;
this.attackedTime = WordSpace.gameTimer.now;
console.log('Attack text : ' + text + ', Attacker : ' + _attacker);
console.log('Attack text : ' + text + ', Attacker : ' + this.attacker + ', Weight : ' + this.wordWeight);
console.log('Attacked time : ' + this.attackedTime);
}
}
......@@ -86,6 +89,6 @@ class NameWord extends WordObject
super(text);
this.wordWeight = 2;
this.isStrong = _isStrong;
console.log('Attack text : ' + text + ', Attacker : ' + _attacker);
}
console.log('Name : ' + text + ', Strong : ' + this.isStrong + ', Weight : ' + this.wordWeight);
}
}
......@@ -236,14 +236,9 @@ WordSpace.loadImage = function(scene)
WordSpace.weightTextObjForTest = scene.add.text(100, 75, '뇌의 무게: (현재) 0 / 100 (전체)').setDepth(10).setColor('#000000');
}
WordSpace.generateWord = function(scene, wordText, grade, lenRate, attacker = null)
WordSpace.generateWord = function(scene, wordText, grade, lenRate, isStrong)
{
if(attacker != null)
{
console.log('d');
word = new AttackWord(wordText, attacker);
}
if(isStrong != undefined) word = new AttackWord(wordText, grade, isStrong);
else word = new WordObject(wordText);
if (typeof grade == 'number')
{
......@@ -361,7 +356,7 @@ WordSpace.attack = function(wordText, grade)
if (wordText != '')
{
console.log('attack ' + wordText + ', grade: ' + grade);
WordSpace.generateWord(WordSpace.gameSceneForTest, wordText, grade, playerNum); // for test
WordSpace.generateWord(WordSpace.gameSceneForTest, wordText, grade, undefined, true); // for test
// 이부분에서 게이지에 따라 급수 결정
// 이걸 서버로 공격을 보내야 함
// 이부분은 서버 잘써야함
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment