From da4e376551bb5c355e3cffef1511af59ea650e20 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 1 Jan 2020 11:02:49 -0500 Subject: [PATCH] Implemented Devourer of Memory --- .../src/mage/cards/d/DevourerOfMemory.java | 95 +++++++++++++++++++ .../src/mage/sets/TherosBeyondDeath.java | 1 + 2 files changed, 96 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DevourerOfMemory.java diff --git a/Mage.Sets/src/mage/cards/d/DevourerOfMemory.java b/Mage.Sets/src/mage/cards/d/DevourerOfMemory.java new file mode 100644 index 00000000000..1525aa66da6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DevourerOfMemory.java @@ -0,0 +1,95 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect; +import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeGroupEvent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DevourerOfMemory extends CardImpl { + + public DevourerOfMemory(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{B}"); + + this.subtype.add(SubType.NIGHTMARE); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Whenever one or more cards are put into your graveyard from your library, Devourer of Memory gets +1/+1 until end of turn and can't be blocked this turn. + this.addAbility(new DevourerOfMemoryTriggeredAbility()); + + // {1}{U}{B}: Put the top card of your library into your graveyard. + this.addAbility(new SimpleActivatedAbility( + new PutTopCardOfLibraryIntoGraveControllerEffect(1), new ManaCostsImpl("{1}{U}{B}") + )); + } + + private DevourerOfMemory(final DevourerOfMemory card) { + super(card); + } + + @Override + public DevourerOfMemory copy() { + return new DevourerOfMemory(this); + } +} + +class DevourerOfMemoryTriggeredAbility extends TriggeredAbilityImpl { + + DevourerOfMemoryTriggeredAbility() { + super(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn), false); + this.addEffect(new CantBeBlockedSourceEffect(Duration.EndOfTurn)); + } + + private DevourerOfMemoryTriggeredAbility(final DevourerOfMemoryTriggeredAbility 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 + && zEvent.getFromZone() == Zone.LIBRARY + && zEvent.getToZone() == Zone.GRAVEYARD + && zEvent.getCards() != null + && zEvent + .getCards() + .stream() + .map(Card::getOwnerId) + .filter(this.getControllerId()::equals) + .count() > 0; + } + + @Override + public DevourerOfMemoryTriggeredAbility copy() { + return new DevourerOfMemoryTriggeredAbility(this); + } + + @Override + public String getRule() { + return "Whenever one or more cards are put into your graveyard from your library, " + + "{this} gets +1/+1 until end of turn and can't be blocked this turn."; + } +} diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 4042e92cba3..01b391e1853 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -39,6 +39,7 @@ public final class TherosBeyondDeath extends ExpansionSet { 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)); + cards.add(new SetCardInfo("Devourer of Memory", 213, Rarity.UNCOMMON, mage.cards.d.DevourerOfMemory.class)); cards.add(new SetCardInfo("Eidolon of Philosophy", 48, Rarity.COMMON, mage.cards.e.EidolonOfPhilosophy.class)); cards.add(new SetCardInfo("Elspeth, Sun's Nemesis", 14, Rarity.MYTHIC, mage.cards.e.ElspethSunsNemesis.class)); cards.add(new SetCardInfo("Elspeth, Undaunted Hero", 270, Rarity.MYTHIC, mage.cards.e.ElspethUndauntedHero.class));