From 204d2410a18ea09421e47dd4e96abe2aeffc9fea Mon Sep 17 00:00:00 2001 From: North Date: Tue, 4 Sep 2012 23:59:05 +0300 Subject: [PATCH] Reimplemented Indestructable using a replacement effect --- .../src/mage/player/ai/ma/MagicAbility.java | 5 +- .../avacynrestored/AvacynAngelOfHope.java | 2 +- .../KondaLordOfEiganjo.java | 2 +- .../MyojinOfCleansingFire.java | 2 +- .../MyojinOfInfiniteRage.java | 2 +- .../championsofkamigawa/MyojinOfLifesWeb.java | 2 +- .../MyojinOfNightsReach.java | 2 +- .../MyojinOfSeeingWinds.java | 2 +- .../src/mage/sets/conflux/Thornling.java | 2 +- .../mage/sets/darkascension/BreakOfDay.java | 2 +- .../darkascension/FalkenrathAristocrat.java | 2 +- .../mage/sets/darkascension/PredatorOoze.java | 2 +- .../mage/sets/darksteel/DarksteelBrute.java | 2 +- .../mage/sets/darksteel/DarksteelCitadel.java | 2 +- .../sets/darksteel/DarksteelColossus.java | 2 +- .../mage/sets/darksteel/DarksteelForge.java | 2 +- .../sets/darksteel/DarksteelGargoyle.java | 2 +- .../mage/sets/darksteel/DarksteelIngot.java | 2 +- .../src/mage/sets/darksteel/MyrMatrix.java | 2 +- .../sets/darksteel/SlobadGoblinTinkerer.java | 2 +- .../mage/sets/innistrad/AngelicOverseer.java | 2 +- .../src/mage/sets/innistrad/CreepyDoll.java | 2 +- .../mage/sets/innistrad/ManorGargoyle.java | 2 +- .../src/mage/sets/lorwyn/TimberProtector.java | 2 +- .../sets/magic2010/Indestructibility.java | 2 +- .../mage/sets/magic2011/KnightExemplar.java | 2 +- .../mage/sets/magic2011/PhylacteryLich.java | 2 +- .../src/mage/sets/magic2012/AegisAngel.java | 2 +- .../mirrodinbesieged/BlightsteelColossus.java | 2 +- .../sets/mirrodinbesieged/DarksteelPlate.java | 4 +- .../mage/sets/newphyrexia/DarksteelRelic.java | 2 +- .../sets/riseoftheeldrazi/DeathlessAngel.java | 2 +- .../riseoftheeldrazi/TranscendentMaster.java | 5 +- .../UlamogTheInfiniteGyre.java | 2 +- .../sets/scarsofmirrodin/DarksteelAxe.java | 2 +- .../scarsofmirrodin/DarksteelJuggernaut.java | 2 +- .../sets/scarsofmirrodin/DarksteelMyr.java | 2 +- .../scarsofmirrodin/DarksteelSentinel.java | 2 +- .../sets/scarsofmirrodin/WithstandDeath.java | 2 +- .../shardsofalara/ElspethKnightErrant.java | 2 +- .../shardsofalara/SpearbreakerBehemoth.java | 4 +- .../src/mage/sets/timespiral/StuffyDoll.java | 2 +- .../mage/sets/zendikar/EldraziMonument.java | 2 +- .../activated/LevelUpAbilityTest.java | 10 +-- .../test/cards/copy/PhantasmalImageTest.java | 4 +- .../common/IndestructibleSourceEffect.java | 72 +++++++++++++++++++ .../keyword/IndestructibleAbility.java | 30 +++----- .../mage/game/permanent/PermanentImpl.java | 8 +-- Utils/keywords.txt | 2 +- 49 files changed, 138 insertions(+), 84 deletions(-) create mode 100644 Mage/src/mage/abilities/effects/common/IndestructibleSourceEffect.java diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/MagicAbility.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/MagicAbility.java index 6b63a7dd5a..d89062cfe9 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/MagicAbility.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/MagicAbility.java @@ -1,13 +1,10 @@ package mage.player.ai.ma; import mage.abilities.Ability; -import mage.abilities.StaticAbility; import mage.abilities.keyword.*; -import mage.cards.basiclands.Plains; import java.util.HashMap; import java.util.Map; -import java.util.zip.Inflater; /** * @author nantuko @@ -25,7 +22,7 @@ public class MagicAbility { put(FlyingAbility.getInstance().getRule(), 50); put(new ForestwalkAbility().getRule(), 10); put(HasteAbility.getInstance().getRule(), 0); - put(IndestructibleAbility.getInstance().getRule(), 150); + put(new IndestructibleAbility().getRule(), 150); put(InfectAbility.getInstance().getRule(), 60); put(IntimidateAbility.getInstance().getRule(), 50); put(new IslandwalkAbility().getRule(), 10); diff --git a/Mage.Sets/src/mage/sets/avacynrestored/AvacynAngelOfHope.java b/Mage.Sets/src/mage/sets/avacynrestored/AvacynAngelOfHope.java index 55da4f3753..ae498d4110 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/AvacynAngelOfHope.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/AvacynAngelOfHope.java @@ -60,7 +60,7 @@ public class AvacynAngelOfHope extends CardImpl { this.addAbility(VigilanceAbility.getInstance()); // Avacyn, Angel of Hope and other permanents you control are indestructible. - this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAllEffect(IndestructibleAbility.getInstance(), Constants.Duration.WhileInGraveyard, new FilterControlledPermanent()))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAllEffect(new IndestructibleAbility(), Constants.Duration.WhileInGraveyard, new FilterControlledPermanent()))); } public AvacynAngelOfHope(final AvacynAngelOfHope card) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/KondaLordOfEiganjo.java b/Mage.Sets/src/mage/sets/championsofkamigawa/KondaLordOfEiganjo.java index 3f67e614c7..0dff358417 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/KondaLordOfEiganjo.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/KondaLordOfEiganjo.java @@ -54,7 +54,7 @@ public class KondaLordOfEiganjo extends CardImpl { this.toughness = new MageInt(3); this.addAbility(VigilanceAbility.getInstance()); this.addAbility(new BushidoAbility(5)); - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); } public KondaLordOfEiganjo(final KondaLordOfEiganjo card) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfCleansingFire.java b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfCleansingFire.java index 7912ac1e05..32fbc86b08 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfCleansingFire.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfCleansingFire.java @@ -76,7 +76,7 @@ public class MyojinOfCleansingFire extends CardImpl { // Myojin of Cleansing Fire enters the battlefield with a divinity counter on it if you cast it from your hand. this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); // Myojin of Cleansing Fire is indestructible as long as it has a divinity counter on it. - this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Constants.Duration.WhileOnBattlefield), + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(new IndestructibleAbility(), Constants.Duration.WhileOnBattlefield), new HasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it"))); // Remove a divinity counter from Myojin of Cleansing Fire: Destroy all other creatures. this.addAbility(new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new DestroyAllEffect(filter), new RemoveCountersSourceCost(CounterType.DIVINITY.createInstance()))); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfInfiniteRage.java b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfInfiniteRage.java index c5925f6d1d..5c638be59d 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfInfiniteRage.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfInfiniteRage.java @@ -72,7 +72,7 @@ public class MyojinOfInfiniteRage extends CardImpl { // Myojin of Infinite Rage enters the battlefield with a divinity counter on it if you cast it from your hand. this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); // Myojin of Infinite Rage is indestructible as long as it has a divinity counter on it. - this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Constants.Duration.WhileOnBattlefield), + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(new IndestructibleAbility(), Constants.Duration.WhileOnBattlefield), new HasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it"))); // Remove a divinity counter from Myojin of Infinite Rage: Destroy all lands. this.addAbility(new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new DestroyAllEffect(filter), new RemoveCountersSourceCost(CounterType.DIVINITY.createInstance()))); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfLifesWeb.java b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfLifesWeb.java index 9ee7437826..d29aff59f0 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfLifesWeb.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfLifesWeb.java @@ -82,7 +82,7 @@ public class MyojinOfLifesWeb extends CardImpl { this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); // Myojin of Life's Web is indestructible as long as it has a divinity counter on it. this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, - new ConditionalContinousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Constants.Duration.WhileOnBattlefield), + new ConditionalContinousEffect(new GainAbilitySourceEffect(new IndestructibleAbility(), Constants.Duration.WhileOnBattlefield), new HasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it"))); // Remove a divinity counter from Myojin of Life's Web: Put any number of creature cards from your hand onto the battlefield. Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new PutOntoBattlefieldTargetEffect(false), new RemoveCountersSourceCost(CounterType.DIVINITY.createInstance())); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfNightsReach.java b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfNightsReach.java index 7373203c50..f2fc5b93ab 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfNightsReach.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfNightsReach.java @@ -73,7 +73,7 @@ public class MyojinOfNightsReach extends CardImpl { // Myojin of Night's Reach enters the battlefield with a divinity counter on it if you cast it from your hand. this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); // Myojin of Night's Reach is indestructible as long as it has a divinity counter on it. - this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Constants.Duration.WhileOnBattlefield), + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(new IndestructibleAbility(), Constants.Duration.WhileOnBattlefield), new HasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it"))); // Remove a divinity counter from Myojin of Night's Reach: Each opponent discards his or her hand. Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new MyojinOfNightsReachEffect(), new RemoveCountersSourceCost(CounterType.DIVINITY.createInstance())); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfSeeingWinds.java b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfSeeingWinds.java index 806d0d4a1e..4fedb58972 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfSeeingWinds.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfSeeingWinds.java @@ -79,7 +79,7 @@ public class MyojinOfSeeingWinds extends CardImpl { // Myojin of Seeing Winds enters the battlefield with a divinity counter on it if you cast it from your hand. this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); // Myojin of Seeing Winds is indestructible as long as it has a divinity counter on it. - this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Constants.Duration.WhileOnBattlefield), + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(new IndestructibleAbility(), Constants.Duration.WhileOnBattlefield), new HasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it"))); // Remove a divinity counter from Myojin of Seeing Winds: Draw a card for each permanent you control. Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new DrawCardControllerEffect(new PermanentsOnBattlefieldCount(filter, 1)), new RemoveCountersSourceCost(CounterType.DIVINITY.createInstance())); diff --git a/Mage.Sets/src/mage/sets/conflux/Thornling.java b/Mage.Sets/src/mage/sets/conflux/Thornling.java index 97349e0143..e1ca015824 100644 --- a/Mage.Sets/src/mage/sets/conflux/Thornling.java +++ b/Mage.Sets/src/mage/sets/conflux/Thornling.java @@ -60,7 +60,7 @@ public class Thornling extends CardImpl { this.toughness = new MageInt(4); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{G}"))); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{G}"))); - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{G}"))); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(new IndestructibleAbility(), Duration.EndOfTurn), new ManaCostsImpl("{G}"))); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, -1, Duration.EndOfTurn), new ManaCostsImpl("{1}"))); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(-1, 1, Duration.EndOfTurn), new ManaCostsImpl("{1}"))); } diff --git a/Mage.Sets/src/mage/sets/darkascension/BreakOfDay.java b/Mage.Sets/src/mage/sets/darkascension/BreakOfDay.java index a349ee7945..42bfaa0aa6 100644 --- a/Mage.Sets/src/mage/sets/darkascension/BreakOfDay.java +++ b/Mage.Sets/src/mage/sets/darkascension/BreakOfDay.java @@ -56,7 +56,7 @@ public class BreakOfDay extends CardImpl { // Creatures you control get +1/+1 until end of turn. this.getSpellAbility().addEffect(new BoostControlledEffect(1, 1, Constants.Duration.EndOfTurn)); // Fateful hour - If you have 5 or less life, those creatures also are indestructible this turn. - this.getSpellAbility().addEffect(new ConditionalContinousEffect(new GainAbilityControlledEffect(IndestructibleAbility.getInstance(), Constants.Duration.EndOfTurn, new FilterCreaturePermanent()), + this.getSpellAbility().addEffect(new ConditionalContinousEffect(new GainAbilityControlledEffect(new IndestructibleAbility(), Constants.Duration.EndOfTurn, new FilterCreaturePermanent()), FatefulHourCondition.getInstance(), "If you have 5 or less life, those creatures also are indestructible this turn.")); } diff --git a/Mage.Sets/src/mage/sets/darkascension/FalkenrathAristocrat.java b/Mage.Sets/src/mage/sets/darkascension/FalkenrathAristocrat.java index 7c85814969..c408029daa 100644 --- a/Mage.Sets/src/mage/sets/darkascension/FalkenrathAristocrat.java +++ b/Mage.Sets/src/mage/sets/darkascension/FalkenrathAristocrat.java @@ -70,7 +70,7 @@ public class FalkenrathAristocrat extends CardImpl { // Sacrifice a creature: Falkenrath Aristocrat is indestructible this turn. // If the sacrificed creature was a Human, put a +1/+1 counter on Falkenrath Aristocrat. SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, - new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), + new GainAbilitySourceEffect(new IndestructibleAbility(), Duration.EndOfTurn), new SacrificeTargetCost(new TargetControlledCreaturePermanent())); ability.addEffect(new FalkenrathAristocratEffect()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/darkascension/PredatorOoze.java b/Mage.Sets/src/mage/sets/darkascension/PredatorOoze.java index b513014e7b..8e3b1c2ab5 100644 --- a/Mage.Sets/src/mage/sets/darkascension/PredatorOoze.java +++ b/Mage.Sets/src/mage/sets/darkascension/PredatorOoze.java @@ -54,7 +54,7 @@ public class PredatorOoze extends CardImpl { this.toughness = new MageInt(1); // Predator Ooze is indestructible. - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); // Whenever Predator Ooze attacks, put a +1/+1 counter on it. this.addAbility(new AttacksTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); diff --git a/Mage.Sets/src/mage/sets/darksteel/DarksteelBrute.java b/Mage.Sets/src/mage/sets/darksteel/DarksteelBrute.java index 62ec38de63..dd71364895 100644 --- a/Mage.Sets/src/mage/sets/darksteel/DarksteelBrute.java +++ b/Mage.Sets/src/mage/sets/darksteel/DarksteelBrute.java @@ -51,7 +51,7 @@ public class DarksteelBrute extends CardImpl { public DarksteelBrute (UUID ownerId) { super(ownerId, 108, "Darksteel Brute", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); this.expansionSetCode = "DST"; - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); this.addAbility(new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new DarksteelBruteToken(), "", Duration.EndOfTurn), new GenericManaCost(3))); } diff --git a/Mage.Sets/src/mage/sets/darksteel/DarksteelCitadel.java b/Mage.Sets/src/mage/sets/darksteel/DarksteelCitadel.java index fb51e492c1..a99c4a3569 100644 --- a/Mage.Sets/src/mage/sets/darksteel/DarksteelCitadel.java +++ b/Mage.Sets/src/mage/sets/darksteel/DarksteelCitadel.java @@ -44,7 +44,7 @@ public class DarksteelCitadel extends CardImpl { public DarksteelCitadel (UUID ownerId) { super(ownerId, 164, "Darksteel Citadel", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.LAND}, null); this.expansionSetCode = "DST"; - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); this.addAbility(new ColorlessManaAbility()); } diff --git a/Mage.Sets/src/mage/sets/darksteel/DarksteelColossus.java b/Mage.Sets/src/mage/sets/darksteel/DarksteelColossus.java index 812a69ecf9..95eccc31fd 100644 --- a/Mage.Sets/src/mage/sets/darksteel/DarksteelColossus.java +++ b/Mage.Sets/src/mage/sets/darksteel/DarksteelColossus.java @@ -58,7 +58,7 @@ public class DarksteelColossus extends CardImpl { this.power = new MageInt(11); this.toughness = new MageInt(11); this.addAbility(TrampleAbility.getInstance()); - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new DarksteelColossusEffect(), false)); } diff --git a/Mage.Sets/src/mage/sets/darksteel/DarksteelForge.java b/Mage.Sets/src/mage/sets/darksteel/DarksteelForge.java index fe6d61c921..baab40b361 100644 --- a/Mage.Sets/src/mage/sets/darksteel/DarksteelForge.java +++ b/Mage.Sets/src/mage/sets/darksteel/DarksteelForge.java @@ -54,7 +54,7 @@ public class DarksteelForge extends CardImpl { public DarksteelForge(UUID ownerId) { super(ownerId, 110, "Darksteel Forge", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{9}"); this.expansionSetCode = "DST"; - this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(IndestructibleAbility.getInstance(), Constants.Duration.WhileOnBattlefield, filter, false))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(new IndestructibleAbility(), Constants.Duration.WhileOnBattlefield, filter, false))); } diff --git a/Mage.Sets/src/mage/sets/darksteel/DarksteelGargoyle.java b/Mage.Sets/src/mage/sets/darksteel/DarksteelGargoyle.java index b350337873..c1cb95f145 100644 --- a/Mage.Sets/src/mage/sets/darksteel/DarksteelGargoyle.java +++ b/Mage.Sets/src/mage/sets/darksteel/DarksteelGargoyle.java @@ -49,7 +49,7 @@ public class DarksteelGargoyle extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(3); this.addAbility(FlyingAbility.getInstance()); - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); } public DarksteelGargoyle(final DarksteelGargoyle card) { diff --git a/Mage.Sets/src/mage/sets/darksteel/DarksteelIngot.java b/Mage.Sets/src/mage/sets/darksteel/DarksteelIngot.java index 5c0489ee4f..f9c9373964 100644 --- a/Mage.Sets/src/mage/sets/darksteel/DarksteelIngot.java +++ b/Mage.Sets/src/mage/sets/darksteel/DarksteelIngot.java @@ -44,7 +44,7 @@ public class DarksteelIngot extends CardImpl { public DarksteelIngot(UUID ownerId) { super(ownerId, 112, "Darksteel Ingot", Constants.Rarity.COMMON, new Constants.CardType[]{Constants.CardType.ARTIFACT}, "{3}"); this.expansionSetCode = "DST"; - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); this.addAbility(new AnyColorManaAbility()); } diff --git a/Mage.Sets/src/mage/sets/darksteel/MyrMatrix.java b/Mage.Sets/src/mage/sets/darksteel/MyrMatrix.java index e35d951081..9d44b4c351 100644 --- a/Mage.Sets/src/mage/sets/darksteel/MyrMatrix.java +++ b/Mage.Sets/src/mage/sets/darksteel/MyrMatrix.java @@ -59,7 +59,7 @@ public class MyrMatrix extends CardImpl { public MyrMatrix (UUID ownerId) { super(ownerId, 132, "Myr Matrix", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}"); this.expansionSetCode = "DST"; - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Constants.Duration.WhileOnBattlefield, filter, false))); this.addAbility(new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new CreateTokenEffect(new MyrToken()), new GenericManaCost(5))); diff --git a/Mage.Sets/src/mage/sets/darksteel/SlobadGoblinTinkerer.java b/Mage.Sets/src/mage/sets/darksteel/SlobadGoblinTinkerer.java index 1fbf0013c7..0655aaddde 100644 --- a/Mage.Sets/src/mage/sets/darksteel/SlobadGoblinTinkerer.java +++ b/Mage.Sets/src/mage/sets/darksteel/SlobadGoblinTinkerer.java @@ -68,7 +68,7 @@ public class SlobadGoblinTinkerer extends CardImpl { this.color.setRed(true); this.power = new MageInt(1); this.toughness = new MageInt(2); - Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Constants.Duration.EndOfTurn), new SacrificeTargetCost(new TargetControlledPermanent(filterControlled))); + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainAbilityTargetEffect(new IndestructibleAbility(), Constants.Duration.EndOfTurn), new SacrificeTargetCost(new TargetControlledPermanent(filterControlled))); ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/innistrad/AngelicOverseer.java b/Mage.Sets/src/mage/sets/innistrad/AngelicOverseer.java index e5520b3b08..05aff92cd5 100644 --- a/Mage.Sets/src/mage/sets/innistrad/AngelicOverseer.java +++ b/Mage.Sets/src/mage/sets/innistrad/AngelicOverseer.java @@ -69,7 +69,7 @@ public class AngelicOverseer extends CardImpl { // As long as you control a Human, Angelic Overseer has hexproof and is indestructible. ConditionalContinousEffect effect1 = new ConditionalContinousEffect(new GainAbilitySourceEffect(HexproofAbility.getInstance()), new ControlsPermanentCondition(filter), rule1); this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, effect1)); - ConditionalContinousEffect effect2 = new ConditionalContinousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance()), new ControlsPermanentCondition(filter), rule2); + ConditionalContinousEffect effect2 = new ConditionalContinousEffect(new GainAbilitySourceEffect(new IndestructibleAbility()), new ControlsPermanentCondition(filter), rule2); this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, effect2)); } diff --git a/Mage.Sets/src/mage/sets/innistrad/CreepyDoll.java b/Mage.Sets/src/mage/sets/innistrad/CreepyDoll.java index 6d227fd639..7218bfe293 100644 --- a/Mage.Sets/src/mage/sets/innistrad/CreepyDoll.java +++ b/Mage.Sets/src/mage/sets/innistrad/CreepyDoll.java @@ -59,7 +59,7 @@ public class CreepyDoll extends CardImpl { this.toughness = new MageInt(1); // Creepy Doll is indestructible. - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); // Whenever Creepy Doll deals combat damage to a creature, flip a coin. If you win the flip, destroy that creature. this.addAbility(new CreepyDollTriggeredAbility()); diff --git a/Mage.Sets/src/mage/sets/innistrad/ManorGargoyle.java b/Mage.Sets/src/mage/sets/innistrad/ManorGargoyle.java index 705e39cdcc..ae599f69c0 100644 --- a/Mage.Sets/src/mage/sets/innistrad/ManorGargoyle.java +++ b/Mage.Sets/src/mage/sets/innistrad/ManorGargoyle.java @@ -71,7 +71,7 @@ public class ManorGargoyle extends CardImpl { this.addAbility(DefenderAbility.getInstance()); // Manor Gargoyle is indestructible as long as it has defender. - ConditionalContinousEffect effect = new ConditionalContinousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance()), HasDefenderCondition.getInstance(), rule); + ConditionalContinousEffect effect = new ConditionalContinousEffect(new GainAbilitySourceEffect(new IndestructibleAbility()), HasDefenderCondition.getInstance(), rule); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); // {1}: Until end of turn, Manor Gargoyle loses defender and gains flying. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GargoyleSentinelEffect(), new ManaCostsImpl("{1}"))); diff --git a/Mage.Sets/src/mage/sets/lorwyn/TimberProtector.java b/Mage.Sets/src/mage/sets/lorwyn/TimberProtector.java index 9c6f9810ca..c1aa6089e9 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/TimberProtector.java +++ b/Mage.Sets/src/mage/sets/lorwyn/TimberProtector.java @@ -69,7 +69,7 @@ public class TimberProtector extends CardImpl { // Other Treefolk creatures you control get +1/+1. this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Constants.Duration.WhileOnBattlefield, filterTreefolk, true))); // Other Treefolk and Forests you control are indestructible. - this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(IndestructibleAbility.getInstance(), Constants.Duration.WhileOnBattlefield, filterBoth, true))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(new IndestructibleAbility(), Constants.Duration.WhileOnBattlefield, filterBoth, true))); } public TimberProtector(final TimberProtector card) { diff --git a/Mage.Sets/src/mage/sets/magic2010/Indestructibility.java b/Mage.Sets/src/mage/sets/magic2010/Indestructibility.java index c90c6a7031..c7d869339d 100644 --- a/Mage.Sets/src/mage/sets/magic2010/Indestructibility.java +++ b/Mage.Sets/src/mage/sets/magic2010/Indestructibility.java @@ -62,7 +62,7 @@ public class Indestructibility extends CardImpl { Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Enchanted permanent is indestructible. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(IndestructibleAbility.getInstance(), AttachmentType.AURA))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new IndestructibleAbility(), AttachmentType.AURA))); } public Indestructibility(final Indestructibility card) { diff --git a/Mage.Sets/src/mage/sets/magic2011/KnightExemplar.java b/Mage.Sets/src/mage/sets/magic2011/KnightExemplar.java index d2aa5d40bf..1df8ed013e 100644 --- a/Mage.Sets/src/mage/sets/magic2011/KnightExemplar.java +++ b/Mage.Sets/src/mage/sets/magic2011/KnightExemplar.java @@ -66,7 +66,7 @@ public class KnightExemplar extends CardImpl { this.addAbility(FirstStrikeAbility.getInstance()); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true))); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield, filter, true))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new IndestructibleAbility(), Duration.WhileOnBattlefield, filter, true))); } public KnightExemplar(final KnightExemplar card) { diff --git a/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java b/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java index 9cc45f5625..02801c7fc1 100644 --- a/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java +++ b/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java @@ -65,7 +65,7 @@ public class PhylacteryLich extends CardImpl { this.toughness = new MageInt(5); this.addAbility(new AsEntersBattlefieldAbility(new PhylacteryLichEffect(), "put a phylactery counter on an artifact you control")); - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); this.addAbility(new PhylacteryLichAbility()); } diff --git a/Mage.Sets/src/mage/sets/magic2012/AegisAngel.java b/Mage.Sets/src/mage/sets/magic2012/AegisAngel.java index a9f410a4eb..dd91a80990 100644 --- a/Mage.Sets/src/mage/sets/magic2012/AegisAngel.java +++ b/Mage.Sets/src/mage/sets/magic2012/AegisAngel.java @@ -60,7 +60,7 @@ public class AegisAngel extends CardImpl { this.addAbility(FlyingAbility.getInstance()); FilterPermanent filter = new FilterPermanent("another target permanent"); filter.add(new AnotherPredicate()); - Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Constants.Duration.WhileOnBattlefield), false); + Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(new IndestructibleAbility(), Constants.Duration.WhileOnBattlefield), false); Target target = new TargetPermanent(filter); target.setRequired(true); ability.addTarget(target); diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/BlightsteelColossus.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/BlightsteelColossus.java index c47ab0745b..d8fc6408a4 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/BlightsteelColossus.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/BlightsteelColossus.java @@ -60,7 +60,7 @@ public class BlightsteelColossus extends CardImpl { this.toughness = new MageInt(11); this.addAbility(TrampleAbility.getInstance()); this.addAbility(InfectAbility.getInstance()); - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new BlightsteelColossusEffect(), false)); } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/DarksteelPlate.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/DarksteelPlate.java index 718fc052be..241c3cd424 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/DarksteelPlate.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/DarksteelPlate.java @@ -51,8 +51,8 @@ public class DarksteelPlate extends CardImpl { this.expansionSetCode = "MBS"; this.subtype.add("Equipment"); this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new GenericManaCost(2))); - this.addAbility(IndestructibleAbility.getInstance()); - this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(IndestructibleAbility.getInstance(), Constants.AttachmentType.EQUIPMENT))); + this.addAbility(new IndestructibleAbility()); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new IndestructibleAbility(), Constants.AttachmentType.EQUIPMENT))); } public DarksteelPlate (final DarksteelPlate card) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/DarksteelRelic.java b/Mage.Sets/src/mage/sets/newphyrexia/DarksteelRelic.java index ac0c124331..902b585af3 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/DarksteelRelic.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/DarksteelRelic.java @@ -43,7 +43,7 @@ public class DarksteelRelic extends CardImpl { super(ownerId, 134, "Darksteel Relic", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{0}"); this.expansionSetCode = "NPH"; - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); } public DarksteelRelic(final DarksteelRelic card) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/DeathlessAngel.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/DeathlessAngel.java index a2e32ec165..120cb0f95f 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/DeathlessAngel.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/DeathlessAngel.java @@ -57,7 +57,7 @@ public class DeathlessAngel extends CardImpl { this.power = new MageInt(5); this.toughness = new MageInt(7); this.addAbility(FlyingAbility.getInstance()); - Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Constants.Duration.EndOfTurn), new ManaCostsImpl("{W}{W}")); + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainAbilityTargetEffect(new IndestructibleAbility(), Constants.Duration.EndOfTurn), new ManaCostsImpl("{W}{W}")); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/TranscendentMaster.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/TranscendentMaster.java index 42ddec3890..50c237dce0 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/TranscendentMaster.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/TranscendentMaster.java @@ -58,8 +58,9 @@ public class TranscendentMaster extends LevelerCard { this.addAbility(new LevelUpAbility(new ManaCostsImpl("{1}"))); Abilities abilities1 = new AbilitiesImpl(LifelinkAbility.getInstance()); - Abilities abilities2 = new AbilitiesImpl(LifelinkAbility.getInstance(), - IndestructibleAbility.getInstance()); + Abilities abilities2 = new AbilitiesImpl( + LifelinkAbility.getInstance(), + new IndestructibleAbility()); LevelerCardBuilder.construct(this, new LevelerCardBuilder.LevelAbility(6, 11, abilities1, 6, 6), diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java index 557d787293..339f37922b 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java @@ -67,7 +67,7 @@ public class UlamogTheInfiniteGyre extends CardImpl { this.addAbility(new UlamogTheInfiniteGyreDestroyOnCastAbility()); this.addAbility(new AnnihilatorAbility(4)); - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); this.addAbility(new ZoneChangeTriggeredAbility(Zone.GRAVEYARD, new UlamogTheInfiniteGyreEnterGraveyardEffect(), effectText, false)); } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelAxe.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelAxe.java index 64226e55e0..2e7a56ab0e 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelAxe.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelAxe.java @@ -51,7 +51,7 @@ public class DarksteelAxe extends CardImpl { super(ownerId, 149, "Darksteel Axe", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{1}"); this.expansionSetCode = "SOM"; this.subtype.add("Equipment"); - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 0))); this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new GenericManaCost(2))); } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelJuggernaut.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelJuggernaut.java index c7b36d9176..0fd24cceb1 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelJuggernaut.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelJuggernaut.java @@ -63,7 +63,7 @@ public class DarksteelJuggernaut extends CardImpl { SetPowerToughnessSourceEffect effect = new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filter), Constants.Duration.EndOfGame); this.addAbility(new SimpleStaticAbility(Constants.Zone.ALL, effect)); - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); this.addAbility(new AttacksEachTurnStaticAbility()); } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelMyr.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelMyr.java index 9226ccadf3..cb15741a2c 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelMyr.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelMyr.java @@ -47,7 +47,7 @@ public class DarksteelMyr extends CardImpl { this.subtype.add("Myr"); this.power = new MageInt(0); this.toughness = new MageInt(1); - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); } public DarksteelMyr (final DarksteelMyr card) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelSentinel.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelSentinel.java index e8d8c10a6d..a02e9323f6 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelSentinel.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/DarksteelSentinel.java @@ -51,7 +51,7 @@ public class DarksteelSentinel extends CardImpl { this.toughness = new MageInt(3); this.addAbility(FlashAbility.getInstance()); this.addAbility(VigilanceAbility.getInstance()); - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); } public DarksteelSentinel (final DarksteelSentinel card) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/WithstandDeath.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/WithstandDeath.java index b258da3eba..a9388c1e78 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/WithstandDeath.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/WithstandDeath.java @@ -47,7 +47,7 @@ public class WithstandDeath extends CardImpl { super(ownerId, 134, "Withstand Death", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{G}"); this.expansionSetCode = "SOM"; this.color.setGreen(true); - this.getSpellAbility().addEffect(new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new GainAbilityTargetEffect(new IndestructibleAbility(), Duration.EndOfTurn)); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } diff --git a/Mage.Sets/src/mage/sets/shardsofalara/ElspethKnightErrant.java b/Mage.Sets/src/mage/sets/shardsofalara/ElspethKnightErrant.java index 862c78c1e7..e0bb46668d 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/ElspethKnightErrant.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/ElspethKnightErrant.java @@ -119,7 +119,7 @@ class ElspethKnightErrantEffect extends ContinuousEffectImpl { this.power = new MageInt(5); this.toughness = new MageInt(5); - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, - new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), + new GainAbilityTargetEffect(new IndestructibleAbility(), Duration.EndOfTurn), new ManaCostsImpl("{1}")); ability.addTarget(new TargetCreaturePermanent(filter)); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java b/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java index 14eb759df7..f24151c008 100644 --- a/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java +++ b/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java @@ -64,7 +64,7 @@ public class StuffyDoll extends CardImpl { // As Stuffy Doll enters the battlefield, choose a player. this.addAbility(new AsEntersBattlefieldAbility(new StuffyDollChoosePlayerEffect())); // Stuffy Doll is indestructible. - this.addAbility(IndestructibleAbility.getInstance()); + this.addAbility(new IndestructibleAbility()); // Whenever Stuffy Doll is dealt damage, it deals that much damage to the chosen player. this.addAbility(new StuffyDollTriggeredAbility()); // {tap}: Stuffy Doll deals 1 damage to itself. diff --git a/Mage.Sets/src/mage/sets/zendikar/EldraziMonument.java b/Mage.Sets/src/mage/sets/zendikar/EldraziMonument.java index 0dc3994d14..f5dea90d0b 100644 --- a/Mage.Sets/src/mage/sets/zendikar/EldraziMonument.java +++ b/Mage.Sets/src/mage/sets/zendikar/EldraziMonument.java @@ -62,7 +62,7 @@ public class EldraziMonument extends CardImpl { this.expansionSetCode = "ZEN"; this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCreaturePermanent()))); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCreaturePermanent()))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new IndestructibleAbility(), Duration.WhileOnBattlefield, new FilterCreaturePermanent()))); this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new EldraziMonumentEffect())); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java index 9903a787d8..3bbd39c6b1 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java @@ -31,7 +31,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { Assert.assertEquals(3, master.getPower().getValue()); Assert.assertEquals(3, master.getToughness().getValue()); Assert.assertFalse(master.getAbilities().contains(LifelinkAbility.getInstance())); - Assert.assertFalse(master.getAbilities().contains(IndestructibleAbility.getInstance())); + Assert.assertFalse(master.getAbilities().contains(new IndestructibleAbility())); } /** @@ -53,7 +53,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { Assert.assertEquals(3, master.getPower().getValue()); Assert.assertEquals(3, master.getToughness().getValue()); Assert.assertFalse(master.getAbilities().contains(LifelinkAbility.getInstance())); - Assert.assertFalse(master.getAbilities().contains(IndestructibleAbility.getInstance())); + Assert.assertFalse(master.getAbilities().contains(new IndestructibleAbility())); } /** @@ -79,7 +79,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { // since now Lifelink will appear Assert.assertTrue(master.getAbilities().contains(LifelinkAbility.getInstance())); // but still no Indestructible - Assert.assertFalse(master.getAbilities().contains(IndestructibleAbility.getInstance())); + Assert.assertFalse(master.getAbilities().contains(new IndestructibleAbility())); } /** @@ -103,7 +103,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { Assert.assertEquals("Power different", 9, master.getPower().getValue()); Assert.assertEquals("Toughness different", 9, master.getToughness().getValue()); Assert.assertTrue(master.getAbilities().contains(LifelinkAbility.getInstance())); - Assert.assertTrue(master.getAbilities().contains(IndestructibleAbility.getInstance())); + Assert.assertTrue(master.getAbilities().contains(new IndestructibleAbility())); } /** @@ -127,7 +127,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { Assert.assertEquals("Power different", 9, master.getPower().getValue()); Assert.assertEquals("Toughness different", 9, master.getToughness().getValue()); Assert.assertTrue(master.getAbilities().contains(LifelinkAbility.getInstance())); - Assert.assertTrue(master.getAbilities().contains(IndestructibleAbility.getInstance())); + Assert.assertTrue(master.getAbilities().contains(new IndestructibleAbility())); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java index 50ac7f1c8b..4bacdac8a5 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java @@ -84,13 +84,13 @@ public class PhantasmalImageTest extends CardTestPlayerBase { Assert.assertEquals("Power different", 9, master.getPower().getValue()); Assert.assertEquals("Toughness different", 9, master.getToughness().getValue()); Assert.assertTrue(master.getAbilities().contains(LifelinkAbility.getInstance())); - Assert.assertTrue(master.getAbilities().contains(IndestructibleAbility.getInstance())); + Assert.assertTrue(master.getAbilities().contains(new IndestructibleAbility())); // But copied one should not Assert.assertEquals("Power different", 3, masterCopied.getPower().getValue()); Assert.assertEquals("Toughness different", 3, masterCopied.getToughness().getValue()); Assert.assertFalse(masterCopied.getAbilities().contains(LifelinkAbility.getInstance())); - Assert.assertFalse(masterCopied.getAbilities().contains(IndestructibleAbility.getInstance())); + Assert.assertFalse(masterCopied.getAbilities().contains(new IndestructibleAbility())); } /** diff --git a/Mage/src/mage/abilities/effects/common/IndestructibleSourceEffect.java b/Mage/src/mage/abilities/effects/common/IndestructibleSourceEffect.java new file mode 100644 index 0000000000..29edf78a21 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/IndestructibleSourceEffect.java @@ -0,0 +1,72 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.abilities.effects.common; + +import mage.Constants.Duration; +import mage.Constants.Outcome; +import mage.abilities.Ability; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * + * @author North + */ +public class IndestructibleSourceEffect extends ReplacementEffectImpl { + + public IndestructibleSourceEffect(Duration duration) { + super(duration, Outcome.Benefit); + this.staticText = "{this} is indestructible"; + } + + public IndestructibleSourceEffect(ReplacementEffectImpl effect) { + super(effect); + } + + @Override + public IndestructibleSourceEffect copy() { + return new IndestructibleSourceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + return true; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return event.getType().equals(GameEvent.EventType.DESTROY_PERMANENT) + && event.getTargetId().equals(source.getSourceId()); + } +} diff --git a/Mage/src/mage/abilities/keyword/IndestructibleAbility.java b/Mage/src/mage/abilities/keyword/IndestructibleAbility.java index b118080699..1a17208074 100644 --- a/Mage/src/mage/abilities/keyword/IndestructibleAbility.java +++ b/Mage/src/mage/abilities/keyword/IndestructibleAbility.java @@ -25,43 +25,29 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.keyword; +import mage.Constants.Duration; import mage.Constants.Zone; -import mage.abilities.MageSingleton; import mage.abilities.StaticAbility; - -import java.io.ObjectStreamException; +import mage.abilities.effects.common.IndestructibleSourceEffect; /** * * @author BetaSteward_at_googlemail.com */ -public class IndestructibleAbility extends StaticAbility implements MageSingleton { +public class IndestructibleAbility extends StaticAbility { - private static final IndestructibleAbility fINSTANCE = new IndestructibleAbility(); - - private Object readResolve() throws ObjectStreamException { - return fINSTANCE; + public IndestructibleAbility() { + super(Zone.BATTLEFIELD, new IndestructibleSourceEffect(Duration.WhileOnBattlefield)); } - public static IndestructibleAbility getInstance() { - return fINSTANCE; - } - - private IndestructibleAbility() { - super(Zone.BATTLEFIELD, null); - } - - @Override - public String getRule() { - return "Indestructible"; + private IndestructibleAbility(IndestructibleAbility ability) { + super(ability); } @Override public IndestructibleAbility copy() { - return fINSTANCE; + return new IndestructibleAbility(this); } - } diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index 7d7253c588..7f2781128b 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -727,11 +727,9 @@ public abstract class PermanentImpl> extends CardImpl //20091005 - 701.6 //TODO: handle noRegen if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT, objectId, sourceId, controllerId, noRegen ? 1 : 0))) { - if (!this.getAbilities().containsKey(IndestructibleAbility.getInstance().getId())) { - if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) { - game.fireEvent(GameEvent.getEvent(EventType.DESTROYED_PERMANENT, objectId, sourceId, controllerId)); - return true; - } + if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) { + game.fireEvent(GameEvent.getEvent(EventType.DESTROYED_PERMANENT, objectId, sourceId, controllerId)); + return true; } } return false; diff --git a/Utils/keywords.txt b/Utils/keywords.txt index 08ec00259c..7ff42c8f08 100644 --- a/Utils/keywords.txt +++ b/Utils/keywords.txt @@ -12,6 +12,7 @@ Battle cry|new| Cascade|new| Exalted|new| Forestwalk|new| +Indestructible|new| Islandwalk|new| Living weapon|new| Mountainwalk|new| @@ -30,7 +31,6 @@ Flash|instance| Flying|instance| Haste|instance| Hexproof|instance| -Indestructible|instance| Infect|instance| Intimidate|instance| Lifelink|instance|