From 319d040bc78c195045e5971fa02b076a95aab555 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Fri, 14 Apr 2023 08:16:29 -0400 Subject: [PATCH] [MOM] Implement Corruption of Towashi --- .../src/mage/cards/c/CorruptionOfTowashi.java | 79 +++++++++++++++++++ .../src/mage/sets/MarchOfTheMachine.java | 1 + 2 files changed, 80 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CorruptionOfTowashi.java diff --git a/Mage.Sets/src/mage/cards/c/CorruptionOfTowashi.java b/Mage.Sets/src/mage/cards/c/CorruptionOfTowashi.java new file mode 100644 index 0000000000..e1d4110378 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CorruptionOfTowashi.java @@ -0,0 +1,79 @@ +package mage.cards.c; + +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.keyword.IncubateEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; +import mage.game.events.GameEvent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CorruptionOfTowashi extends CardImpl { + + public CorruptionOfTowashi(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}"); + + // When Corruption of Towashi enters the battlefield, incubate 4. + this.addAbility(new EntersBattlefieldTriggeredAbility(new IncubateEffect(4))); + + // Whenever a permanent you control transforms or a permanent enters the battlefield under your control transformed, you may draw a card. Do this only once each turn. + this.addAbility(new CorruptionOfTowashiTriggeredAbility()); + } + + private CorruptionOfTowashi(final CorruptionOfTowashi card) { + super(card); + } + + @Override + public CorruptionOfTowashi copy() { + return new CorruptionOfTowashi(this); + } +} + +class CorruptionOfTowashiTriggeredAbility extends TriggeredAbilityImpl { + + CorruptionOfTowashiTriggeredAbility() { + super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), true); + this.setTriggerPhrase("Whenever a permanent you control transforms " + + "or a permanent enters the battlefield under your control transformed, "); + this.setDoOnlyOnce(true); + } + + private CorruptionOfTowashiTriggeredAbility(final CorruptionOfTowashiTriggeredAbility ability) { + super(ability); + } + + @Override + public CorruptionOfTowashiTriggeredAbility copy() { + return new CorruptionOfTowashiTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD + || event.getType() == GameEvent.EventType.TRANSFORMED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!isControlledBy(game.getControllerId(event.getTargetId()))) { + return false; + } + switch (event.getType()) { + case ENTERS_THE_BATTLEFIELD: + return ((EntersTheBattlefieldEvent) event).getTarget().isTransformed(); + case TRANSFORMED: + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java index 4f8a6c3b6e..79cc86c7eb 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java @@ -75,6 +75,7 @@ public final class MarchOfTheMachine extends ExpansionSet { cards.add(new SetCardInfo("Converter Beast", 180, Rarity.COMMON, mage.cards.c.ConverterBeast.class)); cards.add(new SetCardInfo("Copper Host Crusher", 181, Rarity.UNCOMMON, mage.cards.c.CopperHostCrusher.class)); cards.add(new SetCardInfo("Corrupted Conviction", 98, Rarity.COMMON, mage.cards.c.CorruptedConviction.class)); + cards.add(new SetCardInfo("Corruption of Towashi", 53, Rarity.UNCOMMON, mage.cards.c.CorruptionOfTowashi.class)); cards.add(new SetCardInfo("Cosmic Hunger", 182, Rarity.COMMON, mage.cards.c.CosmicHunger.class)); cards.add(new SetCardInfo("Cragsmasher Yeti", 333, Rarity.COMMON, mage.cards.c.CragsmasherYeti.class)); cards.add(new SetCardInfo("Crystal Carapace", 183, Rarity.COMMON, mage.cards.c.CrystalCarapace.class));