Commit 94d2cd10 authored by 18신대성's avatar 18신대성 Committed by 18손재민

끝내기단어 조건 변경 및 페이즈변경 조건 변경

parent e41809ef
...@@ -212,6 +212,7 @@ class GameRoom ...@@ -212,6 +212,7 @@ class GameRoom
if (this.phaseChanger < 0 && checkTime - this.startTime > 60000) if (this.phaseChanger < 0 && checkTime - this.startTime > 60000)
{ {
this.currentPhase = GameServer.Phase.MAIN; this.currentPhase = GameServer.Phase.MAIN;
this.rateArrangePoint = 150;
this.announceToRoom('changePhase', GameServer.Phase.MAIN); this.announceToRoom('changePhase', GameServer.Phase.MAIN);
} }
else if (this.phaseChanger < 0) else if (this.phaseChanger < 0)
...@@ -219,6 +220,7 @@ class GameRoom ...@@ -219,6 +220,7 @@ class GameRoom
this.phaseChanger = setTimeout(function(room) this.phaseChanger = setTimeout(function(room)
{ {
room.currentPhase = GameServer.Phase.MAIN; room.currentPhase = GameServer.Phase.MAIN;
room.rateArrangePoint = 150;
room.announceToRoom('changePhase', GameServer.Phase.MAIN); room.announceToRoom('changePhase', GameServer.Phase.MAIN);
room.phaseChanger = -1; room.phaseChanger = -1;
}, 60000 - (checkTime - this.startTime), this); }, 60000 - (checkTime - this.startTime), this);
...@@ -226,10 +228,11 @@ class GameRoom ...@@ -226,10 +228,11 @@ class GameRoom
} }
else if (this.currentPhase === GameServer.Phase.MAIN) else if (this.currentPhase === GameServer.Phase.MAIN)
{ {
let playerLimit = Math.max(this.currentPlayer.length / 10, 3); let playerLimit = Math.min(Math.round(this.currentPlayer.length / 5), 3);
if (this.aliveCount <= playerLimit) if (this.aliveCount <= playerLimit)
{ {
this.currentPhase = GameServer.Phase.MUSIC; this.currentPhase = GameServer.Phase.MUSIC;
this.rateArrangePoint = 50;
this.announceToRoom('changePhase', GameServer.Phase.MUSIC); this.announceToRoom('changePhase', GameServer.Phase.MUSIC);
} }
} }
...@@ -291,7 +294,7 @@ class Player ...@@ -291,7 +294,7 @@ class Player
this.rank = -1; this.rank = -1;
this.playerTyping = 0; this.playerTyping = 0;
this.lastAttacks = []; // { attackerId, word, wordGrade, time } this.lastAttacks = []; // { attackerId, attacker, wrongCount, word, wordGrade, time }
this.lastAttack = null; this.lastAttack = null;
} }
...@@ -311,12 +314,16 @@ class Player ...@@ -311,12 +314,16 @@ class Player
if (this.lastAttacks.length > 0) if (this.lastAttacks.length > 0)
{ {
this.lastAttack = this.lastAttacks[this.lastAttacks.length - 1]; this.lastAttack = this.lastAttacks[this.lastAttacks.length - 1];
if (Date.now() - this.lastAttack.time > 40000) this.lastAttack = null; if (Date.now() - this.lastAttack.time > 20000) this.lastAttack = null;
else else
{ {
this.lastAttacks.forEach(function(element) this.lastAttacks.forEach(function(element)
{ {
if (Date.now() - element.time < 40000 && element.wordGrade > player.lastAttack.wordGrade) player.lastAttack = element; if (Date.now() - element.time < 20000)
{
if (element.wrongCount > player.lastAttack.wrongCount) player.lastAttack = element;
else if (element.wrongCount === player.lastAttack.wrongCount && element.wordGrade > player.lastAttack.wordGrade) player.lastAttack = element;
}
}); });
} }
} }
......
...@@ -65,16 +65,7 @@ WordSpace.spaceInitiate = function(scene) ...@@ -65,16 +65,7 @@ WordSpace.spaceInitiate = function(scene)
WordSpace.AdjustVarByPhase = function(typingRate, phase) WordSpace.AdjustVarByPhase = function(typingRate, phase)
{ {
if(phase == WordSpace.Phase.READY) if(phase == WordSpace.Phase.START)
{
WordSpace.delay.WordSpawn = 10000;
WordSpace.delay.NameSpawn = 10000;
WordSpace.NameSpawnReduce = 0;
WordSpace.GradeProb[0] = 1;
WordSpace.GradeProb[1] = 1;
WordSpace.GradeProb[2] = 1;
}
else if(phase == WordSpace.Phase.START)
{ {
WordSpace.delay.WordSpawn = 3000; WordSpace.delay.WordSpawn = 3000;
WordSpace.delay.NameSpawn = 15000; WordSpace.delay.NameSpawn = 15000;
......
...@@ -106,16 +106,16 @@ io.on('connection', function(socket) ...@@ -106,16 +106,16 @@ io.on('connection', function(socket)
{ {
attackerId: msg.attacker.id, attackerId: msg.attacker.id,
attacker: msg.attacker.nickname, attacker: msg.attacker.nickname,
wrongCount: 0,
word: msg.text, word: msg.text,
wordGrade: msg.grade, wordGrade: msg.grade,
time: Date.now() time: Date.now()
} }
if (target.playerData.playingData.lastAttacks.length < 5) target.playerData.playingData.lastAttacks.push(dataToPush); target.playerData.playingData.lastAttacks.push(dataToPush);
else while (target.playerData.playingData.lastAttacks[0].time + 20000 < Date.now())
{ {
target.playerData.playingData.lastAttacks.splice(0, 1); target.playerData.playingData.lastAttacks.splice(0, 1);
target.playerData.playingData.lastAttacks.push(dataToPush);
} }
} }
}, 4000); }, 4000);
...@@ -129,6 +129,10 @@ io.on('connection', function(socket) ...@@ -129,6 +129,10 @@ io.on('connection', function(socket)
socket.on('defenseFailed', function(msg) socket.on('defenseFailed', function(msg)
{ {
socket.playerData.currentRoom.announceToTarget(msg.target, 'attackSucceed', msg); socket.playerData.currentRoom.announceToTarget(msg.target, 'attackSucceed', msg);
//let socket.playerData.playingData.lastAttacks.findIndex(function(element)
//{
//})
}); });
socket.on('disconnect', function(reason) socket.on('disconnect', function(reason)
......
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