如果state.round为空, 那么设为0
This commit is contained in:
parent
68e69ba53d
commit
ed36bc0371
@ -63,7 +63,7 @@ export class BeginGameCommand extends Command<CardGameState, {}> {
|
|||||||
const cardChangeTime = new GameEnv().cardChangeTime
|
const cardChangeTime = new GameEnv().cardChangeTime
|
||||||
await this.delay(cardChangeTime * 1000)
|
await this.delay(cardChangeTime * 1000)
|
||||||
if (this.state.gameState == GameStateConst.STATE_CHANGE_CARD) {
|
if (this.state.gameState == GameStateConst.STATE_CHANGE_CARD) {
|
||||||
if (this.state.mode === 4) {
|
if (this.state.mode !== 4) {
|
||||||
return [new NextTurnCommand()]
|
return [new NextTurnCommand()]
|
||||||
} else {
|
} else {
|
||||||
return [new DiceNextTurnCommand()]
|
return [new DiceNextTurnCommand()]
|
||||||
|
@ -5,6 +5,9 @@ import { DiceDrawCommand } from './DiceDrawCommand'
|
|||||||
|
|
||||||
export class DiceNextTurnCommand extends Command<CardGameState, {}> {
|
export class DiceNextTurnCommand extends Command<CardGameState, {}> {
|
||||||
async execute() {
|
async execute() {
|
||||||
|
if (this.state.round == undefined) {
|
||||||
|
this.state.round = 0
|
||||||
|
}
|
||||||
this.state.round += 1
|
this.state.round += 1
|
||||||
this.state.updateGameState(GameStateConst.STATE_DICE_TURN)
|
this.state.updateGameState(GameStateConst.STATE_DICE_TURN)
|
||||||
for (let [,player] of this.state.players) {
|
for (let [,player] of this.state.players) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user