From 6c293187a67a145a9fb6f26d29f96e538239cca2 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Thu, 27 May 2021 19:40:10 -0500 Subject: [PATCH] [MH2] Implemented Discerning Taste (#7852) Co-authored-by: Evan Kranzler --- .../src/mage/cards/d/DiscerningTaste.java | 76 +++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons2.java | 1 + 2 files changed, 77 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DiscerningTaste.java diff --git a/Mage.Sets/src/mage/cards/d/DiscerningTaste.java b/Mage.Sets/src/mage/cards/d/DiscerningTaste.java new file mode 100644 index 00000000000..7a1bf6eb6f9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DiscerningTaste.java @@ -0,0 +1,76 @@ +package mage.cards.d; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; +import mage.cards.Card; +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; + +/** + * + * @author weirddan455 + */ +public final class DiscerningTaste extends CardImpl { + + public DiscerningTaste(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}"); + + // Look at the top four cards of your library. Put one of them into your hand and the rest into your graveyard. You gain life equal to the greatest power among creature cards put into your graveyard this way. + this.getSpellAbility().addEffect(new DiscerningTasteEffect()); + } + + private DiscerningTaste(final DiscerningTaste card) { + super(card); + } + + @Override + public DiscerningTaste copy() { + return new DiscerningTaste(this); + } +} + +class DiscerningTasteEffect extends LookLibraryAndPickControllerEffect { + + public DiscerningTasteEffect() { + super(StaticValue.get(4), false, StaticValue.get(1), StaticFilters.FILTER_CARD, Zone.GRAVEYARD, + false, false, false, Zone.HAND, false, false, false + ); + } + + private DiscerningTasteEffect(final DiscerningTasteEffect effect) { + super(effect); + } + + @Override + public DiscerningTasteEffect copy() { + return new DiscerningTasteEffect(this); + } + + @Override + protected void putCardsBack(Ability source, Player player, Cards cards, Game game) { + int life = 0; + for (Card card : cards.getCards(StaticFilters.FILTER_CARD_CREATURE, game)) { + int power = card.getPower().getValue(); + if (power > life) { + life = power; + } + } + player.moveCards(cards, Zone.GRAVEYARD, source, game); + player.gainLife(life, game, source); + } + + @Override + public String getText(Mode mode) { + return super.getText(mode).concat(". You gain life equal to the greatest power among creature cards put into your graveyard this way"); + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons2.java b/Mage.Sets/src/mage/sets/ModernHorizons2.java index b04824dc3b0..412dc61cc33 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons2.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons2.java @@ -48,6 +48,7 @@ public final class ModernHorizons2 extends ExpansionSet { cards.add(new SetCardInfo("Dakkon, Shadow Slayer", 192, Rarity.MYTHIC, mage.cards.d.DakkonShadowSlayer.class)); cards.add(new SetCardInfo("Darkmoss Bridge", 245, Rarity.COMMON, mage.cards.d.DarkmossBridge.class)); cards.add(new SetCardInfo("Diamond Lion", 225, Rarity.RARE, mage.cards.d.DiamondLion.class)); + cards.add(new SetCardInfo("Discerning Taste", 82, Rarity.COMMON, mage.cards.d.DiscerningTaste.class)); cards.add(new SetCardInfo("Dragon's Rage Channeler", 121, Rarity.UNCOMMON, mage.cards.d.DragonsRageChanneler.class)); cards.add(new SetCardInfo("Drey Keeper", 194, Rarity.COMMON, mage.cards.d.DreyKeeper.class)); cards.add(new SetCardInfo("Drossforge Bridge", 246, Rarity.COMMON, mage.cards.d.DrossforgeBridge.class));