diff --git a/Mage.Sets/src/mage/cards/d/DesecratedTomb.java b/Mage.Sets/src/mage/cards/d/DesecratedTomb.java new file mode 100644 index 0000000000..8112550b0f --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DesecratedTomb.java @@ -0,0 +1,89 @@ +package mage.cards.d; + +import java.util.Set; +import java.util.UUID; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeGroupEvent; +import mage.game.permanent.token.BatToken; + +/** + * + * @author TheElk801 + */ +public final class DesecratedTomb extends CardImpl { + + public DesecratedTomb(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); + + // Whenever one or more creature cards leave your graveyard, create a 1/1 black Bat creature token with flying. + this.addAbility(new DesecratedTombTriggeredAbility()); + } + + public DesecratedTomb(final DesecratedTomb card) { + super(card); + } + + @Override + public DesecratedTomb copy() { + return new DesecratedTomb(this); + } +} + +class DesecratedTombTriggeredAbility extends TriggeredAbilityImpl { + + public DesecratedTombTriggeredAbility() { + super(Zone.BATTLEFIELD, new CreateTokenEffect(new BatToken()), false); + } + + public DesecratedTombTriggeredAbility(final DesecratedTombTriggeredAbility 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; + if (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(); + Set cardType = card.getCardType(); + + if (cardOwnerId != null + && card.getOwnerId().equals(getControllerId()) + && cardType != null + && card.isCreature()) { + return true; + } + } + + } + } + return false; + } + + @Override + public DesecratedTombTriggeredAbility copy() { + return new DesecratedTombTriggeredAbility(this); + } + + @Override + public String getRule() { + 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/sets/CoreSet2019.java b/Mage.Sets/src/mage/sets/CoreSet2019.java index de295f5b39..c6beb9e5f7 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2019.java +++ b/Mage.Sets/src/mage/sets/CoreSet2019.java @@ -40,6 +40,7 @@ public final class CoreSet2019 extends ExpansionSet { cards.add(new SetCardInfo("Colossal Dreadmaw", 172, Rarity.COMMON, mage.cards.c.ColossalDreadmaw.class)); cards.add(new SetCardInfo("Daybreak Chaplain", 10, Rarity.COMMON, mage.cards.d.DaybreakChaplain.class)); cards.add(new SetCardInfo("Demon of Catastrophes", 91, Rarity.RARE, mage.cards.d.DemonOfCatastrophes.class)); + cards.add(new SetCardInfo("Desecrated Tomb", 230, Rarity.RARE, mage.cards.d.DesecratedTomb.class)); cards.add(new SetCardInfo("Diregraf Ghoul", 92, Rarity.UNCOMMON, mage.cards.d.DiregrafGhoul.class)); cards.add(new SetCardInfo("Disperse", 50, Rarity.COMMON, mage.cards.d.Disperse.class)); cards.add(new SetCardInfo("Divination", 51, Rarity.COMMON, mage.cards.d.Divination.class));