text fixes and filter corrections: GainAbilityControlledEffect

This commit is contained in:
xenohedron 2023-10-03 23:05:52 -04:00
parent c8da0f6216
commit 708ec9b8e9
20 changed files with 61 additions and 51 deletions

View file

@ -45,7 +45,7 @@ public final class AtarkasCommand extends CardImpl {
Effect effect = new BoostControlledEffect(1, 1, Duration.EndOfTurn);
effect.setText("Creatures you control get +1/+1");
mode = new Mode(effect);
effect = new GainAbilityControlledEffect(ReachAbility.getInstance(), Duration.EndOfTurn);
effect = new GainAbilityControlledEffect(ReachAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES);
effect.setText("and gain reach until end of turn");
mode.addEffect(effect);
this.getSpellAbility().addMode(mode);

View file

@ -10,6 +10,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
/**
*
@ -24,7 +25,7 @@ public final class BattleTactics extends CardImpl {
Effect effect = new BoostControlledEffect(2, 1, Duration.EndOfTurn);
effect.setText("Creatures you control get +2/+1");
this.getSpellAbility().addEffect(effect);
effect = new GainAbilityControlledEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn);
effect = new GainAbilityControlledEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES);
effect.setText("and gain lifelink until end of turn");
this.getSpellAbility().addEffect(effect);
}

View file

@ -1,4 +1,3 @@
package mage.cards.b;
import java.util.UUID;
@ -15,7 +14,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/**
*
@ -36,8 +35,8 @@ public final class BullRancor extends CardImpl {
this.addAbility(new MonstrosityAbility("{3}{R}{G}{G}{W}", 3));
// As long as Bull Rancor is monstrous, creatures you control have menace.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new GainAbilityControlledEffect(new MenaceAbility(), Duration.WhileOnBattlefield),
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
new GainAbilityControlledEffect(new MenaceAbility(false), Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURES),
MonstrousCondition.instance,
"As long as Bull Rancor is monstrous, creatures you control have menace")
));

View file

@ -37,7 +37,7 @@ public final class DomriCitySmasher extends CardImpl {
1, 1, Duration.EndOfTurn
).setText("creatures you control get +1/+1"), 2);
ability.addEffect(new GainAbilityControlledEffect(
HasteAbility.getInstance(), Duration.EndOfTurn
HasteAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES
).setText("and gain haste until end of turn"));
this.addAbility(ability);
@ -52,7 +52,7 @@ public final class DomriCitySmasher extends CardImpl {
StaticFilters.FILTER_CONTROLLED_CREATURE
), -8);
ability.addEffect(new GainAbilityControlledEffect(
TrampleAbility.getInstance(), Duration.EndOfTurn
TrampleAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES
).setText("Those creatures gain trample until end of turn"));
this.addAbility(ability);
}

View file

@ -1,4 +1,3 @@
package mage.cards.f;
import java.util.UUID;
@ -23,11 +22,10 @@ public final class FlameFusillade extends CardImpl {
public FlameFusillade(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{R}");
// Until end of turn, permanents you control gain "{tap}: This permanent deals 1 damage to any target."
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost());
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1, "this permanent"), new TapSourceCost());
gainedAbility.addTarget(new TargetAnyTarget());
this.getSpellAbility().addEffect(new GainAbilityControlledEffect(gainedAbility, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new GainAbilityControlledEffect(gainedAbility, Duration.EndOfTurn).withDurationRuleAtStart(true));
}
private FlameFusillade(final FlameFusillade card) {

View file

@ -1,4 +1,3 @@
package mage.cards.f;
import java.util.UUID;
@ -13,7 +12,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.StaticFilters;
/**
*
@ -30,8 +29,10 @@ public final class FlameKinZealot extends CardImpl {
this.toughness = new MageInt(2);
// When Flame-Kin Zealot enters the battlefield, creatures you control get +1/+1 and gain haste until end of turn.
Ability ability = new EntersBattlefieldTriggeredAbility(new BoostControlledEffect(1, 1, Duration.EndOfTurn));
ability.addEffect(new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent()));
Ability ability = new EntersBattlefieldTriggeredAbility(new BoostControlledEffect(1, 1, Duration.EndOfTurn)
.setText("creatures you control get +1/+1"));
ability.addEffect(new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES)
.setText("and gain haste until end of turn"));
this.addAbility(ability);
}

View file

@ -18,6 +18,7 @@ import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.game.Game;
@ -60,7 +61,7 @@ public final class GarrukSavageHerald extends CardImpl {
this.addAbility(minusAbility);
// 7: Until end of turn, creatures you control gain "You may have this creature assign its combat damage as though it weren't blocked."
ContinuousEffect ultimateEffect = new GainAbilityControlledEffect(DamageAsThoughNotBlockedAbility.getInstance(), Duration.EndOfTurn);
ContinuousEffect ultimateEffect = new GainAbilityControlledEffect(DamageAsThoughNotBlockedAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES);
ultimateEffect.setText("Until end of turn, creatures you control gain \"You may have this creature assign its combat damage as though it weren't blocked.\"");
this.addAbility(new LoyaltyAbility(ultimateEffect, -7));
}
@ -109,4 +110,4 @@ class GarrukSavageHeraldEffect extends OneShotEffect {
return player.putCardsOnBottomOfLibrary(card, game, source, false);
}
}
}
}

View file

@ -10,6 +10,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.game.permanent.token.GoblinToken;
import java.util.UUID;
@ -31,7 +32,7 @@ public final class GoblinWarParty extends CardImpl {
1, 1, Duration.EndOfTurn
).setText("creatures you control get +1/+1"));
mode.addEffect(new GainAbilityControlledEffect(
HasteAbility.getInstance(), Duration.EndOfTurn
HasteAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES
).setText("and gain haste until end of turn"));
this.getSpellAbility().addMode(mode);

View file

@ -1,4 +1,3 @@
package mage.cards.i;
import java.util.UUID;
@ -12,10 +11,10 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
@ -43,7 +42,7 @@ public final class InvertTheSkies extends CardImpl {
"Creatures your opponents control lose flying until end of turn if {G} was spent to cast this spell,"));
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.EndOfTurn),
new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES),
new LockedInCondition(ManaWasSpentCondition.BLUE),
"and creatures you control gain flying until end of turn if {U} was spent to cast this spell"));

View file

@ -15,6 +15,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.permanent.token.Elemental11BlueRedToken;
import java.util.UUID;
@ -43,7 +44,7 @@ public final class KyrenFlamewright extends CardImpl {
ability.addEffect(new BoostControlledEffect(1, 0, Duration.EndOfTurn)
.setText("creatures you control get +1/+0"));
ability.addEffect(new GainAbilityControlledEffect(
HasteAbility.getInstance(), Duration.EndOfTurn
HasteAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES
).setText("and gain haste until end of turn"));
this.addAbility(ability);
}

View file

@ -12,6 +12,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
/**
*
@ -26,7 +27,7 @@ public final class KytheonsTactics extends CardImpl {
this.getSpellAbility().addEffect(new BoostControlledEffect(2, 1, Duration.EndOfTurn));
// <i>Spell mastery</i> &mdash; If there are two or more instant and/or sorcery cards in your graveyard, those creatures also gain vigilance until end of turn.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new AddContinuousEffectToGame(new GainAbilityControlledEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn)),
new AddContinuousEffectToGame(new GainAbilityControlledEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES)),
SpellMasteryCondition.instance,
"<br><i>Spell mastery</i> &mdash; If there are two or more instant and/or sorcery cards in your graveyard, those creatures also gain vigilance until end of turn"));
}

View file

@ -1,4 +1,3 @@
package mage.cards.m;
import java.util.UUID;
@ -13,7 +12,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.TimingRule;
import mage.filter.StaticFilters;
/**
*
@ -28,7 +27,7 @@ public final class MarshalingCry extends CardImpl {
Effect effect = new BoostControlledEffect(1, 1, Duration.EndOfTurn);
effect.setText("Creatures you control get +1/+1");
this.getSpellAbility().addEffect(effect);
effect = new GainAbilityControlledEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn);
effect = new GainAbilityControlledEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES);
effect.setText("and gain vigilance until end of turn");
this.getSpellAbility().addEffect(effect);

View file

@ -10,6 +10,7 @@ import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.*;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.filter.common.FilterLandCard;
import mage.game.Game;
import mage.players.Player;
@ -42,7 +43,7 @@ public final class NissaNaturesArtisan extends CardImpl {
5, 5, Duration.EndOfTurn
).setText("creatures you control get +5/+5"), -12);
ability.addEffect(new GainAbilityControlledEffect(
TrampleAbility.getInstance(), Duration.EndOfTurn
TrampleAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES
).setText("and gain trample until end of turn"));
this.addAbility(ability);
}

View file

@ -18,6 +18,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent;
import mage.game.permanent.token.FoodToken;
import mage.target.common.TargetControlledPermanent;
@ -54,7 +55,7 @@ public final class PippinWardenOfIsengard extends CardImpl {
).setText("other creatures you control get +3/+3"), new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(4, filter)));
ability.addEffect(new GainAbilityControlledEffect(
HasteAbility.getInstance(), Duration.EndOfTurn
HasteAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES, true
).setText("and gain haste until end of turn"));
this.addAbility(ability);
}

View file

@ -19,6 +19,7 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/**
*
@ -40,10 +41,10 @@ public final class SoulOfTheros extends CardImpl {
Effect effect1 = new BoostControlledEffect(2, 2, Duration.EndOfTurn);
effect1.setText("Creatures you control get +2/+2");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect1, new ManaCostsImpl<>("{4}{W}{W}"));
Effect effect2 = new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn);
Effect effect2 = new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES);
effect2.setText("and gain first strike");
ability.addEffect(effect2);
Effect effect3 = new GainAbilityControlledEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn);
Effect effect3 = new GainAbilityControlledEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES);
effect3.setText("and lifelink until end of turn");
ability.addEffect(effect3);
this.addAbility(ability);

View file

@ -12,6 +12,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
/**
*
@ -29,7 +30,7 @@ public final class StirThePride extends CardImpl {
// Creatures you control get +2/+2 until end of turn;
this.getSpellAbility().addEffect(new BoostControlledEffect(2,2, Duration.EndOfTurn));
// or until end of turn, creatures you control gain "Whenever this creature deals damage, you gain that much life."
Effect effect = new GainAbilityControlledEffect(new DealsDamageGainLifeSourceTriggeredAbility(), Duration.EndOfTurn);
Effect effect = new GainAbilityControlledEffect(new DealsDamageGainLifeSourceTriggeredAbility(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES);
effect.setText("until end of turn, creatures you control gain \"Whenever this creature deals damage, you gain that much life.\"");
Mode mode = new Mode(effect);
this.getSpellAbility().getModes().addMode(mode);

View file

@ -7,6 +7,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
import java.util.UUID;
@ -23,7 +24,7 @@ public final class TowerDefense extends CardImpl {
0, 5, Duration.EndOfTurn
).setText("creatures you control get +0/+5"));
this.getSpellAbility().addEffect(new GainAbilityControlledEffect(
ReachAbility.getInstance(), Duration.EndOfTurn
ReachAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES
).setText("and gain reach until end of turn"));
}

View file

@ -25,15 +25,12 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
protected boolean excludeSource;
protected FilterPermanent filter;
protected boolean forceQuotes = false;
protected boolean durationRuleAtStart = false; // put duration rule to the start of the rules instead end
public GainAbilityControlledEffect(Ability ability, Duration duration) {
this(ability, duration, StaticFilters.FILTER_PERMANENTS);
}
public GainAbilityControlledEffect(CompoundAbility ability, Duration duration) {
this(ability, duration, StaticFilters.FILTER_PERMANENTS);
}
public GainAbilityControlledEffect(Ability ability, Duration duration, FilterPermanent filter) {
this(ability, duration, filter, false);
}
@ -62,6 +59,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
this.filter = effect.filter.copy();
this.excludeSource = effect.excludeSource;
this.forceQuotes = effect.forceQuotes;
this.durationRuleAtStart = effect.durationRuleAtStart;
}
@Override
@ -121,6 +119,9 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
private void setText() {
StringBuilder sb = new StringBuilder();
if (durationRuleAtStart && !duration.toString().isEmpty() && duration != Duration.EndOfGame) {
sb.append(duration.toString()).append(", ");
}
if (excludeSource) {
sb.append("other ");
}
@ -128,14 +129,14 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
sb.append(filter.getMessage()).append(" you control ");
if (duration == Duration.WhileOnBattlefield || duration == Duration.EndOfGame) {
sb.append("have ");
if (forceQuotes || gainedAbility.startsWith("When") || gainedAbility.startsWith("{T}")) {
gainedAbility = '"' + gainedAbility + '"';
}
} else {
sb.append("gain ");
}
if (forceQuotes || gainedAbility.startsWith("When") || gainedAbility.startsWith("{T}")) {
gainedAbility = '"' + gainedAbility + '"';
}
sb.append(gainedAbility);
if (!duration.toString().isEmpty() && duration != Duration.EndOfGame) {
if (!durationRuleAtStart && !duration.toString().isEmpty() && duration != Duration.EndOfGame) {
sb.append(' ').append(duration.toString());
}
staticText = sb.toString();
@ -143,12 +144,16 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
/**
* Add quotes to gains abilities (by default static abilities don't have it)
*
* @return
*/
public GainAbilityControlledEffect withForceQuotes() {
this.forceQuotes = true;
setText();
return this;
}
public GainAbilityControlledEffect withDurationRuleAtStart(boolean durationRuleAtStart) {
this.durationRuleAtStart = durationRuleAtStart;
setText();
return this;
}
}

View file

@ -10,6 +10,7 @@ import mage.abilities.keyword.LifelinkAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.command.Emblem;
/**
@ -21,13 +22,13 @@ public final class ObiWanKenobiEmblem extends Emblem {
public ObiWanKenobiEmblem() {
super("Emblem Obi-Wan Kenobi");
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new BoostControlledEffect(1, 1, Duration.EndOfGame));
Effect effect = new GainAbilityControlledEffect(VigilanceAbility.getInstance(), Duration.EndOfGame);
Effect effect = new GainAbilityControlledEffect(VigilanceAbility.getInstance(), Duration.EndOfGame, StaticFilters.FILTER_PERMANENT_CREATURES);
effect.setText("and have vigilance");
ability.addEffect(effect);
effect = new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.WhileOnBattlefield);
effect = new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfGame, StaticFilters.FILTER_PERMANENT_CREATURES);
effect.setText(", first strike");
ability.addEffect(effect);
effect = new GainAbilityControlledEffect(LifelinkAbility.getInstance(), Duration.WhileOnBattlefield);
effect = new GainAbilityControlledEffect(LifelinkAbility.getInstance(), Duration.EndOfGame, StaticFilters.FILTER_PERMANENT_CREATURES);
effect.setText("and lifelink.");
ability.addEffect(effect);
getAbilities().add(ability);

View file

@ -27,8 +27,6 @@ import java.util.List;
*/
public class TheGreatForestPlane extends Plane {
private static final String rule = "Each creature assigns combat damage equal to its toughness rather than its power";
public TheGreatForestPlane() {
this.setPlaneType(Planes.PLANE_THE_GREAT_FOREST);
@ -39,13 +37,13 @@ public class TheGreatForestPlane extends Plane {
// Active player can roll the planar die: Whenever you roll {CHAOS}, creatures you control get +0/+2 and gain trample until end of turn
Effect chaosEffect = new BoostControlledEffect(0, 2, Duration.EndOfTurn);
Target chaosTarget = null;
Effect chaosEffect2 = new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
Effect chaosEffect2 = new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES);
Target chaosTarget2 = null;
List<Effect> chaosEffects = new ArrayList<Effect>();
List<Effect> chaosEffects = new ArrayList<>();
chaosEffects.add(chaosEffect);
chaosEffects.add(chaosEffect2);
List<Target> chaosTargets = new ArrayList<Target>();
List<Target> chaosTargets = new ArrayList<>();
chaosTargets.add(chaosTarget);
chaosTargets.add(chaosTarget2);