From be20a875c27067ba5d86d62779d5166d4d45e66e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 18 Jun 2018 18:32:14 -0400 Subject: [PATCH] Implemented Liliana, the Necromancer --- .../mage/cards/l/LilianaTheNecromancer.java | 109 ++++++++++++++++++ Mage.Sets/src/mage/sets/CoreSet2019.java | 1 + 2 files changed, 110 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LilianaTheNecromancer.java diff --git a/Mage.Sets/src/mage/cards/l/LilianaTheNecromancer.java b/Mage.Sets/src/mage/cards/l/LilianaTheNecromancer.java new file mode 100644 index 00000000000..9023347f94d --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LilianaTheNecromancer.java @@ -0,0 +1,109 @@ +package mage.cards.l; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.LoseLifeTargetEffect; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.Card; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.TargetPlayer; +import mage.target.common.TargetCardInGraveyard; +import mage.target.common.TargetCardInYourGraveyard; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author TheElk801 + */ +public final class LilianaTheNecromancer extends CardImpl { + + public LilianaTheNecromancer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{B}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.LILIANA); + this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); + + // +1: Target player loses 2 life. + Ability ability = new LoyaltyAbility(new LoseLifeTargetEffect(2), 1); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + + // −1: Return target creature card from your graveyard to your hand. + ability = new LoyaltyAbility(new ReturnToHandTargetEffect(), -1); + ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD)); + this.addAbility(ability); + + // −7: Destroy up to two target creatures. Put up to two creature cards from graveyards onto the battlefield under your control. + ability = new LoyaltyAbility(new DestroyTargetEffect(), -7); + ability.addTarget(new TargetCreaturePermanent(0, 2)); + ability.addEffect(new LilianaTheNecromancerEffect()); + this.addAbility(ability); + } + + public LilianaTheNecromancer(final LilianaTheNecromancer card) { + super(card); + } + + @Override + public LilianaTheNecromancer copy() { + return new LilianaTheNecromancer(this); + } +} + +class LilianaTheNecromancerEffect extends OneShotEffect { + + private static final FilterCreatureCard filter = new FilterCreatureCard("creature cards from graveyards"); + + public LilianaTheNecromancerEffect() { + super(Outcome.Benefit); + this.staticText = "Put up to two creature cards from graveyards onto the battlefield under your control"; + } + + public LilianaTheNecromancerEffect(final LilianaTheNecromancerEffect effect) { + super(effect); + } + + @Override + public LilianaTheNecromancerEffect copy() { + return new LilianaTheNecromancerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Target target = new TargetCardInGraveyard(0, 2, filter); + target.setNotTarget(true); + if (!player.choose(outcome, target, source.getSourceId(), game)) { + return false; + } + Cards cardsToMove = new CardsImpl(); + for (UUID targetId : target.getTargets()) { + Card card = game.getCard(targetId); + if (card != null) { + cardsToMove.add(card); + } + } + return player.moveCards(cardsToMove, Zone.BATTLEFIELD, source, game); + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2019.java b/Mage.Sets/src/mage/sets/CoreSet2019.java index 5d2f384e06c..088507fc239 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2019.java +++ b/Mage.Sets/src/mage/sets/CoreSet2019.java @@ -93,6 +93,7 @@ public final class CoreSet2019 extends ExpansionSet { cards.add(new SetCardInfo("Lich's Caress", 105, Rarity.COMMON, mage.cards.l.LichsCaress.class)); cards.add(new SetCardInfo("Lightning Strike", 152, Rarity.COMMON, mage.cards.l.LightningStrike.class)); cards.add(new SetCardInfo("Liliana's Spoils", 294, Rarity.RARE, mage.cards.l.LilianasSpoils.class)); + cards.add(new SetCardInfo("Liliana, the Necromancer", 291, Rarity.MYTHIC, mage.cards.l.LilianaTheNecromancer.class)); cards.add(new SetCardInfo("Llanowar Elves", 314, Rarity.COMMON, mage.cards.l.LlanowarElves.class)); cards.add(new SetCardInfo("Loxodon Line Breaker", 24, Rarity.COMMON, mage.cards.l.LoxodonLineBreaker.class)); cards.add(new SetCardInfo("Luminous Bonds", 25, Rarity.COMMON, mage.cards.l.LuminousBonds.class));