Merge branch 'second' of http://git.kingsome.cn/node/card_svr into second

This commit is contained in:
yuexin 2020-12-25 18:09:56 +08:00
commit 6c3a9de672
2 changed files with 5 additions and 1 deletions

View File

@ -33,6 +33,7 @@ export class DiscardCommand extends Command<CardGameState, { client: Client, car
if (player.cards.has(id + '')) { if (player.cards.has(id + '')) {
if (!player.cards.get(id + '').number) { if (!player.cards.get(id + '').number) {
error(`${player.id} 的手牌 ${id} 数据有问题`); error(`${player.id} 的手牌 ${id} 数据有问题`);
continue;
} }
tmpCards.push(player.cards.get(id + '')); tmpCards.push(player.cards.get(id + ''));
} else { } else {

View File

@ -18,11 +18,14 @@ export class EatCardCommand extends Command<CardGameState, { client: Client, car
return; return;
} }
let tmpCards = []; let tmpCards = [];
let cardIds = [];
for (let id of cards) { for (let id of cards) {
if (player.cards.has(id + '')) { if (player.cards.has(id + '')) {
if (!player.cards.get(id + '').number) { if (!player.cards.get(id + '').number) {
error(`${player.id} 的手牌 ${id} 数据有问题`); error(`${player.id} 的手牌 ${id} 数据有问题`);
continue;
} }
cardIds.push(id);
tmpCards.push(player.cards.get(id + '')); tmpCards.push(player.cards.get(id + ''));
} else { } else {
error(`${player.id} 出的牌 ${id} 在手牌中不存在`) error(`${player.id} 出的牌 ${id} 在手牌中不存在`)
@ -53,7 +56,7 @@ export class EatCardCommand extends Command<CardGameState, { client: Client, car
this.room.send(client,'eat_card_s2c', {errcode: 8, errmsg: '不可更改操作'}); this.room.send(client,'eat_card_s2c', {errcode: 8, errmsg: '不可更改操作'});
return ; return ;
} }
this.state.tmpActionMap.set(client.sessionId, cards); this.state.tmpActionMap.set(client.sessionId, cardIds);
return [new EatConfirmCommand().setPayload({timeUp: false})]; return [new EatConfirmCommand().setPayload({timeUp: false})];
} }