mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
* Disciple of Phenax - If cards in hand are fewer than devotion all cards in hand are revealed automatically.
This commit is contained in:
parent
41132e0a59
commit
fd5a943164
1 changed files with 15 additions and 11 deletions
|
|
@ -107,20 +107,24 @@ class DiscipleOfPhenaxEffect extends OneShotEffect<DiscipleOfPhenaxEffect> {
|
|||
if (devotion > 0 && targetPlayer != null) {
|
||||
Cards revealedCards = new CardsImpl(Zone.PICK);
|
||||
int amount = Math.min(targetPlayer.getHand().size(), devotion);
|
||||
FilterCard filter = new FilterCard("card in target player's hand");
|
||||
TargetCardInHand chosenCards = new TargetCardInHand(amount, amount, filter);
|
||||
chosenCards.setRequired(true);
|
||||
chosenCards.setNotTarget(true);
|
||||
if (chosenCards.canChoose(targetPlayer.getId(), game) && targetPlayer.choose(Outcome.Discard, targetPlayer.getHand(), chosenCards, game)) {
|
||||
if (!chosenCards.getTargets().isEmpty()) {
|
||||
List<UUID> targets = chosenCards.getTargets();
|
||||
for (UUID targetid : targets) {
|
||||
Card card = game.getCard(targetid);
|
||||
if (card != null) {
|
||||
revealedCards.add(card);
|
||||
if (targetPlayer.getHand().size() > amount) {
|
||||
FilterCard filter = new FilterCard("card in target player's hand");
|
||||
TargetCardInHand chosenCards = new TargetCardInHand(amount, amount, filter);
|
||||
chosenCards.setRequired(true);
|
||||
chosenCards.setNotTarget(true);
|
||||
if (chosenCards.canChoose(targetPlayer.getId(), game) && targetPlayer.choose(Outcome.Discard, targetPlayer.getHand(), chosenCards, game)) {
|
||||
if (!chosenCards.getTargets().isEmpty()) {
|
||||
List<UUID> targets = chosenCards.getTargets();
|
||||
for (UUID targetid : targets) {
|
||||
Card card = game.getCard(targetid);
|
||||
if (card != null) {
|
||||
revealedCards.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
revealedCards.addAll(targetPlayer.getHand());
|
||||
}
|
||||
if (!revealedCards.isEmpty()) {
|
||||
targetPlayer.revealCards("Disciple of Phenax", revealedCards, game);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue