From a305511b1323fa95b197eb15e49c1f754f863cba Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 9 Sep 2021 21:00:14 -0400 Subject: [PATCH] [MID] Implemented Heirloom Mirror / Inherited Fiend --- .../src/mage/cards/h/HeirloomMirror.java | 88 +++++++++++++++++++ .../src/mage/cards/i/InheritedFiend.java | 52 +++++++++++ .../src/mage/sets/InnistradMidnightHunt.java | 2 + .../main/java/mage/counters/CounterType.java | 1 + 4 files changed, 143 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/h/HeirloomMirror.java create mode 100644 Mage.Sets/src/mage/cards/i/InheritedFiend.java diff --git a/Mage.Sets/src/mage/cards/h/HeirloomMirror.java b/Mage.Sets/src/mage/cards/h/HeirloomMirror.java new file mode 100644 index 00000000000..e0328627bfd --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HeirloomMirror.java @@ -0,0 +1,88 @@ +package mage.cards.h; + +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.costs.common.DiscardCardCost; +import mage.abilities.costs.common.PayLifeCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.TransformSourceEffect; +import mage.abilities.keyword.TransformAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class HeirloomMirror extends CardImpl { + + public HeirloomMirror(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{B}"); + + this.transformable = true; + this.secondSideCardClazz = mage.cards.i.InheritedFiend.class; + + // {1}, {T}, Pay 1 life, Discard a card: Draw a card, mill a card, then put a ritual counter on Heirloom Mirror. Then if it has 3 or more ritual counters on it, remove them and transform it. Activate only as a sorcery. + this.addAbility(new TransformAbility()); + Ability ability = new ActivateAsSorceryActivatedAbility(new HeirloomMirrorEffect(), new GenericManaCost(1)); + ability.addCost(new TapSourceCost()); + ability.addCost(new PayLifeCost(1)); + ability.addCost(new DiscardCardCost()); + this.addAbility(ability); + } + + private HeirloomMirror(final HeirloomMirror card) { + super(card); + } + + @Override + public HeirloomMirror copy() { + return new HeirloomMirror(this); + } +} + +class HeirloomMirrorEffect extends OneShotEffect { + + HeirloomMirrorEffect() { + super(Outcome.Benefit); + staticText = "draw a card, mill a card, then put a ritual counter on {this}. " + + "Then if it has 3 or more ritual counters on it, remove them and transform it"; + } + + private HeirloomMirrorEffect(final HeirloomMirrorEffect effect) { + super(effect); + } + + @Override + public HeirloomMirrorEffect copy() { + return new HeirloomMirrorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + if (player == null || permanent == null) { + return false; + } + player.drawCards(1, source, game); + player.millCards(1, source, game); + permanent.addCounters(CounterType.RITUAL.createInstance(), source.getControllerId(), source, game); + int counters = permanent.getCounters(game).getCount(CounterType.RITUAL); + if (counters < 3) { + return true; + } + permanent.removeCounters(CounterType.RITUAL.createInstance(counters), source, game); + new TransformSourceEffect(true).apply(game, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/i/InheritedFiend.java b/Mage.Sets/src/mage/cards/i/InheritedFiend.java new file mode 100644 index 00000000000..82cb137fd31 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/InheritedFiend.java @@ -0,0 +1,52 @@ +package mage.cards.i; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.target.common.TargetCardInGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class InheritedFiend extends CardImpl { + + public InheritedFiend(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, ""); + + this.subtype.add(SubType.DEMON); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + this.color.setBlack(true); + this.transformable = true; + this.nightCard = true; + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // {2}{B}: Exile target creature card from a graveyard. Put a +1/+1 counter on Inherited Fiend. + Ability ability = new SimpleActivatedAbility(new ExileTargetEffect(), new ManaCostsImpl<>("{2}{B}")); + ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()).concatBy(".")); + ability.addTarget(new TargetCardInGraveyard()); + this.addAbility(ability); + } + + private InheritedFiend(final InheritedFiend card) { + super(card); + } + + @Override + public InheritedFiend copy() { + return new InheritedFiend(this); + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index ebed2111f5e..c37566d6bbe 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -87,12 +87,14 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Graveyard Trespasser", 104, Rarity.RARE, mage.cards.g.GraveyardTrespasser.class)); cards.add(new SetCardInfo("Haunted Ridge", 263, Rarity.RARE, mage.cards.h.HauntedRidge.class)); cards.add(new SetCardInfo("Hedgewitch's Mask", 23, Rarity.COMMON, mage.cards.h.HedgewitchsMask.class)); + cards.add(new SetCardInfo("Heirloom Mirror", 105, Rarity.UNCOMMON, mage.cards.h.HeirloomMirror.class)); cards.add(new SetCardInfo("Hobbling Zombie", 106, Rarity.COMMON, mage.cards.h.HobblingZombie.class)); cards.add(new SetCardInfo("Hound Tamer", 187, Rarity.UNCOMMON, mage.cards.h.HoundTamer.class)); cards.add(new SetCardInfo("Howl of the Hunt", 188, Rarity.COMMON, mage.cards.h.HowlOfTheHunt.class)); cards.add(new SetCardInfo("Hungry for More", 228, Rarity.UNCOMMON, mage.cards.h.HungryForMore.class)); cards.add(new SetCardInfo("Immolation", 144, Rarity.COMMON, mage.cards.i.Immolation.class)); cards.add(new SetCardInfo("Infernal Grasp", 107, Rarity.UNCOMMON, mage.cards.i.InfernalGrasp.class)); + cards.add(new SetCardInfo("Inherited Fiend", 105, Rarity.UNCOMMON, mage.cards.i.InheritedFiend.class)); cards.add(new SetCardInfo("Insectile Aberration", 47, Rarity.UNCOMMON, mage.cards.i.InsectileAberration.class)); cards.add(new SetCardInfo("Island", 270, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Jack-o'-Lantern", 254, Rarity.COMMON, mage.cards.j.JackOLantern.class)); diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index e4bb5ae6d3a..6bdc7a3726c 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -141,6 +141,7 @@ public enum CounterType { PUPA("pupa"), REACH("reach"), REPAIR("repair"), + RITUAL("ritual"), RUST("rust"), QUEST("quest"), SILVER("silver"),