From eacccf6f062c9659ea9b9b4f0d034ffe6ec227ed Mon Sep 17 00:00:00 2001 From: Evan Kranzler <theelk801@gmail.com> Date: Sat, 4 Jan 2020 20:37:16 -0500 Subject: [PATCH] Implemented Dawn Evangel --- Mage.Sets/src/mage/cards/d/DawnEvangel.java | 95 +++++++++++++++++++ .../src/mage/sets/TherosBeyondDeath.java | 1 + 2 files changed, 96 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DawnEvangel.java diff --git a/Mage.Sets/src/mage/cards/d/DawnEvangel.java b/Mage.Sets/src/mage/cards/d/DawnEvangel.java new file mode 100644 index 0000000000..f6447590ca --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DawnEvangel.java @@ -0,0 +1,95 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ComparisonType; +import mage.constants.SubType; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DawnEvangel extends CardImpl { + + public DawnEvangel(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{2}{W}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.CLERIC); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Whenever a creature dies, if an Aura you control was attached to it, return target creature card with converted mana cost 2 or less from your graveyard to your hand. + this.addAbility(new DawnEvangelAbility()); + } + + private DawnEvangel(final DawnEvangel card) { + super(card); + } + + @Override + public DawnEvangel copy() { + return new DawnEvangel(this); + } +} + +class DawnEvangelAbility extends DiesCreatureTriggeredAbility { + + private static final FilterCard cardFilter + = new FilterCreatureCard("creature card with converted mana cost 2 or less from your graveyard"); + + static { + cardFilter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 3)); + } + + DawnEvangelAbility() { + super(new ReturnFromGraveyardToHandTargetEffect(), false); + this.addTarget(new TargetCardInYourGraveyard(cardFilter)); + } + + private DawnEvangelAbility(DawnEvangelAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!super.checkTrigger(event, game)) { + return false; + } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + return zEvent + .getTarget() + .getAttachments() + .stream() + .map(game::getPermanentOrLKIBattlefield) + .filter(Objects::nonNull) + .filter(permanent -> permanent.hasSubtype(SubType.AURA, game)) + .map(Permanent::getId) + .anyMatch(getControllerId()::equals); + } + + @Override + public String getRule() { + return "Whenever a creature dies, if an Aura you control was attached to it, " + + "return target creature card with converted mana cost 2 or less from your graveyard to your hand."; + } + + @Override + public DawnEvangelAbility copy() { + return new DawnEvangelAbility(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 24f76fee29..b28b3ffa1e 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -42,6 +42,7 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("Cling to Dust", 87, Rarity.UNCOMMON, mage.cards.c.ClingToDust.class)); cards.add(new SetCardInfo("Commanding Presence", 7, Rarity.UNCOMMON, mage.cards.c.CommandingPresence.class)); cards.add(new SetCardInfo("Dalakos, Crafter of Wonders", 212, Rarity.RARE, mage.cards.d.DalakosCrafterOfWonders.class)); + cards.add(new SetCardInfo("Dawn Evangel", 8, Rarity.UNCOMMON, mage.cards.d.DawnEvangel.class)); cards.add(new SetCardInfo("Daxos, Blessed by the Sun", 9, Rarity.UNCOMMON, mage.cards.d.DaxosBlessedByTheSun.class)); cards.add(new SetCardInfo("Deathbellow War Cry", 294, Rarity.RARE, mage.cards.d.DeathbellowWarCry.class)); cards.add(new SetCardInfo("Demon of Loathing", 292, Rarity.RARE, mage.cards.d.DemonOfLoathing.class));