From d28e206a99eabd37fabe6dca0c8cf359c102a74c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 29 Sep 2018 11:19:34 -0400 Subject: [PATCH] removed or replaced various instances of non-static variables in cards --- .../src/mage/cards/c/CrookOfCondemnation.java | 12 ++++------ .../src/mage/cards/l/LuminarchAscension.java | 2 +- .../src/mage/cards/m/MerrowBonegnawer.java | 8 +++---- .../src/mage/cards/p/PhantasmalImage.java | 3 +-- Mage.Sets/src/mage/cards/r/RakkaMar.java | 13 +++++++---- Mage.Sets/src/mage/cards/t/TaintedSigil.java | 23 +++++++++---------- .../src/mage/cards/t/TraceOfAbundance.java | 17 +++++--------- .../src/mage/cards/v/VesuvanShapeshifter.java | 11 +++------ 8 files changed, 38 insertions(+), 51 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/CrookOfCondemnation.java b/Mage.Sets/src/mage/cards/c/CrookOfCondemnation.java index 71016541e7..8770fff76c 100644 --- a/Mage.Sets/src/mage/cards/c/CrookOfCondemnation.java +++ b/Mage.Sets/src/mage/cards/c/CrookOfCondemnation.java @@ -1,7 +1,6 @@ package mage.cards.c; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.ExileSourceCost; @@ -15,29 +14,28 @@ import mage.constants.CardType; import mage.constants.Zone; import mage.target.common.TargetCardInGraveyard; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class CrookOfCondemnation extends CardImpl { - - private UUID exileId = UUID.randomUUID(); public CrookOfCondemnation(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); - + // {1}, {t}: Exile target card from a graveyard. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetEffect(), new ManaCostsImpl("{1}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetCardInGraveyard()); this.addAbility(ability); - + // {1}, Exile Crook of Condemnation: Exile all cards from all graveyards. Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileGraveyardAllPlayersEffect(), new ManaCostsImpl("{1}")); ability2.addCost(new ExileSourceCost()); this.addAbility(ability2); - + } public CrookOfCondemnation(final CrookOfCondemnation card) { diff --git a/Mage.Sets/src/mage/cards/l/LuminarchAscension.java b/Mage.Sets/src/mage/cards/l/LuminarchAscension.java index b2710993d1..e28bd77988 100644 --- a/Mage.Sets/src/mage/cards/l/LuminarchAscension.java +++ b/Mage.Sets/src/mage/cards/l/LuminarchAscension.java @@ -29,7 +29,7 @@ import mage.watchers.common.PlayerLostLifeWatcher; */ public final class LuminarchAscension extends CardImpl { - private String rule = "At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on {this}. (Damage causes loss of life.)"; + private static final String rule = "At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on {this}. (Damage causes loss of life.)"; public LuminarchAscension(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); diff --git a/Mage.Sets/src/mage/cards/m/MerrowBonegnawer.java b/Mage.Sets/src/mage/cards/m/MerrowBonegnawer.java index 0b533c9260..f274496308 100644 --- a/Mage.Sets/src/mage/cards/m/MerrowBonegnawer.java +++ b/Mage.Sets/src/mage/cards/m/MerrowBonegnawer.java @@ -1,7 +1,6 @@ package mage.cards.m; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -20,14 +19,13 @@ import mage.filter.FilterSpell; import mage.filter.predicate.mageobject.ColorPredicate; import mage.target.TargetPlayer; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class MerrowBonegnawer extends CardImpl { - private UUID exileId = UUID.randomUUID(); - private static final FilterSpell filter = new FilterSpell("a black spell"); static { @@ -43,7 +41,7 @@ public final class MerrowBonegnawer extends CardImpl { this.toughness = new MageInt(1); // {tap}: Target player exiles a card from their graveyard. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileFromZoneTargetEffect(Zone.GRAVEYARD, exileId, getIdName(), new FilterCard()), new TapSourceCost()); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileFromZoneTargetEffect(Zone.GRAVEYARD, null, getIdName(), new FilterCard()), new TapSourceCost()); ability.addTarget(new TargetPlayer()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/p/PhantasmalImage.java b/Mage.Sets/src/mage/cards/p/PhantasmalImage.java index 003ff68f88..9c0b2db68f 100644 --- a/Mage.Sets/src/mage/cards/p/PhantasmalImage.java +++ b/Mage.Sets/src/mage/cards/p/PhantasmalImage.java @@ -21,14 +21,13 @@ import mage.util.functions.ApplyToPermanent; import java.util.UUID; /** - * * @author North */ public final class PhantasmalImage extends CardImpl { private static final String effectText = "a copy of any creature on the battlefield, except it's an Illusion in addition to its other types and it has \"When this creature becomes the target of a spell or ability, sacrifice it.\""; - ApplyToPermanent phantasmalImageApplier = new ApplyToPermanent() { + private static final ApplyToPermanent phantasmalImageApplier = new ApplyToPermanent() { @Override public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { if (!permanent.hasSubtype(SubType.ILLUSION, game)) { diff --git a/Mage.Sets/src/mage/cards/r/RakkaMar.java b/Mage.Sets/src/mage/cards/r/RakkaMar.java index 4e6f41225a..30db7aafab 100644 --- a/Mage.Sets/src/mage/cards/r/RakkaMar.java +++ b/Mage.Sets/src/mage/cards/r/RakkaMar.java @@ -1,7 +1,6 @@ package mage.cards.r; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -17,14 +16,13 @@ import mage.constants.SuperType; import mage.constants.Zone; import mage.game.permanent.token.RakkaMarElementalToken; +import java.util.UUID; + /** - * * @author Loki */ public final class RakkaMar extends CardImpl { - private RakkaMarElementalToken token = new RakkaMarElementalToken(); - public RakkaMar(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}"); addSuperType(SuperType.LEGENDARY); @@ -34,7 +32,12 @@ public final class RakkaMar extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(2); this.addAbility(HasteAbility.getInstance()); - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(token), new ManaCostsImpl("{R}")); + + Ability ability = new SimpleActivatedAbility( + Zone.BATTLEFIELD, + new CreateTokenEffect(new RakkaMarElementalToken()), + new ManaCostsImpl("{R}") + ); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/TaintedSigil.java b/Mage.Sets/src/mage/cards/t/TaintedSigil.java index 18f6f77378..8d8de82c22 100644 --- a/Mage.Sets/src/mage/cards/t/TaintedSigil.java +++ b/Mage.Sets/src/mage/cards/t/TaintedSigil.java @@ -1,7 +1,6 @@ package mage.cards.t; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.SacrificeSourceCost; @@ -16,23 +15,22 @@ import mage.constants.Zone; import mage.game.Game; import mage.watchers.common.PlayerLostLifeWatcher; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class TaintedSigil extends CardImpl { - - String rule = "You gain life equal to the total life lost by all players this turn"; + + private static final String rule = "You gain life equal to the total life lost by all players this turn"; public TaintedSigil(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}{W}{B}"); - - - + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{W}{B}"); // {tap}, Sacrifice Tainted Sigil: You gain life equal to the total life lost by all players this turn. - AllPlayersLostLifeCount totalLifeLostThisTurn = new AllPlayersLostLifeCount(); - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(totalLifeLostThisTurn, rule), new TapSourceCost()); + Ability ability = new SimpleActivatedAbility( + Zone.BATTLEFIELD, new GainLifeEffect(AllPlayersLostLifeCount.instance, rule), new TapSourceCost() + ); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); @@ -48,7 +46,8 @@ public final class TaintedSigil extends CardImpl { } } -class AllPlayersLostLifeCount implements DynamicValue { +enum AllPlayersLostLifeCount implements DynamicValue { + instance; @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { @@ -69,7 +68,7 @@ class AllPlayersLostLifeCount implements DynamicValue { @Override public DynamicValue copy() { - return new AllPlayersLostLifeCount(); + return instance; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java b/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java index 3b01224026..361826e348 100644 --- a/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java +++ b/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java @@ -1,23 +1,17 @@ package mage.cards.t; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.mana.AddManaAnyColorAttachedControllerEffect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.effects.mana.AddManaAnyColorAttachedControllerEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.ShroudAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.AttachmentType; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; +import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -25,16 +19,17 @@ import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class TraceOfAbundance extends CardImpl { - private String rule = "Enchanted land has shroud"; + private static final String rule = "Enchanted land has shroud"; public TraceOfAbundance(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{R/W}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R/W}{G}"); this.subtype.add(SubType.AURA); // Enchant land diff --git a/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java b/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java index 404b0334c3..c86743811e 100644 --- a/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java +++ b/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java @@ -1,7 +1,6 @@ package mage.cards.v; -import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -17,12 +16,7 @@ import mage.abilities.effects.common.CopyPermanentEffect; import mage.abilities.keyword.MorphAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.TargetController; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; @@ -32,12 +26,13 @@ import mage.players.Player; import mage.target.common.TargetCreaturePermanent; import mage.util.functions.ApplyToPermanent; +import java.util.UUID; + /** * @author spjspj */ public final class VesuvanShapeshifter extends CardImpl { - protected Ability turnFaceUpAbility = null; private static final String effectText = "as a copy of any creature on the battlefield until {this} is turned faced down"; public VesuvanShapeshifter(UUID ownerId, CardSetInfo setInfo) {