From c7e7d371f86e943fc68238c585cbd14a946b2f46 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 16 Sep 2021 20:42:53 -0400 Subject: [PATCH] [MID] Implemented Lord of the Forsaken --- .../src/mage/cards/l/LordOfTheForsaken.java | 111 ++++++++++++++++++ .../src/mage/sets/InnistradMidnightHunt.java | 1 + 2 files changed, 112 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LordOfTheForsaken.java diff --git a/Mage.Sets/src/mage/cards/l/LordOfTheForsaken.java b/Mage.Sets/src/mage/cards/l/LordOfTheForsaken.java new file mode 100644 index 0000000000..04041271e1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LordOfTheForsaken.java @@ -0,0 +1,111 @@ +package mage.cards.l; + +import mage.ConditionalMana; +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.common.PayLifeCost; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.MillCardsTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.abilities.mana.ConditionalColorlessManaAbility; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.target.TargetPlayer; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LordOfTheForsaken extends CardImpl { + + public LordOfTheForsaken(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}"); + + this.subtype.add(SubType.DEMON); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // {B}, Sacrifice another creature: Target player mills three cards. + Ability ability = new SimpleActivatedAbility( + new MillCardsTargetEffect(3), new ManaCostsImpl<>("{B}") + ); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent( + StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE + ))); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + + // Pay 1 life: Add {C}. Spend this mana only to cast a spell from your graveyard. + this.addAbility(new ConditionalColorlessManaAbility( + new PayLifeCost(1), 1, new LordOfTheForsakenManaBuilder() + )); + } + + private LordOfTheForsaken(final LordOfTheForsaken card) { + super(card); + } + + @Override + public LordOfTheForsaken copy() { + return new LordOfTheForsaken(this); + } +} + +class LordOfTheForsakenManaBuilder extends ConditionalManaBuilder { + + @Override + public ConditionalMana build(Object... options) { + return new LordOfTheForsakenConditionalMana(this.mana); + } + + @Override + public String getRule() { + return "Spend this mana only to cast a spell from a graveyard"; + } +} + +class LordOfTheForsakenConditionalMana extends ConditionalMana { + + public LordOfTheForsakenConditionalMana(Mana mana) { + super(mana); + staticText = "Spend this mana only to cast a spell from a graveyard"; + addCondition(LordOfTheForsakenManaCondition.instance); + } +} + +enum LordOfTheForsakenManaCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + if (game == null || !game.inCheckPlayableState()) { + return false; + } + if (game.getCard(source.getSourceId()) != null + && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { + return true; + } + Spell spell = game.getSpell(source.getSourceId()); + return spell != null && spell.getFromZone() == Zone.GRAVEYARD; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index b51312aacb..b2efb34902 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -190,6 +190,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Liesa, Forgotten Archangel", 232, Rarity.RARE, mage.cards.l.LiesaForgottenArchangel.class)); cards.add(new SetCardInfo("Light Up the Night", 146, Rarity.RARE, mage.cards.l.LightUpTheNight.class)); cards.add(new SetCardInfo("Locked in the Cemetery", 60, Rarity.COMMON, mage.cards.l.LockedInTheCemetery.class)); + cards.add(new SetCardInfo("Lord of the Forsaken", 110, Rarity.MYTHIC, mage.cards.l.LordOfTheForsaken.class)); cards.add(new SetCardInfo("Lord of the Ulvenwald", 231, Rarity.UNCOMMON, mage.cards.l.LordOfTheUlvenwald.class)); cards.add(new SetCardInfo("Loyal Gryff", 26, Rarity.UNCOMMON, mage.cards.l.LoyalGryff.class)); cards.add(new SetCardInfo("Luminous Phantom", 27, Rarity.COMMON, mage.cards.l.LuminousPhantom.class));