some more text improvements (#11258)

* text on Eldrazi Spawn token

* refactor: return Ability instead of void

* cleanup assigning null to staticText

* cleanup Mimic cycle and GainAbilitySourceEffect

adjust Groundling Pouncer

* remove hardcoded rule param from SpellCastControllerTriggeredAbility

* fix #11257
This commit is contained in:
xenohedron 2023-10-05 22:04:02 -04:00 committed by GitHub
parent cd6c5aa7ac
commit c8e2282a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 97 additions and 160 deletions

View file

@ -34,14 +34,13 @@ public final class AriaOfFlame extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new AriaOfFlameEffect()));
// Whenever you cast an instant or sorcery spell, put a verse counter on Aria of Flame, then it deals damage equal to the number of verse counters on it to target player or planeswalker.
Ability ability = SpellCastControllerTriggeredAbility.createWithRule(
Ability ability = new SpellCastControllerTriggeredAbility(
new AddCountersSourceEffect(CounterType.VERSE.createInstance()),
StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY,
false, "Whenever you cast an instant or sorcery spell, "
+ "put a verse counter on {this}, then it deals damage equal to "
+ "the number of verse counters on it to target player or planeswalker."
false
);
ability.addEffect(new DamageTargetEffect(xValue));
ability.addEffect(new DamageTargetEffect(xValue)
.setText(", then it deals damage equal to the number of verse counters on it to target player or planeswalker"));
ability.addTarget(new TargetPlayerOrPlaneswalker());
this.addAbility(ability);
}
@ -82,4 +81,4 @@ class AriaOfFlameEffect extends OneShotEffect {
public AriaOfFlameEffect copy() {
return new AriaOfFlameEffect(this);
}
}
}

View file

@ -1,10 +1,10 @@
package mage.cards.b;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
import mage.abilities.keyword.FirstStrikeAbility;
@ -30,8 +30,6 @@ public final class BattlegateMimic extends CardImpl {
filter.add(new ColorPredicate(ObjectColor.WHITE));
}
private static final String rule = "Whenever you cast a spell that's both red and white, {this} has base power and toughness 4/2 until end of turn and gains first strike until end of turn.";
public BattlegateMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R/W}");
this.subtype.add(SubType.SHAPESHIFTER);
@ -40,9 +38,10 @@ public final class BattlegateMimic extends CardImpl {
this.toughness = new MageInt(1);
// Whenever you cast a spell that's both red and white, Battlegate Mimic has base power and toughness 4/2 and gains first strike until end of turn.
SetBasePowerToughnessSourceEffect baseToughnessSourceEffect = new SetBasePowerToughnessSourceEffect(4, 2, Duration.EndOfTurn);
Ability ability = SpellCastControllerTriggeredAbility.createWithRule(baseToughnessSourceEffect, filter, false, rule);
ability.addEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, false, true));
Effect effect = new SetBasePowerToughnessSourceEffect(4, 2, Duration.EndOfTurn);
Ability ability = new SpellCastControllerTriggeredAbility(effect, filter, false);
ability.addEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn)
.setText("and gains first strike until end of turn"));
this.addAbility(ability);
}

View file

@ -43,7 +43,7 @@ public final class BoseijuWhoSheltersAll extends CardImpl {
ability.getEffects().get(0).setText("Add {C}. If that mana is spent on an instant or sorcery spell, that spell can't be countered");
this.addAbility(ability, new BoseijuWhoSheltersAllWatcher(ability.getOriginalId()));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new BoseijuWhoSheltersAllCantCounterEffect()));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new BoseijuWhoSheltersAllCantCounterEffect()).setRuleVisible(false));
}
private BoseijuWhoSheltersAll(final BoseijuWhoSheltersAll card) {
@ -91,9 +91,8 @@ class BoseijuWhoSheltersAllWatcher extends Watcher {
class BoseijuWhoSheltersAllCantCounterEffect extends ContinuousRuleModifyingEffectImpl {
public BoseijuWhoSheltersAllCantCounterEffect() {
BoseijuWhoSheltersAllCantCounterEffect() {
super(Duration.EndOfGame, Outcome.Benefit);
staticText = null;
}
private BoseijuWhoSheltersAllCantCounterEffect(final BoseijuWhoSheltersAllCantCounterEffect effect) {
@ -125,4 +124,4 @@ class BoseijuWhoSheltersAllCantCounterEffect extends ContinuousRuleModifyingEffe
Spell spell = game.getStack().getSpell(event.getTargetId());
return spell != null && watcher != null && watcher.spellCantBeCountered(new MageObjectReference(spell, game));
}
}
}

View file

@ -43,7 +43,7 @@ public final class CavernOfSouls extends CardImpl {
// {T}: Add one mana of any color. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered.
Ability ability = new ConditionalAnyColorManaAbility(new TapSourceCost(), 1, new CavernOfSoulsManaBuilder(), true);
this.addAbility(ability, new CavernOfSoulsWatcher(ability.getOriginalId()));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CavernOfSoulsCantCounterEffect()));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CavernOfSoulsCantCounterEffect()).setRuleVisible(false));
}
private CavernOfSouls(final CavernOfSouls card) {
@ -163,9 +163,8 @@ class CavernOfSoulsWatcher extends Watcher {
class CavernOfSoulsCantCounterEffect extends ContinuousRuleModifyingEffectImpl {
public CavernOfSoulsCantCounterEffect() {
CavernOfSoulsCantCounterEffect() {
super(Duration.EndOfGame, Outcome.Benefit);
staticText = null;
}
private CavernOfSoulsCantCounterEffect(final CavernOfSoulsCantCounterEffect effect) {

View file

@ -1,7 +1,6 @@
package mage.cards.d;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
@ -43,7 +42,7 @@ public final class DelightedHalfling extends CardImpl {
// {T}: Add one mana of any color. Spend this mana only to cast a legendary spell, and that spell can't be countered.
Ability ability = new ConditionalAnyColorManaAbility(new TapSourceCost(), 1, new DelightedHalflingManaBuilder(), true);
this.addAbility(ability, new DelightedHalflingWatcher(ability.getOriginalId()));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new DelightedHalflingCantCounterEffect()));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new DelightedHalflingCantCounterEffect()).setRuleVisible(false));
}
private DelightedHalfling(final DelightedHalfling card) {
@ -134,9 +133,8 @@ class DelightedHalflingWatcher extends Watcher {
class DelightedHalflingCantCounterEffect extends ContinuousRuleModifyingEffectImpl {
public DelightedHalflingCantCounterEffect() {
DelightedHalflingCantCounterEffect() {
super(Duration.EndOfGame, Outcome.Benefit);
staticText = null;
}
private DelightedHalflingCantCounterEffect(final DelightedHalflingCantCounterEffect effect) {

View file

@ -33,10 +33,10 @@ public final class DragonTurtle extends CardImpl {
this.addAbility(FlashAbility.getInstance());
// Drag Below When Dragon Turtle enters the battlefield, tap it and up to one target creature an opponent controls. They don't untap during their controllers' next untap steps.
Ability ability = new EntersBattlefieldTriggeredAbility(new TapSourceEffect().setText(null));
ability.addEffect(new TapTargetEffect("tap it and up to one target creature an opponent controls"));
ability.addEffect(new DontUntapInControllersNextUntapStepSourceEffect().setText(null));
ability.addEffect(new DontUntapInControllersNextUntapStepTargetEffect().setText("They don't untap during their controllers' next untap steps"));
Ability ability = new EntersBattlefieldTriggeredAbility(new TapSourceEffect().setText("tap it"));
ability.addEffect(new TapTargetEffect("and up to one target creature an opponent controls"));
ability.addEffect(new DontUntapInControllersNextUntapStepSourceEffect().setText("They"));
ability.addEffect(new DontUntapInControllersNextUntapStepTargetEffect().setText(" don't untap during their controllers' next untap steps"));
ability.addTarget(new TargetOpponentsCreaturePermanent(0, 1));
this.addAbility(ability.withFlavorWord("Drag Below"));
}

View file

@ -1,11 +1,10 @@
package mage.cards.d;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -27,14 +26,9 @@ public final class Dreamcatcher extends CardImpl {
this.toughness = new MageInt(1);
// Whenever you cast a Spirit or Arcane spell, you may sacrifice Dreamcatcher. If you do, draw a card.
Ability ability = SpellCastControllerTriggeredAbility.createWithRule(
new SacrificeSourceEffect(),
StaticFilters.FILTER_SPIRIT_OR_ARCANE_CARD,
true,
"Whenever you cast a Spirit or Arcane spell, you may sacrifice {this}. If you do, draw a card."
);
ability.addEffect(new DrawCardSourceControllerEffect(1));
this.addAbility(ability);
this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(
new DrawCardSourceControllerEffect(1), new SacrificeSourceCost()
), StaticFilters.FILTER_SPIRIT_OR_ARCANE_CARD, false));
}
private Dreamcatcher(final Dreamcatcher card) {

View file

@ -82,27 +82,27 @@ class GiantSlugEffect extends OneShotEffect {
switch (choices.getChoice()) {
case "Plains":
game.addEffect(new GainAbilitySourceEffect(
new PlainswalkAbility(), Duration.EndOfTurn, false
new PlainswalkAbility(), Duration.EndOfTurn
), source);
return true;
case "Island":
game.addEffect(new GainAbilitySourceEffect(
new IslandwalkAbility(), Duration.EndOfTurn, false
new IslandwalkAbility(), Duration.EndOfTurn
), source);
return true;
case "Swamp":
game.addEffect(new GainAbilitySourceEffect(
new SwampwalkAbility(), Duration.EndOfTurn, false
new SwampwalkAbility(), Duration.EndOfTurn
), source);
return true;
case "Mountain":
game.addEffect(new GainAbilitySourceEffect(
new MountainwalkAbility(), Duration.EndOfTurn, false
new MountainwalkAbility(), Duration.EndOfTurn
), source);
return true;
case "Forest":
game.addEffect(new GainAbilitySourceEffect(
new ForestwalkAbility(), Duration.EndOfTurn, false
new ForestwalkAbility(), Duration.EndOfTurn
), source);
return true;
default:

View file

@ -1,30 +1,22 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.OpponentControlsPermanentCondition;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.Effects;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.EffectType;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -32,12 +24,6 @@ import mage.game.Game;
*/
public final class GroundlingPouncer extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public GroundlingPouncer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G/U}");
this.subtype.add(SubType.FAERIE);
@ -45,15 +31,8 @@ public final class GroundlingPouncer extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// {GU}: Groundling Pouncer gets +1/+3 and gains flying until end of turn. Activate this ability only once each turn and only if an opponent controls a creature with flying.
Ability ability = new GroundlingPouncerAbility(
Zone.BATTLEFIELD,
new BoostSourceEffect(1, 3, Duration.EndOfTurn),
new ManaCostsImpl<>("{G/U}"),
new OpponentControlsPermanentCondition(filter),
"{G/U}: {this} gets +1/+3 and gains flying until end of turn. Activate only once each turn and only if an opponent controls a creature with flying.");
ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn, false, true));
this.addAbility(ability);
// {G/U}: Groundling Pouncer gets +1/+3 and gains flying until end of turn. Activate this ability only once each turn and only if an opponent controls a creature with flying.
this.addAbility(new GroundlingPouncerAbility());
}
@ -69,19 +48,24 @@ public final class GroundlingPouncer extends CardImpl {
class GroundlingPouncerAbility extends LimitedTimesPerTurnActivatedAbility {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(new AbilityPredicate(FlyingAbility.class));
}
private static final Effects emptyEffects = new Effects();
private final String ruleText;
private static final String ruleText = "{G/U}: {this} gets +1/+3 and gains flying until end of turn. Activate only once each turn and only if an opponent controls a creature with flying.";
public GroundlingPouncerAbility(Zone zone, Effect effect, Cost cost, Condition condition, String rule) {
super(zone, effect, cost);
this.condition = condition;
this.ruleText = rule;
GroundlingPouncerAbility() {
super(Zone.BATTLEFIELD, new BoostSourceEffect(1, 3, Duration.EndOfTurn), new ManaCostsImpl<>("{G/U}"));
this.condition = new OpponentControlsPermanentCondition(filter);
this.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn));
}
private GroundlingPouncerAbility(final GroundlingPouncerAbility ability) {
super(ability);
this.ruleText = ability.ruleText;
}
@Override

View file

@ -46,10 +46,10 @@ public final class LilianaDeathsMajesty extends CardImpl {
// -3: Return target creature card from your graveyard to the battlefield. That creature is a black Zombie in addition to its other colors and types.
ability = new LoyaltyAbility(new AddCreatureTypeAdditionEffect(SubType.ZOMBIE, true) // because the effect has to be active for triggered effects that e.g. check if the creature entering is a Zombie, the continuous effect needs to be added before the card moving effect is applied
.setText(""), -3);
.setText("Return target creature card"), -3);
ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
ability.addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect()
.setText("Return target creature card from your graveyard to the battlefield. That creature is a black Zombie in addition to its other colors and types"));
.setText(" from your graveyard to the battlefield. That creature is a black Zombie in addition to its other colors and types"));
this.addAbility(ability);
// -7: Destroy all non-Zombie creatures.

View file

@ -1,4 +1,3 @@
package mage.cards.n;
import mage.MageInt;
@ -23,15 +22,13 @@ import java.util.UUID;
*/
public final class NightskyMimic extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a spell that's both black and green");
private static final FilterSpell filter = new FilterSpell("a spell that's both white and black");
static {
filter.add(new ColorPredicate(ObjectColor.WHITE));
filter.add(new ColorPredicate(ObjectColor.BLACK));
}
private static final String rule = "Whenever you cast a spell that's both white and black, {this} has base power and toughness 4/4 until end of turn and gains flying until end of turn.";
public NightskyMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W/B}");
this.subtype.add(SubType.SHAPESHIFTER);
@ -42,11 +39,12 @@ public final class NightskyMimic extends CardImpl {
this.toughness = new MageInt(1);
// Whenever you cast a spell that's both white and black, Nightsky Mimic has base power and toughness 4/4 until end of turn and gains flying until end of turn.
Ability ability = SpellCastControllerTriggeredAbility.createWithRule(
Ability ability = new SpellCastControllerTriggeredAbility(
new SetBasePowerToughnessSourceEffect(4, 4, Duration.EndOfTurn),
filter, false, rule
filter, false
);
ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn, false, true));
ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn)
.setText("and gains flying until end of turn"));
this.addAbility(ability);
}

View file

@ -14,7 +14,6 @@ import mage.filter.FilterCard;
import mage.filter.FilterSpell;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreatureSpell;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.mageobject.AbilityPredicate;
import java.util.UUID;
@ -25,8 +24,8 @@ import java.util.UUID;
public final class PollywogSymbiote extends CardImpl {
private static final FilterCard filter = new FilterCreatureCard();
private static final FilterSpell filter2 = new FilterCreatureSpell();
private static final Predicate predicate = new AbilityPredicate(MutateAbility.class);
private static final FilterSpell filter2 = new FilterCreatureSpell("a creature spell, if it has mutate");
private static final AbilityPredicate predicate = new AbilityPredicate(MutateAbility.class);
static {
filter.add(predicate);
@ -45,9 +44,8 @@ public final class PollywogSymbiote extends CardImpl {
.setText("each creature spell you cast costs {1} less to cast if it has mutate")));
// Whenever you cast a creature spell, if it has mutate, draw a card, then discard a card.
this.addAbility(SpellCastControllerTriggeredAbility.createWithRule(
new DrawDiscardControllerEffect(1, 1), filter2, false,
"Whenever you cast a creature spell, if it has mutate, draw a card, then discard a card."
this.addAbility(new SpellCastControllerTriggeredAbility(
new DrawDiscardControllerEffect(1, 1), filter2, false
));
}

View file

@ -1,4 +1,3 @@
package mage.cards.r;
import mage.MageInt;
@ -30,8 +29,6 @@ public final class RiverfallMimic extends CardImpl {
filter.add(new ColorPredicate(ObjectColor.RED));
}
private static final String rule = "Whenever you cast a spell that's both blue and red, {this} has base power and toughness 3/3 until end of turn and can't be blocked this turn.";
public RiverfallMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U/R}");
this.subtype.add(SubType.SHAPESHIFTER);
@ -42,11 +39,12 @@ public final class RiverfallMimic extends CardImpl {
this.toughness = new MageInt(1);
// Whenever you cast a spell that's both blue and red, Riverfall Mimic has base power and toughness 3/3 until end of turn and can't be blocked this turn.
Ability ability = SpellCastControllerTriggeredAbility.createWithRule(
Ability ability = new SpellCastControllerTriggeredAbility(
new SetBasePowerToughnessSourceEffect(3, 3, Duration.EndOfTurn),
filter, false, rule
filter, false
);
ability.addEffect(new GainAbilitySourceEffect(new CantBeBlockedSourceAbility(), Duration.EndOfTurn, false, true));
ability.addEffect(new GainAbilitySourceEffect(new CantBeBlockedSourceAbility(), Duration.EndOfTurn)
.setText("and can't be blocked this turn"));
this.addAbility(ability);
}

View file

@ -30,8 +30,6 @@ public final class ShorecrasherMimic extends CardImpl {
filter.add(new ColorPredicate(ObjectColor.BLUE));
}
private static final String rule = "Whenever you cast a spell that's both green and blue, {this} has base power and toughness 5/3 until end of turn and gains trample until end of turn.";
public ShorecrasherMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G/U}");
this.subtype.add(SubType.SHAPESHIFTER);
@ -42,11 +40,12 @@ public final class ShorecrasherMimic extends CardImpl {
this.toughness = new MageInt(1);
// Whenever you cast a spell that's both green and blue, Shorecrasher Mimic has base power and toughness 5/3 until end of turn and gains trample until end of turn.
Ability ability = SpellCastControllerTriggeredAbility.createWithRule(
Ability ability = new SpellCastControllerTriggeredAbility(
new SetBasePowerToughnessSourceEffect(5, 3, Duration.EndOfTurn),
filter, false, rule
filter, false
);
ability.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, false, true));
ability.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn)
.setText("and gains trample until end of turn"));
this.addAbility(ability);
}

View file

@ -50,10 +50,9 @@ public final class SkyfirePhoenix extends CardImpl {
class SkyfirePhoenixTriggeredAbility extends SpellCastControllerTriggeredAbility {
SkyfirePhoenixTriggeredAbility() {
super(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(),
StaticFilters.FILTER_SPELL, false, SetTargetPointer.NONE,
"When you cast your commander, return {this} from your graveyard to the battlefield.",
null);
super(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(false, false),
StaticFilters.FILTER_SPELL, false, SetTargetPointer.NONE);
setTriggerPhrase("When you cast your commander, ");
}
private SkyfirePhoenixTriggeredAbility(final SkyfirePhoenixTriggeredAbility ability) {
@ -79,4 +78,4 @@ class SkyfirePhoenixTriggeredAbility extends SpellCastControllerTriggeredAbility
public SkyfirePhoenixTriggeredAbility copy() {
return new SkyfirePhoenixTriggeredAbility(this);
}
}
}

View file

@ -4,8 +4,9 @@ package mage.cards.w;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -40,12 +41,9 @@ public final class WaspOfTheBitterEnd extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast a Bolas planeswalker spell, you may sacrifice Wasp of the Bitter End. If you do, destroy target creature.
Ability ability = SpellCastControllerTriggeredAbility.createWithRule(
new SacrificeSourceEffect(),
filter, true,
"Whenever you cast a Bolas planeswalker spell, you may sacrifice {this}. If you do, destroy target creature."
);
ability.addEffect(new DestroyTargetEffect());
Ability ability = new SpellCastControllerTriggeredAbility(new DoIfCostPaid(
new DestroyTargetEffect(), new SacrificeSourceCost()
), filter, false);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -29,13 +29,9 @@ public final class WindriderWizard extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast an instant, sorcery, or Wizard spell, you may draw a card. If you do, discard a card.
this.addAbility(SpellCastControllerTriggeredAbility.createWithRule(
this.addAbility(new SpellCastControllerTriggeredAbility(
new DrawDiscardControllerEffect(1, 1, true),
StaticFilters.FILTER_SPELL_INSTANT_SORCERY_WIZARD,
false,
"Whenever you cast an instant, sorcery, or Wizard spell, you may draw a card. "
+ "If you do, discard a card.")
);
StaticFilters.FILTER_SPELL_INSTANT_SORCERY_WIZARD, false));
}
private WindriderWizard(final WindriderWizard card) {

View file

@ -1,4 +1,3 @@
package mage.cards.w;
import mage.MageInt;
@ -30,8 +29,6 @@ public final class WoodlurkerMimic extends CardImpl {
filter.add(new ColorPredicate(ObjectColor.GREEN));
}
private static final String rule = "Whenever you cast a spell that's both black and green, {this} has base power and toughness 4/5 until end of turn and gains wither until end of turn.";
public WoodlurkerMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B/G}");
this.subtype.add(SubType.SHAPESHIFTER);
@ -42,11 +39,12 @@ public final class WoodlurkerMimic extends CardImpl {
this.toughness = new MageInt(1);
// Whenever you cast a spell that's both black and green, Woodlurker Mimic has base power and toughness 4/5 until end of turn and gains wither until end of turn.
Ability ability = SpellCastControllerTriggeredAbility.createWithRule(
Ability ability = new SpellCastControllerTriggeredAbility(
new SetBasePowerToughnessSourceEffect(4, 5, Duration.EndOfTurn),
filter, false, rule
filter, false
);
ability.addEffect(new GainAbilitySourceEffect(WitherAbility.getInstance(), Duration.EndOfTurn, false, true));
ability.addEffect(new GainAbilitySourceEffect(WitherAbility.getInstance(), Duration.EndOfTurn)
.setText("and gains wither until end of turn"));
this.addAbility(ability);
}

View file

@ -442,7 +442,7 @@ public interface Ability extends Controllable, Serializable {
*
* @param ruleVisible
*/
void setRuleVisible(boolean ruleVisible);
Ability setRuleVisible(boolean ruleVisible);
/**
* Returns true if the additional costs of the abilitiy should be visible on

View file

@ -1080,7 +1080,9 @@ public abstract class AbilityImpl implements Ability {
@Override
public Ability setRuleAtTheTop(boolean ruleAtTheTop) {
this.ruleAtTheTop = ruleAtTheTop;
if (!(this instanceof MageSingleton)) {
this.ruleAtTheTop = ruleAtTheTop;
}
return this;
}
@ -1090,10 +1092,11 @@ public abstract class AbilityImpl implements Ability {
}
@Override
public void setRuleVisible(boolean ruleVisible) {
public Ability setRuleVisible(boolean ruleVisible) {
if (!(this instanceof MageSingleton)) { // prevent to change singletons
this.ruleVisible = ruleVisible;
}
return this;
}
@Override

View file

@ -17,7 +17,6 @@ import mage.target.targetpointer.FixedTarget;
public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
protected final FilterSpell filter;
protected final String rule;
// If either the cast spell or the card must be set as TargetPointer of effects.
protected final SetTargetPointer setTargetPointer;
@ -40,33 +39,27 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
public SpellCastControllerTriggeredAbility(Zone zone, Effect effect, FilterSpell filter,
boolean optional, SetTargetPointer setTargetPointer) {
this(zone, effect, filter, optional, setTargetPointer, null, null);
this(zone, effect, filter, optional, setTargetPointer, null);
}
public SpellCastControllerTriggeredAbility(Zone zone, Effect effect, FilterSpell filter,
boolean optional, SetTargetPointer setTargetPointer,
String rule, Zone fromZone) {
Zone fromZone) {
super(zone, effect, optional);
this.filter = filter == null ? StaticFilters.FILTER_SPELL_A : filter;
this.setTargetPointer = setTargetPointer;
this.rule = rule;
this.fromZone = fromZone == null ? Zone.ALL : fromZone;
makeTriggerPhrase();
}
public static SpellCastControllerTriggeredAbility createWithFromZone(Effect effect, FilterSpell filter, boolean optional, Zone fromZone) {
return new SpellCastControllerTriggeredAbility(Zone.BATTLEFIELD, effect, filter, optional, SetTargetPointer.NONE, null, fromZone);
}
public static SpellCastControllerTriggeredAbility createWithRule(Effect effect, FilterSpell filter, boolean optional, String rule) {
return new SpellCastControllerTriggeredAbility(Zone.BATTLEFIELD, effect, filter, optional, SetTargetPointer.NONE, rule, null);
return new SpellCastControllerTriggeredAbility(Zone.BATTLEFIELD, effect, filter, optional, SetTargetPointer.NONE, fromZone);
}
protected SpellCastControllerTriggeredAbility(final SpellCastControllerTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.rule = ability.rule;
this.setTargetPointer = ability.setTargetPointer;
this.fromZone = ability.fromZone;
}
@ -103,11 +96,6 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
return true;
}
@Override
public String getRule() {
return rule != null ? rule : super.getRule();
}
@Override
public SpellCastControllerTriggeredAbility copy() {
return new SpellCastControllerTriggeredAbility(this);

View file

@ -25,7 +25,6 @@ public class AddCreatureTypeAdditionEffect extends ContinuousEffectImpl {
super(effect);
this.subType = effect.subType;
this.giveBlackColor = effect.giveBlackColor;
updateText();
}
private void updateText() {

View file

@ -18,12 +18,10 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl {
protected Ability ability;
// shall a card gain the ability (otherwise permanent)
private boolean onCard;
private final boolean onCard;
/**
* Add ability with Duration.WhileOnBattlefield
*
* @param ability
*/
public GainAbilitySourceEffect(Ability ability) {
this(ability, Duration.WhileOnBattlefield);
@ -34,19 +32,11 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl {
}
public GainAbilitySourceEffect(Ability ability, Duration duration, boolean onCard) {
this(ability, duration, onCard, false);
staticText = "{this} gains " + ability.getRule()
+ (duration.toString().isEmpty() ? "" : ' ' + duration.toString());
}
public GainAbilitySourceEffect(Ability ability, Duration duration, boolean onCard, boolean noStaticText) {
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
this.ability = ability;
this.onCard = onCard;
if (noStaticText) {
staticText = null;
}
this.staticText = "{this} gains " + ability.getRule()
+ (duration.toString().isEmpty() ? "" : ' ' + duration.toString());
this.generateGainAbilityDependencies(ability, null);
}

View file

@ -20,10 +20,10 @@ public final class EldraziSpawnToken extends TokenImpl {
subtype.add(SubType.SPAWN);
power = new MageInt(0);
toughness = new MageInt(1);
addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1), new SacrificeSourceCost()));
addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1), new SacrificeSourceCost().setText("Sacrifice this creature")));
}
protected EldraziSpawnToken(final EldraziSpawnToken token) {
private EldraziSpawnToken(final EldraziSpawnToken token) {
super(token);
}

View file

@ -485,8 +485,9 @@ public class StackAbility extends StackObjectImpl implements Ability {
}
@Override
public void setRuleVisible(boolean ruleVisible) {
public Ability setRuleVisible(boolean ruleVisible) {
this.ability.setRuleVisible(ruleVisible);
return this;
}
@Override