diff --git a/src/rooms/commands/DiceCommand.ts b/src/rooms/commands/DiceCommand.ts index 89bd68b..33c3b3d 100644 --- a/src/rooms/commands/DiceCommand.ts +++ b/src/rooms/commands/DiceCommand.ts @@ -4,6 +4,7 @@ import { Client } from 'colyseus' import { error } from '../../common/Debug' import { DiceResultCommand } from './DiceResultCommand' import { GameStateConst } from '../../constants/GameStateConst' +import gameUtil from '../../utils/game.util' /** * 出一张牌比大小 @@ -28,6 +29,7 @@ export class DiceCommand extends Command { async execute() { this.state.round += 1 this.state.updateGameState(GameStateConst.STATE_DICE_TURN) + for (let [,player] of this.state.players) { + player.cardQueue.clear() + } return [new DiceDrawCommand()] } } diff --git a/src/rooms/commands/DiceTurnEndCommand.ts b/src/rooms/commands/DiceTurnEndCommand.ts index f290c21..792c8de 100644 --- a/src/rooms/commands/DiceTurnEndCommand.ts +++ b/src/rooms/commands/DiceTurnEndCommand.ts @@ -1,9 +1,16 @@ import { Command } from '@colyseus/command' import { CardGameState } from '../schema/CardGameState' import { DiceNextTurnCommand } from './DiceNextTurnCommand' +import gameUtil from '../../utils/game.util' +import { GameResultCommand } from './GameResultCommand' export class DiceTurnEndCommand extends Command { async execute() { + // 判断是否胜利 + let result = gameUtil.checkGameEnd(this.state) + if (result) { + return [new GameResultCommand()] + } return [new DiceNextTurnCommand()] } }