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

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

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