From 7aa3e75f3a9adad3c48b1be50e4b669ef1d676b9 Mon Sep 17 00:00:00 2001 From: Daniel Bomar <dbdaniel42@gmail.com> Date: Sat, 11 Sep 2021 16:45:43 -0500 Subject: [PATCH] [MID] Implemented Hallowed Respite --- .../src/mage/cards/h/HallowedRespite.java | 88 +++++++++++++++++++ .../src/mage/sets/InnistradMidnightHunt.java | 1 + 2 files changed, 89 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/h/HallowedRespite.java diff --git a/Mage.Sets/src/mage/cards/h/HallowedRespite.java b/Mage.Sets/src/mage/cards/h/HallowedRespite.java new file mode 100644 index 0000000000..c717656406 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HallowedRespite.java @@ -0,0 +1,88 @@ +package mage.cards.h; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileTargetForSourceEffect; +import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect; +import mage.abilities.keyword.FlashbackAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SuperType; +import mage.constants.TimingRule; +import mage.counters.CounterType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author weirddan455 + */ +public final class HallowedRespite extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonlegendary creature"); + + static { + filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate())); + } + + public HallowedRespite(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{W}{U}"); + + // Exile target nonlegendary creature, then return it to the battlefield under its owner's control. If it entered under your control, put a +1/+1 counter on it. Otherwise, tap it. + this.getSpellAbility().addEffect(new ExileTargetForSourceEffect()); + this.getSpellAbility().addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false)); + this.getSpellAbility().addEffect(new HallowedRespiteEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter)); + + // Flashback {1}{W}{U} + this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{1}{W}{U}"))); + } + + private HallowedRespite(final HallowedRespite card) { + super(card); + } + + @Override + public HallowedRespite copy() { + return new HallowedRespite(this); + } +} + +class HallowedRespiteEffect extends OneShotEffect { + + public HallowedRespiteEffect() { + super(Outcome.Benefit); + staticText = "If it entered under your control, put a +1/+1 counter on it. Otherwise, tap it"; + } + + private HallowedRespiteEffect(final HallowedRespiteEffect effect) { + super(effect); + } + + @Override + public HallowedRespiteEffect copy() { + return new HallowedRespiteEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null) { + return false; + } + if (permanent.isControlledBy(source.getControllerId())) { + permanent.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game); + } else { + permanent.tap(source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index 1b8b9c90b2..e6ada750de 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -149,6 +149,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Graveyard Glutton", 104, Rarity.RARE, mage.cards.g.GraveyardGlutton.class)); cards.add(new SetCardInfo("Graveyard Trespasser", 104, Rarity.RARE, mage.cards.g.GraveyardTrespasser.class)); cards.add(new SetCardInfo("Grizzly Ghoul", 226, Rarity.UNCOMMON, mage.cards.g.GrizzlyGhoul.class)); + cards.add(new SetCardInfo("Hallowed Respite", 227, Rarity.RARE, mage.cards.h.HallowedRespite.class)); cards.add(new SetCardInfo("Harvesttide Assailant", 143, Rarity.COMMON, mage.cards.h.HarvesttideAssailant.class)); cards.add(new SetCardInfo("Harvesttide Infiltrator", 143, Rarity.COMMON, mage.cards.h.HarvesttideInfiltrator.class)); cards.add(new SetCardInfo("Harvesttide Sentry", 186, Rarity.COMMON, mage.cards.h.HarvesttideSentry.class));