From 7db53e62d2b352ada876c68086c2c9f054173cc2 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 6 Sep 2020 12:32:06 -0400 Subject: [PATCH] [ZNR] Implemented Oblivion's Hunger --- .../src/mage/cards/o/OblivionsHunger.java | 57 +++++++++++++++++++ Mage.Sets/src/mage/sets/ZendikarRising.java | 1 + 2 files changed, 58 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/o/OblivionsHunger.java diff --git a/Mage.Sets/src/mage/cards/o/OblivionsHunger.java b/Mage.Sets/src/mage/cards/o/OblivionsHunger.java new file mode 100644 index 0000000000..48922388c0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OblivionsHunger.java @@ -0,0 +1,57 @@ +package mage.cards.o; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.IndestructibleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class OblivionsHunger extends CardImpl { + + public OblivionsHunger(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}"); + + // Target creature you control gains indestructible until end of turn. Draw a card if that creature has a +1/+1 counter on it. + this.getSpellAbility().addEffect(new GainAbilityTargetEffect( + IndestructibleAbility.getInstance(), Duration.EndOfTurn + )); + this.getSpellAbility().addEffect(new ConditionalOneShotEffect( + new DrawCardSourceControllerEffect(1), OblivionsHungerCondition.instance, + "Draw a card if that creature has a +1/+1 counter on it" + )); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); + } + + private OblivionsHunger(final OblivionsHunger card) { + super(card); + } + + @Override + public OblivionsHunger copy() { + return new OblivionsHunger(this); + } +} + +enum OblivionsHungerCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + return permanent != null && permanent.getCounters(game).containsKey(CounterType.P1P1); + } +} diff --git a/Mage.Sets/src/mage/sets/ZendikarRising.java b/Mage.Sets/src/mage/sets/ZendikarRising.java index 7aab483428..7d180578d3 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRising.java +++ b/Mage.Sets/src/mage/sets/ZendikarRising.java @@ -174,6 +174,7 @@ public final class ZendikarRising extends ExpansionSet { cards.add(new SetCardInfo("Nighthawk Scavenger", 115, Rarity.RARE, mage.cards.n.NighthawkScavenger.class)); cards.add(new SetCardInfo("Nimana Skitter-Sneak", 116, Rarity.COMMON, mage.cards.n.NimanaSkitterSneak.class)); cards.add(new SetCardInfo("Nissa's Zendikon", 197, Rarity.COMMON, mage.cards.n.NissasZendikon.class)); + cards.add(new SetCardInfo("Oblivion's Hunger", 119, Rarity.COMMON, mage.cards.o.OblivionsHunger.class)); cards.add(new SetCardInfo("Omnath, Locus of Creation", 232, Rarity.MYTHIC, mage.cards.o.OmnathLocusOfCreation.class)); cards.add(new SetCardInfo("Orah, Skyclave Hierophant", 233, Rarity.RARE, mage.cards.o.OrahSkyclaveHierophant.class)); cards.add(new SetCardInfo("Paired Tactician", 31, Rarity.UNCOMMON, mage.cards.p.PairedTactician.class));