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