Implemented Justiciar's Portal

This commit is contained in:
Evan Kranzler 2019-01-12 11:09:33 -05:00
parent cf2b6c3dae
commit 2c58801991
2 changed files with 72 additions and 0 deletions

View file

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

View file

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