diff --git a/Mage.Sets/src/mage/cards/b/BallynockCohort.java b/Mage.Sets/src/mage/cards/b/BallynockCohort.java index a7afdb28be..539e3f0a08 100644 --- a/Mage.Sets/src/mage/cards/b/BallynockCohort.java +++ b/Mage.Sets/src/mage/cards/b/BallynockCohort.java @@ -35,7 +35,7 @@ public final class BallynockCohort extends CardImpl { filter.add(AnotherPredicate.instance); } - private String rule = "{this} gets +1/+1 as long as you control another white creature"; + private static final String rule = "{this} gets +1/+1 as long as you control another white creature"; public BallynockCohort(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}"); diff --git a/Mage.Sets/src/mage/cards/b/BarbedWire.java b/Mage.Sets/src/mage/cards/b/BarbedWire.java index e8f42a84fe..6fcc49d55f 100644 --- a/Mage.Sets/src/mage/cards/b/BarbedWire.java +++ b/Mage.Sets/src/mage/cards/b/BarbedWire.java @@ -24,7 +24,7 @@ import mage.players.Player; */ public final class BarbedWire extends CardImpl { - private final String rule = "At the beginning of each player's upkeep, " + private static final String rule = "At the beginning of each player's upkeep, " + "Barbed Wire deals 1 damage to that player."; public BarbedWire(UUID ownerId, CardSetInfo setInfo) { diff --git a/Mage.Sets/src/mage/cards/b/BattlegateMimic.java b/Mage.Sets/src/mage/cards/b/BattlegateMimic.java index 7466db08d1..24e080bc71 100644 --- a/Mage.Sets/src/mage/cards/b/BattlegateMimic.java +++ b/Mage.Sets/src/mage/cards/b/BattlegateMimic.java @@ -31,7 +31,7 @@ public final class BattlegateMimic extends CardImpl { filter.add(new ColorPredicate(ObjectColor.WHITE)); } - private String rule = "Whenever you cast a spell that's both red and white, {this} has base power and toughness 4/2 and gains first strike until end of turn."; + private static final String rule = "Whenever you cast a spell that's both red and white, {this} has base power and toughness 4/2 and gains first strike until end of turn."; public BattlegateMimic(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R/W}"); diff --git a/Mage.Sets/src/mage/cards/b/BriarberryCohort.java b/Mage.Sets/src/mage/cards/b/BriarberryCohort.java index 135b78470e..edbe30cab8 100644 --- a/Mage.Sets/src/mage/cards/b/BriarberryCohort.java +++ b/Mage.Sets/src/mage/cards/b/BriarberryCohort.java @@ -35,7 +35,7 @@ public final class BriarberryCohort extends CardImpl { filter.add(AnotherPredicate.instance); } - private String rule = "{this} gets +1/+1 as long as you control another blue creature"; + private static final String rule = "{this} gets +1/+1 as long as you control another blue creature"; public BriarberryCohort(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); diff --git a/Mage.Sets/src/mage/cards/e/EzuriClawOfProgress.java b/Mage.Sets/src/mage/cards/e/EzuriClawOfProgress.java index edd8234b6f..445c449493 100644 --- a/Mage.Sets/src/mage/cards/e/EzuriClawOfProgress.java +++ b/Mage.Sets/src/mage/cards/e/EzuriClawOfProgress.java @@ -34,7 +34,7 @@ public final class EzuriClawOfProgress extends CardImpl { filter2.add(AnotherPredicate.instance); } - String rule = "Whenever a creature with power 2 or less enters the battlefield under your control, you get an experience counter."; + private static final String rule = "Whenever a creature with power 2 or less enters the battlefield under your control, you get an experience counter."; public EzuriClawOfProgress(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}"); diff --git a/Mage.Sets/src/mage/cards/g/GodtrackerOfJund.java b/Mage.Sets/src/mage/cards/g/GodtrackerOfJund.java index faef422294..93561bd5db 100644 --- a/Mage.Sets/src/mage/cards/g/GodtrackerOfJund.java +++ b/Mage.Sets/src/mage/cards/g/GodtrackerOfJund.java @@ -27,7 +27,7 @@ public final class GodtrackerOfJund extends CardImpl { filter.add(new PowerPredicate(ComparisonType.MORE_THAN, 4)); } - String rule = "Whenever a creature with power 5 or greater enters the battlefield under your control, you may put a +1/+1 counter on {this}."; + private static final String rule = "Whenever a creature with power 5 or greater enters the battlefield under your control, you may put a +1/+1 counter on {this}."; public GodtrackerOfJund(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}{G}"); diff --git a/Mage.Sets/src/mage/cards/h/HagHedgeMage.java b/Mage.Sets/src/mage/cards/h/HagHedgeMage.java index bf5be6e35e..0374a5b1b4 100644 --- a/Mage.Sets/src/mage/cards/h/HagHedgeMage.java +++ b/Mage.Sets/src/mage/cards/h/HagHedgeMage.java @@ -33,8 +33,8 @@ public final class HagHedgeMage extends CardImpl { filter2.add(SubType.FOREST.getPredicate()); } - private String rule = "When {this} enters the battlefield, if you control two or more Swamps, you may have target player discard a card."; - private String rule2 = "When {this} enters the battlefield, if you control two or more Forests, you may put target card from your graveyard on top of your library."; + private static final String rule = "When {this} enters the battlefield, if you control two or more Swamps, you may have target player discard a card."; + private static final String rule2 = "When {this} enters the battlefield, if you control two or more Forests, you may put target card from your graveyard on top of your library."; public HagHedgeMage(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B/G}"); diff --git a/Mage.Sets/src/mage/cards/l/LostOrderOfJarkeld.java b/Mage.Sets/src/mage/cards/l/LostOrderOfJarkeld.java index b393e26c17..237a561940 100644 --- a/Mage.Sets/src/mage/cards/l/LostOrderOfJarkeld.java +++ b/Mage.Sets/src/mage/cards/l/LostOrderOfJarkeld.java @@ -1,30 +1,29 @@ package mage.cards.l; import mage.MageInt; +import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.AdditiveDynamicValue; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.ChooseOpponentEffect; import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; -import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.dynamicvalue.AdditiveDynamicValue; -import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.dynamicvalue.common.StaticValue; -import mage.abilities.effects.Effect; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** * @author TheElk801 */ public final class LostOrderOfJarkeld extends CardImpl { - protected FilterCreaturePermanent filter = new FilterCreaturePermanent(); - public LostOrderOfJarkeld(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}"); @@ -39,8 +38,9 @@ public final class LostOrderOfJarkeld extends CardImpl { // Lost Order of Jarkeld's power and toughness are each equal to 1 plus the number of creatures the chosen player controls. this.addAbility(new SimpleStaticAbility( Zone.ALL, - new SetPowerToughnessSourceEffect( - new AdditiveDynamicValue(new CreaturesControlledByChosenPlayer(), StaticValue.get(1)), Duration.EndOfGame) + new SetPowerToughnessSourceEffect(new AdditiveDynamicValue( + CreaturesControlledByChosenPlayer.instance, StaticValue.get(1) + ), Duration.EndOfGame) )); } @@ -54,7 +54,8 @@ public final class LostOrderOfJarkeld extends CardImpl { } } -class CreaturesControlledByChosenPlayer implements DynamicValue { +enum CreaturesControlledByChosenPlayer implements DynamicValue { + instance; @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { @@ -70,7 +71,7 @@ class CreaturesControlledByChosenPlayer implements DynamicValue { @Override public CreaturesControlledByChosenPlayer copy() { - return new CreaturesControlledByChosenPlayer(); + return this; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MurasaBehemoth.java b/Mage.Sets/src/mage/cards/m/MurasaBehemoth.java index bcac144b85..d3303cbecd 100644 --- a/Mage.Sets/src/mage/cards/m/MurasaBehemoth.java +++ b/Mage.Sets/src/mage/cards/m/MurasaBehemoth.java @@ -21,7 +21,7 @@ import java.util.UUID; */ public final class MurasaBehemoth extends CardImpl { - Condition condition = new CardsInControllerGraveyardCondition(1, StaticFilters.FILTER_CARD_LAND); + private static final Condition condition = new CardsInControllerGraveyardCondition(1, StaticFilters.FILTER_CARD_LAND); public MurasaBehemoth(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}"); diff --git a/Mage.Sets/src/mage/cards/n/NightskyMimic.java b/Mage.Sets/src/mage/cards/n/NightskyMimic.java index e6caf289c3..d2491c5328 100644 --- a/Mage.Sets/src/mage/cards/n/NightskyMimic.java +++ b/Mage.Sets/src/mage/cards/n/NightskyMimic.java @@ -32,7 +32,7 @@ public final class NightskyMimic extends CardImpl { filter.add(new ColorPredicate(ObjectColor.BLACK)); } - private 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."; + 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}"); diff --git a/Mage.Sets/src/mage/cards/n/NoggleHedgeMage.java b/Mage.Sets/src/mage/cards/n/NoggleHedgeMage.java index 38da0be245..dc876fe2a8 100644 --- a/Mage.Sets/src/mage/cards/n/NoggleHedgeMage.java +++ b/Mage.Sets/src/mage/cards/n/NoggleHedgeMage.java @@ -34,8 +34,8 @@ public final class NoggleHedgeMage extends CardImpl { filter2.add(SubType.MOUNTAIN.getPredicate()); } - private String rule = "When {this} enters the battlefield, if you control two or more Islands, you may tap two target permanents."; - private String rule2 = "When {this} enters the battlefield, if you control two or more Mountains, you may have {this} deal 2 damage to target player or planeswalker."; + private static final String rule = "When {this} enters the battlefield, if you control two or more Islands, you may tap two target permanents."; + private static final String rule2 = "When {this} enters the battlefield, if you control two or more Mountains, you may have {this} deal 2 damage to target player or planeswalker."; public NoggleHedgeMage(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U/R}"); diff --git a/Mage.Sets/src/mage/cards/r/RiverfallMimic.java b/Mage.Sets/src/mage/cards/r/RiverfallMimic.java index 9d61c7ef78..3f4891678a 100644 --- a/Mage.Sets/src/mage/cards/r/RiverfallMimic.java +++ b/Mage.Sets/src/mage/cards/r/RiverfallMimic.java @@ -32,7 +32,7 @@ public final class RiverfallMimic extends CardImpl { filter.add(new ColorPredicate(ObjectColor.RED)); } - private 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."; + 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}"); diff --git a/Mage.Sets/src/mage/cards/s/ShorecrasherMimic.java b/Mage.Sets/src/mage/cards/s/ShorecrasherMimic.java index 7c286d1f83..59c2e84623 100644 --- a/Mage.Sets/src/mage/cards/s/ShorecrasherMimic.java +++ b/Mage.Sets/src/mage/cards/s/ShorecrasherMimic.java @@ -32,7 +32,7 @@ public final class ShorecrasherMimic extends CardImpl { filter.add(new ColorPredicate(ObjectColor.BLUE)); } - private 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."; + 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}"); diff --git a/Mage.Sets/src/mage/cards/s/ShrewdHatchling.java b/Mage.Sets/src/mage/cards/s/ShrewdHatchling.java index 6145a57fc7..db9ce2c695 100644 --- a/Mage.Sets/src/mage/cards/s/ShrewdHatchling.java +++ b/Mage.Sets/src/mage/cards/s/ShrewdHatchling.java @@ -5,14 +5,16 @@ import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.common.SpellCastAllTriggeredAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.RestrictionEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.RemoveCounterSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; import mage.counters.CounterType; import mage.filter.FilterSpell; import mage.filter.predicate.mageobject.ColorPredicate; @@ -27,19 +29,14 @@ import java.util.UUID; */ public final class ShrewdHatchling extends CardImpl { - private static final FilterSpell filter = new FilterSpell("blue spell"); - private static final FilterSpell filter2 = new FilterSpell("red spell"); + private static final FilterSpell filter = new FilterSpell("a blue spell"); + private static final FilterSpell filter2 = new FilterSpell("a red spell"); static { - filter.add(TargetController.YOU.getControllerPredicate()); filter.add(new ColorPredicate(ObjectColor.BLUE)); - filter2.add(TargetController.YOU.getControllerPredicate()); filter2.add(new ColorPredicate(ObjectColor.RED)); } - private String rule = "Whenever you cast a blue spell, remove a -1/-1 counter from Shrewd Hatchling."; - private String rule2 = "Whenever you cast a red spell, remove a -1/-1 counter from Shrewd Hatchling."; - public ShrewdHatchling(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U/R}"); this.subtype.add(SubType.ELEMENTAL); @@ -48,18 +45,24 @@ public final class ShrewdHatchling extends CardImpl { this.toughness = new MageInt(6); // Shrewd Hatchling enters the battlefield with four -1/-1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.M1M1.createInstance(4)))); + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect( + CounterType.M1M1.createInstance(4) + ), "with four -1/-1 counters on it")); // {UR}: Target creature can't block Shrewd Hatchling this turn. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ShrewdHatchlingEffect(), new ManaCostsImpl("{U/R}")); + Ability ability = new SimpleActivatedAbility(new ShrewdHatchlingEffect(), new ManaCostsImpl<>("{U/R}")); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); // Whenever you cast a blue spell, remove a -1/-1 counter from Shrewd Hatchling. - this.addAbility(new SpellCastAllTriggeredAbility(new RemoveCounterSourceEffect(CounterType.M1M1.createInstance()), filter, false, rule)); + this.addAbility(new SpellCastControllerTriggeredAbility( + new RemoveCounterSourceEffect(CounterType.M1M1.createInstance()), filter, false + )); // Whenever you cast a red spell, remove a -1/-1 counter from Shrewd Hatchling. - this.addAbility(new SpellCastAllTriggeredAbility(new RemoveCounterSourceEffect(CounterType.M1M1.createInstance()), filter2, false, rule2)); + this.addAbility(new SpellCastControllerTriggeredAbility( + new RemoveCounterSourceEffect(CounterType.M1M1.createInstance()), filter2, false + )); } diff --git a/Mage.Sets/src/mage/cards/s/SistersOfStoneDeath.java b/Mage.Sets/src/mage/cards/s/SistersOfStoneDeath.java index 286a1218b1..88f3775b82 100644 --- a/Mage.Sets/src/mage/cards/s/SistersOfStoneDeath.java +++ b/Mage.Sets/src/mage/cards/s/SistersOfStoneDeath.java @@ -1,13 +1,11 @@ package mage.cards.s; -import java.util.LinkedList; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.effects.common.ExileTargetForSourceEffect; import mage.abilities.effects.common.combat.MustBeBlockedByTargetSourceEffect; import mage.cards.Card; import mage.cards.CardImpl; @@ -24,14 +22,16 @@ import mage.game.Game; import mage.players.Player; import mage.target.TargetCard; import mage.target.common.TargetCreaturePermanent; +import mage.util.CardUtil; + +import java.util.LinkedList; +import java.util.UUID; /** * @author jeffwadsworth */ public final class SistersOfStoneDeath extends CardImpl { - private UUID exileId = UUID.randomUUID(); - public SistersOfStoneDeath(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}{G}{G}"); this.addSuperType(SuperType.LEGENDARY); @@ -46,7 +46,7 @@ public final class SistersOfStoneDeath extends CardImpl { this.addAbility(ability); // {B}{G}: Exile target creature blocking or blocked by Sisters of Stone Death. - Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetEffect(exileId, this.getIdName()), new ManaCostsImpl("{B}{G}")); + Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetForSourceEffect(), new ManaCostsImpl("{B}{G}")); FilterCreaturePermanent filter = new FilterCreaturePermanent("creature blocking or blocked by Sisters of Stone Death"); filter.add(Predicates.or(new BlockedByIdPredicate(this.getId()), new BlockingAttackerIdPredicate(this.getId()))); @@ -54,7 +54,7 @@ public final class SistersOfStoneDeath extends CardImpl { this.addAbility(ability2); // {2}{B}: Put a creature card exiled with Sisters of Stone Death onto the battlefield under your control. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SistersOfStoneDeathEffect(exileId), new ManaCostsImpl("{2}{B}"))); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SistersOfStoneDeathEffect(), new ManaCostsImpl("{2}{B}"))); } @@ -70,17 +70,13 @@ public final class SistersOfStoneDeath extends CardImpl { class SistersOfStoneDeathEffect extends OneShotEffect { - private final UUID exileId; - - public SistersOfStoneDeathEffect(UUID exileId) { + public SistersOfStoneDeathEffect() { super(Outcome.PutCreatureInPlay); - this.exileId = exileId; staticText = "Put a creature card exiled with {this} onto the battlefield under your control"; } public SistersOfStoneDeathEffect(final SistersOfStoneDeathEffect effect) { super(effect); - this.exileId = effect.exileId; } @Override @@ -89,7 +85,7 @@ class SistersOfStoneDeathEffect extends OneShotEffect { TargetCard target = new TargetCard(Zone.EXILED, StaticFilters.FILTER_CARD_CREATURE); Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - ExileZone exile = game.getExile().getExileZone(exileId); + ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source)); if (exile != null) { LinkedList cards = new LinkedList<>(exile); for (UUID cardId : cards) { diff --git a/Mage.Sets/src/mage/cards/s/SoulReap.java b/Mage.Sets/src/mage/cards/s/SoulReap.java index f43e3b8408..0308ede1df 100644 --- a/Mage.Sets/src/mage/cards/s/SoulReap.java +++ b/Mage.Sets/src/mage/cards/s/SoulReap.java @@ -38,7 +38,7 @@ public final class SoulReap extends CardImpl { filter.add(Predicates.not(new ColorPredicate(ObjectColor.GREEN))); } - private String rule = "Its controller loses 3 life if you've cast another black spell this turn"; + private static final String rule = "Its controller loses 3 life if you've cast another black spell this turn"; public SoulReap(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}"); diff --git a/Mage.Sets/src/mage/cards/w/WoodlurkerMimic.java b/Mage.Sets/src/mage/cards/w/WoodlurkerMimic.java index b8ad68085f..93d15f85cb 100644 --- a/Mage.Sets/src/mage/cards/w/WoodlurkerMimic.java +++ b/Mage.Sets/src/mage/cards/w/WoodlurkerMimic.java @@ -32,7 +32,7 @@ public final class WoodlurkerMimic extends CardImpl { filter.add(new ColorPredicate(ObjectColor.GREEN)); } - private 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."; + 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}");