如果state.round为空, 那么设为0

This commit is contained in:
zhl 2021-03-30 15:53:21 +08:00
parent 68e69ba53d
commit ed36bc0371
2 changed files with 4 additions and 1 deletions

View File

@ -63,7 +63,7 @@ export class BeginGameCommand extends Command<CardGameState, {}> {
const cardChangeTime = new GameEnv().cardChangeTime
await this.delay(cardChangeTime * 1000)
if (this.state.gameState == GameStateConst.STATE_CHANGE_CARD) {
if (this.state.mode === 4) {
if (this.state.mode !== 4) {
return [new NextTurnCommand()]
} else {
return [new DiceNextTurnCommand()]

View File

@ -5,6 +5,9 @@ import { DiceDrawCommand } from './DiceDrawCommand'
export class DiceNextTurnCommand extends Command<CardGameState, {}> {
async execute() {
if (this.state.round == undefined) {
this.state.round = 0
}
this.state.round += 1
this.state.updateGameState(GameStateConst.STATE_DICE_TURN)
for (let [,player] of this.state.players) {