From cf6fe27f7d5a180cfd1ab423ae5b3fa00b4da972 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Wed, 5 Apr 2017 15:28:48 +0200 Subject: [PATCH 1/9] duplicate continuouseffect for vehicles --- .../src/mage/cards/a/AerialModification.java | 41 +++--------------- .../src/mage/cards/s/SiegeModification.java | 39 +++-------------- Mage/src/main/java/mage/MageObject.java | 10 +++-- .../BecomesCreatureIfVehicleEffect.java | 42 +++++++++++++++++++ 4 files changed, 59 insertions(+), 73 deletions(-) create mode 100644 Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureIfVehicleEffect.java diff --git a/Mage.Sets/src/mage/cards/a/AerialModification.java b/Mage.Sets/src/mage/cards/a/AerialModification.java index 1720c2c87b..b68f29e0dc 100644 --- a/Mage.Sets/src/mage/cards/a/AerialModification.java +++ b/Mage.Sets/src/mage/cards/a/AerialModification.java @@ -29,22 +29,23 @@ package mage.cards.a; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BecomesCreatureIfVehicleEffect; import mage.abilities.effects.common.continuous.BoostEnchantedEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import java.util.UUID; @@ -96,35 +97,3 @@ public class AerialModification extends CardImpl { return new AerialModification(this); } } - -class BecomesCreatureIfVehicleEffect extends ContinuousEffectImpl { - - private CardType addedType = CardType.CREATURE; - - public BecomesCreatureIfVehicleEffect() { - super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit); - this.staticText = "As long as enchanted permanent is a Vehicle, it's a creature in addition to its other types"; - } - - public BecomesCreatureIfVehicleEffect(final BecomesCreatureIfVehicleEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent aura = game.getPermanent(source.getSourceId()); - if (aura != null && aura.getAttachedTo() != null) { - Permanent enchanted = game.getPermanent(aura.getAttachedTo()); - if (enchanted != null && enchanted.getSubtype(game).contains("Vehicle")) { - enchanted.getCardType().add(addedType); - } - } - - return true; - } - - @Override - public BecomesCreatureIfVehicleEffect copy() { - return new BecomesCreatureIfVehicleEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/s/SiegeModification.java b/Mage.Sets/src/mage/cards/s/SiegeModification.java index df945c792a..874b878ad9 100644 --- a/Mage.Sets/src/mage/cards/s/SiegeModification.java +++ b/Mage.Sets/src/mage/cards/s/SiegeModification.java @@ -29,22 +29,23 @@ package mage.cards.s; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BecomesCreatureIfVehicleEffect; import mage.abilities.effects.common.continuous.BoostEnchantedEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.FirstStrikeAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import java.util.UUID; @@ -95,35 +96,5 @@ public class SiegeModification extends CardImpl { return new SiegeModification(this); } - private static class BecomesCreatureIfVehicleEffect extends ContinuousEffectImpl { - private CardType addedType = CardType.CREATURE; - - public BecomesCreatureIfVehicleEffect() { - super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit); - this.staticText = "As long as enchanted permanent is a Vehicle, it's a creature in addition to its other types"; - } - - public BecomesCreatureIfVehicleEffect(final BecomesCreatureIfVehicleEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent aura = game.getPermanent(source.getSourceId()); - if (aura != null && aura.getAttachedTo() != null) { - Permanent enchanted = game.getPermanent(aura.getAttachedTo()); - if (enchanted != null && enchanted.getSubtype(game).contains("Vehicle")) { - enchanted.getCardType().add(addedType); - } - } - - return true; - } - - @Override - public BecomesCreatureIfVehicleEffect copy() { - return new BecomesCreatureIfVehicleEffect(this); - } - } } diff --git a/Mage/src/main/java/mage/MageObject.java b/Mage/src/main/java/mage/MageObject.java index 7ec8ec053c..3ee4a3e2d0 100644 --- a/Mage/src/main/java/mage/MageObject.java +++ b/Mage/src/main/java/mage/MageObject.java @@ -125,21 +125,25 @@ public interface MageObject extends MageItem, Serializable { return getSuperType().contains(SuperType.SNOW); } - default void addSuperType(SuperType superType){ + default void addSuperType(SuperType superType) { getSuperType().add(superType); } - default boolean isBasic() { return getSuperType().contains(SuperType.BASIC);} + default boolean isBasic() { + return getSuperType().contains(SuperType.BASIC); + } default boolean isWorld() { return getSuperType().contains(SuperType.WORLD); } + default void addCardType(CardType cardType) { + getCardType().add(cardType); + } /** * Checks whether two cards share card types. * - * * @param otherCard * @return */ diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureIfVehicleEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureIfVehicleEffect.java new file mode 100644 index 0000000000..2fc8214a36 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureIfVehicleEffect.java @@ -0,0 +1,42 @@ +package mage.abilities.effects.common.continuous; + +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * Created by IGOUDT on 5-4-2017. + */ +public class BecomesCreatureIfVehicleEffect extends ContinuousEffectImpl { + + private CardType addedType = CardType.CREATURE; + + public BecomesCreatureIfVehicleEffect() { + super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit); + this.staticText = "As long as enchanted permanent is a Vehicle, it's a creature in addition to its other types"; + } + + public BecomesCreatureIfVehicleEffect(final BecomesCreatureIfVehicleEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent aura = game.getPermanent(source.getSourceId()); + if (aura != null && aura.getAttachedTo() != null) { + Permanent enchanted = game.getPermanent(aura.getAttachedTo()); + if (enchanted != null && enchanted.getSubtype(game).contains("Vehicle")) { + enchanted.addCardType(addedType); + } + } + + return true; + } + + @Override + public BecomesCreatureIfVehicleEffect copy() { + return new BecomesCreatureIfVehicleEffect(this); + } +} \ No newline at end of file From 8b90f87af677168a68faffb3eb79c7ed5eb4cb56 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Wed, 5 Apr 2017 15:36:07 +0200 Subject: [PATCH 2/9] added addCardType to MageObject --- Mage.Sets/src/mage/cards/a/AnimateArtifact.java | 2 +- Mage.Sets/src/mage/cards/c/ChimericCoils.java | 2 +- Mage.Sets/src/mage/cards/c/ChimericStaff.java | 2 +- Mage.Sets/src/mage/cards/e/EnchantedEvening.java | 2 +- Mage.Sets/src/mage/cards/h/HomaridSpawningBed.java | 2 +- .../src/mage/cards/i/ImprisonedInTheMoon.java | 2 +- .../src/mage/cards/j/JeditOjanenOfEfrava.java | 2 +- .../src/mage/cards/k/KariZevSkyshipRaider.java | 2 +- Mage.Sets/src/mage/cards/k/KarnSilverGolem.java | 2 +- Mage.Sets/src/mage/cards/l/LiegeOfTheTangle.java | 14 +++++--------- Mage.Sets/src/mage/cards/l/LifeAndLimb.java | 4 ++-- Mage.Sets/src/mage/cards/m/MarchOfTheMachines.java | 2 +- Mage.Sets/src/mage/cards/m/MycosynthLattice.java | 2 +- Mage.Sets/src/mage/cards/n/NaturalAffinity.java | 2 +- Mage.Sets/src/mage/cards/n/NissaSageAnimist.java | 4 ++-- Mage.Sets/src/mage/cards/o/Opalescence.java | 2 +- Mage.Sets/src/mage/cards/p/PhyrexianMetamorph.java | 2 +- .../src/mage/cards/s/SarkhanTheDragonspeaker.java | 2 +- Mage.Sets/src/mage/cards/s/SlumberingTora.java | 2 +- Mage.Sets/src/mage/cards/s/SongOfTheDryads.java | 2 +- Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java | 2 +- Mage.Sets/src/mage/cards/s/StartYourEngines.java | 4 ++-- .../src/mage/cards/s/SydriGalvanicGenius.java | 2 +- Mage.Sets/src/mage/cards/t/TestamentOfFaith.java | 2 +- Mage.Sets/src/mage/cards/t/TezzeretTheSeeker.java | 4 ++-- Mage.Sets/src/mage/cards/t/TitaniasSong.java | 2 +- .../src/mage/cards/v/VolrathsShapeshifter.java | 2 +- Mage.Sets/src/mage/cards/w/WireflyHive.java | 4 ++-- Mage.Sets/src/mage/cards/x/XenicPoltergeist.java | 2 +- Mage.Sets/src/mage/sets/Amonkhet.java | 7 ++++--- Mage/src/main/java/mage/MageObject.java | 5 ++++- .../java/mage/abilities/common/LicidAbility.java | 2 +- .../mage/abilities/effects/common/CopyEffect.java | 2 +- .../abilities/effects/common/CopyTokenEffect.java | 2 +- .../PutTokenOntoBattlefieldCopyTargetEffect.java | 4 ++-- .../continuous/AddCardTypeAttachedEffect.java | 2 +- .../common/continuous/AddCardTypeSourceEffect.java | 2 +- .../common/continuous/AddCardTypeTargetEffect.java | 2 +- .../continuous/BecomesBasicLandTargetEffect.java | 2 +- .../continuous/BecomesCreatureAllEffect.java | 2 +- .../continuous/BecomesCreatureAttachedEffect.java | 2 +- ...eAttachedWithActivatedAbilityOrSpellEffect.java | 2 +- .../continuous/BecomesCreatureSourceEffect.java | 2 +- .../continuous/BecomesCreatureTargetEffect.java | 2 +- .../BecomesFaceDownCreatureAllEffect.java | 2 +- .../continuous/BecomesFaceDownCreatureEffect.java | 2 +- .../java/mage/abilities/keyword/BestowAbility.java | 4 ++-- .../java/mage/abilities/keyword/MorphAbility.java | 2 +- .../mage/abilities/keyword/TransformAbility.java | 2 +- Mage/src/main/java/mage/game/stack/Spell.java | 6 +++--- .../java/mage/util/functions/CardTypeApplier.java | 4 ++-- .../mage/util/functions/CopyTokenFunction.java | 2 +- 52 files changed, 72 insertions(+), 72 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AnimateArtifact.java b/Mage.Sets/src/mage/cards/a/AnimateArtifact.java index 777a588ddf..f2f9e9ba8e 100644 --- a/Mage.Sets/src/mage/cards/a/AnimateArtifact.java +++ b/Mage.Sets/src/mage/cards/a/AnimateArtifact.java @@ -107,7 +107,7 @@ class AnimateArtifactContinuousEffect extends ContinuousEffectImpl { Permanent permanent = game.getPermanent(enchantment.getAttachedTo()); if (permanent != null && !permanent.isCreature()) { if (sublayer == SubLayer.NA) { - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); permanent.getPower().setValue(permanent.getConvertedManaCost()); permanent.getToughness().setValue(permanent.getConvertedManaCost()); } diff --git a/Mage.Sets/src/mage/cards/c/ChimericCoils.java b/Mage.Sets/src/mage/cards/c/ChimericCoils.java index ea3da2d9f4..9d00a26bc0 100644 --- a/Mage.Sets/src/mage/cards/c/ChimericCoils.java +++ b/Mage.Sets/src/mage/cards/c/ChimericCoils.java @@ -90,7 +90,7 @@ class ChimericCoilsEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); permanent.getSubtype(game).add("Construct"); } break; diff --git a/Mage.Sets/src/mage/cards/c/ChimericStaff.java b/Mage.Sets/src/mage/cards/c/ChimericStaff.java index 69122831af..03cf21438f 100644 --- a/Mage.Sets/src/mage/cards/c/ChimericStaff.java +++ b/Mage.Sets/src/mage/cards/c/ChimericStaff.java @@ -85,7 +85,7 @@ class ChimericStaffEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); permanent.getSubtype(game).add("Construct"); } break; diff --git a/Mage.Sets/src/mage/cards/e/EnchantedEvening.java b/Mage.Sets/src/mage/cards/e/EnchantedEvening.java index d4b5052d4e..f5d8165de5 100644 --- a/Mage.Sets/src/mage/cards/e/EnchantedEvening.java +++ b/Mage.Sets/src/mage/cards/e/EnchantedEvening.java @@ -88,7 +88,7 @@ public class EnchantedEvening extends CardImpl { public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { if (permanent != null && !permanent.getCardType().contains(addedCardType)) { - permanent.getCardType().add(addedCardType); + permanent.addCardType(addedCardType); } } return true; diff --git a/Mage.Sets/src/mage/cards/h/HomaridSpawningBed.java b/Mage.Sets/src/mage/cards/h/HomaridSpawningBed.java index f0e561f432..9e260a8eb7 100644 --- a/Mage.Sets/src/mage/cards/h/HomaridSpawningBed.java +++ b/Mage.Sets/src/mage/cards/h/HomaridSpawningBed.java @@ -85,6 +85,6 @@ class CamaridToken extends Token { this.getToughness().modifyBaseValue(1); this.color.setBlue(true); this.getSubtype(null).add("Camarid"); - this.getCardType().add(CardType.CREATURE); + this.addCardType(CardType.CREATURE); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/i/ImprisonedInTheMoon.java b/Mage.Sets/src/mage/cards/i/ImprisonedInTheMoon.java index 1b3f3cf3ee..1afecae365 100644 --- a/Mage.Sets/src/mage/cards/i/ImprisonedInTheMoon.java +++ b/Mage.Sets/src/mage/cards/i/ImprisonedInTheMoon.java @@ -130,7 +130,7 @@ class BecomesColorlessLandEffect extends ContinuousEffectImpl { case TypeChangingEffects_4: boolean isLand = permanent.isLand(); permanent.getCardType().clear(); - permanent.getCardType().add(CardType.LAND); + permanent.addCardType(CardType.LAND); if (!isLand) { permanent.getSubtype(game).clear(); } diff --git a/Mage.Sets/src/mage/cards/j/JeditOjanenOfEfrava.java b/Mage.Sets/src/mage/cards/j/JeditOjanenOfEfrava.java index 78e28e09b8..f5cef06c09 100644 --- a/Mage.Sets/src/mage/cards/j/JeditOjanenOfEfrava.java +++ b/Mage.Sets/src/mage/cards/j/JeditOjanenOfEfrava.java @@ -80,7 +80,7 @@ class CatWarriorToken extends Token { this.color.setGreen(true); this.getSubtype(null).add("Cat"); this.getSubtype(null).add("Warrior"); - this.getCardType().add(CardType.CREATURE); + this.addCardType(CardType.CREATURE); this.addAbility(new ForestwalkAbility()); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java b/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java index 2e93745f47..ffc7b7177a 100644 --- a/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java +++ b/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java @@ -117,6 +117,6 @@ class RagavanToken extends Token { this.getToughness().modifyBaseValue(1); this.color.setRed(true); this.getSubtype(null).add("Monkey"); - this.getCardType().add(CardType.CREATURE); + this.addCardType(CardType.CREATURE); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/k/KarnSilverGolem.java b/Mage.Sets/src/mage/cards/k/KarnSilverGolem.java index 759fe434d3..2ff48d3442 100644 --- a/Mage.Sets/src/mage/cards/k/KarnSilverGolem.java +++ b/Mage.Sets/src/mage/cards/k/KarnSilverGolem.java @@ -110,7 +110,7 @@ class KarnSilverGolemEffect extends ContinuousEffectImpl { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { if (!artifact.isCreature()) { - artifact.getCardType().add(CardType.CREATURE); + artifact.addCardType(CardType.CREATURE); } } break; diff --git a/Mage.Sets/src/mage/cards/l/LiegeOfTheTangle.java b/Mage.Sets/src/mage/cards/l/LiegeOfTheTangle.java index 117bc4960b..f3063ea85b 100644 --- a/Mage.Sets/src/mage/cards/l/LiegeOfTheTangle.java +++ b/Mage.Sets/src/mage/cards/l/LiegeOfTheTangle.java @@ -28,8 +28,6 @@ package mage.cards.l; -import java.util.Iterator; -import java.util.UUID; import mage.MageInt; import mage.MageObjectReference; import mage.abilities.Ability; @@ -39,12 +37,7 @@ import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; -import mage.constants.Zone; +import mage.constants.*; import mage.counters.CounterType; import mage.filter.common.FilterLandPermanent; import mage.game.Game; @@ -56,6 +49,9 @@ import mage.game.permanent.token.Token; import mage.target.Target; import mage.target.common.TargetLandPermanent; +import java.util.Iterator; +import java.util.UUID; + /** * * @author Loki @@ -138,7 +134,7 @@ class LiegeOfTheTangleEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { - perm.getCardType().addAll(token.getCardType()); + perm.addCardTypes(token.getCardType()); perm.getSubtype(game).addAll(token.getSubtype(game)); } break; diff --git a/Mage.Sets/src/mage/cards/l/LifeAndLimb.java b/Mage.Sets/src/mage/cards/l/LifeAndLimb.java index f3024e3fb3..dc0708ef3d 100644 --- a/Mage.Sets/src/mage/cards/l/LifeAndLimb.java +++ b/Mage.Sets/src/mage/cards/l/LifeAndLimb.java @@ -100,13 +100,13 @@ class LifeAndLimbEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: if (!permanent.isCreature()) { - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); } if (!permanent.getSubtype(game).contains("Saproling")) { permanent.getSubtype(game).add("Saproling"); } if (!permanent.isLand()) { - permanent.getCardType().add(CardType.LAND); + permanent.addCardType(CardType.LAND); } if (!permanent.getSubtype(game).contains("Forest")) { permanent.getSubtype(game).add("Forest"); diff --git a/Mage.Sets/src/mage/cards/m/MarchOfTheMachines.java b/Mage.Sets/src/mage/cards/m/MarchOfTheMachines.java index 6a2c374c5f..fa21b32eb2 100644 --- a/Mage.Sets/src/mage/cards/m/MarchOfTheMachines.java +++ b/Mage.Sets/src/mage/cards/m/MarchOfTheMachines.java @@ -97,7 +97,7 @@ class MarchOfTheMachinesEffect extends ContinuousEffectImpl { for(Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)){ if(permanent != null){ affectedObjectList.add(new MageObjectReference(permanent, game)); - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); } } } diff --git a/Mage.Sets/src/mage/cards/m/MycosynthLattice.java b/Mage.Sets/src/mage/cards/m/MycosynthLattice.java index 72f82fc9f3..b55ace064d 100644 --- a/Mage.Sets/src/mage/cards/m/MycosynthLattice.java +++ b/Mage.Sets/src/mage/cards/m/MycosynthLattice.java @@ -83,7 +83,7 @@ class PermanentsAreArtifactsEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { - perm.getCardType().add(CardType.ARTIFACT); + perm.addCardType(CardType.ARTIFACT); } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NaturalAffinity.java b/Mage.Sets/src/mage/cards/n/NaturalAffinity.java index e783d37460..cfae01cb44 100644 --- a/Mage.Sets/src/mage/cards/n/NaturalAffinity.java +++ b/Mage.Sets/src/mage/cards/n/NaturalAffinity.java @@ -99,7 +99,7 @@ class BecomesCreatureAllEffect extends ContinuousEffectImpl { for (Iterator it = affectedObjectList.iterator(); it.hasNext();) { Permanent permanent = it.next().getPermanent(game); if (permanent != null) { - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); } else { it.remove(); } diff --git a/Mage.Sets/src/mage/cards/n/NissaSageAnimist.java b/Mage.Sets/src/mage/cards/n/NissaSageAnimist.java index cd16fdb1f9..02ad58399d 100644 --- a/Mage.Sets/src/mage/cards/n/NissaSageAnimist.java +++ b/Mage.Sets/src/mage/cards/n/NissaSageAnimist.java @@ -132,7 +132,7 @@ class NissaSageAnimistToken extends Token { this.getToughness().modifyBaseValue(4); this.color.setGreen(true); this.getSubtype(null).add("Elemental"); - this.getCardType().add(CardType.CREATURE); + this.addCardType(CardType.CREATURE); } } @@ -160,7 +160,7 @@ class NissaSageAnimistMinusSevenEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: if (!permanent.isCreature()) { - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); } if (!permanent.getSubtype(game).contains("Elemental")) { permanent.getSubtype(game).add("Elemental"); diff --git a/Mage.Sets/src/mage/cards/o/Opalescence.java b/Mage.Sets/src/mage/cards/o/Opalescence.java index d16722e4c3..5f75871939 100644 --- a/Mage.Sets/src/mage/cards/o/Opalescence.java +++ b/Mage.Sets/src/mage/cards/o/Opalescence.java @@ -109,7 +109,7 @@ class OpalescenceEffect extends ContinuousEffectImpl { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { if (!permanent.isCreature()) { - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); } } break; diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianMetamorph.java b/Mage.Sets/src/mage/cards/p/PhyrexianMetamorph.java index cb5b18d275..805cda4b1c 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianMetamorph.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianMetamorph.java @@ -76,7 +76,7 @@ public class PhyrexianMetamorph extends CardImpl { @Override public boolean apply(Game game, MageObject mageObject) { if (!mageObject.isArtifact()) { - mageObject.getCardType().add(CardType.ARTIFACT); + mageObject.addCardType(CardType.ARTIFACT); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SarkhanTheDragonspeaker.java b/Mage.Sets/src/mage/cards/s/SarkhanTheDragonspeaker.java index c89413f0b2..38f49b9315 100644 --- a/Mage.Sets/src/mage/cards/s/SarkhanTheDragonspeaker.java +++ b/Mage.Sets/src/mage/cards/s/SarkhanTheDragonspeaker.java @@ -118,7 +118,7 @@ class SarkhanTheDragonspeakerEffect extends ContinuousEffectImpl { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { permanent.getCardType().clear(); - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); permanent.getSubtype(game).clear(); permanent.getSubtype(game).add("Dragon"); permanent.getSuperType().clear(); diff --git a/Mage.Sets/src/mage/cards/s/SlumberingTora.java b/Mage.Sets/src/mage/cards/s/SlumberingTora.java index c28b823d00..a6166c594d 100644 --- a/Mage.Sets/src/mage/cards/s/SlumberingTora.java +++ b/Mage.Sets/src/mage/cards/s/SlumberingTora.java @@ -98,7 +98,7 @@ public class SlumberingTora extends CardImpl { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); permanent.getSubtype(game).add("Cat"); } break; diff --git a/Mage.Sets/src/mage/cards/s/SongOfTheDryads.java b/Mage.Sets/src/mage/cards/s/SongOfTheDryads.java index cd535c6b33..cb9df59690 100644 --- a/Mage.Sets/src/mage/cards/s/SongOfTheDryads.java +++ b/Mage.Sets/src/mage/cards/s/SongOfTheDryads.java @@ -119,7 +119,7 @@ class BecomesColorlessForestLandEffect extends ContinuousEffectImpl { break; case TypeChangingEffects_4: permanent.getCardType().clear(); - permanent.getCardType().add(CardType.LAND); + permanent.addCardType(CardType.LAND); permanent.getSubtype(game).clear(); permanent.getSubtype(game).add("Forest"); break; diff --git a/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java b/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java index 39a144b3fc..c9a00d3bca 100644 --- a/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java +++ b/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java @@ -133,7 +133,7 @@ class StarfieldOfNyxEffect extends ContinuousEffectImpl { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { if (!permanent.isCreature()) { - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); } } break; diff --git a/Mage.Sets/src/mage/cards/s/StartYourEngines.java b/Mage.Sets/src/mage/cards/s/StartYourEngines.java index d1edf3c87e..d7232d26c6 100644 --- a/Mage.Sets/src/mage/cards/s/StartYourEngines.java +++ b/Mage.Sets/src/mage/cards/s/StartYourEngines.java @@ -91,8 +91,8 @@ class StartYourEnginesEffect extends ContinuousEffectImpl { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) { if (permanent != null && permanent.getSubtype(game).contains("Vehicle")) { if (sublayer == SubLayer.NA) { - permanent.getCardType().add(CardType.ARTIFACT); - permanent.getCardType().add(CardType.CREATURE);// TODO: Chcek if giving CREATURE Type is correct + permanent.addCardType(CardType.ARTIFACT); + permanent.addCardType(CardType.CREATURE);// TODO: Chcek if giving CREATURE Type is correct } } } diff --git a/Mage.Sets/src/mage/cards/s/SydriGalvanicGenius.java b/Mage.Sets/src/mage/cards/s/SydriGalvanicGenius.java index 845841fc76..4551b656b8 100644 --- a/Mage.Sets/src/mage/cards/s/SydriGalvanicGenius.java +++ b/Mage.Sets/src/mage/cards/s/SydriGalvanicGenius.java @@ -121,7 +121,7 @@ class SydriGalvanicGeniusEffect extends ContinuousEffectImpl { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { if (!artifact.isCreature()) { - artifact.getCardType().add(CardType.CREATURE); + artifact.addCardType(CardType.CREATURE); } } break; diff --git a/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java b/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java index 752516f627..4e864b2520 100644 --- a/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java +++ b/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java @@ -112,7 +112,7 @@ class TestamentOfFaithBecomesCreatureSourceEffect extends ContinuousEffectImpl i if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { - permanent.getCardType().add(t); + permanent.addCardType(t); } } } diff --git a/Mage.Sets/src/mage/cards/t/TezzeretTheSeeker.java b/Mage.Sets/src/mage/cards/t/TezzeretTheSeeker.java index e70262927b..1312c47b67 100644 --- a/Mage.Sets/src/mage/cards/t/TezzeretTheSeeker.java +++ b/Mage.Sets/src/mage/cards/t/TezzeretTheSeeker.java @@ -160,10 +160,10 @@ class TezzeretTheSeekerEffect3 extends ContinuousEffectImpl { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { if (!permanent.isArtifact()) { - permanent.getCardType().add(CardType.ARTIFACT); + permanent.addCardType(CardType.ARTIFACT); } if (!permanent.isCreature()) { - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); } permanent.getSubtype(game).clear(); } diff --git a/Mage.Sets/src/mage/cards/t/TitaniasSong.java b/Mage.Sets/src/mage/cards/t/TitaniasSong.java index 97480346c8..a4a0485580 100644 --- a/Mage.Sets/src/mage/cards/t/TitaniasSong.java +++ b/Mage.Sets/src/mage/cards/t/TitaniasSong.java @@ -100,7 +100,7 @@ class TitaniasSongEffect extends ContinuousEffectImpl { for(Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)){ if(permanent != null){ affectedObjectList.add(new MageObjectReference(permanent, game)); - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); } } } diff --git a/Mage.Sets/src/mage/cards/v/VolrathsShapeshifter.java b/Mage.Sets/src/mage/cards/v/VolrathsShapeshifter.java index 0198ed05f5..f62aeb67db 100644 --- a/Mage.Sets/src/mage/cards/v/VolrathsShapeshifter.java +++ b/Mage.Sets/src/mage/cards/v/VolrathsShapeshifter.java @@ -104,7 +104,7 @@ class VolrathsShapeshifterEffect extends ContinuousEffectImpl { permanent.setName(card.getName()); for (CardType type : card.getCardType()) { - permanent.getCardType().add(type); + permanent.addCardType(type); } permanent.getSubtype(game).clear(); diff --git a/Mage.Sets/src/mage/cards/w/WireflyHive.java b/Mage.Sets/src/mage/cards/w/WireflyHive.java index 46539044fb..a57ec8e766 100644 --- a/Mage.Sets/src/mage/cards/w/WireflyHive.java +++ b/Mage.Sets/src/mage/cards/w/WireflyHive.java @@ -79,7 +79,7 @@ class WireflyToken extends Token { this.getPower().modifyBaseValue(2); this.getToughness().modifyBaseValue(2); this.getSubtype(null).add("Insect"); - this.getCardType().add(CardType.ARTIFACT); - this.getCardType().add(CardType.CREATURE); + this.addCardType(CardType.ARTIFACT); + this.addCardType(CardType.CREATURE); } } diff --git a/Mage.Sets/src/mage/cards/x/XenicPoltergeist.java b/Mage.Sets/src/mage/cards/x/XenicPoltergeist.java index 2198066f5f..62e232b958 100644 --- a/Mage.Sets/src/mage/cards/x/XenicPoltergeist.java +++ b/Mage.Sets/src/mage/cards/x/XenicPoltergeist.java @@ -145,7 +145,7 @@ class XenicPoltergeistEffect extends ContinuousEffectImpl { UUID permanentId = targetPointer.getFirst(game, source); Permanent permanent = game.getPermanentOrLKIBattlefield(permanentId); if(permanent != null){ - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); } } break; diff --git a/Mage.Sets/src/mage/sets/Amonkhet.java b/Mage.Sets/src/mage/sets/Amonkhet.java index 8d87bbae9f..e4a6f55324 100644 --- a/Mage.Sets/src/mage/sets/Amonkhet.java +++ b/Mage.Sets/src/mage/sets/Amonkhet.java @@ -27,8 +27,6 @@ */ package mage.sets; -import java.util.ArrayList; -import java.util.List; import mage.cards.CardGraphicInfo; import mage.cards.ExpansionSet; import mage.cards.repository.CardCriteria; @@ -37,6 +35,9 @@ import mage.cards.repository.CardRepository; import mage.constants.Rarity; import mage.constants.SetType; +import java.util.ArrayList; +import java.util.List; + /** * * @author fireshoes @@ -105,7 +106,7 @@ public class Amonkhet extends ExpansionSet { cards.add(new SetCardInfo("Island", 258, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(null, true))); cards.add(new SetCardInfo("Island", 259, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(null, true))); cards.add(new SetCardInfo("Island", 260, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(null, true))); - cards.add(new SetCardInfo("Kefnet the Mindful", 59, Rarity.MYTHIC, mage.cards.k.KefnetTheMindful.class)); + // cards.add(new SetCardInfo("Kefnet the Mindful", 59, Rarity.MYTHIC, mage.cards.k.KefnetTheMindful.class)); cards.add(new SetCardInfo("Kefnet's Monument", 231, Rarity.UNCOMMON, mage.cards.k.KefnetsMonument.class)); cards.add(new SetCardInfo("Lay Bare the Heart", 96, Rarity.UNCOMMON, mage.cards.l.LayBareTheHeart.class)); cards.add(new SetCardInfo("Liliana, Death Wielder", 274, Rarity.MYTHIC, mage.cards.l.LilianaDeathWielder.class)); diff --git a/Mage/src/main/java/mage/MageObject.java b/Mage/src/main/java/mage/MageObject.java index 3ee4a3e2d0..370b55e176 100644 --- a/Mage/src/main/java/mage/MageObject.java +++ b/Mage/src/main/java/mage/MageObject.java @@ -138,7 +138,7 @@ public interface MageObject extends MageItem, Serializable { } default void addCardType(CardType cardType) { - getCardType().add(cardType); + addCardType(cardType); } /** @@ -186,4 +186,7 @@ public interface MageObject extends MageItem, Serializable { return false; } + default void addCardTypes(EnumSet cardType){ + getCardType().addAll(cardType); + } } diff --git a/Mage/src/main/java/mage/abilities/common/LicidAbility.java b/Mage/src/main/java/mage/abilities/common/LicidAbility.java index 1b8381c8bb..f9db3f2439 100644 --- a/Mage/src/main/java/mage/abilities/common/LicidAbility.java +++ b/Mage/src/main/java/mage/abilities/common/LicidAbility.java @@ -139,7 +139,7 @@ class LicidContinuousEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: licid.getCardType().clear(); - licid.getCardType().add(CardType.ENCHANTMENT); + licid.addCardType(CardType.ENCHANTMENT); licid.getSubtype(game).clear(); licid.getSubtype(game).add("Aura"); break; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java index 3ad75b5da4..c70164c857 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java @@ -122,7 +122,7 @@ public class CopyEffect extends ContinuousEffectImpl { permanent.getManaCost().add(copyFromObject.getManaCost()); permanent.getCardType().clear(); for (CardType type : copyFromObject.getCardType()) { - permanent.getCardType().add(type); + permanent.addCardType(type); } permanent.getSubtype(game).clear(); for (String type : copyFromObject.getSubtype(game)) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopyTokenEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopyTokenEffect.java index 3aa3ba8a9e..026854d6ef 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopyTokenEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopyTokenEffect.java @@ -28,7 +28,7 @@ public class CopyTokenEffect extends ContinuousEffectImpl { permanent.getColor(game).setColor(token.getColor(game)); permanent.getCardType().clear(); for (CardType type: token.getCardType()) { - permanent.getCardType().add(type); + permanent.addCardType(type); } permanent.getSubtype(game).clear(); for (String type: token.getSubtype(game)) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PutTokenOntoBattlefieldCopyTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PutTokenOntoBattlefieldCopyTargetEffect.java index 8b38820d92..9db4c7574b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PutTokenOntoBattlefieldCopyTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PutTokenOntoBattlefieldCopyTargetEffect.java @@ -190,10 +190,10 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect { CardUtil.copyTo(token).from(copyFrom); // needed so that entersBattlefied triggered abilities see the attributes (e.g. Master Biomancer) applier.apply(game, token); if (becomesArtifact) { - token.getCardType().add(CardType.ARTIFACT); + token.addCardType(CardType.ARTIFACT); } if (additionalCardType != null && !token.getCardType().contains(additionalCardType)) { - token.getCardType().add(additionalCardType); + token.addCardType(additionalCardType); } if (gainsHaste) { token.addAbility(HasteAbility.getInstance()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeAttachedEffect.java index 2886bdf363..360091fca2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeAttachedEffect.java @@ -60,7 +60,7 @@ public class AddCardTypeAttachedEffect extends ContinuousEffectImpl { if (equipment != null && equipment.getAttachedTo() != null) { Permanent target = game.getPermanent(equipment.getAttachedTo()); if (target != null && !target.getCardType().contains(addedCardType)) - target.getCardType().add(addedCardType); + target.addCardType(addedCardType); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeSourceEffect.java index 83ac0c1e94..6a2e18f61d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeSourceEffect.java @@ -66,7 +66,7 @@ public class AddCardTypeSourceEffect extends ContinuousEffectImpl { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && affectedObjectList.contains(new MageObjectReference(permanent, game))) { if (!permanent.getCardType().contains(addedCardType)) { - permanent.getCardType().add(addedCardType); + permanent.addCardType(addedCardType); } return true; } else if (this.getDuration() == Duration.Custom) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeTargetEffect.java index 56981a038f..33c325bdc4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeTargetEffect.java @@ -69,7 +69,7 @@ public class AddCardTypeTargetEffect extends ContinuousEffectImpl { Permanent target = game.getPermanent(targetId); if (target != null) { if (!target.getCardType().contains(addedCardType)) { - target.getCardType().add(addedCardType); + target.addCardType(addedCardType); } result = true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java index 5ada0f6b1c..c559f5cd5c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java @@ -145,7 +145,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { case TypeChangingEffects_4: // Attention: Cards like Unstable Frontier that use this class do not give the "Basic" supertype to the target if (!land.isLand()) { - land.getCardType().add(CardType.LAND); + land.addCardType(CardType.LAND); } if (loseOther) { // 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java index d7758dc6fe..f6f796c25f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java @@ -79,7 +79,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { - permanent.getCardType().add(t); + permanent.addCardType(t); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java index ca214044a8..b7dfb71df6 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java @@ -93,7 +93,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { break; } for (CardType t : token.getCardType()) { - permanent.getCardType().add(t); + permanent.addCardType(t); } // sub type diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect.java index 1c9cccfed7..169ee278e3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect.java @@ -109,7 +109,7 @@ public class BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect extends Co break; } for (CardType cardType : token.getCardType()) { - permanentAttachedTo.getCardType().add(cardType); + permanentAttachedTo.addCardType(cardType); } // sub type diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java index 51ad5a94d8..a47f8d0c77 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java @@ -116,7 +116,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { - permanent.getCardType().add(t); + permanent.addCardType(t); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java index 838014740d..8d12dd0289 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java @@ -103,7 +103,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { - permanent.getCardType().add(t); + permanent.addCardType(t); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureAllEffect.java index 88e921758d..6584faf92a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureAllEffect.java @@ -109,7 +109,7 @@ public class BecomesFaceDownCreatureAllEffect extends ContinuousEffectImpl imple permanent.setName(""); permanent.getSuperType().clear(); permanent.getCardType().clear(); - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); permanent.getSubtype(game).clear(); permanent.getManaCost().clear(); break; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureEffect.java index f71868632f..e5747882b4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureEffect.java @@ -165,7 +165,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen permanent.setName(""); permanent.getSuperType().clear(); permanent.getCardType().clear(); - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); permanent.getSubtype(game).clear(); break; case ColorChangingEffects_5: diff --git a/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java b/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java index a69c5aa538..0ae699c711 100644 --- a/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java @@ -151,12 +151,12 @@ public class BestowAbility extends SpellAbility { if (basicObject != null) { basicObject.getSubtype(null).remove("Aura"); if (!basicObject.isCreature()) { - basicObject.getCardType().add(CardType.CREATURE); + basicObject.addCardType(CardType.CREATURE); } } permanent.getSubtype(null).remove("Aura"); if (!permanent.isCreature()) { - permanent.getCardType().add(CardType.CREATURE); + permanent.addCardType(CardType.CREATURE); } } diff --git a/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java b/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java index 587aa53c93..555fb72c33 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java @@ -299,7 +299,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost mageObject.getColor(null).setColor(new ObjectColor()); mageObject.setName(""); mageObject.getCardType().clear(); - mageObject.getCardType().add(CardType.CREATURE); + mageObject.addCardType(CardType.CREATURE); mageObject.getSubtype(null).clear(); mageObject.getSuperType().clear(); mageObject.getManaCost().clear(); diff --git a/Mage/src/main/java/mage/abilities/keyword/TransformAbility.java b/Mage/src/main/java/mage/abilities/keyword/TransformAbility.java index e365e6dd28..c769de9ca0 100644 --- a/Mage/src/main/java/mage/abilities/keyword/TransformAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/TransformAbility.java @@ -77,7 +77,7 @@ public class TransformAbility extends SimpleStaticAbility { permanent.getManaCost().add(sourceCard.getManaCost()); permanent.getCardType().clear(); for (CardType type : sourceCard.getCardType()) { - permanent.getCardType().add(type); + permanent.addCardType(type); } permanent.getSubtype(game).clear(); for (String type : sourceCard.getSubtype(game)) { diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index e71ea49ed9..863302c53f 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -253,14 +253,14 @@ public class Spell extends StackObjImpl implements Card { Permanent permanent = game.getPermanent(card.getId()); if (permanent != null && permanent instanceof PermanentCard) { permanent.setSpellAbility(ability); // otherwise spell ability without bestow will be set - card.getCardType().add(CardType.CREATURE); + card.addCardType(CardType.CREATURE); card.getSubtype(game).remove("Aura"); } } return ability.resolve(game); } if (bestow) { - card.getCardType().add(CardType.CREATURE); + card.addCardType(CardType.CREATURE); } return false; } @@ -270,7 +270,7 @@ public class Spell extends StackObjImpl implements Card { if (controller.moveCards(card, Zone.BATTLEFIELD, ability, game, false, faceDown, false, null)) { Permanent permanent = game.getPermanent(card.getId()); if (permanent != null && permanent instanceof PermanentCard) { - ((PermanentCard) permanent).getCard().getCardType().add(CardType.CREATURE); + ((PermanentCard) permanent).getCard().addCardType(CardType.CREATURE); ((PermanentCard) permanent).getCard().getSubtype(game).remove("Aura"); return true; } diff --git a/Mage/src/main/java/mage/util/functions/CardTypeApplier.java b/Mage/src/main/java/mage/util/functions/CardTypeApplier.java index 4e6ec1719e..00409a1cf6 100644 --- a/Mage/src/main/java/mage/util/functions/CardTypeApplier.java +++ b/Mage/src/main/java/mage/util/functions/CardTypeApplier.java @@ -47,7 +47,7 @@ public class CardTypeApplier extends ApplyToPermanent { @Override public boolean apply(Game game, Permanent permanent) { if (!permanent.getCardType().contains(cardType)) { - permanent.getCardType().add(cardType); + permanent.addCardType(cardType); } return true; } @@ -55,7 +55,7 @@ public class CardTypeApplier extends ApplyToPermanent { @Override public boolean apply(Game game, MageObject mageObject) { if (!mageObject.getCardType().contains(cardType)) { - mageObject.getCardType().add(cardType); + mageObject.addCardType(cardType); } return true; } diff --git a/Mage/src/main/java/mage/util/functions/CopyTokenFunction.java b/Mage/src/main/java/mage/util/functions/CopyTokenFunction.java index 373e573f8f..2d1ad62b7f 100644 --- a/Mage/src/main/java/mage/util/functions/CopyTokenFunction.java +++ b/Mage/src/main/java/mage/util/functions/CopyTokenFunction.java @@ -93,7 +93,7 @@ public class CopyTokenFunction implements Function { target.getManaCost().add(sourceObj.getManaCost()); target.getCardType().clear(); for (CardType type : sourceObj.getCardType()) { - target.getCardType().add(type); + target.addCardType(type); } target.getSubtype(null).clear(); for (String type : sourceObj.getSubtype(null)) { From e44b2fd6735fc9a859a63611eba58a1f744bd20c Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Wed, 5 Apr 2017 15:39:35 +0200 Subject: [PATCH 3/9] extracted duplicate AttachmentAttachedToCardTypePredicate --- .../src/mage/cards/c/CrownOfTheAges.java | 27 +--------------- Mage.Sets/src/mage/cards/k/KitsuneMystic.java | 27 +--------------- ...AttachmentAttachedToCardTypePredicate.java | 31 +++++++++++++++++++ 3 files changed, 33 insertions(+), 52 deletions(-) create mode 100644 Mage/src/main/java/mage/filter/predicate/mageobject/AttachmentAttachedToCardTypePredicate.java diff --git a/Mage.Sets/src/mage/cards/c/CrownOfTheAges.java b/Mage.Sets/src/mage/cards/c/CrownOfTheAges.java index c90707cd96..df45382d5f 100644 --- a/Mage.Sets/src/mage/cards/c/CrownOfTheAges.java +++ b/Mage.Sets/src/mage/cards/c/CrownOfTheAges.java @@ -40,8 +40,8 @@ import mage.constants.Outcome; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterEnchantmentPermanent; -import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AttachmentAttachedToCardTypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.PermanentIdPredicate; import mage.game.Game; @@ -85,31 +85,6 @@ public class CrownOfTheAges extends CardImpl { } } -class AttachmentAttachedToCardTypePredicate implements Predicate { - - private final CardType cardType; - - public AttachmentAttachedToCardTypePredicate(CardType cardType) { - this.cardType = cardType; - } - - @Override - public boolean apply(Permanent input, Game game) { - if (input.getAttachedTo() != null) { - Permanent attachedTo = game.getPermanent(input.getAttachedTo()); - if (attachedTo != null && attachedTo.getCardType().contains(cardType)) { - return true; - } - } - return false; - } - - @Override - public String toString() { - return "AttachmentAttachedToCardType(" + cardType + ')'; - } -} - class CrownOfTheAgesEffect extends OneShotEffect { public CrownOfTheAgesEffect() { diff --git a/Mage.Sets/src/mage/cards/k/KitsuneMystic.java b/Mage.Sets/src/mage/cards/k/KitsuneMystic.java index 8aeabd77d5..975b60c979 100644 --- a/Mage.Sets/src/mage/cards/k/KitsuneMystic.java +++ b/Mage.Sets/src/mage/cards/k/KitsuneMystic.java @@ -43,7 +43,7 @@ import mage.constants.Outcome; import mage.constants.SuperType; import mage.constants.Zone; import mage.filter.common.FilterEnchantmentPermanent; -import mage.filter.predicate.Predicate; +import mage.filter.predicate.mageobject.AttachmentAttachedToCardTypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; @@ -113,31 +113,6 @@ class AutumnTailKitsuneSage extends Token { } } -class AttachmentAttachedToCardTypePredicate implements Predicate { - - private final CardType cardType; - - public AttachmentAttachedToCardTypePredicate(CardType cardType) { - this.cardType = cardType; - } - - @Override - public boolean apply(Permanent input, Game game) { - if (input.getAttachedTo() != null) { - Permanent attachedTo = game.getPermanent(input.getAttachedTo()); - if (attachedTo != null && attachedTo.getCardType().contains(cardType)) { - return true; - } - } - return false; - } - - @Override - public String toString() { - return "AttachmentAttachedToCardType(" + cardType + ')'; - } -} - class AutumnTailEffect extends OneShotEffect { public AutumnTailEffect() { diff --git a/Mage/src/main/java/mage/filter/predicate/mageobject/AttachmentAttachedToCardTypePredicate.java b/Mage/src/main/java/mage/filter/predicate/mageobject/AttachmentAttachedToCardTypePredicate.java new file mode 100644 index 0000000000..943a49d467 --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/mageobject/AttachmentAttachedToCardTypePredicate.java @@ -0,0 +1,31 @@ +package mage.filter.predicate.mageobject; + +import mage.constants.CardType; +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +public class AttachmentAttachedToCardTypePredicate implements Predicate { + + private final CardType cardType; + + public AttachmentAttachedToCardTypePredicate(CardType cardType) { + this.cardType = cardType; + } + + @Override + public boolean apply(Permanent input, Game game) { + if (input.getAttachedTo() != null) { + Permanent attachedTo = game.getPermanent(input.getAttachedTo()); + if (attachedTo != null && attachedTo.getCardType().contains(cardType)) { + return true; + } + } + return false; + } + + @Override + public String toString() { + return "AttachmentAttachedToCardType(" + cardType + ')'; + } +} From 1f89b4eedff5eb8664fef9d9ab7587a806bdece1 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Wed, 5 Apr 2017 15:58:54 +0200 Subject: [PATCH 4/9] introduced XorLessLifeCondition --- Mage.Sets/src/mage/cards/b/Bloodghast.java | 4 ++-- .../src/mage/cards/c/ConvalescentCare.java | 12 ++---------- .../src/mage/cards/c/CryptolithFragment.java | 4 ++-- Mage.Sets/src/mage/cards/g/GuulDrazVampire.java | 4 ++-- .../src/mage/cards/r/RuthlessCullblade.java | 13 +++++++------ Mage.Sets/src/mage/cards/s/SecondChance.java | 12 ++---------- .../src/mage/cards/v/VampireLacerator.java | 10 +++++----- ...Condition.java => XorLessLifeCondition.java} | 17 ++++++++++------- 8 files changed, 32 insertions(+), 44 deletions(-) rename Mage/src/main/java/mage/abilities/condition/common/{TenOrLessLifeCondition.java => XorLessLifeCondition.java} (90%) diff --git a/Mage.Sets/src/mage/cards/b/Bloodghast.java b/Mage.Sets/src/mage/cards/b/Bloodghast.java index 7bd5f898b1..f055302612 100644 --- a/Mage.Sets/src/mage/cards/b/Bloodghast.java +++ b/Mage.Sets/src/mage/cards/b/Bloodghast.java @@ -31,7 +31,7 @@ import mage.MageInt; import mage.abilities.common.CantBlockAbility; import mage.abilities.common.LandfallAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.TenOrLessLifeCondition; +import mage.abilities.condition.common.XorLessLifeCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect; @@ -64,7 +64,7 @@ public class Bloodghast extends CardImpl { // Bloodghast has haste as long as an opponent has 10 or less life. ContinuousEffect effect = new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(effect, - new TenOrLessLifeCondition(TenOrLessLifeCondition.CheckType.AN_OPPONENT), + new XorLessLifeCondition(XorLessLifeCondition.CheckType.AN_OPPONENT, 10), "Bloodghast has haste as long as an opponent has 10 or less life"))); // Landfall — Whenever a land enters the battlefield under your control, you may return Bloodghast from your graveyard to the battlefield. this.addAbility(new LandfallAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), true)); diff --git a/Mage.Sets/src/mage/cards/c/ConvalescentCare.java b/Mage.Sets/src/mage/cards/c/ConvalescentCare.java index cd478adc8d..d2439a139d 100644 --- a/Mage.Sets/src/mage/cards/c/ConvalescentCare.java +++ b/Mage.Sets/src/mage/cards/c/ConvalescentCare.java @@ -27,10 +27,9 @@ */ package mage.cards.c; -import mage.abilities.Ability; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.condition.Condition; +import mage.abilities.condition.common.XorLessLifeCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; @@ -39,7 +38,6 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.TargetController; -import mage.game.Game; import java.util.UUID; @@ -56,7 +54,7 @@ public class ConvalescentCare extends CardImpl { Effect effect = new DrawCardSourceControllerEffect(1); TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new GainLifeEffect(3), TargetController.YOU, false); ability.addEffect(effect); - this.addAbility(new ConditionalTriggeredAbility(ability, new FiveOrLessLifeCondition(), "At the beginning of your upkeep, if you have 5 or less life, you gain 3 life and draw a card.")); + this.addAbility(new ConditionalTriggeredAbility(ability, new XorLessLifeCondition(XorLessLifeCondition.CheckType.CONTROLLER, 5), "At the beginning of your upkeep, if you have 5 or less life, you gain 3 life and draw a card.")); } public ConvalescentCare(final ConvalescentCare card) { @@ -68,11 +66,5 @@ public class ConvalescentCare extends CardImpl { return new ConvalescentCare(this); } - static class FiveOrLessLifeCondition implements Condition { - @Override - public boolean apply(Game game, Ability source) { - return game.getPlayer(source.getControllerId()).getLife() <= 5; - } - } } diff --git a/Mage.Sets/src/mage/cards/c/CryptolithFragment.java b/Mage.Sets/src/mage/cards/c/CryptolithFragment.java index 958f22f128..0b95b8c809 100644 --- a/Mage.Sets/src/mage/cards/c/CryptolithFragment.java +++ b/Mage.Sets/src/mage/cards/c/CryptolithFragment.java @@ -30,7 +30,7 @@ package mage.cards.c; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.EntersBattlefieldTappedAbility; -import mage.abilities.condition.common.TenOrLessLifeCondition; +import mage.abilities.condition.common.XorLessLifeCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.LoseLifeAllPlayersEffect; import mage.abilities.effects.common.TransformSourceEffect; @@ -68,7 +68,7 @@ public class CryptolithFragment extends CardImpl { this.addAbility(new TransformAbility()); this.addAbility(new ConditionalTriggeredAbility( new BeginningOfUpkeepTriggeredAbility(new TransformSourceEffect(true), TargetController.YOU, false), - new TenOrLessLifeCondition(TenOrLessLifeCondition.CheckType.EACH_PLAYER), + new XorLessLifeCondition(XorLessLifeCondition.CheckType.EACH_PLAYER, 10), "At the beginning of your upkeep, if each player has 10 or less life, transform Cryptolith Fragment.")); } diff --git a/Mage.Sets/src/mage/cards/g/GuulDrazVampire.java b/Mage.Sets/src/mage/cards/g/GuulDrazVampire.java index 16cc824e35..86790c3bfd 100644 --- a/Mage.Sets/src/mage/cards/g/GuulDrazVampire.java +++ b/Mage.Sets/src/mage/cards/g/GuulDrazVampire.java @@ -31,7 +31,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.TenOrLessLifeCondition; +import mage.abilities.condition.common.XorLessLifeCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; @@ -63,7 +63,7 @@ public class GuulDrazVampire extends CardImpl { this.toughness = new MageInt(1); // As long as an opponent has 10 or less life, Guul Draz Vampire gets +2/+1 and has intimidate. (It can't be blocked except by artifact creatures and/or creatures that share a color with it.) - Condition condition = new TenOrLessLifeCondition(TenOrLessLifeCondition.CheckType.AN_OPPONENT); + Condition condition = new XorLessLifeCondition(XorLessLifeCondition.CheckType.AN_OPPONENT, 10); ConditionalContinuousEffect effect1 = new ConditionalContinuousEffect(new BoostSourceEffect(2, 1, Duration.WhileOnBattlefield), condition, rule1); Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect1); ability.addEffect(new ConditionalContinuousEffect(new GainAbilitySourceEffect(IntimidateAbility.getInstance()), condition, rule2)); diff --git a/Mage.Sets/src/mage/cards/r/RuthlessCullblade.java b/Mage.Sets/src/mage/cards/r/RuthlessCullblade.java index c62d36ea39..4d652fa54e 100644 --- a/Mage.Sets/src/mage/cards/r/RuthlessCullblade.java +++ b/Mage.Sets/src/mage/cards/r/RuthlessCullblade.java @@ -27,17 +27,18 @@ */ package mage.cards.r; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.TenOrLessLifeCondition; +import mage.abilities.condition.common.XorLessLifeCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Zone; + +import java.util.UUID; /** * @@ -56,7 +57,7 @@ public class RuthlessCullblade extends CardImpl { // Ruthless Cullblade gets +2/+1 as long as an opponent has 10 or less life. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostSourceEffect(2, 1, Duration.WhileOnBattlefield), - new TenOrLessLifeCondition(TenOrLessLifeCondition.CheckType.AN_OPPONENT), + new XorLessLifeCondition(XorLessLifeCondition.CheckType.AN_OPPONENT, 10), "{this} gets +2/+1 as long as an opponent has 10 or less life."))); } diff --git a/Mage.Sets/src/mage/cards/s/SecondChance.java b/Mage.Sets/src/mage/cards/s/SecondChance.java index b69916d76e..fd72ea635f 100644 --- a/Mage.Sets/src/mage/cards/s/SecondChance.java +++ b/Mage.Sets/src/mage/cards/s/SecondChance.java @@ -27,10 +27,9 @@ */ package mage.cards.s; -import mage.abilities.Ability; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.condition.Condition; +import mage.abilities.condition.common.XorLessLifeCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.turn.AddExtraTurnControllerEffect; @@ -39,7 +38,6 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.TargetController; import mage.constants.Zone; -import mage.game.Game; import java.util.UUID; @@ -56,7 +54,7 @@ public class SecondChance extends CardImpl { // At the beginning of your upkeep, if you have 5 or less life, sacrifice Second Chance and take an extra turn after this one. TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SacrificeSourceEffect(), TargetController.YOU, false); ability.addEffect(new AddExtraTurnControllerEffect()); - this.addAbility(new ConditionalTriggeredAbility(ability, new FiveOrLessLifeCondition(), "At the beginning of your upkeep, if you have 5 or less life, sacrifice {this} and take an extra turn after this one")); + this.addAbility(new ConditionalTriggeredAbility(ability, new XorLessLifeCondition(XorLessLifeCondition.CheckType.CONTROLLER, 5), "At the beginning of your upkeep, if you have 5 or less life, sacrifice {this} and take an extra turn after this one")); } @@ -69,11 +67,5 @@ public class SecondChance extends CardImpl { return new SecondChance(this); } - static class FiveOrLessLifeCondition implements Condition { - @Override - public boolean apply(Game game, Ability source) { - return game.getPlayer(source.getControllerId()).getLife() <= 5; - } - } } diff --git a/Mage.Sets/src/mage/cards/v/VampireLacerator.java b/Mage.Sets/src/mage/cards/v/VampireLacerator.java index daef1ff92b..200d822b0d 100644 --- a/Mage.Sets/src/mage/cards/v/VampireLacerator.java +++ b/Mage.Sets/src/mage/cards/v/VampireLacerator.java @@ -27,19 +27,19 @@ */ package mage.cards.v; -import java.util.UUID; - -import mage.constants.CardType; import mage.MageInt; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.condition.common.TenOrLessLifeCondition; import mage.abilities.condition.InvertCondition; +import mage.abilities.condition.common.XorLessLifeCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.LoseLifeSourceControllerEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; import mage.constants.TargetController; +import java.util.UUID; + /** * * @author maurer.it_at_gmail.com @@ -57,7 +57,7 @@ public class VampireLacerator extends CardImpl { this.addAbility(new BeginningOfUpkeepTriggeredAbility( new ConditionalOneShotEffect( new LoseLifeSourceControllerEffect(1), - new InvertCondition( new TenOrLessLifeCondition(TenOrLessLifeCondition.CheckType.AN_OPPONENT) ), + new InvertCondition( new XorLessLifeCondition(XorLessLifeCondition.CheckType.AN_OPPONENT, 10) ), "you lose 1 life unless an opponent has 10 or less life"), TargetController.YOU, false)); } diff --git a/Mage/src/main/java/mage/abilities/condition/common/TenOrLessLifeCondition.java b/Mage/src/main/java/mage/abilities/condition/common/XorLessLifeCondition.java similarity index 90% rename from Mage/src/main/java/mage/abilities/condition/common/TenOrLessLifeCondition.java rename to Mage/src/main/java/mage/abilities/condition/common/XorLessLifeCondition.java index 06639045af..a31c03f293 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/TenOrLessLifeCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/XorLessLifeCondition.java @@ -27,25 +27,28 @@ */ package mage.abilities.condition.common; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.Condition; import mage.game.Game; import mage.players.Player; import mage.players.PlayerList; +import java.util.UUID; + /** * * @author maurer.it_at_gmail.com */ -public class TenOrLessLifeCondition implements Condition { +public class XorLessLifeCondition implements Condition { public enum CheckType { AN_OPPONENT, CONTROLLER, TARGET_OPPONENT, EACH_PLAYER } private final CheckType type; + private final int amount; - public TenOrLessLifeCondition ( CheckType type ) { + public XorLessLifeCondition ( CheckType type , int amount) { this.type = type; + this.amount = amount; } @Override @@ -55,11 +58,11 @@ public class TenOrLessLifeCondition implements Condition { switch ( this.type ) { case AN_OPPONENT: for ( UUID opponentUUID : game.getOpponents(source.getControllerId()) ) { - conditionApplies |= game.getPlayer(opponentUUID).getLife() <= 10; + conditionApplies |= game.getPlayer(opponentUUID).getLife() <= amount; } break; case CONTROLLER: - conditionApplies |= game.getPlayer(source.getControllerId()).getLife() <= 10; + conditionApplies |= game.getPlayer(source.getControllerId()).getLife() <= amount; break; case TARGET_OPPONENT: //TODO: Implement this. @@ -71,11 +74,11 @@ public class TenOrLessLifeCondition implements Condition { Player p = game.getPlayer(pid); if (p != null) { if (maxLife < p.getLife()) { - maxLife = p.getLife(); + maxLife = p.getLife(); } } } - conditionApplies |= maxLife <= 10; + conditionApplies |= maxLife <= amount; break; } From 22c842dfec89ef25f221c89f2a4a71586cf25b67 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Wed, 5 Apr 2017 17:43:39 +0200 Subject: [PATCH 5/9] refactored IntCompareCondition --- Mage.Sets/src/mage/cards/a/AngelicAccord.java | 6 ++--- .../src/mage/cards/b/BloodchiefAscension.java | 4 ++-- .../src/mage/cards/g/GhirapurOrrery.java | 3 ++- .../src/mage/cards/h/HellkiteHatchling.java | 13 +++++----- Mage.Sets/src/mage/cards/l/LoneRider.java | 9 +++---- .../src/mage/cards/m/MaskOfIntolerance.java | 6 +++-- .../src/mage/cards/s/SpinerockKnoll.java | 12 ++++++---- .../src/mage/cards/s/SyggRiverCutthroat.java | 4 ++-- Mage/src/main/java/mage/MageObject.java | 2 +- .../condition/IntCompareCondition.java | 24 ++++--------------- .../common/DevouredCreaturesCondition.java | 4 ++-- .../common/OpponentLostLifeCondition.java | 14 +++++------ 12 files changed, 46 insertions(+), 55 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AngelicAccord.java b/Mage.Sets/src/mage/cards/a/AngelicAccord.java index 5f4610ac06..eb73267182 100644 --- a/Mage.Sets/src/mage/cards/a/AngelicAccord.java +++ b/Mage.Sets/src/mage/cards/a/AngelicAccord.java @@ -28,8 +28,8 @@ package mage.cards.a; import mage.abilities.Ability; +import mage.abilities.CountType; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; -import mage.abilities.condition.Condition; import mage.abilities.condition.IntCompareCondition; import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.CardImpl; @@ -54,7 +54,7 @@ public class AngelicAccord extends CardImpl { // At the beginning of each end step, if you gained 4 or more life this turn, create a 4/4 white Angel creature token with flying. this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new AngelToken()), TargetController.ANY, - new YouGainedLifeCondition(Condition.ComparisonType.GreaterThan, 3), false), new PlayerGainedLifeWatcher()); + new YouGainedLifeCondition(CountType.MORE_THAN, 3), false), new PlayerGainedLifeWatcher()); } public AngelicAccord(final AngelicAccord card) { @@ -69,7 +69,7 @@ public class AngelicAccord extends CardImpl { class YouGainedLifeCondition extends IntCompareCondition { - public YouGainedLifeCondition(Condition.ComparisonType type, int value) { + public YouGainedLifeCondition(CountType type, int value) { super(type, value); } diff --git a/Mage.Sets/src/mage/cards/b/BloodchiefAscension.java b/Mage.Sets/src/mage/cards/b/BloodchiefAscension.java index 0100501110..7efa892a8c 100644 --- a/Mage.Sets/src/mage/cards/b/BloodchiefAscension.java +++ b/Mage.Sets/src/mage/cards/b/BloodchiefAscension.java @@ -28,9 +28,9 @@ package mage.cards.b; import mage.abilities.Ability; +import mage.abilities.CountType; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility; -import mage.abilities.condition.Condition; import mage.abilities.condition.common.OpponentLostLifeCondition; import mage.abilities.condition.common.SourceHasCounterCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; @@ -61,7 +61,7 @@ public class BloodchiefAscension extends CardImpl { this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.QUEST.createInstance(1), false), TargetController.ANY, - new OpponentLostLifeCondition(Condition.ComparisonType.GreaterThan, 1), + new OpponentLostLifeCondition(CountType.MORE_THAN, 1), true)); // Whenever a card is put into an opponent's graveyard from anywhere, if Bloodchief Ascension has three or more quest counters on it, you may have that player lose 2 life. If you do, you gain 2 life. diff --git a/Mage.Sets/src/mage/cards/g/GhirapurOrrery.java b/Mage.Sets/src/mage/cards/g/GhirapurOrrery.java index 129cf12bac..0ebcfada16 100644 --- a/Mage.Sets/src/mage/cards/g/GhirapurOrrery.java +++ b/Mage.Sets/src/mage/cards/g/GhirapurOrrery.java @@ -28,6 +28,7 @@ package mage.cards.g; import mage.abilities.Ability; +import mage.abilities.CountType; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.IntCompareCondition; @@ -76,7 +77,7 @@ public class GhirapurOrrery extends CardImpl { class GhirapurOrreryCondition extends IntCompareCondition { GhirapurOrreryCondition() { - super(ComparisonType.Equal, 0); + super(CountType.EQUAL_TO, 0); } @Override diff --git a/Mage.Sets/src/mage/cards/h/HellkiteHatchling.java b/Mage.Sets/src/mage/cards/h/HellkiteHatchling.java index 2d6cf01007..72866d3810 100644 --- a/Mage.Sets/src/mage/cards/h/HellkiteHatchling.java +++ b/Mage.Sets/src/mage/cards/h/HellkiteHatchling.java @@ -27,12 +27,9 @@ */ package mage.cards.h; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Zone; import mage.MageInt; +import mage.abilities.CountType; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.Condition; import mage.abilities.condition.common.DevouredCreaturesCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.DevourEffect.DevourFactor; @@ -42,6 +39,10 @@ import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; + +import java.util.UUID; /** * @@ -62,11 +63,11 @@ public class HellkiteHatchling extends CardImpl { // Hellkite Hatchling has flying and trample if it devoured a creature. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( new GainAbilitySourceEffect(FlyingAbility.getInstance()), - new DevouredCreaturesCondition(Condition.ComparisonType.GreaterThan, 0), + new DevouredCreaturesCondition(CountType.MORE_THAN, 0), "{this} has flying if it devoured a creature"))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( new GainAbilitySourceEffect(TrampleAbility.getInstance()), - new DevouredCreaturesCondition(Condition.ComparisonType.GreaterThan, 0), + new DevouredCreaturesCondition(CountType.MORE_THAN, 0), "{this} has trample if it devoured a creature"))); } diff --git a/Mage.Sets/src/mage/cards/l/LoneRider.java b/Mage.Sets/src/mage/cards/l/LoneRider.java index e490bb4604..9ab1c92918 100644 --- a/Mage.Sets/src/mage/cards/l/LoneRider.java +++ b/Mage.Sets/src/mage/cards/l/LoneRider.java @@ -27,12 +27,11 @@ */ package mage.cards.l; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.CountType; import mage.abilities.TriggeredAbility; import mage.abilities.common.OnEventTriggeredAbility; -import mage.abilities.condition.Condition; import mage.abilities.condition.IntCompareCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.TransformSourceEffect; @@ -47,6 +46,8 @@ import mage.game.Game; import mage.game.events.GameEvent; import mage.watchers.common.PlayerGainedLifeWatcher; +import java.util.UUID; + /** * * @author fireshoes @@ -74,7 +75,7 @@ public class LoneRider extends CardImpl { // At the beginning of the end step, if you gained 3 or more life this turn, transform Lone Rider. this.addAbility(new TransformAbility()); TriggeredAbility triggered = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new TransformSourceEffect(true)); - this.addAbility(new ConditionalTriggeredAbility(triggered, new YouGainedLifeCondition(Condition.ComparisonType.GreaterThan, 2), ruleText), new PlayerGainedLifeWatcher()); + this.addAbility(new ConditionalTriggeredAbility(triggered, new YouGainedLifeCondition(CountType.MORE_THAN, 2), ruleText), new PlayerGainedLifeWatcher()); } public LoneRider(final LoneRider card) { @@ -89,7 +90,7 @@ public class LoneRider extends CardImpl { class YouGainedLifeCondition extends IntCompareCondition { - public YouGainedLifeCondition(Condition.ComparisonType type, int value) { + public YouGainedLifeCondition(CountType type, int value) { super(type, value); } diff --git a/Mage.Sets/src/mage/cards/m/MaskOfIntolerance.java b/Mage.Sets/src/mage/cards/m/MaskOfIntolerance.java index 77ad74035b..f7145b0db8 100644 --- a/Mage.Sets/src/mage/cards/m/MaskOfIntolerance.java +++ b/Mage.Sets/src/mage/cards/m/MaskOfIntolerance.java @@ -27,8 +27,8 @@ */ package mage.cards.m; -import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.CountType; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.condition.IntCompareCondition; @@ -42,6 +42,8 @@ import mage.constants.TargetController; import mage.constants.Zone; import mage.game.Game; +import java.util.UUID; + /** * * @author LoneFox @@ -70,7 +72,7 @@ public class MaskOfIntolerance extends CardImpl { class MaskOfIntoleranceCondition extends IntCompareCondition { public MaskOfIntoleranceCondition() { - super(ComparisonType.GreaterThan, 3); + super(CountType.MORE_THAN, 3); } @Override diff --git a/Mage.Sets/src/mage/cards/s/SpinerockKnoll.java b/Mage.Sets/src/mage/cards/s/SpinerockKnoll.java index ff92c7b897..034806b8d3 100644 --- a/Mage.Sets/src/mage/cards/s/SpinerockKnoll.java +++ b/Mage.Sets/src/mage/cards/s/SpinerockKnoll.java @@ -27,11 +27,8 @@ */ package mage.cards.s; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.CountType; import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.condition.IntCompareCondition; import mage.abilities.costs.common.TapSourceCost; @@ -50,6 +47,11 @@ import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.watchers.Watcher; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.UUID; + /** * * @author emerald000 @@ -88,7 +90,7 @@ public class SpinerockKnoll extends CardImpl { class SpinerockKnollCondition extends IntCompareCondition { SpinerockKnollCondition() { - super(ComparisonType.GreaterThan, 6); + super(CountType.MORE_THAN, 6); } @Override diff --git a/Mage.Sets/src/mage/cards/s/SyggRiverCutthroat.java b/Mage.Sets/src/mage/cards/s/SyggRiverCutthroat.java index a13834053d..8a176814ab 100644 --- a/Mage.Sets/src/mage/cards/s/SyggRiverCutthroat.java +++ b/Mage.Sets/src/mage/cards/s/SyggRiverCutthroat.java @@ -28,8 +28,8 @@ package mage.cards.s; import mage.MageInt; +import mage.abilities.CountType; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; -import mage.abilities.condition.Condition; import mage.abilities.condition.common.OpponentLostLifeCondition; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; @@ -60,7 +60,7 @@ public class SyggRiverCutthroat extends CardImpl { this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), TargetController.ANY, - new OpponentLostLifeCondition(Condition.ComparisonType.GreaterThan, 2), + new OpponentLostLifeCondition(CountType.MORE_THAN, 2), true)); } diff --git a/Mage/src/main/java/mage/MageObject.java b/Mage/src/main/java/mage/MageObject.java index 370b55e176..0aa2be0cf0 100644 --- a/Mage/src/main/java/mage/MageObject.java +++ b/Mage/src/main/java/mage/MageObject.java @@ -138,7 +138,7 @@ public interface MageObject extends MageItem, Serializable { } default void addCardType(CardType cardType) { - addCardType(cardType); + getCardType().add(cardType); } /** diff --git a/Mage/src/main/java/mage/abilities/condition/IntCompareCondition.java b/Mage/src/main/java/mage/abilities/condition/IntCompareCondition.java index 2e89464c28..2ba089daa5 100644 --- a/Mage/src/main/java/mage/abilities/condition/IntCompareCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/IntCompareCondition.java @@ -28,6 +28,7 @@ package mage.abilities.condition; import mage.abilities.Ability; +import mage.abilities.CountType; import mage.game.Game; /** @@ -36,10 +37,10 @@ import mage.game.Game; */ public abstract class IntCompareCondition implements Condition { - protected final Condition.ComparisonType type; + protected final CountType type; protected final int value; - public IntCompareCondition(Condition.ComparisonType type, int value) { + public IntCompareCondition(CountType type, int value) { this.type = type; this.value = value; } @@ -49,24 +50,7 @@ public abstract class IntCompareCondition implements Condition { @Override public final boolean apply(Game game, Ability source) { int inputValue = getInputValue(game, source); - switch (type) { - case Equal: - if (inputValue != value) { - return false; - } - break; - case GreaterThan: - if (inputValue <= value) { - return false; - } - break; - case LessThan: - if (inputValue >= value) { - return false; - } - break; - } - return true; + return CountType.compare(inputValue , type, value); } @Override diff --git a/Mage/src/main/java/mage/abilities/condition/common/DevouredCreaturesCondition.java b/Mage/src/main/java/mage/abilities/condition/common/DevouredCreaturesCondition.java index fa62e96f2b..8aa2e96341 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/DevouredCreaturesCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/DevouredCreaturesCondition.java @@ -28,7 +28,7 @@ package mage.abilities.condition.common; import mage.abilities.Ability; -import mage.abilities.condition.Condition; +import mage.abilities.CountType; import mage.abilities.condition.IntCompareCondition; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DevourEffect; @@ -43,7 +43,7 @@ import mage.game.permanent.Permanent; */ public class DevouredCreaturesCondition extends IntCompareCondition { - public DevouredCreaturesCondition(Condition.ComparisonType type, int value) { + public DevouredCreaturesCondition(CountType type, int value) { super(type, value); } diff --git a/Mage/src/main/java/mage/abilities/condition/common/OpponentLostLifeCondition.java b/Mage/src/main/java/mage/abilities/condition/common/OpponentLostLifeCondition.java index 4d4cfbf24c..5fa01a1697 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/OpponentLostLifeCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/OpponentLostLifeCondition.java @@ -27,14 +27,14 @@ */ package mage.abilities.condition.common; -import java.util.UUID; - import mage.abilities.Ability; -import mage.abilities.condition.Condition; +import mage.abilities.CountType; import mage.abilities.condition.IntCompareCondition; import mage.game.Game; import mage.watchers.common.PlayerLostLifeWatcher; +import java.util.UUID; + /** * Describes condition when an opponent has lost an amount of life * @@ -42,7 +42,7 @@ import mage.watchers.common.PlayerLostLifeWatcher; */ public class OpponentLostLifeCondition extends IntCompareCondition { - public OpponentLostLifeCondition(Condition.ComparisonType type, int value) { + public OpponentLostLifeCondition(CountType type, int value) { super(type, value); } @@ -65,13 +65,13 @@ public class OpponentLostLifeCondition extends IntCompareCondition { public String toString() { StringBuilder sb = new StringBuilder("if an opponent lost "); switch (type) { - case GreaterThan: + case MORE_THAN: sb.append(value + 1).append(" or more life this turn "); break; - case Equal: + case EQUAL_TO: sb.append(value).append(" life this turn "); break; - case LessThan: + case FEWER_THAN: sb.append(" less than ").append(value).append(" life this turn "); break; } From 3420d0d76c68f85d9be5e7af4d317ebaab7f9423 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Wed, 5 Apr 2017 17:52:04 +0200 Subject: [PATCH 6/9] use getOrDefault --- .../src/mage/cards/s/SpinerockKnoll.java | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Mage.Sets/src/mage/cards/s/SpinerockKnoll.java b/Mage.Sets/src/mage/cards/s/SpinerockKnoll.java index 034806b8d3..803ffd24c2 100644 --- a/Mage.Sets/src/mage/cards/s/SpinerockKnoll.java +++ b/Mage.Sets/src/mage/cards/s/SpinerockKnoll.java @@ -53,20 +53,19 @@ import java.util.Map.Entry; import java.util.UUID; /** - * * @author emerald000 */ public class SpinerockKnoll extends CardImpl { public SpinerockKnoll(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.LAND},""); + super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); // Hideaway this.addAbility(new HideawayAbility()); - + // {tap}: Add {R} to your mana pool. this.addAbility(new RedManaAbility()); - + // {R}, {tap}: You may play the exiled card without paying its mana cost if an opponent was dealt 7 or more damage this turn. Ability ability = new ActivateIfConditionActivatedAbility( Zone.BATTLEFIELD, @@ -98,7 +97,7 @@ class SpinerockKnollCondition extends IntCompareCondition { int maxDamageReceived = 0; SpinerockKnollWatcher watcher = (SpinerockKnollWatcher) game.getState().getWatchers().get("SpinerockKnollWatcher", source.getSourceId()); if (watcher != null) { - for (UUID opponentId: game.getOpponents(source.getControllerId())) { + for (UUID opponentId : game.getOpponents(source.getControllerId())) { int damageReceived = watcher.getDamageReceived(opponentId); if (damageReceived > maxDamageReceived) { maxDamageReceived = damageReceived; @@ -134,23 +133,15 @@ class SpinerockKnollWatcher extends Watcher { if (event.getType() == EventType.DAMAGED_PLAYER) { UUID playerId = event.getPlayerId(); if (playerId != null) { - Integer amount = amountOfDamageReceivedThisTurn.get(playerId); - if (amount == null) { - amount = event.getAmount(); - } else { - amount += event.getAmount(); - } + Integer amount = amountOfDamageReceivedThisTurn.getOrDefault(playerId, 0); + amount += event.getAmount(); amountOfDamageReceivedThisTurn.put(playerId, amount); } } } public int getDamageReceived(UUID playerId) { - Integer amount = amountOfDamageReceivedThisTurn.get(playerId); - if (amount != null) { - return amount; - } - return 0; + return amountOfDamageReceivedThisTurn.getOrDefault(playerId, 0); } @Override From 809c8c97c91f30b2590323a7df2617bfea0efa43 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Wed, 5 Apr 2017 17:54:06 +0200 Subject: [PATCH 7/9] introduced YouGainedLifeCondition --- Mage.Sets/src/mage/cards/a/AngelicAccord.java | 26 +-------------- Mage.Sets/src/mage/cards/l/LoneRider.java | 28 ++-------------- .../common/YouGainedLifeCondition.java | 33 +++++++++++++++++++ 3 files changed, 36 insertions(+), 51 deletions(-) create mode 100644 Mage/src/main/java/mage/abilities/condition/common/YouGainedLifeCondition.java diff --git a/Mage.Sets/src/mage/cards/a/AngelicAccord.java b/Mage.Sets/src/mage/cards/a/AngelicAccord.java index eb73267182..2cbe190e36 100644 --- a/Mage.Sets/src/mage/cards/a/AngelicAccord.java +++ b/Mage.Sets/src/mage/cards/a/AngelicAccord.java @@ -27,17 +27,15 @@ */ package mage.cards.a; -import mage.abilities.Ability; import mage.abilities.CountType; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; -import mage.abilities.condition.IntCompareCondition; +import mage.abilities.condition.common.YouGainedLifeCondition; import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.TargetController; import mage.constants.Zone; -import mage.game.Game; import mage.game.permanent.token.AngelToken; import mage.watchers.common.PlayerGainedLifeWatcher; @@ -66,25 +64,3 @@ public class AngelicAccord extends CardImpl { return new AngelicAccord(this); } } - -class YouGainedLifeCondition extends IntCompareCondition { - - public YouGainedLifeCondition(CountType type, int value) { - super(type, value); - } - - @Override - protected int getInputValue(Game game, Ability source) { - int gainedLife = 0; - PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatchers().get(PlayerGainedLifeWatcher.class.getName()); - if (watcher != null) { - gainedLife = watcher.getLiveGained(source.getControllerId()); - } - return gainedLife; - } - - @Override - public String toString() { - return "if you gained 4 or more life this turn "; - } -} diff --git a/Mage.Sets/src/mage/cards/l/LoneRider.java b/Mage.Sets/src/mage/cards/l/LoneRider.java index 9ab1c92918..f38f85343d 100644 --- a/Mage.Sets/src/mage/cards/l/LoneRider.java +++ b/Mage.Sets/src/mage/cards/l/LoneRider.java @@ -28,11 +28,10 @@ package mage.cards.l; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.CountType; import mage.abilities.TriggeredAbility; import mage.abilities.common.OnEventTriggeredAbility; -import mage.abilities.condition.IntCompareCondition; +import mage.abilities.condition.common.YouGainedLifeCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.TransformSourceEffect; import mage.abilities.keyword.FirstStrikeAbility; @@ -42,7 +41,6 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.cards.i.ItThatRidesAsOne; import mage.constants.CardType; -import mage.game.Game; import mage.game.events.GameEvent; import mage.watchers.common.PlayerGainedLifeWatcher; @@ -86,26 +84,4 @@ public class LoneRider extends CardImpl { public LoneRider copy() { return new LoneRider(this); } -} - -class YouGainedLifeCondition extends IntCompareCondition { - - public YouGainedLifeCondition(CountType type, int value) { - super(type, value); - } - - @Override - protected int getInputValue(Game game, Ability source) { - int gainedLife = 0; - PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatchers().get(PlayerGainedLifeWatcher.class.getName()); - if (watcher != null) { - gainedLife = watcher.getLiveGained(source.getControllerId()); - } - return gainedLife; - } - - @Override - public String toString() { - return "if you gained 3 or more life this turn "; - } -} +} \ No newline at end of file diff --git a/Mage/src/main/java/mage/abilities/condition/common/YouGainedLifeCondition.java b/Mage/src/main/java/mage/abilities/condition/common/YouGainedLifeCondition.java new file mode 100644 index 0000000000..edfed0b8c0 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/condition/common/YouGainedLifeCondition.java @@ -0,0 +1,33 @@ +package mage.abilities.condition.common; + +import mage.abilities.Ability; +import mage.abilities.CountType; +import mage.abilities.condition.IntCompareCondition; +import mage.game.Game; +import mage.watchers.common.PlayerGainedLifeWatcher; + +/** + * Created by IGOUDT on 5-4-2017. + */ +public class YouGainedLifeCondition extends IntCompareCondition { + + public YouGainedLifeCondition(CountType type, int value) { + super(type, value); + } + + @Override + protected int getInputValue(Game game, Ability source) { + int gainedLife = 0; + PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatchers().get(PlayerGainedLifeWatcher.class.getName()); + if (watcher != null) { + gainedLife = watcher.getLiveGained(source.getControllerId()); + } + return gainedLife; + } + + @Override + public String toString() { + return String.format("if you gained %s or more life this turn ", value); + } +} + From fb9d713287b3c88b849800dee1d1af912ff3013f Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Wed, 5 Apr 2017 19:02:16 +0200 Subject: [PATCH 8/9] singleton conditions to enum --- Mage.Sets/src/mage/cards/a/AlabornVeteran.java | 2 +- Mage.Sets/src/mage/cards/a/AnimateDead.java | 2 +- .../src/mage/cards/a/ApprenticeSorcerer.java | 2 +- .../src/mage/cards/a/AuriokGlaivemaster.java | 4 ++-- .../src/mage/cards/a/AuriokSteelshaper.java | 2 +- .../mage/cards/a/AvacynianMissionaries.java | 2 +- .../src/mage/cards/c/CaoCaoLordOfWei.java | 2 +- .../src/mage/cards/c/CapriciousSorcerer.java | 2 +- Mage.Sets/src/mage/cards/c/Charisma.java | 11 ++++++----- Mage.Sets/src/mage/cards/c/CoastalWizard.java | 2 +- Mage.Sets/src/mage/cards/c/CunningAdvisor.java | 2 +- .../src/mage/cards/c/CytoplastManipulator.java | 2 +- Mage.Sets/src/mage/cards/d/DanceOfTheDead.java | 2 +- Mage.Sets/src/mage/cards/d/DeepSeaKraken.java | 2 +- .../src/mage/cards/d/DiaochanArtfulBeauty.java | 2 +- .../src/mage/cards/e/EnshroudingMist.java | 2 +- .../src/mage/cards/e/EntourageOfTrest.java | 2 +- Mage.Sets/src/mage/cards/f/FireBowman.java | 2 +- .../src/mage/cards/f/ForgestokerDragon.java | 2 +- Mage.Sets/src/mage/cards/f/FreneticSliver.java | 2 +- Mage.Sets/src/mage/cards/g/GaeasLiege.java | 2 +- .../src/mage/cards/g/GarrulousSycophant.java | 2 +- .../src/mage/cards/g/GerrardCapashen.java | 2 +- .../src/mage/cards/g/GoblinFirestarter.java | 2 +- Mage.Sets/src/mage/cards/g/GorillaWarCry.java | 2 +- Mage.Sets/src/mage/cards/g/GraspOfFate.java | 2 +- Mage.Sets/src/mage/cards/g/Groundswell.java | 2 +- .../src/mage/cards/h/HomuraHumanAscendant.java | 2 +- .../mage/cards/h/HuaTuoHonoredPhysician.java | 2 +- Mage.Sets/src/mage/cards/k/KeeperOfKeys.java | 5 +++-- Mage.Sets/src/mage/cards/k/KingsAssassin.java | 5 +++-- .../src/mage/cards/k/KitesailApprentice.java | 10 +++++----- .../src/mage/cards/k/KorScythemaster.java | 5 +++-- Mage.Sets/src/mage/cards/l/LadySun.java | 5 +++-- Mage.Sets/src/mage/cards/l/LeoninDenGuard.java | 10 +++++----- Mage.Sets/src/mage/cards/l/LoyalRetainers.java | 5 +++-- Mage.Sets/src/mage/cards/l/LuSuWuAdvisor.java | 2 +- Mage.Sets/src/mage/cards/m/MyrServitor.java | 5 +++-- .../src/mage/cards/m/MysteriesOfTheDeep.java | 7 ++++--- Mage.Sets/src/mage/cards/n/Necromancy.java | 13 ++++--------- Mage.Sets/src/mage/cards/n/NekoTe.java | 7 ++++--- Mage.Sets/src/mage/cards/n/Nihilith.java | 5 +++-- .../src/mage/cards/n/NorwoodPriestess.java | 5 +++-- .../src/mage/cards/p/PangTongYoungPhoenix.java | 2 +- Mage.Sets/src/mage/cards/p/Panic.java | 5 +++-- Mage.Sets/src/mage/cards/p/PardicDragon.java | 12 ++++-------- .../src/mage/cards/r/RakshaGoldenCub.java | 7 ++++--- .../src/mage/cards/r/RestForTheWeary.java | 7 ++++--- Mage.Sets/src/mage/cards/r/RiverOfTears.java | 9 +++++---- Mage.Sets/src/mage/cards/s/ShuFarmer.java | 5 +++-- Mage.Sets/src/mage/cards/s/SiegeBehemoth.java | 5 +++-- Mage.Sets/src/mage/cards/s/SkyhunterCub.java | 7 ++++--- Mage.Sets/src/mage/cards/s/SkylineDespot.java | 5 +++-- Mage.Sets/src/mage/cards/s/SoltariLancer.java | 5 +++-- .../src/mage/cards/s/SowerOfTemptation.java | 7 ++++--- .../src/mage/cards/s/SpiritOfTheNight.java | 2 +- Mage.Sets/src/mage/cards/s/SteamCatapult.java | 5 +++-- Mage.Sets/src/mage/cards/s/SternMarshal.java | 5 +++-- Mage.Sets/src/mage/cards/s/StoneCatapult.java | 5 +++-- .../src/mage/cards/s/SunspearShikari.java | 7 ++++--- .../src/mage/cards/t/TalasResearcher.java | 6 ++++-- Mage.Sets/src/mage/cards/t/TempleElder.java | 5 +++-- Mage.Sets/src/mage/cards/t/ThroneWarden.java | 5 +++-- Mage.Sets/src/mage/cards/t/TombHex.java | 8 ++++---- Mage.Sets/src/mage/cards/w/WuLongbowman.java | 5 +++-- .../src/mage/cards/x/XiahouDunTheOneEyed.java | 2 +- .../src/mage/cards/x/XunYuWeiAdvisor.java | 5 +++-- .../src/mage/cards/z/ZhugeJinWuStrategist.java | 2 +- .../abilityword/LieutenantAbility.java | 8 ++++---- .../BeforeBlockersAreDeclaredCondition.java | 8 ++------ .../common/CommanderInPlayCondition.java | 17 ++++------------- .../common/EquippedSourceCondition.java | 11 ++++------- .../condition/common/FlippedCondition.java | 8 ++------ .../condition/common/LandfallCondition.java | 11 ++--------- .../MonarchIsSourceControllerCondition.java | 8 ++------ ...MyTurnBeforeAttackersDeclaredCondition.java | 8 ++------ .../common/RenownedTargetCondition.java | 14 ++------------ .../common/SourceAttackingCondition.java | 8 ++------ .../common/SourceOnBattlefieldCondition.java | 8 ++------ .../condition/common/SuspendedCondition.java | 13 ++----------- .../effects/common/FlipSourceEffect.java | 2 +- .../mage/abilities/keyword/SuspendAbility.java | 18 ++++++------------ 82 files changed, 196 insertions(+), 242 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AlabornVeteran.java b/Mage.Sets/src/mage/cards/a/AlabornVeteran.java index 0f384d7983..478f7db6b8 100644 --- a/Mage.Sets/src/mage/cards/a/AlabornVeteran.java +++ b/Mage.Sets/src/mage/cards/a/AlabornVeteran.java @@ -57,7 +57,7 @@ public class AlabornVeteran extends CardImpl { // {tap}: Target creature gets +2/+2 until end of turn. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new BoostTargetEffect(2, 2, Duration.EndOfTurn), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new BoostTargetEffect(2, 2, Duration.EndOfTurn), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/a/AnimateDead.java b/Mage.Sets/src/mage/cards/a/AnimateDead.java index dae14d60c2..b121933497 100644 --- a/Mage.Sets/src/mage/cards/a/AnimateDead.java +++ b/Mage.Sets/src/mage/cards/a/AnimateDead.java @@ -76,7 +76,7 @@ public class AnimateDead extends CardImpl { // under your control and attach Animate Dead to it. When Animate Dead leaves the battlefield, that creature's controller sacrifices it. Ability ability = new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new AnimateDeadReAttachEffect(), false), - SourceOnBattlefieldCondition.getInstance(), + SourceOnBattlefieldCondition.instance, "When {this} enters the battlefield, if it's on the battlefield, it loses \"enchant creature card in a graveyard\" and gains \"enchant creature put onto the battlefield with {this}.\" Return enchanted creature card to the battlefield under your control and attach {this} to it."); ability.addEffect(new AnimateDeadChangeAbilityEffect()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/a/ApprenticeSorcerer.java b/Mage.Sets/src/mage/cards/a/ApprenticeSorcerer.java index 493eb87b5b..df8e0adc3b 100644 --- a/Mage.Sets/src/mage/cards/a/ApprenticeSorcerer.java +++ b/Mage.Sets/src/mage/cards/a/ApprenticeSorcerer.java @@ -56,7 +56,7 @@ public class ApprenticeSorcerer extends CardImpl { // {tap}: Apprentice Sorcerer deals 1 damage to target creature or player. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new DamageTargetEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new DamageTargetEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/a/AuriokGlaivemaster.java b/Mage.Sets/src/mage/cards/a/AuriokGlaivemaster.java index a2a4ca0d7c..8355ea65ff 100644 --- a/Mage.Sets/src/mage/cards/a/AuriokGlaivemaster.java +++ b/Mage.Sets/src/mage/cards/a/AuriokGlaivemaster.java @@ -58,9 +58,9 @@ public class AuriokGlaivemaster extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(1); - ConditionalContinuousEffect effect1 = new ConditionalContinuousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), EquippedSourceCondition.getInstance(), rule1); + ConditionalContinuousEffect effect1 = new ConditionalContinuousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), EquippedSourceCondition.instance, rule1); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect1)); - ConditionalContinuousEffect effect2 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), EquippedSourceCondition.getInstance(), rule2); + ConditionalContinuousEffect effect2 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), EquippedSourceCondition.instance, rule2); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect2)); } diff --git a/Mage.Sets/src/mage/cards/a/AuriokSteelshaper.java b/Mage.Sets/src/mage/cards/a/AuriokSteelshaper.java index dedd985c38..4b64b7a615 100644 --- a/Mage.Sets/src/mage/cards/a/AuriokSteelshaper.java +++ b/Mage.Sets/src/mage/cards/a/AuriokSteelshaper.java @@ -74,7 +74,7 @@ public class AuriokSteelshaper extends CardImpl { // As long as Auriok Steelshaper is equipped, each creature you control that's a Soldier or a Knight gets +1/+1. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, soldiersOrKnights, false), - EquippedSourceCondition.getInstance(), + EquippedSourceCondition.instance, "As long as {this} is equipped, each creature you control that's a Soldier or a Knight gets +1/+1" ))); } diff --git a/Mage.Sets/src/mage/cards/a/AvacynianMissionaries.java b/Mage.Sets/src/mage/cards/a/AvacynianMissionaries.java index 342d51d0db..bb674c0492 100644 --- a/Mage.Sets/src/mage/cards/a/AvacynianMissionaries.java +++ b/Mage.Sets/src/mage/cards/a/AvacynianMissionaries.java @@ -59,7 +59,7 @@ public class AvacynianMissionaries extends CardImpl { // At the beginning of your end step, if Avacynian Missionaries is equipped, transform it. this.addAbility(new TransformAbility()); - this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new TransformSourceEffect(true), TargetController.YOU, new EquippedSourceCondition(), false)); + this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new TransformSourceEffect(true), TargetController.YOU, EquippedSourceCondition.instance, false)); } diff --git a/Mage.Sets/src/mage/cards/c/CaoCaoLordOfWei.java b/Mage.Sets/src/mage/cards/c/CaoCaoLordOfWei.java index 4e6a39e572..5ec4d5e1b8 100644 --- a/Mage.Sets/src/mage/cards/c/CaoCaoLordOfWei.java +++ b/Mage.Sets/src/mage/cards/c/CaoCaoLordOfWei.java @@ -58,7 +58,7 @@ public class CaoCaoLordOfWei extends CardImpl { this.toughness = new MageInt(3); // {tap}: Target opponent discards two cards. Activate this ability only during your turn, before attackers are declared. - Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(2), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(2), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetOpponent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/c/CapriciousSorcerer.java b/Mage.Sets/src/mage/cards/c/CapriciousSorcerer.java index e00bcbfdbb..d99c8a0a7c 100644 --- a/Mage.Sets/src/mage/cards/c/CapriciousSorcerer.java +++ b/Mage.Sets/src/mage/cards/c/CapriciousSorcerer.java @@ -56,7 +56,7 @@ public class CapriciousSorcerer extends CardImpl { // {tap}: Capricious Sorcerer deals 1 damage to target creature or player. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new DamageTargetEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new DamageTargetEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/c/Charisma.java b/Mage.Sets/src/mage/cards/c/Charisma.java index 0181379436..0208a3f9b0 100644 --- a/Mage.Sets/src/mage/cards/c/Charisma.java +++ b/Mage.Sets/src/mage/cards/c/Charisma.java @@ -27,8 +27,6 @@ */ package mage.cards.c; -import java.util.UUID; -import mage.target.common.TargetCreaturePermanent; import mage.abilities.Ability; import mage.abilities.common.DealsDamageToACreatureAttachedTriggeredAbility; import mage.abilities.condition.Condition; @@ -36,13 +34,16 @@ import mage.abilities.condition.common.SourceOnBattlefieldCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.continuous.GainControlTargetEffect; -import mage.constants.Outcome; -import mage.target.TargetPermanent; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Outcome; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; /** * @@ -65,7 +66,7 @@ public class Charisma extends CardImpl { this.addAbility(ability); // Whenever enchanted creature deals damage to a creature, gain control of the other creature for as long as Charisma remains on the battlefield. - Condition condition = new SourceOnBattlefieldCondition(); + Condition condition = SourceOnBattlefieldCondition.instance; ConditionalContinuousEffect conditionalEffect = new ConditionalContinuousEffect(new GainControlTargetEffect(Duration.Custom), condition, rule); this.addAbility(new DealsDamageToACreatureAttachedTriggeredAbility(conditionalEffect, false, "enchanted creature", false, true)); diff --git a/Mage.Sets/src/mage/cards/c/CoastalWizard.java b/Mage.Sets/src/mage/cards/c/CoastalWizard.java index c683fec481..95fbdc5c08 100644 --- a/Mage.Sets/src/mage/cards/c/CoastalWizard.java +++ b/Mage.Sets/src/mage/cards/c/CoastalWizard.java @@ -67,7 +67,7 @@ public class CoastalWizard extends CardImpl { Effect effect = new ReturnToHandSourceEffect(true); effect.setText("Return Coastal Wizard"); Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - effect, new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + effect, new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); effect = new ReturnToHandTargetEffect(); effect.setText("and another target creature to their owners' hands"); ability.addTarget(new TargetCreaturePermanent(filter)); diff --git a/Mage.Sets/src/mage/cards/c/CunningAdvisor.java b/Mage.Sets/src/mage/cards/c/CunningAdvisor.java index 8bb2710624..c0833b04b0 100644 --- a/Mage.Sets/src/mage/cards/c/CunningAdvisor.java +++ b/Mage.Sets/src/mage/cards/c/CunningAdvisor.java @@ -56,7 +56,7 @@ public class CunningAdvisor extends CardImpl { // {tap}: Target opponent discards a card. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new DiscardTargetEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new DiscardTargetEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetOpponent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/c/CytoplastManipulator.java b/Mage.Sets/src/mage/cards/c/CytoplastManipulator.java index 56e4a18c18..a8e4458c77 100644 --- a/Mage.Sets/src/mage/cards/c/CytoplastManipulator.java +++ b/Mage.Sets/src/mage/cards/c/CytoplastManipulator.java @@ -73,7 +73,7 @@ public class CytoplastManipulator extends CardImpl { // {U}, {tap}: Gain control of target creature with a +1/+1 counter on it for as long as Cytoplast Manipulator remains on the battlefield. ConditionalContinuousEffect effect = new ConditionalContinuousEffect( new GainControlTargetEffect(Duration.Custom, true), - new SourceOnBattlefieldCondition(), + SourceOnBattlefieldCondition.instance, "gain control of target creature with a +1/+1 counter on it for as long as {this} remains on the battlefield"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{U}")); ability.addCost(new TapSourceCost()); diff --git a/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java b/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java index 25f3c79a69..1144b49594 100644 --- a/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java +++ b/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java @@ -81,7 +81,7 @@ public class DanceOfTheDead extends CardImpl { // When Dance of the Dead enters the battlefield, if it's on the battlefield, it loses "enchant creature card in a graveyard" and gains "enchant creature put onto the battlefield with Dance of the Dead." Put enchanted creature card to the battlefield tapped under your control and attach Dance of the Dead to it. When Dance of the Dead leaves the battlefield, that creature's controller sacrifices it. Ability ability = new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new DanceOfTheDeadReAttachEffect(), false), - SourceOnBattlefieldCondition.getInstance(), + SourceOnBattlefieldCondition.instance, "When {this} enters the battlefield, if it's on the battlefield, it loses \"enchant creature card in a graveyard\" and gains \"enchant creature put onto the battlefield with {this}.\" Return enchanted creature card to the battlefield under your control and attach {this} to it."); ability.addEffect(new DanceOfTheDeadChangeAbilityEffect()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/d/DeepSeaKraken.java b/Mage.Sets/src/mage/cards/d/DeepSeaKraken.java index a3d02b3177..e0bf769a7e 100644 --- a/Mage.Sets/src/mage/cards/d/DeepSeaKraken.java +++ b/Mage.Sets/src/mage/cards/d/DeepSeaKraken.java @@ -72,7 +72,7 @@ public class DeepSeaKraken extends CardImpl { this.addAbility(new SuspendAbility(9, new ManaCostsImpl("{2}{U}"), this)); // Whenever an opponent casts a spell, if Deep-Sea Kraken is suspended, remove a time counter from it. this.addAbility(new ConditionalTriggeredAbility( - new SpellCastAllTriggeredAbility(Zone.EXILED, new RemoveCounterSourceEffect(CounterType.TIME.createInstance()), filter, false, SetTargetPointer.NONE), SuspendedCondition.getInstance(), + new SpellCastAllTriggeredAbility(Zone.EXILED, new RemoveCounterSourceEffect(CounterType.TIME.createInstance()), filter, false, SetTargetPointer.NONE), SuspendedCondition.instance, "Whenever an opponent casts a spell, if Deep-Sea Kraken is suspended, remove a time counter from it.")); } diff --git a/Mage.Sets/src/mage/cards/d/DiaochanArtfulBeauty.java b/Mage.Sets/src/mage/cards/d/DiaochanArtfulBeauty.java index 1b45e92080..e8804c8eef 100644 --- a/Mage.Sets/src/mage/cards/d/DiaochanArtfulBeauty.java +++ b/Mage.Sets/src/mage/cards/d/DiaochanArtfulBeauty.java @@ -64,7 +64,7 @@ public class DiaochanArtfulBeauty extends CardImpl { this.toughness = new MageInt(1); // {tap}: Destroy target creature of your choice, then destroy target creature of an opponent's choice. Activate this ability only during your turn, before attackers are declared. - Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new DiaochanArtfulBeautyDestroyEffect(), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new DiaochanArtfulBeautyDestroyEffect(), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetOpponentsChoicePermanent(1, 1, new FilterCreaturePermanent(), false, true)); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/e/EnshroudingMist.java b/Mage.Sets/src/mage/cards/e/EnshroudingMist.java index 6b7805714e..5def8193e9 100644 --- a/Mage.Sets/src/mage/cards/e/EnshroudingMist.java +++ b/Mage.Sets/src/mage/cards/e/EnshroudingMist.java @@ -58,7 +58,7 @@ public class EnshroudingMist extends CardImpl { this.getSpellAbility().addEffect(effect); OneShotEffect effect2 = new UntapTargetEffect(); effect2.setText("untap it"); - this.getSpellAbility().addEffect(new ConditionalOneShotEffect(effect2, RenownedTargetCondition.getInstance())); + this.getSpellAbility().addEffect(new ConditionalOneShotEffect(effect2, RenownedTargetCondition.instance)); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } diff --git a/Mage.Sets/src/mage/cards/e/EntourageOfTrest.java b/Mage.Sets/src/mage/cards/e/EntourageOfTrest.java index 4d9d22194a..a6c3969b99 100644 --- a/Mage.Sets/src/mage/cards/e/EntourageOfTrest.java +++ b/Mage.Sets/src/mage/cards/e/EntourageOfTrest.java @@ -60,7 +60,7 @@ public class EntourageOfTrest extends CardImpl { // Entourage of Trest can block an additional creature each combat as long as you're the monarch. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( - new CanBlockAdditionalCreatureEffect(1), MonarchIsSourceControllerCondition.getInstance(), + new CanBlockAdditionalCreatureEffect(1), MonarchIsSourceControllerCondition.instance, "{this} can block an additional creature each combat as long as you're the monarch"))); } diff --git a/Mage.Sets/src/mage/cards/f/FireBowman.java b/Mage.Sets/src/mage/cards/f/FireBowman.java index e56437c5ce..726dcf7d64 100644 --- a/Mage.Sets/src/mage/cards/f/FireBowman.java +++ b/Mage.Sets/src/mage/cards/f/FireBowman.java @@ -57,7 +57,7 @@ public class FireBowman extends CardImpl { // Sacrifice Fire Bowman: Fire Bowman deals 1 damage to target creature or player. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new DamageTargetEffect(1), new SacrificeSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new DamageTargetEffect(1), new SacrificeSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/f/ForgestokerDragon.java b/Mage.Sets/src/mage/cards/f/ForgestokerDragon.java index d661e3d054..43aa253e0f 100644 --- a/Mage.Sets/src/mage/cards/f/ForgestokerDragon.java +++ b/Mage.Sets/src/mage/cards/f/ForgestokerDragon.java @@ -61,7 +61,7 @@ public class ForgestokerDragon extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); // {1}{R}: Forgestoker Dragon deals 1 damage to target creature. That creature can't block this combat. Activate this ability only if Forgestoker Dragon is attacking. - Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{1}{R}"), new SourceAttackingCondition()); + Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{1}{R}"), SourceAttackingCondition.instance); ability.addTarget(new TargetCreaturePermanent()); Effect effect = new CantBlockTargetEffect(Duration.EndOfCombat); effect.setText("That creature can't block this combat"); diff --git a/Mage.Sets/src/mage/cards/f/FreneticSliver.java b/Mage.Sets/src/mage/cards/f/FreneticSliver.java index 21f2540f25..8446358101 100644 --- a/Mage.Sets/src/mage/cards/f/FreneticSliver.java +++ b/Mage.Sets/src/mage/cards/f/FreneticSliver.java @@ -65,7 +65,7 @@ public class FreneticSliver extends CardImpl { // All Slivers have "{0}: If this permanent is on the battlefield, flip a coin. If you win the flip, exile this permanent and return it to the battlefield under its owner's control at the beginning of the next end step. If you lose the flip, sacrifice it." Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, - new FreneticSliverEffect(), new ManaCostsImpl("{0}"), SourceOnBattlefieldCondition.getInstance(), "{0}: If this permanent is on the battlefield, flip a coin. If you win the flip, exile this permanent and return it to the battlefield under its owner's control at the beginning of the next end step. If you lose the flip, sacrifice it."); + new FreneticSliverEffect(), new ManaCostsImpl("{0}"), SourceOnBattlefieldCondition.instance, "{0}: If this permanent is on the battlefield, flip a coin. If you win the flip, exile this permanent and return it to the battlefield under its owner's control at the beginning of the next end step. If you lose the flip, sacrifice it."); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, filter, "All Slivers have \"{0}: If this permanent is on the battlefield, flip a coin. If you win the flip, exile this permanent and return it to the battlefield under its owner's control at the beginning of the next end step. If you lose the flip, sacrifice it.\""))); diff --git a/Mage.Sets/src/mage/cards/g/GaeasLiege.java b/Mage.Sets/src/mage/cards/g/GaeasLiege.java index 694bba7e70..13dcdc17c3 100644 --- a/Mage.Sets/src/mage/cards/g/GaeasLiege.java +++ b/Mage.Sets/src/mage/cards/g/GaeasLiege.java @@ -78,7 +78,7 @@ public class GaeasLiege extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.ALL, new ConditionalContinuousEffect( new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filterLands), Duration.EndOfGame), new SetPowerToughnessSourceEffect(new DefendersForestCount(), Duration.EndOfCombat), - new InvertCondition(SourceAttackingCondition.getInstance()), + new InvertCondition(SourceAttackingCondition.instance), "As long as {this} isn't attacking, its power and toughness are each equal to the number of Forests you control. As long as {this} is attacking, its power and toughness are each equal to the number of Forests defending player controls."))); // {tap}: Target land becomes a Forest until Gaea's Liege leaves the battlefield. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.WhileOnBattlefield, "Forest"), new TapSourceCost()); diff --git a/Mage.Sets/src/mage/cards/g/GarrulousSycophant.java b/Mage.Sets/src/mage/cards/g/GarrulousSycophant.java index 73887f5978..6ba21b55a9 100644 --- a/Mage.Sets/src/mage/cards/g/GarrulousSycophant.java +++ b/Mage.Sets/src/mage/cards/g/GarrulousSycophant.java @@ -58,7 +58,7 @@ public class GarrulousSycophant extends CardImpl { // At the beginning of your end step, if you're the monarch, each opponent loses 1 life and you gain 1 life. Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new LoseLifeOpponentsEffect(1), - TargetController.YOU, MonarchIsSourceControllerCondition.getInstance(), false); + TargetController.YOU, MonarchIsSourceControllerCondition.instance, false); Effect effect = new GainLifeEffect(1); effect.setText("and you gain 1 life"); ability.addEffect(effect); diff --git a/Mage.Sets/src/mage/cards/g/GerrardCapashen.java b/Mage.Sets/src/mage/cards/g/GerrardCapashen.java index f7170dfb40..419b594b93 100644 --- a/Mage.Sets/src/mage/cards/g/GerrardCapashen.java +++ b/Mage.Sets/src/mage/cards/g/GerrardCapashen.java @@ -67,7 +67,7 @@ public class GerrardCapashen extends CardImpl { // {3}{W}: Tap target creature. Activate this ability only if {this} is attacking. Ability ability2 = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), - new ManaCostsImpl("{3}{W}"), new SourceAttackingCondition()); + new ManaCostsImpl("{3}{W}"), SourceAttackingCondition.instance); ability2.addTarget(new TargetCreaturePermanent()); this.addAbility(ability2); } diff --git a/Mage.Sets/src/mage/cards/g/GoblinFirestarter.java b/Mage.Sets/src/mage/cards/g/GoblinFirestarter.java index f63e5e1b9d..a082de1308 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinFirestarter.java +++ b/Mage.Sets/src/mage/cards/g/GoblinFirestarter.java @@ -55,7 +55,7 @@ public class GoblinFirestarter extends CardImpl { // Sacrifice Goblin Firestarter: Goblin Firestarter deals 1 damage to target creature or player. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new DamageTargetEffect(1), new SacrificeSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new DamageTargetEffect(1), new SacrificeSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GorillaWarCry.java b/Mage.Sets/src/mage/cards/g/GorillaWarCry.java index 65d2a03372..1fd22041b3 100644 --- a/Mage.Sets/src/mage/cards/g/GorillaWarCry.java +++ b/Mage.Sets/src/mage/cards/g/GorillaWarCry.java @@ -54,7 +54,7 @@ public class GorillaWarCry extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}"); // Cast Gorilla War Cry only during combat before blockers are declared. - this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(TurnPhase.COMBAT, BeforeBlockersAreDeclaredCondition.getInstance())); + this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(TurnPhase.COMBAT, BeforeBlockersAreDeclaredCondition.instance)); // All creatures gain menace until end of turn. (They can't be blocked except by two or more creatures.) Effect effect = new GainAbilityAllEffect(new MenaceAbility(), Duration.EndOfTurn, new FilterCreaturePermanent()); diff --git a/Mage.Sets/src/mage/cards/g/GraspOfFate.java b/Mage.Sets/src/mage/cards/g/GraspOfFate.java index 88644e478b..3bd4f6e0ef 100644 --- a/Mage.Sets/src/mage/cards/g/GraspOfFate.java +++ b/Mage.Sets/src/mage/cards/g/GraspOfFate.java @@ -117,7 +117,7 @@ class GraspOfFateExileEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - return new ConditionalOneShotEffect(new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName(), Zone.BATTLEFIELD, true), new SourceOnBattlefieldCondition()).apply(game, source); + return new ConditionalOneShotEffect(new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName(), Zone.BATTLEFIELD, true), SourceOnBattlefieldCondition.instance).apply(game, source); } return false; } diff --git a/Mage.Sets/src/mage/cards/g/Groundswell.java b/Mage.Sets/src/mage/cards/g/Groundswell.java index d63375fced..cd0d9a201b 100644 --- a/Mage.Sets/src/mage/cards/g/Groundswell.java +++ b/Mage.Sets/src/mage/cards/g/Groundswell.java @@ -55,7 +55,7 @@ public class Groundswell extends CardImpl { this.getSpellAbility().addEffect(new ConditionalOneShotEffect( new AddContinuousEffectToGame(new BoostTargetEffect(4, 4, Duration.EndOfTurn)), new AddContinuousEffectToGame(new BoostTargetEffect(2, 2, Duration.EndOfTurn)), - LandfallCondition.getInstance(), + LandfallCondition.instance, "Target creature gets +2/+2 until end of turn.
Landfall — If you had a land enter the battlefield under your control this turn, that creature gets +4/+4 until end of turn instead")); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } diff --git a/Mage.Sets/src/mage/cards/h/HomuraHumanAscendant.java b/Mage.Sets/src/mage/cards/h/HomuraHumanAscendant.java index 5f95d7deb4..e9a250abca 100644 --- a/Mage.Sets/src/mage/cards/h/HomuraHumanAscendant.java +++ b/Mage.Sets/src/mage/cards/h/HomuraHumanAscendant.java @@ -109,7 +109,7 @@ class HomuraReturnFlippedSourceEffect extends OneShotEffect { Card sourceCard = game.getCard(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (sourceCard != null && controller != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { - ContinuousEffect effect = new ConditionalContinuousEffect(new CopyTokenEffect(flipToken), FlippedCondition.getInstance(), ""); + ContinuousEffect effect = new ConditionalContinuousEffect(new CopyTokenEffect(flipToken), FlippedCondition.instance, ""); game.addEffect(effect, source); controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game); Permanent permanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/h/HuaTuoHonoredPhysician.java b/Mage.Sets/src/mage/cards/h/HuaTuoHonoredPhysician.java index fc71a9c972..96695c170c 100644 --- a/Mage.Sets/src/mage/cards/h/HuaTuoHonoredPhysician.java +++ b/Mage.Sets/src/mage/cards/h/HuaTuoHonoredPhysician.java @@ -58,7 +58,7 @@ public class HuaTuoHonoredPhysician extends CardImpl { this.toughness = new MageInt(2); // {tap}: Put target creature card from your graveyard on top of your library. Activate this ability only during your turn, before attackers are declared. - Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new PutOnLibraryTargetEffect(true), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new PutOnLibraryTargetEffect(true), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard"))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/k/KeeperOfKeys.java b/Mage.Sets/src/mage/cards/k/KeeperOfKeys.java index 04bcaf8d69..bed95415d1 100644 --- a/Mage.Sets/src/mage/cards/k/KeeperOfKeys.java +++ b/Mage.Sets/src/mage/cards/k/KeeperOfKeys.java @@ -27,7 +27,6 @@ */ package mage.cards.k; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -43,6 +42,8 @@ import mage.constants.TargetController; import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; +import java.util.UUID; + /** * * @author LevelX2 @@ -64,7 +65,7 @@ public class KeeperOfKeys extends CardImpl { // At the beginning of your upkeep, if you're the monarch, creatures you control can't be blocked this turn. this.addAbility(new ConditionalTriggeredAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new CantBeBlockedAllEffect(new FilterControlledCreaturePermanent("creatures you control"), Duration.EndOfTurn), - TargetController.YOU, false), MonarchIsSourceControllerCondition.getInstance(), + TargetController.YOU, false), MonarchIsSourceControllerCondition.instance, "At the beginning of your upkeep, if you're the monarch, creatures you control can't be blocked this turn.")); } diff --git a/Mage.Sets/src/mage/cards/k/KingsAssassin.java b/Mage.Sets/src/mage/cards/k/KingsAssassin.java index a3a2fc5738..3ad0aae465 100644 --- a/Mage.Sets/src/mage/cards/k/KingsAssassin.java +++ b/Mage.Sets/src/mage/cards/k/KingsAssassin.java @@ -27,7 +27,6 @@ */ package mage.cards.k; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; @@ -42,6 +41,8 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.TappedPredicate; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author fireshoes @@ -63,7 +64,7 @@ public class KingsAssassin extends CardImpl { // {tap}: Destroy target tapped creature. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new DestroyTargetEffect(), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new DestroyTargetEffect(), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreaturePermanent(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/k/KitesailApprentice.java b/Mage.Sets/src/mage/cards/k/KitesailApprentice.java index 61403d4b25..7c8a554da8 100644 --- a/Mage.Sets/src/mage/cards/k/KitesailApprentice.java +++ b/Mage.Sets/src/mage/cards/k/KitesailApprentice.java @@ -27,9 +27,6 @@ */ package mage.cards.k; -import java.util.UUID; - -import mage.constants.CardType; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.EquippedSourceCondition; @@ -39,9 +36,12 @@ 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.Duration; import mage.constants.Zone; +import java.util.UUID; + /** * * @author Loki @@ -60,9 +60,9 @@ public class KitesailApprentice extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(1); - ConditionalContinuousEffect effect1 = new ConditionalContinuousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), EquippedSourceCondition.getInstance(), rule1); + ConditionalContinuousEffect effect1 = new ConditionalContinuousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), EquippedSourceCondition.instance, rule1); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect1)); - ConditionalContinuousEffect effect2 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance()), EquippedSourceCondition.getInstance(), rule2); + ConditionalContinuousEffect effect2 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance()), EquippedSourceCondition.instance, rule2); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect2)); } diff --git a/Mage.Sets/src/mage/cards/k/KorScythemaster.java b/Mage.Sets/src/mage/cards/k/KorScythemaster.java index 4befcda12a..d84c3a0943 100644 --- a/Mage.Sets/src/mage/cards/k/KorScythemaster.java +++ b/Mage.Sets/src/mage/cards/k/KorScythemaster.java @@ -27,7 +27,6 @@ */ package mage.cards.k; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.SourceAttackingCondition; @@ -39,6 +38,8 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; +import java.util.UUID; + /** * * @author fireshoes @@ -54,7 +55,7 @@ public class KorScythemaster extends CardImpl { this.toughness = new MageInt(1); // Kor Scythemaster has first strike as long as its attacking. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), SourceAttackingCondition.getInstance(), "{this} has first strike as long as it's attacking"))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), SourceAttackingCondition.instance, "{this} has first strike as long as it's attacking"))); } public KorScythemaster(final KorScythemaster card) { diff --git a/Mage.Sets/src/mage/cards/l/LadySun.java b/Mage.Sets/src/mage/cards/l/LadySun.java index d988b831f6..7f47b4e4b3 100644 --- a/Mage.Sets/src/mage/cards/l/LadySun.java +++ b/Mage.Sets/src/mage/cards/l/LadySun.java @@ -27,7 +27,6 @@ */ package mage.cards.l; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; @@ -45,6 +44,8 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author fireshoes @@ -68,7 +69,7 @@ public class LadySun extends CardImpl { Effect effect = new ReturnToHandSourceEffect(true); effect.setText("Return Lady Sun"); Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - effect, new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + effect, new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); effect = new ReturnToHandTargetEffect(); effect.setText("and another target creature to their owners' hands"); ability.addTarget(new TargetCreaturePermanent(filter)); diff --git a/Mage.Sets/src/mage/cards/l/LeoninDenGuard.java b/Mage.Sets/src/mage/cards/l/LeoninDenGuard.java index 81a4c064ad..bb61febf2d 100644 --- a/Mage.Sets/src/mage/cards/l/LeoninDenGuard.java +++ b/Mage.Sets/src/mage/cards/l/LeoninDenGuard.java @@ -27,9 +27,6 @@ */ package mage.cards.l; -import java.util.UUID; - -import mage.constants.CardType; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.EquippedSourceCondition; @@ -39,9 +36,12 @@ import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; +import java.util.UUID; + /** * * @author Loki @@ -61,9 +61,9 @@ public class LeoninDenGuard extends CardImpl { this.toughness = new MageInt(3); // As long as Leonin Den-Guard is equipped, it gets +1/+1 and has vigilance. - ConditionalContinuousEffect effect1 = new ConditionalContinuousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), EquippedSourceCondition.getInstance(), rule1); + ConditionalContinuousEffect effect1 = new ConditionalContinuousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), EquippedSourceCondition.instance, rule1); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect1)); - ConditionalContinuousEffect effect2 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance()), EquippedSourceCondition.getInstance(), rule2); + ConditionalContinuousEffect effect2 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance()), EquippedSourceCondition.instance, rule2); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect2)); } diff --git a/Mage.Sets/src/mage/cards/l/LoyalRetainers.java b/Mage.Sets/src/mage/cards/l/LoyalRetainers.java index c7ffb2726f..8281c286b8 100644 --- a/Mage.Sets/src/mage/cards/l/LoyalRetainers.java +++ b/Mage.Sets/src/mage/cards/l/LoyalRetainers.java @@ -27,7 +27,6 @@ */ package mage.cards.l; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; @@ -42,6 +41,8 @@ import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.mageobject.SupertypePredicate; import mage.target.common.TargetCardInYourGraveyard; +import java.util.UUID; + /** * * @author LevelX2 @@ -63,7 +64,7 @@ public class LoyalRetainers extends CardImpl { this.toughness = new MageInt(1); // Sacrifice Loyal Retainers: Return target legendary creature card from your graveyard to the battlefield. Activate this ability only during your turn, before attackers are declared. - Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new SacrificeSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new SacrificeSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCardInYourGraveyard(filter)); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/l/LuSuWuAdvisor.java b/Mage.Sets/src/mage/cards/l/LuSuWuAdvisor.java index 3bc4e2e24c..8a78445e6a 100644 --- a/Mage.Sets/src/mage/cards/l/LuSuWuAdvisor.java +++ b/Mage.Sets/src/mage/cards/l/LuSuWuAdvisor.java @@ -57,7 +57,7 @@ public class LuSuWuAdvisor extends CardImpl { // {tap}: Draw a card. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new DrawCardSourceControllerEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new DrawCardSourceControllerEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/m/MyrServitor.java b/Mage.Sets/src/mage/cards/m/MyrServitor.java index a79e35065b..50f35f9912 100644 --- a/Mage.Sets/src/mage/cards/m/MyrServitor.java +++ b/Mage.Sets/src/mage/cards/m/MyrServitor.java @@ -27,7 +27,6 @@ */ package mage.cards.m; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; @@ -45,6 +44,8 @@ import mage.filter.predicate.mageobject.NamePredicate; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** * * @author LevelX2 @@ -61,7 +62,7 @@ public class MyrServitor extends CardImpl { // At the beginning of your upkeep, if Myr Servitor is on the battlefield, each player returns all cards named Myr Servitor from his or her graveyard to the battlefield. this.addAbility(new ConditionalTriggeredAbility( new BeginningOfUpkeepTriggeredAbility(new MyrServitorReturnEffect(), TargetController.YOU, false), - SourceOnBattlefieldCondition.getInstance(), + SourceOnBattlefieldCondition.instance, "At the beginning of your upkeep, if {this} is on the battlefield, each player returns all cards named Myr Servitor from his or her graveyard to the battlefield" )); diff --git a/Mage.Sets/src/mage/cards/m/MysteriesOfTheDeep.java b/Mage.Sets/src/mage/cards/m/MysteriesOfTheDeep.java index 5ac9903f14..5c4719ea06 100644 --- a/Mage.Sets/src/mage/cards/m/MysteriesOfTheDeep.java +++ b/Mage.Sets/src/mage/cards/m/MysteriesOfTheDeep.java @@ -27,15 +27,16 @@ */ package mage.cards.m; -import java.util.UUID; -import mage.constants.CardType; import mage.abilities.condition.common.LandfallCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; import mage.watchers.common.LandfallWatcher; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -48,7 +49,7 @@ public class MysteriesOfTheDeep extends CardImpl { // Draw two cards. // Landfall - If you had a land enter the battlefield under your control this turn, draw three cards instead. this.getSpellAbility().addWatcher(new LandfallWatcher()); - this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new DrawCardSourceControllerEffect(3), new DrawCardSourceControllerEffect(2), LandfallCondition.getInstance(), "Draw 2 cards. Landfall - If you had a land enter the battlefield under your control this turn, draw three cards instead")); + this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new DrawCardSourceControllerEffect(3), new DrawCardSourceControllerEffect(2), LandfallCondition.instance, "Draw 2 cards. Landfall - If you had a land enter the battlefield under your control this turn, draw three cards instead")); } public MysteriesOfTheDeep(final MysteriesOfTheDeep card) { diff --git a/Mage.Sets/src/mage/cards/n/Necromancy.java b/Mage.Sets/src/mage/cards/n/Necromancy.java index 73390856cb..0fe2d0e986 100644 --- a/Mage.Sets/src/mage/cards/n/Necromancy.java +++ b/Mage.Sets/src/mage/cards/n/Necromancy.java @@ -27,7 +27,6 @@ */ package mage.cards.n; -import java.util.UUID; import mage.MageObjectReference; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -44,13 +43,7 @@ import mage.abilities.keyword.EnchantAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.DependencyType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.PermanentIdPredicate; @@ -61,6 +54,8 @@ import mage.target.Target; import mage.target.common.TargetCardInGraveyard; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author LevelX2 @@ -79,7 +74,7 @@ public class Necromancy extends CardImpl { // When Necromancy leaves the battlefield, that creature's controller sacrifices it. Ability ability = new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new NecromancyReAttachEffect(), false), - SourceOnBattlefieldCondition.getInstance(), + SourceOnBattlefieldCondition.instance, "When {this} enters the battlefield, if it's on the battlefield, it becomes an Aura with \"enchant creature put onto the battlefield with {this}.\" Put target creature card from a graveyard onto the battlefield under your control and attach {this} to it."); ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card from a graveyard"))); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/n/NekoTe.java b/Mage.Sets/src/mage/cards/n/NekoTe.java index b2dbbed4d4..2f335833f7 100644 --- a/Mage.Sets/src/mage/cards/n/NekoTe.java +++ b/Mage.Sets/src/mage/cards/n/NekoTe.java @@ -27,7 +27,6 @@ */ package mage.cards.n; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.DealsDamageToACreatureAttachedTriggeredAbility; import mage.abilities.common.DealsDamageToAPlayerAttachedTriggeredAbility; @@ -35,8 +34,8 @@ import mage.abilities.condition.common.SourceOnBattlefieldCondition; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect; import mage.abilities.effects.ContinuousRuleModifyingEffect; -import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.DontUntapInControllersUntapStepTargetEffect; +import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.TapTargetEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; @@ -45,6 +44,8 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; +import java.util.UUID; + /** * * @author LevelX2 @@ -58,7 +59,7 @@ public class NekoTe extends CardImpl { // Whenever equipped creature deals damage to a creature, tap that creature. That creature doesn't untap during its controller's untap step for as long as Neko-Te remains on the battlefield. ContinuousRuleModifyingEffect skipUntapEffect = new DontUntapInControllersUntapStepTargetEffect(Duration.WhileOnBattlefield); skipUntapEffect.setText("That creature doesn't untap during its controller's untap step for as long as {this} remains on the battlefield"); - ConditionalContinuousRuleModifyingEffect effect = new ConditionalContinuousRuleModifyingEffect(skipUntapEffect, new SourceOnBattlefieldCondition()); + ConditionalContinuousRuleModifyingEffect effect = new ConditionalContinuousRuleModifyingEffect(skipUntapEffect, SourceOnBattlefieldCondition.instance); Ability ability = new DealsDamageToACreatureAttachedTriggeredAbility(new TapTargetEffect("that creature"), false, "equipped creature", false, true); ability.addEffect(effect); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/n/Nihilith.java b/Mage.Sets/src/mage/cards/n/Nihilith.java index 6762ed6635..51cf55c202 100644 --- a/Mage.Sets/src/mage/cards/n/Nihilith.java +++ b/Mage.Sets/src/mage/cards/n/Nihilith.java @@ -27,7 +27,6 @@ */ package mage.cards.n; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility; import mage.abilities.condition.common.SuspendedCondition; @@ -45,6 +44,8 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.FilterCard; +import java.util.UUID; + /** * * @author LevelX2 @@ -67,7 +68,7 @@ public class Nihilith extends CardImpl { this.addAbility(new ConditionalTriggeredAbility( new PutCardIntoGraveFromAnywhereAllTriggeredAbility(Zone.EXILED, new RemoveCounterSourceEffect(CounterType.TIME.createInstance()), true, new FilterCard(), TargetController.OPPONENT, SetTargetPointer.NONE), - SuspendedCondition.getInstance(), + SuspendedCondition.instance, "Whenever a card is put into an opponent's graveyard from anywhere, if {this} is suspended, you may remove a time counter from {this}." )); diff --git a/Mage.Sets/src/mage/cards/n/NorwoodPriestess.java b/Mage.Sets/src/mage/cards/n/NorwoodPriestess.java index fd26904e92..98a5e17ed8 100644 --- a/Mage.Sets/src/mage/cards/n/NorwoodPriestess.java +++ b/Mage.Sets/src/mage/cards/n/NorwoodPriestess.java @@ -27,7 +27,6 @@ */ package mage.cards.n; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.ActivateIfConditionActivatedAbility; @@ -41,6 +40,8 @@ import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.mageobject.ColorPredicate; +import java.util.UUID; + /** * * @author fireshoes @@ -65,7 +66,7 @@ public class NorwoodPriestess extends CardImpl { Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter), new TapSourceCost(), - MyTurnBeforeAttackersDeclaredCondition.getInstance() + MyTurnBeforeAttackersDeclaredCondition.instance )); } diff --git a/Mage.Sets/src/mage/cards/p/PangTongYoungPhoenix.java b/Mage.Sets/src/mage/cards/p/PangTongYoungPhoenix.java index 37593148fb..a921ba15aa 100644 --- a/Mage.Sets/src/mage/cards/p/PangTongYoungPhoenix.java +++ b/Mage.Sets/src/mage/cards/p/PangTongYoungPhoenix.java @@ -59,7 +59,7 @@ public class PangTongYoungPhoenix extends CardImpl { // {tap}: Target creature gets +0/+2 until end of turn. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new BoostTargetEffect(0, 2, Duration.EndOfTurn), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new BoostTargetEffect(0, 2, Duration.EndOfTurn), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/p/Panic.java b/Mage.Sets/src/mage/cards/p/Panic.java index d662e8146f..b3b96d2fe7 100644 --- a/Mage.Sets/src/mage/cards/p/Panic.java +++ b/Mage.Sets/src/mage/cards/p/Panic.java @@ -27,7 +27,6 @@ */ package mage.cards.p; -import java.util.UUID; import mage.abilities.common.CastOnlyDuringPhaseStepSourceAbility; import mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility; import mage.abilities.condition.common.BeforeBlockersAreDeclaredCondition; @@ -41,6 +40,8 @@ import mage.constants.Duration; import mage.constants.TurnPhase; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author fireshoes @@ -51,7 +52,7 @@ public class Panic extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R}"); // Cast Panic only during combat before blockers are declared. - this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(TurnPhase.COMBAT, BeforeBlockersAreDeclaredCondition.getInstance())); + this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(TurnPhase.COMBAT, BeforeBlockersAreDeclaredCondition.instance)); // Target creature can't block this turn. this.getSpellAbility().addTarget(new TargetCreaturePermanent()); diff --git a/Mage.Sets/src/mage/cards/p/PardicDragon.java b/Mage.Sets/src/mage/cards/p/PardicDragon.java index 066c516b47..159adf9793 100644 --- a/Mage.Sets/src/mage/cards/p/PardicDragon.java +++ b/Mage.Sets/src/mage/cards/p/PardicDragon.java @@ -27,7 +27,6 @@ */ package mage.cards.p; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -43,17 +42,14 @@ import mage.abilities.keyword.SuspendAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.ColoredManaSymbol; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.SetTargetPointer; -import mage.constants.Zone; +import mage.constants.*; import mage.counters.CounterType; import mage.filter.FilterSpell; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** * * @author LevelX2 @@ -76,7 +72,7 @@ public class PardicDragon extends CardImpl { // Whenever an opponent casts a spell, if Pardic Dragon is suspended, that player may put a time counter on Pardic Dragon. this.addAbility(new ConditionalTriggeredAbility( new SpellCastOpponentTriggeredAbility(Zone.EXILED, new PardicDragonEffect(), new FilterSpell(), false, SetTargetPointer.PLAYER), - SuspendedCondition.getInstance(), + SuspendedCondition.instance, "Whenever an opponent casts a spell, if {this} is suspended, that player may put a time counter on {this}." )); diff --git a/Mage.Sets/src/mage/cards/r/RakshaGoldenCub.java b/Mage.Sets/src/mage/cards/r/RakshaGoldenCub.java index e26d17ba6b..8376c0eaaf 100644 --- a/Mage.Sets/src/mage/cards/r/RakshaGoldenCub.java +++ b/Mage.Sets/src/mage/cards/r/RakshaGoldenCub.java @@ -27,7 +27,6 @@ */ package mage.cards.r; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; @@ -45,6 +44,8 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.ControllerPredicate; +import java.util.UUID; + /** * * @author Plopman @@ -70,12 +71,12 @@ public class RakshaGoldenCub extends CardImpl { // As long as Raksha Golden Cub is equipped, Cat creatures you control get +2/+2 and have double strike. Effect effect1 = new ConditionalContinuousEffect( new BoostAllEffect(2, 2, Duration.WhileOnBattlefield, filter, false), - EquippedSourceCondition.getInstance(), + EquippedSourceCondition.instance, "As long as {this} is equipped, Cat creatures you control get +2/+2"); Effect effect2 = new ConditionalContinuousEffect( new GainAbilityAllEffect(DoubleStrikeAbility.getInstance(), Duration.WhileOnBattlefield, filter, false), - EquippedSourceCondition.getInstance(), + EquippedSourceCondition.instance, "As long as {this} is equipped, Cat creatures you control have double strike"); effect2.setText("and have double strike"); diff --git a/Mage.Sets/src/mage/cards/r/RestForTheWeary.java b/Mage.Sets/src/mage/cards/r/RestForTheWeary.java index ceaf2a6ab7..e03cedb8f8 100644 --- a/Mage.Sets/src/mage/cards/r/RestForTheWeary.java +++ b/Mage.Sets/src/mage/cards/r/RestForTheWeary.java @@ -27,16 +27,17 @@ */ package mage.cards.r; -import java.util.UUID; -import mage.constants.CardType; import mage.abilities.condition.common.LandfallCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.GainLifeTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; import mage.target.TargetPlayer; import mage.watchers.common.LandfallWatcher; +import java.util.UUID; + /** * * @author Loki @@ -49,7 +50,7 @@ public class RestForTheWeary extends CardImpl { // Target player gains 4 life. // Landfall - If you had a land enter the battlefield under your control this turn, that player gains 8 life instead. this.getSpellAbility().addWatcher(new LandfallWatcher()); - this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new GainLifeTargetEffect(8), new GainLifeTargetEffect(4), LandfallCondition.getInstance(), "Target player gains 4 life.
Landfall - If you had a land enter the battlefield under your control this turn, that player gains 8 life instead")); + this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new GainLifeTargetEffect(8), new GainLifeTargetEffect(4), LandfallCondition.instance, "Target player gains 4 life.
Landfall - If you had a land enter the battlefield under your control this turn, that player gains 8 life instead")); this.getSpellAbility().addTarget(new TargetPlayer()); } diff --git a/Mage.Sets/src/mage/cards/r/RiverOfTears.java b/Mage.Sets/src/mage/cards/r/RiverOfTears.java index 9a7b04b774..3996cf0325 100644 --- a/Mage.Sets/src/mage/cards/r/RiverOfTears.java +++ b/Mage.Sets/src/mage/cards/r/RiverOfTears.java @@ -27,9 +27,6 @@ */ package mage.cards.r; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Zone; import mage.Mana; import mage.abilities.condition.common.LandfallCondition; import mage.abilities.costs.common.TapSourceCost; @@ -38,8 +35,12 @@ import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.mana.ConditionalManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; import mage.watchers.common.LandfallWatcher; +import java.util.UUID; + /** * * @author LevelX2 @@ -53,7 +54,7 @@ public class RiverOfTears extends CardImpl { this.addAbility(new ConditionalManaAbility(Zone.BATTLEFIELD, new ConditionalManaEffect( new BasicManaEffect(Mana.BlackMana(1)), new BasicManaEffect(Mana.BlueMana(1)), - LandfallCondition.getInstance(), + LandfallCondition.instance, "Add {U} to your mana pool. If you played a land this turn, add {B} to your mana pool instead"), new TapSourceCost()), new LandfallWatcher()); diff --git a/Mage.Sets/src/mage/cards/s/ShuFarmer.java b/Mage.Sets/src/mage/cards/s/ShuFarmer.java index 164e89685f..6f7823ee34 100644 --- a/Mage.Sets/src/mage/cards/s/ShuFarmer.java +++ b/Mage.Sets/src/mage/cards/s/ShuFarmer.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; @@ -39,6 +38,8 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; +import java.util.UUID; + /** * * @author fireshoes @@ -53,7 +54,7 @@ public class ShuFarmer extends CardImpl { // {tap}: You gain 1 life. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new GainLifeEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new GainLifeEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SiegeBehemoth.java b/Mage.Sets/src/mage/cards/s/SiegeBehemoth.java index 9ee700e345..a65a07436c 100644 --- a/Mage.Sets/src/mage/cards/s/SiegeBehemoth.java +++ b/Mage.Sets/src/mage/cards/s/SiegeBehemoth.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.DamageAsThoughNotBlockedAbility; import mage.abilities.common.SimpleStaticAbility; @@ -41,6 +40,8 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; +import java.util.UUID; + /** * * @author LevelX2 @@ -62,7 +63,7 @@ public class SiegeBehemoth extends CardImpl { Zone.BATTLEFIELD, new ConditionalContinuousEffect( new GainAbilityControlledEffect(DamageAsThoughNotBlockedAbility.getInstance(), Duration.WhileOnBattlefield), - SourceAttackingCondition.getInstance(), + SourceAttackingCondition.instance, "As long as {this} is attacking, for each creature you control, you may have that creature assign its combat damage as though it weren't blocked" ))); } diff --git a/Mage.Sets/src/mage/cards/s/SkyhunterCub.java b/Mage.Sets/src/mage/cards/s/SkyhunterCub.java index 58739de072..de603c502c 100644 --- a/Mage.Sets/src/mage/cards/s/SkyhunterCub.java +++ b/Mage.Sets/src/mage/cards/s/SkyhunterCub.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.EquippedSourceCondition; @@ -41,6 +40,8 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; +import java.util.UUID; + /** * * @author Derpthemeus @@ -58,9 +59,9 @@ public class SkyhunterCub extends CardImpl { this.toughness = new MageInt(2); // As long as Skyhunter Cub is equipped, it gets +1/+1 and has flying. - ConditionalContinuousEffect effect1 = new ConditionalContinuousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), EquippedSourceCondition.getInstance(), rule1); + ConditionalContinuousEffect effect1 = new ConditionalContinuousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), EquippedSourceCondition.instance, rule1); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect1)); - ConditionalContinuousEffect effect2 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance()), EquippedSourceCondition.getInstance(), rule2); + ConditionalContinuousEffect effect2 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance()), EquippedSourceCondition.instance, rule2); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect2)); } diff --git a/Mage.Sets/src/mage/cards/s/SkylineDespot.java b/Mage.Sets/src/mage/cards/s/SkylineDespot.java index 8e9b34bf67..a3dd2ba6a6 100644 --- a/Mage.Sets/src/mage/cards/s/SkylineDespot.java +++ b/Mage.Sets/src/mage/cards/s/SkylineDespot.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -43,6 +42,8 @@ import mage.constants.TargetController; import mage.constants.Zone; import mage.game.permanent.token.DragonToken2; +import java.util.UUID; + /** * * @author LevelX2 @@ -64,7 +65,7 @@ public class SkylineDespot extends CardImpl { // At the beginning of your upkeep, if you're the monarch, put a 5/5 red Dragon creature token with flying onto the battlefield. this.addAbility(new ConditionalTriggeredAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new DragonToken2()), - TargetController.YOU, false), MonarchIsSourceControllerCondition.getInstance(), + TargetController.YOU, false), MonarchIsSourceControllerCondition.instance, "At the beginning of your upkeep, if you're the monarch, put a 5/5 red Dragon creature token with flying onto the battlefield.")); } diff --git a/Mage.Sets/src/mage/cards/s/SoltariLancer.java b/Mage.Sets/src/mage/cards/s/SoltariLancer.java index 62fb1c0366..37f851fe68 100644 --- a/Mage.Sets/src/mage/cards/s/SoltariLancer.java +++ b/Mage.Sets/src/mage/cards/s/SoltariLancer.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.SourceAttackingCondition; @@ -40,6 +39,8 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; +import java.util.UUID; + /** * * @author fireshoes @@ -57,7 +58,7 @@ public class SoltariLancer extends CardImpl { this.addAbility(ShadowAbility.getInstance()); // Soltari Lancer has first strike as long as it's attacking. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), SourceAttackingCondition.getInstance(), "{this} has first strike as long as it's attacking"))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), SourceAttackingCondition.instance, "{this} has first strike as long as it's attacking"))); } public SoltariLancer(final SoltariLancer card) { diff --git a/Mage.Sets/src/mage/cards/s/SowerOfTemptation.java b/Mage.Sets/src/mage/cards/s/SowerOfTemptation.java index d4ce7112ee..9643c047b0 100644 --- a/Mage.Sets/src/mage/cards/s/SowerOfTemptation.java +++ b/Mage.Sets/src/mage/cards/s/SowerOfTemptation.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -44,6 +43,8 @@ import mage.constants.Outcome; import mage.game.Game; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author Loki @@ -65,7 +66,7 @@ public class SowerOfTemptation extends CardImpl { // remains on the battlefield, even if a different player gains control of Sower of Temptation itself. ConditionalContinuousEffect effect = new ConditionalContinuousEffect( new GainControlTargetEffect(Duration.Custom, true), - new SourceOnBattlefieldCondition(), + SourceOnBattlefieldCondition.instance, "gain control of target creature for as long as {this} remains on the battlefield"); Ability ability = new EntersBattlefieldTriggeredAbility(effect, false); ability.addTarget(new TargetCreaturePermanent()); @@ -103,7 +104,7 @@ class SowerOfTemptationGainControlEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { ConditionalContinuousEffect effect = new ConditionalContinuousEffect( new GainControlTargetEffect(Duration.Custom), - new SourceOnBattlefieldCondition(), + SourceOnBattlefieldCondition.instance, "gain control of target creature for as long as {this} remains on the battlefield"); game.addEffect(effect, source); return false; diff --git a/Mage.Sets/src/mage/cards/s/SpiritOfTheNight.java b/Mage.Sets/src/mage/cards/s/SpiritOfTheNight.java index 178f70d68b..5da19010f4 100644 --- a/Mage.Sets/src/mage/cards/s/SpiritOfTheNight.java +++ b/Mage.Sets/src/mage/cards/s/SpiritOfTheNight.java @@ -70,7 +70,7 @@ public class SpiritOfTheNight extends CardImpl { this.addAbility(ProtectionAbility.from(ObjectColor.BLACK)); // Spirit of the Night has first strike as long as it's attacking. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), SourceAttackingCondition.getInstance(), "{this} has first strike as long as it's attacking"))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), SourceAttackingCondition.instance, "{this} has first strike as long as it's attacking"))); } public SpiritOfTheNight(final SpiritOfTheNight card) { diff --git a/Mage.Sets/src/mage/cards/s/SteamCatapult.java b/Mage.Sets/src/mage/cards/s/SteamCatapult.java index 75518babb3..cf73063a49 100644 --- a/Mage.Sets/src/mage/cards/s/SteamCatapult.java +++ b/Mage.Sets/src/mage/cards/s/SteamCatapult.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; @@ -42,6 +41,8 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.TappedPredicate; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author fireshoes @@ -63,7 +64,7 @@ public class SteamCatapult extends CardImpl { // {tap}: Destroy target tapped creature. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new DestroyTargetEffect(), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new DestroyTargetEffect(), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreaturePermanent(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SternMarshal.java b/Mage.Sets/src/mage/cards/s/SternMarshal.java index f3bdb10443..4430a0304d 100644 --- a/Mage.Sets/src/mage/cards/s/SternMarshal.java +++ b/Mage.Sets/src/mage/cards/s/SternMarshal.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; @@ -41,6 +40,8 @@ import mage.constants.Duration; import mage.constants.Zone; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author fireshoes @@ -56,7 +57,7 @@ public class SternMarshal extends CardImpl { // {tap}: Target creature gets +2/+2 until end of turn. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new BoostTargetEffect(2, 2, Duration.EndOfTurn), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new BoostTargetEffect(2, 2, Duration.EndOfTurn), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/StoneCatapult.java b/Mage.Sets/src/mage/cards/s/StoneCatapult.java index 8dada2bc5e..d7998c13e5 100644 --- a/Mage.Sets/src/mage/cards/s/StoneCatapult.java +++ b/Mage.Sets/src/mage/cards/s/StoneCatapult.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -45,6 +44,8 @@ import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.permanent.TappedPredicate; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author fireshoes @@ -67,7 +68,7 @@ public class StoneCatapult extends CardImpl { // {tap}: Destroy target tapped nonblack creature. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new DestroyTargetEffect(), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new DestroyTargetEffect(), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreaturePermanent(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SunspearShikari.java b/Mage.Sets/src/mage/cards/s/SunspearShikari.java index a0741ec783..2618ee2a47 100644 --- a/Mage.Sets/src/mage/cards/s/SunspearShikari.java +++ b/Mage.Sets/src/mage/cards/s/SunspearShikari.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; @@ -41,6 +40,8 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; +import java.util.UUID; + /** * * @author nantuko @@ -57,10 +58,10 @@ public class SunspearShikari extends CardImpl { // As long as Sunspear Shikari is equipped, it has first strike and lifelink. ConditionalContinuousEffect effect1 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), - EquippedSourceCondition.getInstance(), "As long as {this} is equipped, it has first strike"); + EquippedSourceCondition.instance, "As long as {this} is equipped, it has first strike"); Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect1); ConditionalContinuousEffect effect2 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(LifelinkAbility.getInstance()), - EquippedSourceCondition.getInstance(), "and lifelink"); + EquippedSourceCondition.instance, "and lifelink"); ability.addEffect(effect2); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/TalasResearcher.java b/Mage.Sets/src/mage/cards/t/TalasResearcher.java index 154bbeb188..2ceb287c59 100644 --- a/Mage.Sets/src/mage/cards/t/TalasResearcher.java +++ b/Mage.Sets/src/mage/cards/t/TalasResearcher.java @@ -27,7 +27,6 @@ */ package mage.cards.t; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; @@ -39,6 +38,8 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; +import java.util.UUID; + /** * * @author fireshoes @@ -55,7 +56,8 @@ public class TalasResearcher extends CardImpl { // {tap}: Draw a card. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new DrawCardSourceControllerEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new DrawCardSourceControllerEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); + this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/TempleElder.java b/Mage.Sets/src/mage/cards/t/TempleElder.java index 8fc8b537e5..b57ce42741 100644 --- a/Mage.Sets/src/mage/cards/t/TempleElder.java +++ b/Mage.Sets/src/mage/cards/t/TempleElder.java @@ -27,7 +27,6 @@ */ package mage.cards.t; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; @@ -39,6 +38,8 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; +import java.util.UUID; + /** * * @author fireshoes @@ -54,7 +55,7 @@ public class TempleElder extends CardImpl { // {tap}: You gain 1 life. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new GainLifeEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new GainLifeEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/ThroneWarden.java b/Mage.Sets/src/mage/cards/t/ThroneWarden.java index 18b44a16de..80836e4950 100644 --- a/Mage.Sets/src/mage/cards/t/ThroneWarden.java +++ b/Mage.Sets/src/mage/cards/t/ThroneWarden.java @@ -27,7 +27,6 @@ */ package mage.cards.t; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; import mage.abilities.condition.common.MonarchIsSourceControllerCondition; @@ -39,6 +38,8 @@ import mage.constants.TargetController; import mage.constants.Zone; import mage.counters.CounterType; +import java.util.UUID; + /** * * @author LevelX2 @@ -55,7 +56,7 @@ public class ThroneWarden extends CardImpl { // At the beginning of your end step, if you're the monarch, put a +1/+1 counter on Throne Warden. this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), - TargetController.YOU, MonarchIsSourceControllerCondition.getInstance(), false)); + TargetController.YOU, MonarchIsSourceControllerCondition.instance, false)); } public ThroneWarden(final ThroneWarden card) { diff --git a/Mage.Sets/src/mage/cards/t/TombHex.java b/Mage.Sets/src/mage/cards/t/TombHex.java index 5a850d64f2..897f7af93d 100644 --- a/Mage.Sets/src/mage/cards/t/TombHex.java +++ b/Mage.Sets/src/mage/cards/t/TombHex.java @@ -27,19 +27,19 @@ */ package mage.cards.t; -import java.util.UUID; import mage.abilities.condition.LockedInCondition; - -import mage.constants.CardType; import mage.abilities.condition.common.LandfallCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; import mage.constants.Duration; import mage.target.common.TargetCreaturePermanent; import mage.watchers.common.LandfallWatcher; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -53,7 +53,7 @@ public class TombHex extends CardImpl { // Landfall - If you had a land enter the battlefield under your control this turn, that creature gets -4/-4 until end of turn instead. this.getSpellAbility().addWatcher(new LandfallWatcher()); this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new BoostTargetEffect(-4, -4, Duration.EndOfTurn), new BoostTargetEffect(-2, -2, Duration.EndOfTurn), - new LockedInCondition(LandfallCondition.getInstance()), + new LockedInCondition(LandfallCondition.instance), "Target creature gets -2/-2 until end of turn.
Landfall — If you had a land enter the battlefield under your control this turn, that creature gets -4/-4 until end of turn instead")); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } diff --git a/Mage.Sets/src/mage/cards/w/WuLongbowman.java b/Mage.Sets/src/mage/cards/w/WuLongbowman.java index cf38566b30..90d121577e 100644 --- a/Mage.Sets/src/mage/cards/w/WuLongbowman.java +++ b/Mage.Sets/src/mage/cards/w/WuLongbowman.java @@ -27,7 +27,6 @@ */ package mage.cards.w; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; @@ -40,6 +39,8 @@ import mage.constants.CardType; import mage.constants.Zone; import mage.target.common.TargetCreatureOrPlayer; +import java.util.UUID; + /** * * @author fireshoes @@ -56,7 +57,7 @@ public class WuLongbowman extends CardImpl { // {tap}: Wu Longbowman deals 1 damage to target creature or player. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new DamageTargetEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new DamageTargetEffect(1), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/x/XiahouDunTheOneEyed.java b/Mage.Sets/src/mage/cards/x/XiahouDunTheOneEyed.java index 42be882c02..434e5697b9 100644 --- a/Mage.Sets/src/mage/cards/x/XiahouDunTheOneEyed.java +++ b/Mage.Sets/src/mage/cards/x/XiahouDunTheOneEyed.java @@ -71,7 +71,7 @@ public class XiahouDunTheOneEyed extends CardImpl { // Sacrifice Xiahou Dun, the One-Eyed: Return target black card from your graveyard to your hand. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new ReturnFromGraveyardToHandTargetEffect(), new SacrificeSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new ReturnFromGraveyardToHandTargetEffect(), new SacrificeSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCardInYourGraveyard(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/x/XunYuWeiAdvisor.java b/Mage.Sets/src/mage/cards/x/XunYuWeiAdvisor.java index 40d3dffd0b..c2c33a8cad 100644 --- a/Mage.Sets/src/mage/cards/x/XunYuWeiAdvisor.java +++ b/Mage.Sets/src/mage/cards/x/XunYuWeiAdvisor.java @@ -27,7 +27,6 @@ */ package mage.cards.x; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; @@ -42,6 +41,8 @@ import mage.constants.SuperType; import mage.constants.Zone; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** * * @author fireshoes @@ -58,7 +59,7 @@ public class XunYuWeiAdvisor extends CardImpl { // {tap}: Target creature you control gets +2/+0 until end of turn. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new BoostTargetEffect(2, 0, Duration.EndOfTurn), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new BoostTargetEffect(2, 0, Duration.EndOfTurn), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetControlledCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/z/ZhugeJinWuStrategist.java b/Mage.Sets/src/mage/cards/z/ZhugeJinWuStrategist.java index 817f28dc26..00f4e5f0a4 100644 --- a/Mage.Sets/src/mage/cards/z/ZhugeJinWuStrategist.java +++ b/Mage.Sets/src/mage/cards/z/ZhugeJinWuStrategist.java @@ -60,7 +60,7 @@ public class ZhugeJinWuStrategist extends CardImpl { // {tap}: Target creature can't be blocked this turn. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, - new CantBeBlockedTargetEffect(Duration.EndOfTurn), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); + new CantBeBlockedTargetEffect(Duration.EndOfTurn), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.instance); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage/src/main/java/mage/abilities/abilityword/LieutenantAbility.java b/Mage/src/main/java/mage/abilities/abilityword/LieutenantAbility.java index 55efa7e72d..6471e97e76 100644 --- a/Mage/src/main/java/mage/abilities/abilityword/LieutenantAbility.java +++ b/Mage/src/main/java/mage/abilities/abilityword/LieutenantAbility.java @@ -46,14 +46,14 @@ import mage.constants.Zone; public class LieutenantAbility extends SimpleStaticAbility { public LieutenantAbility(ContinuousEffect effect) { - super(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield), CommanderInPlayCondition.getInstance(), "Lieutenant - As long as you control your commander, {this} gets +2/+2")); - this.addEffect(new ConditionalContinuousEffect(effect, CommanderInPlayCondition.getInstance(), effect.getText(null))); + super(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield), CommanderInPlayCondition.instance, "Lieutenant - As long as you control your commander, {this} gets +2/+2")); + this.addEffect(new ConditionalContinuousEffect(effect, CommanderInPlayCondition.instance, effect.getText(null))); } public LieutenantAbility(Effects effects) { - super(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield), CommanderInPlayCondition.getInstance(), "Lieutenant - As long as you control your commander, {this} gets +2/+2")); + super(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield), CommanderInPlayCondition.instance, "Lieutenant - As long as you control your commander, {this} gets +2/+2")); for (Effect effect : effects) { - this.addEffect(new ConditionalContinuousEffect((ContinuousEffect) effect, CommanderInPlayCondition.getInstance(), effect.getText(null))); + this.addEffect(new ConditionalContinuousEffect((ContinuousEffect) effect, CommanderInPlayCondition.instance, effect.getText(null))); } } diff --git a/Mage/src/main/java/mage/abilities/condition/common/BeforeBlockersAreDeclaredCondition.java b/Mage/src/main/java/mage/abilities/condition/common/BeforeBlockersAreDeclaredCondition.java index 352e1506d5..cf529fa0de 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/BeforeBlockersAreDeclaredCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/BeforeBlockersAreDeclaredCondition.java @@ -16,13 +16,9 @@ import mage.game.Game; * * @author LevelX2 */ -public class BeforeBlockersAreDeclaredCondition implements Condition { +public enum BeforeBlockersAreDeclaredCondition implements Condition { - private static final BeforeBlockersAreDeclaredCondition instance = new BeforeBlockersAreDeclaredCondition(); - - public static Condition getInstance() { - return instance; - } + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/CommanderInPlayCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CommanderInPlayCondition.java index a6ba1a0972..5d340bc948 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/CommanderInPlayCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/CommanderInPlayCondition.java @@ -27,31 +27,22 @@ */ package mage.abilities.condition.common; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.Condition; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import java.util.UUID; + /** * Checks if the player has its commander in play and controls it * * @author LevelX2 */ -public class CommanderInPlayCondition implements Condition { +public enum CommanderInPlayCondition implements Condition { - private static CommanderInPlayCondition instance = null; - - private CommanderInPlayCondition() { - } - - public static Condition getInstance() { - if (instance == null) { - instance = new CommanderInPlayCondition(); - } - return instance; - } + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/EquippedSourceCondition.java b/Mage/src/main/java/mage/abilities/condition/common/EquippedSourceCondition.java index 8c7fb5e645..90d079d1b8 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/EquippedSourceCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/EquippedSourceCondition.java @@ -27,24 +27,21 @@ */ package mage.abilities.condition.common; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.Condition; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.UUID; + /** * Describes condition when creature is equipped. * * @author nantuko */ -public class EquippedSourceCondition implements Condition { +public enum EquippedSourceCondition implements Condition { - private static final EquippedSourceCondition instance = new EquippedSourceCondition(); - - public static Condition getInstance() { - return instance; - } + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/FlippedCondition.java b/Mage/src/main/java/mage/abilities/condition/common/FlippedCondition.java index 85c9dbebd9..ae8dc15e12 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/FlippedCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/FlippedCondition.java @@ -32,13 +32,9 @@ import mage.abilities.condition.Condition; import mage.game.Game; import mage.game.permanent.Permanent; -public class FlippedCondition implements Condition { +public enum FlippedCondition implements Condition { - private static FlippedCondition instance = new FlippedCondition(); - - public static Condition getInstance() { - return instance; - } + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/LandfallCondition.java b/Mage/src/main/java/mage/abilities/condition/common/LandfallCondition.java index 482f12371c..07a1a4b868 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/LandfallCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/LandfallCondition.java @@ -8,15 +8,8 @@ import mage.watchers.common.LandfallWatcher; /** * @author Loki */ -public class LandfallCondition implements Condition { - private final static LandfallCondition instance = new LandfallCondition(); - - public static LandfallCondition getInstance() { - return instance; - } - - private LandfallCondition() { - } +public enum LandfallCondition implements Condition { + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/MonarchIsSourceControllerCondition.java b/Mage/src/main/java/mage/abilities/condition/common/MonarchIsSourceControllerCondition.java index 40fca1d93a..c1ba5bce38 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/MonarchIsSourceControllerCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/MonarchIsSourceControllerCondition.java @@ -35,13 +35,9 @@ import mage.game.Game; * * @author LevelX2 */ -public class MonarchIsSourceControllerCondition implements Condition { +public enum MonarchIsSourceControllerCondition implements Condition { - private final static MonarchIsSourceControllerCondition instance = new MonarchIsSourceControllerCondition(); - - public static Condition getInstance() { - return instance; - } + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/MyTurnBeforeAttackersDeclaredCondition.java b/Mage/src/main/java/mage/abilities/condition/common/MyTurnBeforeAttackersDeclaredCondition.java index edfab63c3d..468939ef23 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/MyTurnBeforeAttackersDeclaredCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/MyTurnBeforeAttackersDeclaredCondition.java @@ -37,12 +37,8 @@ import mage.game.Game; * * @author LevelX2 */ -public class MyTurnBeforeAttackersDeclaredCondition implements Condition { - private static final MyTurnBeforeAttackersDeclaredCondition instance = new MyTurnBeforeAttackersDeclaredCondition(); - - public static Condition getInstance() { - return instance; - } +public enum MyTurnBeforeAttackersDeclaredCondition implements Condition { + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/RenownedTargetCondition.java b/Mage/src/main/java/mage/abilities/condition/common/RenownedTargetCondition.java index 3aa31557fd..a1061436b5 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/RenownedTargetCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/RenownedTargetCondition.java @@ -36,19 +36,9 @@ import mage.game.permanent.Permanent; * * @author LevelX2 */ -public class RenownedTargetCondition implements Condition { +public enum RenownedTargetCondition implements Condition { - private static RenownedTargetCondition instance = null; - - private RenownedTargetCondition() { - } - - public static RenownedTargetCondition getInstance() { - if (instance == null) { - instance = new RenownedTargetCondition(); - } - return instance; - } + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/SourceAttackingCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SourceAttackingCondition.java index a20648cecc..36fa91dfa0 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/SourceAttackingCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/SourceAttackingCondition.java @@ -37,13 +37,9 @@ import mage.game.permanent.Permanent; * @author LevelX2 */ -public class SourceAttackingCondition implements Condition { +public enum SourceAttackingCondition implements Condition { - private static final SourceAttackingCondition instance = new SourceAttackingCondition(); - - public static SourceAttackingCondition getInstance() { - return instance; - } + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/SourceOnBattlefieldCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SourceOnBattlefieldCondition.java index 544e6e38dd..c5ed34e364 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/SourceOnBattlefieldCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/SourceOnBattlefieldCondition.java @@ -38,13 +38,9 @@ import mage.game.Game; * * @author LevelX2 */ -public class SourceOnBattlefieldCondition implements Condition { +public enum SourceOnBattlefieldCondition implements Condition { - private static final SourceOnBattlefieldCondition instance = new SourceOnBattlefieldCondition(); - - public static SourceOnBattlefieldCondition getInstance() { - return instance; - } + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/SuspendedCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SuspendedCondition.java index 44e2ba7aaf..3642ce382b 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/SuspendedCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/SuspendedCondition.java @@ -45,18 +45,9 @@ import mage.game.Game; * */ -public class SuspendedCondition implements Condition { +public enum SuspendedCondition implements Condition { - private static SuspendedCondition instance = null; - - private SuspendedCondition() {} - - public static Condition getInstance() { - if (instance == null) { - instance = new SuspendedCondition(); - } - return instance; - } + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/FlipSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/FlipSourceEffect.java index 3e08835578..2ed186cd42 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/FlipSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/FlipSourceEffect.java @@ -36,7 +36,7 @@ public class FlipSourceEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (permanent != null && controller != null) { if (permanent.flip(game)) { - ContinuousEffect effect = new ConditionalContinuousEffect(new CopyTokenEffect(flipToken), FlippedCondition.getInstance(), ""); + ContinuousEffect effect = new ConditionalContinuousEffect(new CopyTokenEffect(flipToken), FlippedCondition.instance, ""); game.addEffect(effect, source); if (!game.isSimulation()) game.informPlayers(new StringBuilder(controller.getLogName()).append(" flips ").append(permanent.getName()).toString()); diff --git a/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java b/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java index a273bd123f..3382b061db 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java @@ -27,9 +27,6 @@ */ package mage.abilities.keyword; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.SpecialAction; @@ -45,14 +42,7 @@ import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.counter.RemoveCounterSourceEffect; import mage.cards.Card; -import mage.constants.AsThoughEffectType; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; -import mage.constants.TargetController; -import mage.constants.Zone; +import mage.constants.*; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; @@ -60,6 +50,10 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** * * 502.59. Suspend @@ -441,7 +435,7 @@ class SuspendBeginningOfUpkeepTriggeredAbility extends ConditionalTriggeredAbili public SuspendBeginningOfUpkeepTriggeredAbility() { super(new BeginningOfUpkeepTriggeredAbility(Zone.EXILED, new RemoveCounterSourceEffect(CounterType.TIME.createInstance()), TargetController.YOU, false), - SuspendedCondition.getInstance(), + SuspendedCondition.instance, "At the beginning of your upkeep, if this card ({this}) is suspended, remove a time counter from it."); this.setRuleVisible(false); From 4361b7412ab5ecc35be4b64536394a23712e23fc Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Wed, 5 Apr 2017 19:06:06 +0200 Subject: [PATCH 9/9] can not be singleton --- .../common/SourceTappedBeforeUntapStepCondition.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/condition/common/SourceTappedBeforeUntapStepCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SourceTappedBeforeUntapStepCondition.java index 7a082493bc..1e0b6238ec 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/SourceTappedBeforeUntapStepCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/SourceTappedBeforeUntapStepCondition.java @@ -28,7 +28,6 @@ package mage.abilities.condition.common; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.Condition; import mage.constants.PhaseStep; @@ -37,6 +36,8 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.turn.Step; +import java.util.UUID; + /** * * @author spjspj @@ -44,15 +45,11 @@ import mage.game.turn.Step; public class SourceTappedBeforeUntapStepCondition implements Condition { - private static final SourceTappedBeforeUntapStepCondition instance = new SourceTappedBeforeUntapStepCondition(); UUID permanentId = null; boolean permanentWasTappedBeforeUntapStep = false; int lastTurnNum = -1; - public static SourceTappedBeforeUntapStepCondition getInstance() { - return instance; - } public void setPermanentId(UUID permanentId) { this.permanentId = permanentId;