换卡数量超过限制后, 返回错误提示

This commit is contained in:
zhl 2020-12-07 16:32:14 +08:00
parent 9a2c417f84
commit a6ae526b56

View File

@ -30,6 +30,11 @@ export class ChangeCardCommand extends Command<CardGameState, { client: Client,
return;
}
const maxCount = singleton(GameEnv).roundDrawNum;
if (cards.length > maxCount) {
client.send('change_card_s2c', {errcode: 3, errmsg: '换卡数量超过限制'});
return;
}
let cardToRemove:Card[] = [];
for (let id of cards) {
let card = player.cards.get(id + '');