From 7774f48325a8f0e845110a19205c28379628d411 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Sat, 11 Sep 2021 19:09:01 -0500 Subject: [PATCH] [MID] Implemented Liesa, Forgotten Archangel --- .../mage/cards/l/LiesaForgottenArchangel.java | 139 ++++++++++++++++++ .../src/mage/sets/InnistradMidnightHunt.java | 1 + 2 files changed, 140 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LiesaForgottenArchangel.java diff --git a/Mage.Sets/src/mage/cards/l/LiesaForgottenArchangel.java b/Mage.Sets/src/mage/cards/l/LiesaForgottenArchangel.java new file mode 100644 index 0000000000..e2c159ad2d --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LiesaForgottenArchangel.java @@ -0,0 +1,139 @@ +package mage.cards.l; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.constants.*; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.filter.predicate.permanent.TokenPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author weirddan455 + */ +public final class LiesaForgottenArchangel extends CardImpl { + + private final static FilterControlledCreaturePermanent filter + = new FilterControlledCreaturePermanent("another nontoken creature you control"); + + static { + filter.add(AnotherPredicate.instance); + filter.add(TokenPredicate.FALSE); + } + + public LiesaForgottenArchangel(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.ANGEL); + this.power = new MageInt(4); + this.toughness = new MageInt(5); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Lifelink + this.addAbility(LifelinkAbility.getInstance()); + + // Whenever another nontoken creature you control dies, return that card to its owner's hand at the beginning of the next end step. + this.addAbility(new DiesCreatureTriggeredAbility(new LiesaForgottenArchangelReturnToHandEffect(), false, filter, true)); + + // If a creature an opponent controls would die, exile it instead. + this.addAbility(new SimpleStaticAbility(new LiesaForgottenArchangelReplacementEffect())); + } + + private LiesaForgottenArchangel(final LiesaForgottenArchangel card) { + super(card); + } + + @Override + public LiesaForgottenArchangel copy() { + return new LiesaForgottenArchangel(this); + } +} + +class LiesaForgottenArchangelReturnToHandEffect extends OneShotEffect { + + public LiesaForgottenArchangelReturnToHandEffect() { + super(Outcome.ReturnToHand); + staticText = "return that card to its owner's hand at the beginning of the next end step"; + } + + private LiesaForgottenArchangelReturnToHandEffect(final LiesaForgottenArchangelReturnToHandEffect effect) { + super(effect); + } + + @Override + public LiesaForgottenArchangelReturnToHandEffect copy() { + return new LiesaForgottenArchangelReturnToHandEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Effect effect = new ReturnToHandTargetEffect(); + effect.setText("return that card to its owner's hand"); + effect.setTargetPointer(targetPointer); + DelayedTriggeredAbility ability = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); + game.addDelayedTriggeredAbility(ability, source); + return true; + } +} + +class LiesaForgottenArchangelReplacementEffect extends ReplacementEffectImpl { + + public LiesaForgottenArchangelReplacementEffect() { + super(Duration.WhileOnBattlefield, Outcome.Exile); + staticText = "If a creature an opponent controls would die, exile it instead"; + } + + private LiesaForgottenArchangelReplacementEffect(final LiesaForgottenArchangelReplacementEffect effect) { + super(effect); + } + + @Override + public LiesaForgottenArchangelReplacementEffect copy() { + return new LiesaForgottenArchangelReplacementEffect(this); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); + return false; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.isDiesEvent()) { + Permanent permanent = zEvent.getTarget(); + if (permanent != null && permanent.isCreature()) { + Player player = game.getPlayer(source.getControllerId()); + return player != null && player.hasOpponent(permanent.getControllerId(), game); + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index e7b79f4e5b..57acd7213d 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -176,6 +176,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Lambholt Harrier", 145, Rarity.COMMON, mage.cards.l.LambholtHarrier.class)); cards.add(new SetCardInfo("Larder Zombie", 58, Rarity.COMMON, mage.cards.l.LarderZombie.class)); cards.add(new SetCardInfo("Lier, Disciple of the Drowned", 59, Rarity.MYTHIC, mage.cards.l.LierDiscipleOfTheDrowned.class)); + cards.add(new SetCardInfo("Liesa, Forgotten Archangel", 232, Rarity.RARE, mage.cards.l.LiesaForgottenArchangel.class)); cards.add(new SetCardInfo("Locked in the Cemetery", 60, Rarity.COMMON, mage.cards.l.LockedInTheCemetery.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));