Implemented Devourer of Memory

This commit is contained in:
Evan Kranzler 2020-01-01 11:02:49 -05:00
parent 14b002bce6
commit da4e376551
2 changed files with 96 additions and 0 deletions

View file

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

View file

@ -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));