From 7c18cf84546284e7107bd7a1ec54fa33b06c6b64 Mon Sep 17 00:00:00 2001 From: zhl Date: Tue, 30 Mar 2021 16:07:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=AF=94=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=E7=9A=84=E4=B8=80=E4=BA=9Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/robot/Robot.ts | 17 +++++++++++------ src/robot/RobotClient.ts | 17 +++++++++++------ src/rooms/commands/ChangeCardCommand.ts | 2 +- src/rooms/commands/DiceResultCommand.ts | 4 +--- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/robot/Robot.ts b/src/robot/Robot.ts index 2251ada..e08330d 100644 --- a/src/robot/Robot.ts +++ b/src/robot/Robot.ts @@ -223,13 +223,18 @@ export class Robot { let repData: any = { cards: cardIds } - if (hasEatCard) { - repData.target = targetCard.id + if (this.room.state.mode === 4) { + self.reply('dice_card_c2s', repData) + } else { + if (hasEatCard) { + repData.target = targetCard.id + } + if (result.nums) { + repData.nums = result.nums + } + self.reply('discard_card_c2s', repData) } - if (result.nums) { - repData.nums = result.nums - } - self.reply('discard_card_c2s', repData) + } /** diff --git a/src/robot/RobotClient.ts b/src/robot/RobotClient.ts index 856395d..c8e801f 100644 --- a/src/robot/RobotClient.ts +++ b/src/robot/RobotClient.ts @@ -183,13 +183,18 @@ export class RobotClient implements Client { let repData: any = { cards: cardIds } - if (hasEatCard) { - repData.target = targetCard.id + if (this.svrstate.mode === 4) { + self.reply('dice_card_c2s', repData) + } else { + if (hasEatCard) { + repData.target = targetCard.id + } + if (result.nums) { + repData.nums = result.nums + } + self.reply('discard_card_c2s', repData) } - if (result.nums) { - repData.nums = result.nums - } - self.reply('discard_card_c2s', repData) + } /** diff --git a/src/rooms/commands/ChangeCardCommand.ts b/src/rooms/commands/ChangeCardCommand.ts index b7f4b5f..f7e1f58 100644 --- a/src/rooms/commands/ChangeCardCommand.ts +++ b/src/rooms/commands/ChangeCardCommand.ts @@ -53,7 +53,7 @@ export class ChangeCardCommand extends Command= this.room.maxClients) { // TODO:: 根据 this.state.firstPlayer确定先手 - if (this.state.mode === 4) { + if (this.state.mode !== 4) { // 正式开始游戏, 第一个玩家出牌 this.state.updateGameState(GameStateConst.STATE_BEGIN_DRAW) return [new NextTurnCommand()] diff --git a/src/rooms/commands/DiceResultCommand.ts b/src/rooms/commands/DiceResultCommand.ts index ad90865..3e525b0 100644 --- a/src/rooms/commands/DiceResultCommand.ts +++ b/src/rooms/commands/DiceResultCommand.ts @@ -14,7 +14,6 @@ export class DiceResultCommand extends Command max) { max = ap winner = pid } } - this.room.broadcast('dice_result_s2c', {winner, tatal: max, results: resultMap}) + this.room.broadcast('dice_result_s2c', {winner, tatal: max }) let player = this.state.players.get(winner) const time = this.room.battleMan.onPlayerRoundWin(player) await this.delay(time)