[CMR] Implemented Tormod, the Desecrator

This commit is contained in:
Evan Kranzler 2020-11-01 17:32:27 -05:00
parent 59b38cc66a
commit d672df550b
3 changed files with 110 additions and 20 deletions

View file

@ -1,6 +1,6 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID; import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.Card; import mage.cards.Card;
@ -13,8 +13,10 @@ import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeGroupEvent; import mage.game.events.ZoneChangeGroupEvent;
import mage.game.permanent.token.BatToken; import mage.game.permanent.token.BatToken;
import java.util.Objects;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class DesecratedTomb extends CardImpl { public final class DesecratedTomb extends CardImpl {
@ -38,11 +40,11 @@ public final class DesecratedTomb extends CardImpl {
class DesecratedTombTriggeredAbility extends TriggeredAbilityImpl { class DesecratedTombTriggeredAbility extends TriggeredAbilityImpl {
public DesecratedTombTriggeredAbility() { DesecratedTombTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new BatToken()), false); super(Zone.BATTLEFIELD, new CreateTokenEffect(new BatToken()), false);
} }
public DesecratedTombTriggeredAbility(final DesecratedTombTriggeredAbility ability) { private DesecratedTombTriggeredAbility(final DesecratedTombTriggeredAbility ability) {
super(ability); super(ability);
} }
@ -54,22 +56,16 @@ class DesecratedTombTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event;
if (zEvent != null && Zone.GRAVEYARD == zEvent.getFromZone() return zEvent != null
&& Zone.GRAVEYARD == zEvent.getFromZone()
&& Zone.GRAVEYARD != zEvent.getToZone() && Zone.GRAVEYARD != zEvent.getToZone()
&& zEvent.getCards() != null) { && zEvent.getCards() != null
for (Card card : zEvent.getCards()) { && zEvent.getCards()
if (card != null) { .stream()
UUID cardOwnerId = card.getOwnerId(); .filter(Objects::nonNull)
if (cardOwnerId != null .filter(MageObject::isCreature)
&& card.isOwnedBy(getControllerId()) .map(Card::getOwnerId)
&& card.isCreature()) { .anyMatch(getControllerId()::equals);
return true;
}
}
}
}
return false;
} }
@Override @Override
@ -79,6 +75,7 @@ class DesecratedTombTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public String getRule() { 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.";
} }
} }

View file

@ -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.";
}
}

View file

@ -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("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("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("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("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("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)); cards.add(new SetCardInfo("Undergrowth Stadium", 359, Rarity.RARE, mage.cards.u.UndergrowthStadium.class));