From d672df550b215401402641e575fbd8a6c51b1151 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 1 Nov 2020 17:32:27 -0500 Subject: [PATCH] [CMR] Implemented Tormod, the Desecrator --- .../src/mage/cards/d/DesecratedTomb.java | 37 ++++---- .../src/mage/cards/t/TormodTheDesecrator.java | 92 +++++++++++++++++++ Mage.Sets/src/mage/sets/CommanderLegends.java | 1 + 3 files changed, 110 insertions(+), 20 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/t/TormodTheDesecrator.java diff --git a/Mage.Sets/src/mage/cards/d/DesecratedTomb.java b/Mage.Sets/src/mage/cards/d/DesecratedTomb.java index 0ca91ef33b..80389e162b 100644 --- a/Mage.Sets/src/mage/cards/d/DesecratedTomb.java +++ b/Mage.Sets/src/mage/cards/d/DesecratedTomb.java @@ -1,6 +1,6 @@ package mage.cards.d; -import java.util.UUID; +import mage.MageObject; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.Card; @@ -13,8 +13,10 @@ import mage.game.events.GameEvent; import mage.game.events.ZoneChangeGroupEvent; import mage.game.permanent.token.BatToken; +import java.util.Objects; +import java.util.UUID; + /** - * * @author TheElk801 */ public final class DesecratedTomb extends CardImpl { @@ -38,11 +40,11 @@ public final class DesecratedTomb extends CardImpl { class DesecratedTombTriggeredAbility extends TriggeredAbilityImpl { - public DesecratedTombTriggeredAbility() { + DesecratedTombTriggeredAbility() { super(Zone.BATTLEFIELD, new CreateTokenEffect(new BatToken()), false); } - public DesecratedTombTriggeredAbility(final DesecratedTombTriggeredAbility ability) { + private DesecratedTombTriggeredAbility(final DesecratedTombTriggeredAbility ability) { super(ability); } @@ -54,22 +56,16 @@ class DesecratedTombTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; - if (zEvent != null && Zone.GRAVEYARD == zEvent.getFromZone() + return zEvent != null + && Zone.GRAVEYARD == zEvent.getFromZone() && Zone.GRAVEYARD != zEvent.getToZone() - && zEvent.getCards() != null) { - for (Card card : zEvent.getCards()) { - if (card != null) { - UUID cardOwnerId = card.getOwnerId(); - if (cardOwnerId != null - && card.isOwnedBy(getControllerId()) - && card.isCreature()) { - return true; - } - } - - } - } - return false; + && zEvent.getCards() != null + && zEvent.getCards() + .stream() + .filter(Objects::nonNull) + .filter(MageObject::isCreature) + .map(Card::getOwnerId) + .anyMatch(getControllerId()::equals); } @Override @@ -79,6 +75,7 @@ class DesecratedTombTriggeredAbility extends TriggeredAbilityImpl { @Override public String getRule() { - return "Whenever one or more creature cards leave your graveyard, create a 1/1 black Bat creature token with flying"; + return "Whenever one or more creature cards leave your graveyard, " + + "create a 1/1 black Bat creature token with flying."; } } diff --git a/Mage.Sets/src/mage/cards/t/TormodTheDesecrator.java b/Mage.Sets/src/mage/cards/t/TormodTheDesecrator.java new file mode 100644 index 0000000000..da7cc61e53 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TormodTheDesecrator.java @@ -0,0 +1,92 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.PartnerAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeGroupEvent; +import mage.game.permanent.token.ZombieToken; + +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TormodTheDesecrator extends CardImpl { + + public TormodTheDesecrator(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.ZOMBIE); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(4); + this.toughness = new MageInt(2); + + // Whenever one or more cards leave your graveyard, create a tapped 2/2 black Zombie creature token. + this.addAbility(new TormodTheDesecratorTriggeredAbility()); + + // Partner + this.addAbility(PartnerAbility.getInstance()); + } + + private TormodTheDesecrator(final TormodTheDesecrator card) { + super(card); + } + + @Override + public TormodTheDesecrator copy() { + return new TormodTheDesecrator(this); + } +} + +class TormodTheDesecratorTriggeredAbility extends TriggeredAbilityImpl { + + TormodTheDesecratorTriggeredAbility() { + super(Zone.BATTLEFIELD, new CreateTokenEffect(new ZombieToken(), 1, true, false), false); + } + + private TormodTheDesecratorTriggeredAbility(final TormodTheDesecratorTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE_GROUP; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; + return zEvent != null + && Zone.GRAVEYARD == zEvent.getFromZone() + && Zone.GRAVEYARD != zEvent.getToZone() + && zEvent.getCards() != null + && zEvent.getCards() + .stream() + .filter(Objects::nonNull) + .map(Card::getOwnerId) + .anyMatch(getControllerId()::equals); + } + + @Override + public TormodTheDesecratorTriggeredAbility copy() { + return new TormodTheDesecratorTriggeredAbility(this); + } + + @Override + public String getRule() { + return "Whenever one or more cards leave your graveyard, " + + "create a tapped 2/2 black Zombie creature token."; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegends.java b/Mage.Sets/src/mage/sets/CommanderLegends.java index 26b584fa22..aecc9fd7f1 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegends.java +++ b/Mage.Sets/src/mage/sets/CommanderLegends.java @@ -192,6 +192,7 @@ public final class CommanderLegends extends ExpansionSet { cards.add(new SetCardInfo("Thought Vessel", 346, Rarity.COMMON, mage.cards.t.ThoughtVessel.class)); cards.add(new SetCardInfo("Thrasios, Triton Hero", 538, Rarity.MYTHIC, mage.cards.t.ThrasiosTritonHero.class)); cards.add(new SetCardInfo("Three Visits", 261, Rarity.UNCOMMON, mage.cards.t.ThreeVisits.class)); + cards.add(new SetCardInfo("Tormod, the Desecrator", 155, Rarity.UNCOMMON, mage.cards.t.TormodTheDesecrator.class)); cards.add(new SetCardInfo("Training Center", 358, Rarity.RARE, mage.cards.t.TrainingCenter.class)); cards.add(new SetCardInfo("Tymna the Weaver", 539, Rarity.MYTHIC, mage.cards.t.TymnaTheWeaver.class)); cards.add(new SetCardInfo("Undergrowth Stadium", 359, Rarity.RARE, mage.cards.u.UndergrowthStadium.class));