diff --git a/src/rooms/commands/DiscardCommand.ts b/src/rooms/commands/DiscardCommand.ts index c7e81fe..f36f4bd 100644 --- a/src/rooms/commands/DiscardCommand.ts +++ b/src/rooms/commands/DiscardCommand.ts @@ -22,7 +22,7 @@ export class DiscardCommand extends Command { - execute({timeUp} = this.payload) { + async execute({timeUp} = this.payload) { let giveUpCount = 0; const playerCount = this.room.maxClients - 1; const sessionIds = [...this.state.players.keys()]; @@ -98,9 +98,11 @@ export class EatConfirmCommand extends Command { if (!player) { error('未找到玩家'); } - this.room.battleMan.onPlayerRoundStart(player); + let time = this.room.battleMan.onPlayerRoundStart(player); + await this.delay(time); if (player.state == PlayerStateConst.PLAYER_DEAD) { return [new TurnEndCommand()]; } else { diff --git a/src/rooms/commands/TurnEndCommand.ts b/src/rooms/commands/TurnEndCommand.ts index 40d5802..e6c4bb2 100644 --- a/src/rooms/commands/TurnEndCommand.ts +++ b/src/rooms/commands/TurnEndCommand.ts @@ -13,12 +13,12 @@ import gameUtil from "../../utils/game.util"; */ export class TurnEndCommand extends Command { - execute() : Array | void{ - const sessionIds = [...this.state.players.keys()]; + async execute(): Promise { if (this.state.currentTurn) { let player = this.state.players.get(this.state.currentTurn); if (player) { - this.room.battleMan.onPlayerRoundEnd(player); + let delay = this.room.battleMan.onPlayerRoundEnd(player); + await this.delay(delay); } } // if (this.state.currentTurn