From 847ed97848b4db5d03bb73a59bc97eb1cd7d0746 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 18 Sep 2018 16:21:34 -0400 Subject: [PATCH] Implemented Divine Visitation (somewhat incorrectly) --- .../src/mage/cards/d/DivineVisitation.java | 85 +++++++++++++++++++ .../src/mage/cards/r/ResplendentAngel.java | 4 +- Mage.Sets/src/mage/sets/GuildsOfRavnica.java | 1 + ...elToken2.java => AngelVigilanceToken.java} | 10 +-- 4 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/d/DivineVisitation.java rename Mage/src/main/java/mage/game/permanent/token/{AngelToken2.java => AngelVigilanceToken.java} (71%) diff --git a/Mage.Sets/src/mage/cards/d/DivineVisitation.java b/Mage.Sets/src/mage/cards/d/DivineVisitation.java new file mode 100644 index 0000000000..f7914a8e97 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DivineVisitation.java @@ -0,0 +1,85 @@ +package mage.cards.d; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.CopyEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.PermanentToken; +import mage.game.permanent.token.AngelVigilanceToken; + +/** + * + * @author TheElk801 + */ +public final class DivineVisitation extends CardImpl { + + public DivineVisitation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{W}"); + + // TODO: This implementation is not entirely correct, see https://twitter.com/EliShffrn/status/1042145606582591490 + // If one or more creature tokens would be created under your control, that many 4/4 white Angel creature tokens with flying and vigilance are created instead. + this.addAbility(new SimpleStaticAbility( + Zone.BATTLEFIELD, new DivineVisitationEffect() + )); + } + + public DivineVisitation(final DivineVisitation card) { + super(card); + } + + @Override + public DivineVisitation copy() { + return new DivineVisitation(this); + } +} + +class DivineVisitationEffect extends ReplacementEffectImpl { + + public DivineVisitationEffect() { + super(Duration.WhileOnBattlefield, Outcome.Copy, false); + staticText = "If one or more creature tokens would be created " + + "under your control, that many 4/4 white Angel creature " + + "tokens with flying and vigilance are created instead."; + } + + public DivineVisitationEffect(DivineVisitationEffect effect) { + super(effect); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Permanent perm = ((EntersTheBattlefieldEvent) event).getTarget(); + return perm != null + && perm.isCreature() + && perm instanceof PermanentToken + && perm.isControlledBy(source.getControllerId()); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + game.addEffect(new CopyEffect(Duration.Custom, new AngelVigilanceToken(), event.getTargetId()), source); + return false; + } + + @Override + public DivineVisitationEffect copy() { + return new DivineVisitationEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/cards/r/ResplendentAngel.java b/Mage.Sets/src/mage/cards/r/ResplendentAngel.java index ef40284b69..86160a7236 100644 --- a/Mage.Sets/src/mage/cards/r/ResplendentAngel.java +++ b/Mage.Sets/src/mage/cards/r/ResplendentAngel.java @@ -20,7 +20,7 @@ import mage.constants.ComparisonType; import mage.constants.Duration; import mage.constants.TargetController; import mage.constants.Zone; -import mage.game.permanent.token.AngelToken2; +import mage.game.permanent.token.AngelVigilanceToken; import mage.watchers.common.PlayerGainedLifeWatcher; /** @@ -42,7 +42,7 @@ public final class ResplendentAngel extends CardImpl { // At the beginning of each end step, if you gained 5 or more life this turn, create a 4/4 white Angel creature token with flying and vigilance. this.addAbility(new BeginningOfEndStepTriggeredAbility( Zone.BATTLEFIELD, - new CreateTokenEffect(new AngelToken2()), + new CreateTokenEffect(new AngelVigilanceToken()), TargetController.ANY, new YouGainedLifeCondition(ComparisonType.MORE_THAN, 4), false diff --git a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java index ecfbb93ce1..678fa94f74 100644 --- a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java +++ b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java @@ -68,6 +68,7 @@ public final class GuildsOfRavnica extends ExpansionSet { cards.add(new SetCardInfo("Disdainful Stroke", 37, Rarity.COMMON, mage.cards.d.DisdainfulStroke.class)); cards.add(new SetCardInfo("Disinformation Campaign", 167, Rarity.UNCOMMON, mage.cards.d.DisinformationCampaign.class)); cards.add(new SetCardInfo("District Guide", 128, Rarity.UNCOMMON, mage.cards.d.DistrictGuide.class)); + cards.add(new SetCardInfo("Divine Visitation", 10, Rarity.MYTHIC, mage.cards.d.DivineVisitation.class)); cards.add(new SetCardInfo("Doom Whisperer", 69, Rarity.MYTHIC, mage.cards.d.DoomWhisperer.class)); cards.add(new SetCardInfo("Dream Eater", 38, Rarity.MYTHIC, mage.cards.d.DreamEater.class)); cards.add(new SetCardInfo("Emmara, Soul of the Accord", 168, Rarity.RARE, mage.cards.e.EmmaraSoulOfTheAccord.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/AngelToken2.java b/Mage/src/main/java/mage/game/permanent/token/AngelVigilanceToken.java similarity index 71% rename from Mage/src/main/java/mage/game/permanent/token/AngelToken2.java rename to Mage/src/main/java/mage/game/permanent/token/AngelVigilanceToken.java index 9369b05c36..0167c1a2bb 100644 --- a/Mage/src/main/java/mage/game/permanent/token/AngelToken2.java +++ b/Mage/src/main/java/mage/game/permanent/token/AngelVigilanceToken.java @@ -6,9 +6,9 @@ import mage.abilities.keyword.VigilanceAbility; import mage.constants.CardType; import mage.constants.SubType; -public final class AngelToken2 extends TokenImpl { +public final class AngelVigilanceToken extends TokenImpl { - public AngelToken2() { + public AngelVigilanceToken() { super("Angel", "4/4 white Angel creature token with flying and vigilance"); cardType.add(CardType.CREATURE); color.setWhite(true); @@ -19,11 +19,11 @@ public final class AngelToken2 extends TokenImpl { addAbility(VigilanceAbility.getInstance()); } - public AngelToken2(final AngelToken2 token) { + public AngelVigilanceToken(final AngelVigilanceToken token) { super(token); } - public AngelToken2 copy() { - return new AngelToken2(this); + public AngelVigilanceToken copy() { + return new AngelVigilanceToken(this); } }