[MID] Implemented Lord of the Forsaken

This commit is contained in:
Evan Kranzler 2021-09-16 20:42:53 -04:00
parent c1d16a3763
commit c7e7d371f8
2 changed files with 112 additions and 0 deletions

View file

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

View file

@ -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("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("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("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("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("Loyal Gryff", 26, Rarity.UNCOMMON, mage.cards.l.LoyalGryff.class));
cards.add(new SetCardInfo("Luminous Phantom", 27, Rarity.COMMON, mage.cards.l.LuminousPhantom.class)); cards.add(new SetCardInfo("Luminous Phantom", 27, Rarity.COMMON, mage.cards.l.LuminousPhantom.class));