Commit 682e7530 authored by 18손재민's avatar 18손재민

반격 시간 안에 반격하면 공격자의 강호패가 생성됨, 오타 최소치 수정함

parent 8f50f148
var GameServer = GameServer || {}; var GameServer = GameServer || {};
GameServer.Phase = {READY: 0, START: 1, MAIN: 2, MUSIC: 3}; GameServer.Phase = {READY: 0, START: 1, MAIN: 2, MUSIC: 3};
GameServer.startCount = 2; GameServer.startCount = 3;
GameServer.currentPlayer = []; GameServer.currentPlayer = [];
GameServer.playingRoom = []; GameServer.playingRoom = [];
......
...@@ -117,7 +117,6 @@ class AttackWord extends WordObject ...@@ -117,7 +117,6 @@ class AttackWord extends WordObject
constructor(text, _wordGrade, _playerData, isStrong) constructor(text, _wordGrade, _playerData, isStrong)
{ {
super(text); super(text);
console.log(_playerData);
this.wordGrade = _wordGrade; this.wordGrade = _wordGrade;
this.wordWeight = WordReader.getWordWeight(this.wordGrade); this.wordWeight = WordReader.getWordWeight(this.wordGrade);
if(WordReader.getWordTyping(_playerData.nickname) <= 9) if(WordReader.getWordTyping(_playerData.nickname) <= 9)
...@@ -127,7 +126,6 @@ class AttackWord extends WordObject ...@@ -127,7 +126,6 @@ class AttackWord extends WordObject
//서버 사용하게 되면 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) * 2 :
((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) * 3) * (WordSpace.playerTyping / 60) * 2);
this.counterTime = 10000;
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);
} }
......
...@@ -253,6 +253,7 @@ WordSpace.generateWord = ...@@ -253,6 +253,7 @@ WordSpace.generateWord =
Name: function(scene, isStrong, lenRate) Name: function(scene, isStrong, lenRate)
{ {
word = new NameWord(WordSpace.nameQueue.pop(), isStrong); word = new NameWord(WordSpace.nameQueue.pop(), isStrong);
//word = new NameWord(RoomData.myself, false);
WordSpace.pushWord(scene, word, lenRate); WordSpace.pushWord(scene, word, lenRate);
} }
} }
...@@ -334,7 +335,7 @@ WordSpace.findWord = function(wordText) ...@@ -334,7 +335,7 @@ WordSpace.findWord = function(wordText)
} }
else // 오타 체크 else // 오타 체크
{ {
let minDist = 5, tempDist = 0; let minDist = WordReader.getWordTyping(wordText) / 2 + 1, tempDist = 0;
let attackWords = []; let attackWords = [];
WordSpace.wordGroup.forEach(function(element) WordSpace.wordGroup.forEach(function(element)
{ {
...@@ -350,9 +351,10 @@ WordSpace.findWord = function(wordText) ...@@ -350,9 +351,10 @@ WordSpace.findWord = function(wordText)
if(WordSpace.getEditDistance(wordText, element.wordText) == minDist) if(WordSpace.getEditDistance(wordText, element.wordText) == minDist)
{ {
//강호패 보내야 함 //강호패 보내야 함
console.log('Attack word of ' + element.attacker.nickname + ' 오타임'); console.log('Attack word : ' + element.wordText + ' of ' + element.attacker.nickname + ' 오타임');
} }
}); });
this.attackGauge.sub(2);
} }
} }
...@@ -393,6 +395,7 @@ WordSpace.attack = function(wordText, grade) ...@@ -393,6 +395,7 @@ WordSpace.attack = function(wordText, grade)
} }
socket.emit('attack', attackData); socket.emit('attack', attackData);
}); });
//테스트용, 자기 자신에게 공격함
//WordSpace.generateWord.Attack(WordSpace.gameSceneForTest, wordText, grade, PlayerData, false); //WordSpace.generateWord.Attack(WordSpace.gameSceneForTest, wordText, grade, PlayerData, false);
WordSpace.nameGroup = []; WordSpace.nameGroup = [];
WordSpace.attackGauge.resetValue(); WordSpace.attackGauge.resetValue();
......
...@@ -24,7 +24,7 @@ PlayerData.nickname = '홍길동'; //플레이어 닉네임 ...@@ -24,7 +24,7 @@ PlayerData.nickname = '홍길동'; //플레이어 닉네임
// 현재 들어가있는 Game Room의 정보 // 현재 들어가있는 Game Room의 정보
var RoomData = RoomData || {}; var RoomData = RoomData || {};
RoomData.myself = null;
RoomData.roomNum = -1; RoomData.roomNum = -1;
RoomData.myself = null;
RoomData.players = null; RoomData.players = null;
RoomData.aliveCount = -1; RoomData.aliveCount = -1;
\ No newline at end of file
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