From 2c58801991921574f94e08b6fdcbfa007136b1b4 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 12 Jan 2019 11:09:33 -0500 Subject: [PATCH] Implemented Justiciar's Portal --- .../src/mage/cards/j/JusticiarsPortal.java | 71 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 2 files changed, 72 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/j/JusticiarsPortal.java diff --git a/Mage.Sets/src/mage/cards/j/JusticiarsPortal.java b/Mage.Sets/src/mage/cards/j/JusticiarsPortal.java new file mode 100644 index 0000000000..7dfc2956ba --- /dev/null +++ b/Mage.Sets/src/mage/cards/j/JusticiarsPortal.java @@ -0,0 +1,71 @@ +package mage.cards.j; + +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileTargetForSourceEffect; +import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class JusticiarsPortal extends CardImpl { + + public JusticiarsPortal(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}"); + + // Exile target creature you control, then return that card to the battlefield under its owner's control. It gains first strike until end of turn. + this.getSpellAbility().addEffect(new JusticiarsPortalEffect()); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); + } + + private JusticiarsPortal(final JusticiarsPortal card) { + super(card); + } + + @Override + public JusticiarsPortal copy() { + return new JusticiarsPortal(this); + } +} + +class JusticiarsPortalEffect extends OneShotEffect { + + JusticiarsPortalEffect() { + super(Outcome.Benefit); + staticText = "Exile target creature you control, then return that card to the battlefield " + + "under its owner's control. It gains first strike until end of turn."; + } + + private JusticiarsPortalEffect(final JusticiarsPortalEffect effect) { + super(effect); + } + + @Override + public JusticiarsPortalEffect copy() { + return new JusticiarsPortalEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + UUID targetId = source.getFirstTarget(); + new ExileTargetForSourceEffect().apply(game, source); + new ReturnToBattlefieldUnderYourControlTargetEffect(true).apply(game, source); + ContinuousEffect effect = new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(targetId, game)); + game.addEffect(effect, source); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index 8121ea03f4..52a22987af 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -162,6 +162,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Island", 261, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Judith, the Scourge Diva", 185, Rarity.RARE, mage.cards.j.JudithTheScourgeDiva.class)); cards.add(new SetCardInfo("Junktroller", 235, Rarity.UNCOMMON, mage.cards.j.Junktroller.class)); + cards.add(new SetCardInfo("Justiciar's Portal", 13, Rarity.COMMON, mage.cards.j.JusticiarsPortal.class)); cards.add(new SetCardInfo("Kaya's Wrath", 187, Rarity.RARE, mage.cards.k.KayasWrath.class)); cards.add(new SetCardInfo("Kaya, Orzhov Usurper", 186, Rarity.MYTHIC, mage.cards.k.KayaOrzhovUsurper.class)); cards.add(new SetCardInfo("Knight of Sorrows", 14, Rarity.COMMON, mage.cards.k.KnightOfSorrows.class));