[MH2] Discerning Taste only gains life if cards actually put in graveyard

This commit is contained in:
Alex W. Jackson 2022-09-28 22:32:18 -04:00
parent 938c0e37aa
commit 825327cb8e

View file

@ -1,7 +1,7 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
@ -11,10 +11,13 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards; import mage.cards.Cards;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
* *
* @author weirddan455 * @author weirddan455
@ -56,13 +59,13 @@ class DiscerningTasteEffect extends LookLibraryAndPickControllerEffect {
@Override @Override
protected boolean actionWithPickedCards(Game game, Ability source, Player player, Cards pickedCards, Cards otherCards) { protected boolean actionWithPickedCards(Game game, Ability source, Player player, Cards pickedCards, Cards otherCards) {
super.actionWithPickedCards(game, source, player, pickedCards, otherCards); super.actionWithPickedCards(game, source, player, pickedCards, otherCards);
int life = 0; otherCards.retainZone(Zone.GRAVEYARD, game);
for (Card card : otherCards.getCards(StaticFilters.FILTER_CARD_CREATURE, game)) { int life = otherCards.getCards(StaticFilters.FILTER_CARD_CREATURE, game)
int power = card.getPower().getValue(); .stream()
if (power > life) { .map(MageObject::getPower)
life = power; .mapToInt(MageInt::getValue)
} .max()
} .orElse(0);
player.gainLife(life, game, source); player.gainLife(life, game, source);
return true; return true;
} }