修改出牌过程中的吃牌判断规则

This commit is contained in:
zhl 2021-02-19 19:37:15 +08:00
parent 2599b711cd
commit afb78df7e5

View File

@ -48,11 +48,6 @@ export class DiscardCommand extends Command<CardGameState, { client: Client, car
this.room.send(client,'discard_card_s2c', {errcode: 3, errmsg: '不是当前轮'});
return;
}
if (!gameUtil.checkDiscard(tmpCards, new GameEnv().selfEatCount)) {
this.room.send(client,'discard_card_s2c', {errcode: 4, errmsg: '出牌不符合规则'});
return;
}
if (target) {
if (this.state.cards.size > 1) {
this.room.send(client,'discard_card_s2c', {errcode: 6, errmsg: '不符合吃牌规则'});
@ -62,12 +57,22 @@ export class DiscardCommand extends Command<CardGameState, { client: Client, car
this.room.send(client,'discard_card_s2c', {errcode: 5, errmsg: '找不到要吃的牌'});
return;
}
let tmpCards2 = tmpCards.concat(...this.state.cards.values())
if (!gameUtil.checkDiscard(tmpCards2, new GameEnv().otherEatCount)) {
this.room.send(client,'discard_card_s2c', {errcode: 4, errmsg: '出牌不符合规则'});
return;
}
} else {
if (!gameUtil.checkDiscard(tmpCards, new GameEnv().selfEatCount)) {
this.room.send(client,'discard_card_s2c', {errcode: 4, errmsg: '出牌不符合规则'});
return;
}
for (let [key, val] of this.state.cards) {
this.state.cards.delete(key);
}
}
//停止出牌计时, 并更新player.extraTime;
let elapsedTime = this.room.stopSchedule('draw_card');
if (elapsedTime >= 0) {