mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 12:19:59 -08:00
Fixed a bug that if a human player had to discard more cards than he had on hand, the game UI was blocked.
This commit is contained in:
parent
09dd373909
commit
cd0f273122
5 changed files with 33 additions and 13 deletions
|
|
@ -709,7 +709,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
TargetDiscard target = new TargetDiscard(amount, amount, new FilterCard(CardUtil.numberToText(amount, "a") + " card" + (amount > 1 ? "s" : "")), playerId);
|
||||
int possibleAmount = Math.min(getHand().size(), amount);
|
||||
TargetDiscard target = new TargetDiscard(possibleAmount, possibleAmount, new FilterCard(CardUtil.numberToText(possibleAmount, "a") + " card" + (possibleAmount > 1 ? "s" : "")), playerId);
|
||||
choose(Outcome.Discard, target, source == null ? null : source.getSourceId(), game);
|
||||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = this.getHand().get(cardId, game);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue