diff --git a/src/robot/Robot.ts b/src/robot/Robot.ts index 6109870..9ea162e 100644 --- a/src/robot/Robot.ts +++ b/src/robot/Robot.ts @@ -158,9 +158,13 @@ export class Robot { */ @wait('maxDiscardTime') private async discard() { + let targetCard + if (this.room.state.cards.size == 1) { + targetCard =[...this.room.state.cards.values()][0]; + } let self = this; let cardArr = [...self.player.cards.values()]; - let cards = assistantUtil.checkTriple(cardArr); + let cards = assistantUtil.checkTriple(cardArr, targetCard); if (!cards) { return; } @@ -168,7 +172,8 @@ export class Robot { // let cardIds = [cardArr[0].id] log(`discard: ${self.sessionId} ${cardIds}`); self.reply('discard_card_c2s', { - cards: cardIds + cards: cardIds, + target: targetCard.id }); } diff --git a/src/robot/RobotClient.ts b/src/robot/RobotClient.ts index 78f7a7b..64de35c 100644 --- a/src/robot/RobotClient.ts +++ b/src/robot/RobotClient.ts @@ -135,16 +135,21 @@ export class RobotClient implements Client { */ @wait('maxDiscardTime') private async discard() { + let targetCard + if (this.svrstate.cards.size == 1) { + targetCard =[...this.svrstate.cards.values()][0]; + } let self = this; let cardArr = [...self.selfPlayer.cards.values()]; - let cards = assistantUtil.checkTriple(cardArr); + let cards = assistantUtil.checkTriple(cardArr, targetCard); if (!cards) { return; } let cardIds = cards.map(o => o.id); log(`discard: ${self.sessionId} ${cardIds}`); self.reply('discard_card_c2s', { - cards: cardIds + cards: cardIds, + target: targetCard.id }); }