尝试修正$changes为null的问题
This commit is contained in:
parent
5d392a0fdb
commit
a06f9b08c7
@ -38,7 +38,9 @@ export class DiscardCommand extends Command<CardGameState, { client: Client, car
|
||||
}
|
||||
let tmpCards = [];
|
||||
for (let id of cards) {
|
||||
tmpCards.push(player.cards.get(id + ''));
|
||||
if (player.cards.has(id + '')) {
|
||||
tmpCards.push(player.cards.get(id + ''));
|
||||
}
|
||||
}
|
||||
if (!gameUtil.checkDiscard(tmpCards, new GameEnv().selfEatCount)) {
|
||||
this.room.send(client,'discard_card_s2c', {errcode: 4, errmsg: '出牌不符合规则'});
|
||||
@ -55,11 +57,11 @@ export class DiscardCommand extends Command<CardGameState, { client: Client, car
|
||||
let newCount = player.extraTime - Math.min(count, 0);
|
||||
player.extraTime = Math.max(newCount, 0);
|
||||
}
|
||||
for (let id of cards) {
|
||||
this.state.cards.set(id+'', player.cards.get(id + ''));
|
||||
player.cardQueue.push(player.cards.get(id + ''));
|
||||
player.cards.delete(id + '');
|
||||
player.cardSet.delete(id + '');
|
||||
for (let card of tmpCards) {
|
||||
this.state.cards.set(card.id + '', card);
|
||||
player.cardQueue.push(card);
|
||||
player.cards.delete(card.id + '');
|
||||
player.cardSet.delete(card.id + '');
|
||||
}
|
||||
/**
|
||||
* 这说明是当前轮正常出牌,
|
||||
@ -90,13 +92,6 @@ export class DiscardCommand extends Command<CardGameState, { client: Client, car
|
||||
self.room.dispatcher.dispatch(new TurnEndCommand());
|
||||
}
|
||||
this.room.beginSchedule(time, timeOverSelectPet, `select_pet`);
|
||||
// this.room.mainClock = this.clock.setTimeout(function (){
|
||||
// player.extraTime = 0;
|
||||
// self.room.mainClock.clear();
|
||||
// debugRoom('选随从或者法术时间到, 自动出牌, 自动进入下一轮');
|
||||
// self.room.dispatcher.dispatch(new TurnEndCommand());
|
||||
// }.bind(this), time);
|
||||
// return [new NextTurnCommand()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user