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)