diff --git a/Mage.Sets/src/mage/cards/a/AriaOfFlame.java b/Mage.Sets/src/mage/cards/a/AriaOfFlame.java index 71cffb71f78..2856347067a 100644 --- a/Mage.Sets/src/mage/cards/a/AriaOfFlame.java +++ b/Mage.Sets/src/mage/cards/a/AriaOfFlame.java @@ -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); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/b/BattlegateMimic.java b/Mage.Sets/src/mage/cards/b/BattlegateMimic.java index d4655b7fa10..3ec45208f9f 100644 --- a/Mage.Sets/src/mage/cards/b/BattlegateMimic.java +++ b/Mage.Sets/src/mage/cards/b/BattlegateMimic.java @@ -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); } diff --git a/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java b/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java index 5a8e25285b0..6018272c638 100644 --- a/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java +++ b/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java @@ -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)); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/c/CavernOfSouls.java b/Mage.Sets/src/mage/cards/c/CavernOfSouls.java index 3b0663ce566..d9471c40ce5 100644 --- a/Mage.Sets/src/mage/cards/c/CavernOfSouls.java +++ b/Mage.Sets/src/mage/cards/c/CavernOfSouls.java @@ -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) { diff --git a/Mage.Sets/src/mage/cards/d/DelightedHalfling.java b/Mage.Sets/src/mage/cards/d/DelightedHalfling.java index b0ff88fcd81..78ae4ffed80 100644 --- a/Mage.Sets/src/mage/cards/d/DelightedHalfling.java +++ b/Mage.Sets/src/mage/cards/d/DelightedHalfling.java @@ -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) { diff --git a/Mage.Sets/src/mage/cards/d/DragonTurtle.java b/Mage.Sets/src/mage/cards/d/DragonTurtle.java index b032cdb1674..7150c1b1a12 100644 --- a/Mage.Sets/src/mage/cards/d/DragonTurtle.java +++ b/Mage.Sets/src/mage/cards/d/DragonTurtle.java @@ -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")); } diff --git a/Mage.Sets/src/mage/cards/d/Dreamcatcher.java b/Mage.Sets/src/mage/cards/d/Dreamcatcher.java index 071b09e6843..ac4f20ac4c6 100644 --- a/Mage.Sets/src/mage/cards/d/Dreamcatcher.java +++ b/Mage.Sets/src/mage/cards/d/Dreamcatcher.java @@ -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) { diff --git a/Mage.Sets/src/mage/cards/g/GiantSlug.java b/Mage.Sets/src/mage/cards/g/GiantSlug.java index 6a04d189c13..456753237e6 100644 --- a/Mage.Sets/src/mage/cards/g/GiantSlug.java +++ b/Mage.Sets/src/mage/cards/g/GiantSlug.java @@ -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: diff --git a/Mage.Sets/src/mage/cards/g/GroundlingPouncer.java b/Mage.Sets/src/mage/cards/g/GroundlingPouncer.java index 6f6e9802da7..91b5e74a7fa 100644 --- a/Mage.Sets/src/mage/cards/g/GroundlingPouncer.java +++ b/Mage.Sets/src/mage/cards/g/GroundlingPouncer.java @@ -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 diff --git a/Mage.Sets/src/mage/cards/l/LilianaDeathsMajesty.java b/Mage.Sets/src/mage/cards/l/LilianaDeathsMajesty.java index 72ac0476d61..e1852e909b9 100644 --- a/Mage.Sets/src/mage/cards/l/LilianaDeathsMajesty.java +++ b/Mage.Sets/src/mage/cards/l/LilianaDeathsMajesty.java @@ -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. diff --git a/Mage.Sets/src/mage/cards/n/NightskyMimic.java b/Mage.Sets/src/mage/cards/n/NightskyMimic.java index 34f00cb3569..6dc87132edf 100644 --- a/Mage.Sets/src/mage/cards/n/NightskyMimic.java +++ b/Mage.Sets/src/mage/cards/n/NightskyMimic.java @@ -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); } diff --git a/Mage.Sets/src/mage/cards/p/PollywogSymbiote.java b/Mage.Sets/src/mage/cards/p/PollywogSymbiote.java index 85c4011e097..15710991b15 100644 --- a/Mage.Sets/src/mage/cards/p/PollywogSymbiote.java +++ b/Mage.Sets/src/mage/cards/p/PollywogSymbiote.java @@ -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 )); } diff --git a/Mage.Sets/src/mage/cards/r/RiverfallMimic.java b/Mage.Sets/src/mage/cards/r/RiverfallMimic.java index 4d3c3341a77..02eb03b497e 100644 --- a/Mage.Sets/src/mage/cards/r/RiverfallMimic.java +++ b/Mage.Sets/src/mage/cards/r/RiverfallMimic.java @@ -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); } diff --git a/Mage.Sets/src/mage/cards/s/ShorecrasherMimic.java b/Mage.Sets/src/mage/cards/s/ShorecrasherMimic.java index 37e5c2c347b..a50d6c6a487 100644 --- a/Mage.Sets/src/mage/cards/s/ShorecrasherMimic.java +++ b/Mage.Sets/src/mage/cards/s/ShorecrasherMimic.java @@ -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); } diff --git a/Mage.Sets/src/mage/cards/s/SkyfirePhoenix.java b/Mage.Sets/src/mage/cards/s/SkyfirePhoenix.java index 481f3b75486..dbab3f39da3 100644 --- a/Mage.Sets/src/mage/cards/s/SkyfirePhoenix.java +++ b/Mage.Sets/src/mage/cards/s/SkyfirePhoenix.java @@ -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); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/w/WaspOfTheBitterEnd.java b/Mage.Sets/src/mage/cards/w/WaspOfTheBitterEnd.java index 0f04ce8e473..9a22e33e511 100644 --- a/Mage.Sets/src/mage/cards/w/WaspOfTheBitterEnd.java +++ b/Mage.Sets/src/mage/cards/w/WaspOfTheBitterEnd.java @@ -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); } diff --git a/Mage.Sets/src/mage/cards/w/WindriderWizard.java b/Mage.Sets/src/mage/cards/w/WindriderWizard.java index 996182ca659..8ff2a1f50ad 100644 --- a/Mage.Sets/src/mage/cards/w/WindriderWizard.java +++ b/Mage.Sets/src/mage/cards/w/WindriderWizard.java @@ -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) { diff --git a/Mage.Sets/src/mage/cards/w/WoodlurkerMimic.java b/Mage.Sets/src/mage/cards/w/WoodlurkerMimic.java index c166fbfe989..6dd3e551725 100644 --- a/Mage.Sets/src/mage/cards/w/WoodlurkerMimic.java +++ b/Mage.Sets/src/mage/cards/w/WoodlurkerMimic.java @@ -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); } diff --git a/Mage/src/main/java/mage/abilities/Ability.java b/Mage/src/main/java/mage/abilities/Ability.java index 9ad685a0917..47f73e9dc63 100644 --- a/Mage/src/main/java/mage/abilities/Ability.java +++ b/Mage/src/main/java/mage/abilities/Ability.java @@ -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 diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 0a0be725e31..baa3fa71fa3 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -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 diff --git a/Mage/src/main/java/mage/abilities/common/SpellCastControllerTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/SpellCastControllerTriggeredAbility.java index 278d4cca4f7..728e67f5d3f 100644 --- a/Mage/src/main/java/mage/abilities/common/SpellCastControllerTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/SpellCastControllerTriggeredAbility.java @@ -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); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCreatureTypeAdditionEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCreatureTypeAdditionEffect.java index c65e9467909..b5dbdd6f980 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCreatureTypeAdditionEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCreatureTypeAdditionEffect.java @@ -25,7 +25,6 @@ public class AddCreatureTypeAdditionEffect extends ContinuousEffectImpl { super(effect); this.subType = effect.subType; this.giveBlackColor = effect.giveBlackColor; - updateText(); } private void updateText() { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java index 9d00941e1c5..a8d5bfa9981 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java @@ -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); } diff --git a/Mage/src/main/java/mage/game/permanent/token/EldraziSpawnToken.java b/Mage/src/main/java/mage/game/permanent/token/EldraziSpawnToken.java index fba83e5b0c4..01a47f352f5 100644 --- a/Mage/src/main/java/mage/game/permanent/token/EldraziSpawnToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/EldraziSpawnToken.java @@ -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); } diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index 8631b7a690d..ce5db211882 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -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