[SNC] Implemented Slip Out the Back

This commit is contained in:
Evan Kranzler 2022-04-14 20:19:18 -04:00
parent dee18a211e
commit fd98037fd2
5 changed files with 43 additions and 24 deletions

View file

@ -44,7 +44,7 @@ public final class GuardianOfFaith extends CardImpl {
// When Guardian of Faith enters the battlefield, any number of other target creatures you control phase out.
Ability ability = new EntersBattlefieldTriggeredAbility(new PhaseOutTargetEffect(
"any number of other target creatures you control", false
"any number of other target creatures you control"
));
ability.addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, false));
this.addAbility(ability);

View file

@ -0,0 +1,35 @@
package mage.cards.s;
import mage.abilities.effects.common.PhaseOutTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SlipOutTheBack extends CardImpl {
public SlipOutTheBack(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
// Put a +1/+1 counter on target creature. It phases out.
this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance()));
this.getSpellAbility().addEffect(new PhaseOutTargetEffect("it"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
private SlipOutTheBack(final SlipOutTheBack card) {
super(card);
}
@Override
public SlipOutTheBack copy() {
return new SlipOutTheBack(this);
}
}

View file

@ -21,7 +21,7 @@ public final class TeferisVeil extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
// Whenever a creature you control attacks, it phases out at end of combat.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new PhaseOutTargetEffect("it", false)));
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new PhaseOutTargetEffect("it")));
effect.setText("it phases out at end of combat");
this.addAbility(new AttacksCreatureYouControlTriggeredAbility(effect, false, true));
}

View file

@ -154,6 +154,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
cards.add(new SetCardInfo("Shakedown Heavy", 95, Rarity.RARE, mage.cards.s.ShakedownHeavy.class));
cards.add(new SetCardInfo("Skybridge Towers", 256, Rarity.COMMON, mage.cards.s.SkybridgeTowers.class));
cards.add(new SetCardInfo("Sleep with the Fishes", 61, Rarity.UNCOMMON, mage.cards.s.SleepWithTheFishes.class));
cards.add(new SetCardInfo("Slip Out the Back", 62, Rarity.UNCOMMON, mage.cards.s.SlipOutTheBack.class));
cards.add(new SetCardInfo("Snooping Newsie", 222, Rarity.COMMON, mage.cards.s.SnoopingNewsie.class));
cards.add(new SetCardInfo("Social Climber", 157, Rarity.COMMON, mage.cards.s.SocialClimber.class));
cards.add(new SetCardInfo("Spara's Headquarters", 257, Rarity.RARE, mage.cards.s.SparasHeadquarters.class));

View file

@ -6,7 +6,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
import java.util.UUID;
@ -15,23 +14,20 @@ import java.util.UUID;
*/
public class PhaseOutTargetEffect extends OneShotEffect {
protected String targetDescription;
protected boolean useOnlyTargetPointer;
protected final String targetDescription;
public PhaseOutTargetEffect() {
super(Outcome.Detriment);
this((String) null);
}
public PhaseOutTargetEffect(String targetDescription, boolean useOnlyTargetPointer) {
public PhaseOutTargetEffect(String targetDescription) {
super(Outcome.Detriment);
this.targetDescription = targetDescription;
this.useOnlyTargetPointer = useOnlyTargetPointer;
}
public PhaseOutTargetEffect(final PhaseOutTargetEffect effect) {
private PhaseOutTargetEffect(final PhaseOutTargetEffect effect) {
super(effect);
this.targetDescription = effect.targetDescription;
this.useOnlyTargetPointer = effect.useOnlyTargetPointer;
}
@Override
@ -41,17 +37,6 @@ public class PhaseOutTargetEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
if (!useOnlyTargetPointer && source.getTargets().size() > 1) {
for (Target target : source.getTargets()) {
for (UUID targetId : target.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.phaseOut(game);
}
}
}
return true;
}
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
@ -66,12 +51,11 @@ public class PhaseOutTargetEffect extends OneShotEffect {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
if (targetDescription != null && !targetDescription.isEmpty()) {
sb.append(targetDescription);
} else {
sb.append("Target ").append(mode.getTargets().get(0).getTargetName());
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
}
sb.append(" phase");
if (mode.getTargets().isEmpty()
@ -81,5 +65,4 @@ public class PhaseOutTargetEffect extends OneShotEffect {
sb.append(" out");
return sb.toString();
}
}