Commit 19ac797c authored by 18손재민's avatar 18손재민

공격 단어 오타낼 시 강호패가 공격자에게 생기는 기능 구현. 이제 공격할 경우 호패 2개가 추가로 생김.

parent 13860f74
...@@ -43,6 +43,11 @@ socket.on('defeat', function(msg) // object player ...@@ -43,6 +43,11 @@ socket.on('defeat', function(msg) // object player
console.log(RoomData.players[msg.index].nickname + ' defeated'); console.log(RoomData.players[msg.index].nickname + ' defeated');
}); });
socket.on('attacksuccess', function(msg)
{
WordSpace.nameGroup.push(new NameWord(msg.victim, true));
});
// out game // out game
socket.on('userDisconnect', function(msg) // {num index , num id, str nickname} socket.on('userDisconnect', function(msg) // {num index , num id, str nickname}
{ {
......
...@@ -140,8 +140,8 @@ class AttackWord extends WordObject ...@@ -140,8 +140,8 @@ class AttackWord extends WordObject
this.wordWeight *= isStrong ? 3 : 2; this.wordWeight *= isStrong ? 3 : 2;
this.attacker = _playerData; this.attacker = _playerData;
//서버 사용하게 되면 PlayerTyping을 피격자의 것으로 바꿔야 함 //서버 사용하게 되면 PlayerTyping을 피격자의 것으로 바꿔야 함
this.counterTime = WordSpace.gameTimer.now + 1000 * (this.wordTyping <= (5 - _wordGrade) * 2.5 ? this.wordTyping * (WordSpace.playerTyping / 60) * 2 : this.counterTime = WordSpace.gameTimer.now + 1000 * (this.wordTyping <= (5 - _wordGrade) * 2.5 ? this.wordTyping * (WordSpace.playerTyping / 60) * 1.5 :
((5 - _wordGrade) * 2.5 + (this.wordTyping - (5 - _wordGrade) * 2.5) * 3) * (WordSpace.playerTyping / 60) * 2); ((5 - _wordGrade) * 2.5 + (this.wordTyping - (5 - _wordGrade) * 2.5) * 2.5) * (WordSpace.playerTyping / 60) * 1.5);
console.log('Attack text : ' + text + ', Attacker : ' + this.attacker.nickname + ', Weight : ' + this.wordWeight); console.log('Attack text : ' + text + ', Attacker : ' + this.attacker.nickname + ', Weight : ' + this.wordWeight);
console.log('Counter time : ' + this.counterTime); console.log('Counter time : ' + this.counterTime);
} }
...@@ -155,7 +155,12 @@ class AttackWord extends WordObject ...@@ -155,7 +155,12 @@ class AttackWord extends WordObject
case 3: WordSpace.attackGauge.add(0.5); break; case 3: WordSpace.attackGauge.add(0.5); break;
default: console.log('[ERR] wrong grade of word'); break; default: console.log('[ERR] wrong grade of word'); break;
} }
if(WordSpace.gameTimer.now < this.counterTime) WordSpace.nameGroup.push(new NameWord(this.attacker, true)); if(WordSpace.gameTimer.now < this.counterTime)
{
WordSpace.nameGroup.push(new NameWord(this.attacker, true));
WordSpace.generateWord.Name(WordSpace.gameSceneForTest, false);
WordSpace.generateWord.Name(WordSpace.gameSceneForTest, false);
}
//강호패 넣기 구현해야됨 //강호패 넣기 구현해야됨
//WordSpace.generateWord.Name(WordSpace.gameSceneForTest, true); //WordSpace.generateWord.Name(WordSpace.gameSceneForTest, true);
super.destroy(); super.destroy();
......
...@@ -354,8 +354,14 @@ WordSpace.findWord = function(wordText) ...@@ -354,8 +354,14 @@ WordSpace.findWord = function(wordText)
{ {
if(WordSpace.getEditDistance(wordText, element.wordText) == minDist) if(WordSpace.getEditDistance(wordText, element.wordText) == minDist)
{ {
//강호패 보내야 함 //console.log('Attack word : ' + element.wordText + ' of ' + element.attacker.nickname + ' 오타임');
console.log('Attack word : ' + element.wordText + ' of ' + element.attacker.nickname + ' 오타임'); let attackedData =
{
roomNum: RoomData.roomNum,
victim: RoomData.myself,
target: element.attacker.ownerId
}
socket.emit('defenseFailed', attackedData);
} }
}); });
this.attackGauge.sub(2); this.attackGauge.sub(2);
......
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