From 8ef941abf0afaee7a96247330d62eede21845c5a Mon Sep 17 00:00:00 2001 From: North Date: Wed, 18 Jul 2012 01:47:39 +0300 Subject: [PATCH] [refactoring] Added AsEnteresBattlefieldAbility --- .../sets/avacynrestored/CavernOfSouls.java | 6 +- .../sets/avacynrestored/RidersOfGavony.java | 6 +- .../src/mage/sets/dissension/BloodCrypt.java | 4 +- .../mage/sets/dissension/BreedingPool.java | 4 +- .../sets/dissension/HallowedFountain.java | 4 +- .../mage/sets/guildpact/GodlessShrine.java | 4 +- .../src/mage/sets/guildpact/SteamVents.java | 4 +- .../mage/sets/guildpact/StompingGround.java | 4 +- .../src/mage/sets/innistrad/Nevermore.java | 4 +- .../mage/sets/magic2010/ConvincingMirage.java | 4 +- .../mage/sets/magic2011/PhylacteryLich.java | 4 +- .../sets/magic2012/AdaptiveAutomaton.java | 6 +- .../src/mage/sets/magic2012/SuturedGhoul.java | 4 +- .../mirrodinbesieged/PhyrexianRevoker.java | 4 +- .../src/mage/sets/newphyrexia/CagedSun.java | 5 +- .../src/mage/sets/newphyrexia/Xenograft.java | 6 +- .../src/mage/sets/ravnika/OvergrownTomb.java | 4 +- .../src/mage/sets/ravnika/SacredFoundry.java | 4 +- .../src/mage/sets/ravnika/TempleGarden.java | 4 +- .../src/mage/sets/ravnika/WateryGrave.java | 4 +- .../riseoftheeldrazi/CurseOfWizardry.java | 16 ++--- .../sets/saviorsofkamigawa/PithingNeedle.java | 7 +-- .../sets/shadowmoor/LureboundScarecrow.java | 26 +------- .../common/AsEntersBattlefieldAbility.java | 62 +++++++++++++++++++ 24 files changed, 120 insertions(+), 80 deletions(-) create mode 100644 Mage/src/mage/abilities/common/AsEntersBattlefieldAbility.java diff --git a/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java b/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java index 65e55c73ef6..f586d48510f 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java @@ -34,7 +34,7 @@ import mage.Constants.Rarity; import mage.MageObject; import mage.Mana; import mage.abilities.Ability; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.ReplacementEffectImpl; @@ -63,14 +63,14 @@ import java.util.UUID; */ public class CavernOfSouls extends CardImpl { - private static final String ruleText = "As Cavern of Souls enters the battlefield, choose a creature type"; + private static final String ruleText = "choose a creature type"; public CavernOfSouls(UUID ownerId) { super(ownerId, 226, "Cavern of Souls", Rarity.RARE, new CardType[]{CardType.LAND}, ""); this.expansionSetCode = "AVR"; // As Cavern of Souls enters the battlefield, choose a creature type. - this.addAbility(new EntersBattlefieldAbility(new CavernOfSoulsEffect(), ruleText)); + this.addAbility(new AsEntersBattlefieldAbility(new CavernOfSoulsEffect(), ruleText)); // {tap}: Add {1} to your mana pool. this.addAbility(new ColorlessManaAbility()); diff --git a/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java b/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java index c092bf56b45..4ff140ba41b 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java @@ -32,7 +32,7 @@ import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.OneShotEffect; @@ -69,7 +69,7 @@ public class RidersOfGavony extends CardImpl { this.addAbility(VigilanceAbility.getInstance()); // As Riders of Gavony enters the battlefield, choose a creature type. - this.addAbility(new EntersBattlefieldAbility(new RidersOfGavonyEffect())); + this.addAbility(new AsEntersBattlefieldAbility(new RidersOfGavonyEffect())); // Human creatures you control have protection from creatures of the chosen type. this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new RidersOfGavonyGainAbilityControlledEffect())); @@ -89,7 +89,7 @@ class RidersOfGavonyEffect extends OneShotEffect { public RidersOfGavonyEffect() { super(Constants.Outcome.BoostCreature); - staticText = "As {this} enters the battlefield, choose a creature type"; + staticText = "choose a creature type"; } public RidersOfGavonyEffect(final RidersOfGavonyEffect effect) { diff --git a/Mage.Sets/src/mage/sets/dissension/BloodCrypt.java b/Mage.Sets/src/mage/sets/dissension/BloodCrypt.java index 23ae0dcfdc8..db630e9326c 100644 --- a/Mage.Sets/src/mage/sets/dissension/BloodCrypt.java +++ b/Mage.Sets/src/mage/sets/dissension/BloodCrypt.java @@ -31,7 +31,7 @@ package mage.sets.dissension; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; import mage.abilities.mana.BlackManaAbility; @@ -51,7 +51,7 @@ public class BloodCrypt extends CardImpl { this.subtype.add("Mountain"); this.addAbility(new BlackManaAbility()); this.addAbility(new RedManaAbility()); - this.addAbility(new EntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "As {this} enters the battlefield, you may pay 2 life. If you don't, {this} enters the battlefield tapped")); + this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "you may pay 2 life. If you don't, {this} enters the battlefield tapped")); } public BloodCrypt (final BloodCrypt card) { diff --git a/Mage.Sets/src/mage/sets/dissension/BreedingPool.java b/Mage.Sets/src/mage/sets/dissension/BreedingPool.java index ae13d1d7136..2cae8c8a23d 100644 --- a/Mage.Sets/src/mage/sets/dissension/BreedingPool.java +++ b/Mage.Sets/src/mage/sets/dissension/BreedingPool.java @@ -31,7 +31,7 @@ package mage.sets.dissension; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; import mage.abilities.mana.BlueManaAbility; @@ -51,7 +51,7 @@ public class BreedingPool extends CardImpl { this.subtype.add("Island"); this.addAbility(new GreenManaAbility()); this.addAbility(new BlueManaAbility()); - this.addAbility(new EntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "As Breeding Pool enters the battlefield, you may pay 2 life. If you don't, Breeding Pool enters the battlefield tapped")); + this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "you may pay 2 life. If you don't, Breeding Pool enters the battlefield tapped")); } public BreedingPool (final BreedingPool card) { diff --git a/Mage.Sets/src/mage/sets/dissension/HallowedFountain.java b/Mage.Sets/src/mage/sets/dissension/HallowedFountain.java index 66baa3668e7..3fddda21ece 100644 --- a/Mage.Sets/src/mage/sets/dissension/HallowedFountain.java +++ b/Mage.Sets/src/mage/sets/dissension/HallowedFountain.java @@ -31,7 +31,7 @@ package mage.sets.dissension; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; import mage.abilities.mana.BlueManaAbility; @@ -51,7 +51,7 @@ public class HallowedFountain extends CardImpl { this.subtype.add("Island"); this.addAbility(new WhiteManaAbility()); this.addAbility(new BlueManaAbility()); - this.addAbility(new EntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "As Hallowed Fountain enters the battlefield, you may pay 2 life. If you don't, Hallowed Fountain enters the battlefield tapped")); + this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "you may pay 2 life. If you don't, Hallowed Fountain enters the battlefield tapped")); } public HallowedFountain (final HallowedFountain card) { diff --git a/Mage.Sets/src/mage/sets/guildpact/GodlessShrine.java b/Mage.Sets/src/mage/sets/guildpact/GodlessShrine.java index 13f4b54e418..1f4e64c6e0b 100644 --- a/Mage.Sets/src/mage/sets/guildpact/GodlessShrine.java +++ b/Mage.Sets/src/mage/sets/guildpact/GodlessShrine.java @@ -31,7 +31,7 @@ package mage.sets.guildpact; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; import mage.abilities.mana.BlackManaAbility; @@ -51,7 +51,7 @@ public class GodlessShrine extends CardImpl { this.subtype.add("Swamp"); this.addAbility(new WhiteManaAbility()); this.addAbility(new BlackManaAbility()); - this.addAbility(new EntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "As Godless Shrine enters the battlefield, you may pay 2 life. If you don't, Godless Shrine enters the battlefield tapped")); + this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "you may pay 2 life. If you don't, Godless Shrine enters the battlefield tapped")); } public GodlessShrine (final GodlessShrine card) { diff --git a/Mage.Sets/src/mage/sets/guildpact/SteamVents.java b/Mage.Sets/src/mage/sets/guildpact/SteamVents.java index d232ead7ba0..e7589f5b959 100644 --- a/Mage.Sets/src/mage/sets/guildpact/SteamVents.java +++ b/Mage.Sets/src/mage/sets/guildpact/SteamVents.java @@ -31,7 +31,7 @@ package mage.sets.guildpact; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; import mage.abilities.mana.BlueManaAbility; @@ -51,7 +51,7 @@ public class SteamVents extends CardImpl { this.subtype.add("Mountain"); this.addAbility(new BlueManaAbility()); this.addAbility(new RedManaAbility()); - this.addAbility(new EntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "As Steam Vents enters the battlefield, you may pay 2 life. If you don't, Steam Vents enters the battlefield tapped")); + this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "you may pay 2 life. If you don't, Steam Vents enters the battlefield tapped")); } public SteamVents (final SteamVents card) { diff --git a/Mage.Sets/src/mage/sets/guildpact/StompingGround.java b/Mage.Sets/src/mage/sets/guildpact/StompingGround.java index cebc13176be..7e486a5eb41 100644 --- a/Mage.Sets/src/mage/sets/guildpact/StompingGround.java +++ b/Mage.Sets/src/mage/sets/guildpact/StompingGround.java @@ -31,7 +31,7 @@ package mage.sets.guildpact; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; import mage.abilities.mana.GreenManaAbility; @@ -51,7 +51,7 @@ public class StompingGround extends CardImpl { this.subtype.add("Forest"); this.addAbility(new RedManaAbility()); this.addAbility(new GreenManaAbility()); - this.addAbility(new EntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "As Stomping Ground enters the battlefield, you may pay 2 life. If you don't, Stomping Ground enters the battlefield tapped")); + this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "you may pay 2 life. If you don't, Stomping Ground enters the battlefield tapped")); } public StompingGround (final StompingGround card) { diff --git a/Mage.Sets/src/mage/sets/innistrad/Nevermore.java b/Mage.Sets/src/mage/sets/innistrad/Nevermore.java index 72885766b44..0c26cc54314 100644 --- a/Mage.Sets/src/mage/sets/innistrad/Nevermore.java +++ b/Mage.Sets/src/mage/sets/innistrad/Nevermore.java @@ -35,7 +35,7 @@ import mage.Constants.Rarity; import mage.Constants.Zone; import mage.MageObject; import mage.abilities.Ability; -import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.ReplacementEffectImpl; @@ -60,7 +60,7 @@ public class Nevermore extends CardImpl { this.color.setWhite(true); //As Nevermore enters the battlefield, name a nonland card. - this.addAbility(new EntersBattlefieldTriggeredAbility(new NevermoreEffect1())); + this.addAbility(new AsEntersBattlefieldAbility(new NevermoreEffect1())); //The named card can't be cast. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new NevermoreEffect2())); diff --git a/Mage.Sets/src/mage/sets/magic2010/ConvincingMirage.java b/Mage.Sets/src/mage/sets/magic2010/ConvincingMirage.java index fd1f567d90d..120503506e7 100644 --- a/Mage.Sets/src/mage/sets/magic2010/ConvincingMirage.java +++ b/Mage.Sets/src/mage/sets/magic2010/ConvincingMirage.java @@ -37,7 +37,7 @@ import mage.Constants.Rarity; import mage.Constants.SubLayer; import mage.Constants.Zone; import mage.abilities.Ability; -import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.OneShotEffect; @@ -74,7 +74,7 @@ public class ConvincingMirage extends CardImpl { this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); // As Convincing Mirage enters the battlefield, choose a basic land type. - this.addAbility(new EntersBattlefieldTriggeredAbility(new ConvincingMirageEffect(), false)); + this.addAbility(new AsEntersBattlefieldAbility(new ConvincingMirageEffect())); // Enchanted land is the chosen type. Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java b/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java index a1dc1874e87..9cc45f56256 100644 --- a/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java +++ b/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java @@ -36,7 +36,7 @@ import mage.Constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.StateTriggeredAbility; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.keyword.IndestructibleAbility; @@ -64,7 +64,7 @@ public class PhylacteryLich extends CardImpl { this.power = new MageInt(5); this.toughness = new MageInt(5); - this.addAbility(new EntersBattlefieldAbility(new PhylacteryLichEffect(), "put a phylactery counter on an artifact you control")); + this.addAbility(new AsEntersBattlefieldAbility(new PhylacteryLichEffect(), "put a phylactery counter on an artifact you control")); this.addAbility(IndestructibleAbility.getInstance()); this.addAbility(new PhylacteryLichAbility()); } diff --git a/Mage.Sets/src/mage/sets/magic2012/AdaptiveAutomaton.java b/Mage.Sets/src/mage/sets/magic2012/AdaptiveAutomaton.java index ffef208fff1..366a4df198d 100644 --- a/Mage.Sets/src/mage/sets/magic2012/AdaptiveAutomaton.java +++ b/Mage.Sets/src/mage/sets/magic2012/AdaptiveAutomaton.java @@ -33,7 +33,7 @@ import mage.Constants.Duration; import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.OneShotEffect; @@ -62,7 +62,7 @@ public class AdaptiveAutomaton extends CardImpl { this.toughness = new MageInt(2); // As Adaptive Automaton enters the battlefield, choose a creature type. - this.addAbility(new EntersBattlefieldAbility(new AdaptiveAutomatonEffect())); + this.addAbility(new AsEntersBattlefieldAbility(new AdaptiveAutomatonEffect())); // Adaptive Automaton is the chosen type in addition to its other types. this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new AdaptiveAutomatonAddSubtypeEffect())); // Other creatures you control of the chosen type get +1/+1. @@ -83,7 +83,7 @@ class AdaptiveAutomatonEffect extends OneShotEffect { public AdaptiveAutomatonEffect() { super(Constants.Outcome.BoostCreature); - staticText = "As {this} enters the battlefield, choose a creature type"; + staticText = "choose a creature type"; } public AdaptiveAutomatonEffect(final AdaptiveAutomatonEffect effect) { diff --git a/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java b/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java index 16fdf3be671..a3b8caa8c47 100644 --- a/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java +++ b/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java @@ -32,7 +32,7 @@ import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.OneShotEffect; @@ -68,7 +68,7 @@ public class SuturedGhoul extends CardImpl { this.addAbility(TrampleAbility.getInstance()); // As Sutured Ghoul enters the battlefield, exile any number of creature cards from your graveyard. - this.addAbility(new EntersBattlefieldAbility(new SuturedGhoulEffect(), staticText)); + this.addAbility(new AsEntersBattlefieldAbility(new SuturedGhoulEffect(), staticText)); // Sutured Ghoul's power is equal to the total power of the exiled cards and its toughness is equal to their total toughness. BoostSourceEffect effect = new BoostSourceEffect(new SuturedGhoulPowerCount(), new SuturedGhoulToughnessCount(), Constants.Duration.WhileOnBattlefield); diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java index 914c92bfd69..a201d979b17 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java @@ -37,7 +37,7 @@ import mage.Constants.Zone; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; -import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.ReplacementEffectImpl; @@ -64,7 +64,7 @@ public class PhyrexianRevoker extends CardImpl { this.toughness = new MageInt(1); // As Phyrexian Revoker enters the battlefield, name a nonland card. - this.addAbility(new EntersBattlefieldTriggeredAbility(new PhyrexianRevokerEffect1())); + this.addAbility(new AsEntersBattlefieldAbility(new PhyrexianRevokerEffect1())); // Activated abilities of sources with the chosen name can't be activated. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhyrexianRevokerEffect2())); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/CagedSun.java b/Mage.Sets/src/mage/sets/newphyrexia/CagedSun.java index a2c7d231b5d..ffe981c4437 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/CagedSun.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/CagedSun.java @@ -36,6 +36,7 @@ import mage.Constants.Zone; import mage.Mana; import mage.ObjectColor; import mage.abilities.Ability; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; @@ -61,7 +62,7 @@ public class CagedSun extends CardImpl { this.expansionSetCode = "NPH"; // As Caged Sun enters the battlefield, choose a color. - this.addAbility(new EntersBattlefieldAbility(new CagedSunEffect1())); + this.addAbility(new AsEntersBattlefieldAbility(new CagedSunEffect1())); // Creatures you control of the chosen color get +1/+1. this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new CagedSunEffect2())); @@ -84,7 +85,7 @@ class CagedSunEffect1 extends OneShotEffect { public CagedSunEffect1() { super(Constants.Outcome.BoostCreature); - staticText = "As {this} enters the battlefield, choose a color"; + staticText = "choose a color"; } public CagedSunEffect1(final CagedSunEffect1 effect) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java b/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java index 83632434c20..c84ce54ed7c 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java @@ -37,7 +37,7 @@ import mage.Constants.Rarity; import mage.Constants.SubLayer; import mage.Constants.Zone; import mage.abilities.Ability; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.OneShotEffect; @@ -63,7 +63,7 @@ public class Xenograft extends CardImpl { this.color.setBlue(true); // As Xenograft enters the battlefield, choose a creature type. - this.addAbility(new EntersBattlefieldAbility(new XenograftEffect())); + this.addAbility(new AsEntersBattlefieldAbility(new XenograftEffect())); // Each creature you control is the chosen type in addition to its other types. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new XenograftAddSubtypeEffect())); } @@ -82,7 +82,7 @@ class XenograftEffect extends OneShotEffect { public XenograftEffect() { super(Outcome.DrawCard); - staticText = "As {this} enters the battlefield, choose a creature type"; + staticText = "choose a creature type"; } public XenograftEffect(final XenograftEffect effect) { diff --git a/Mage.Sets/src/mage/sets/ravnika/OvergrownTomb.java b/Mage.Sets/src/mage/sets/ravnika/OvergrownTomb.java index dd57ecbe68c..807f8d278d8 100644 --- a/Mage.Sets/src/mage/sets/ravnika/OvergrownTomb.java +++ b/Mage.Sets/src/mage/sets/ravnika/OvergrownTomb.java @@ -31,7 +31,7 @@ package mage.sets.ravnika; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; import mage.abilities.mana.BlackManaAbility; @@ -51,7 +51,7 @@ public class OvergrownTomb extends CardImpl { this.subtype.add("Forest"); this.addAbility(new BlackManaAbility()); this.addAbility(new GreenManaAbility()); - this.addAbility(new EntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "As {this} enters the battlefield, you may pay 2 life. If you don't, {this} enters the battlefield tapped")); + this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "you may pay 2 life. If you don't, {this} enters the battlefield tapped")); } public OvergrownTomb (final OvergrownTomb card) { diff --git a/Mage.Sets/src/mage/sets/ravnika/SacredFoundry.java b/Mage.Sets/src/mage/sets/ravnika/SacredFoundry.java index fcb40afc9b9..b35be4c302d 100644 --- a/Mage.Sets/src/mage/sets/ravnika/SacredFoundry.java +++ b/Mage.Sets/src/mage/sets/ravnika/SacredFoundry.java @@ -31,7 +31,7 @@ package mage.sets.ravnika; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; import mage.abilities.mana.RedManaAbility; @@ -51,7 +51,7 @@ public class SacredFoundry extends CardImpl { this.subtype.add("Plains"); this.addAbility(new RedManaAbility()); this.addAbility(new WhiteManaAbility()); - this.addAbility(new EntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "As {this} enters the battlefield, you may pay 2 life. If you don't, {this} enters the battlefield tapped")); + this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "you may pay 2 life. If you don't, {this} enters the battlefield tapped")); } public SacredFoundry (final SacredFoundry card) { diff --git a/Mage.Sets/src/mage/sets/ravnika/TempleGarden.java b/Mage.Sets/src/mage/sets/ravnika/TempleGarden.java index 6ff4cd531d5..5376b4fe8fd 100644 --- a/Mage.Sets/src/mage/sets/ravnika/TempleGarden.java +++ b/Mage.Sets/src/mage/sets/ravnika/TempleGarden.java @@ -31,7 +31,7 @@ package mage.sets.ravnika; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; import mage.abilities.mana.GreenManaAbility; @@ -51,7 +51,7 @@ public class TempleGarden extends CardImpl { this.subtype.add("Plains"); this.addAbility(new GreenManaAbility()); this.addAbility(new WhiteManaAbility()); - this.addAbility(new EntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "As {this} enters the battlefield, you may pay 2 life. If you don't, {this} enters the battlefield tapped")); + this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "you may pay 2 life. If you don't, {this} enters the battlefield tapped")); } public TempleGarden (final TempleGarden card) { diff --git a/Mage.Sets/src/mage/sets/ravnika/WateryGrave.java b/Mage.Sets/src/mage/sets/ravnika/WateryGrave.java index 5435a29f2d7..907b6dad895 100644 --- a/Mage.Sets/src/mage/sets/ravnika/WateryGrave.java +++ b/Mage.Sets/src/mage/sets/ravnika/WateryGrave.java @@ -31,7 +31,7 @@ package mage.sets.ravnika; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; import mage.abilities.mana.BlackManaAbility; @@ -51,7 +51,7 @@ public class WateryGrave extends CardImpl { this.subtype.add("Swamp"); this.addAbility(new BlueManaAbility()); this.addAbility(new BlackManaAbility()); - this.addAbility(new EntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "As {this} enters the battlefield, you may pay 2 life. If you don't, {this} enters the battlefield tapped")); + this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "you may pay 2 life. If you don't, {this} enters the battlefield tapped")); } public WateryGrave(final WateryGrave card) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java index cad59ce53d1..d56a80e410a 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java @@ -33,17 +33,17 @@ import mage.Constants.CardType; import mage.Constants.Rarity; import mage.ObjectColor; import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.cards.CardImpl; -import mage.abilities.common.EntersBattlefieldAbility; import mage.choices.ChoiceColor; import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; import mage.game.stack.Spell; +import mage.players.Player; import mage.target.targetpointer.FixedTarget; /** @@ -59,7 +59,7 @@ public class CurseOfWizardry extends CardImpl { this.color.setBlack(true); // As Curse of Wizardry enters the battlefield, choose a color. - this.addAbility(new EntersBattlefieldAbility(new CurseOfWizardryChooseColorEffect())); + this.addAbility(new AsEntersBattlefieldAbility(new CurseOfWizardryChooseColorEffect())); // Whenever a player casts a spell of the chosen color, that player loses 1 life. this.addAbility(new CurseOfWizardryPlayerCastsSpellChosenColorTriggeredAbility()); @@ -80,7 +80,7 @@ class CurseOfWizardryChooseColorEffect extends OneShotEffect { @@ -56,7 +56,7 @@ public class PithingNeedle extends CardImpl { this.expansionSetCode = "SOK"; // As Pithing Needle enters the battlefield, name a card. - this.addAbility(new EntersBattlefieldTriggeredAbility(new NameCard())); + this.addAbility(new AsEntersBattlefieldAbility(new NameCard())); // Activated abilities of sources with the chosen name can't be activated unless they're mana abilities. this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new PithingNeedleEffect())); @@ -148,4 +148,3 @@ class PithingNeedleEffect extends ReplacementEffectImpl { return false; } } - diff --git a/Mage.Sets/src/mage/sets/shadowmoor/LureboundScarecrow.java b/Mage.Sets/src/mage/sets/shadowmoor/LureboundScarecrow.java index 61e4cf0f481..ed8e207e017 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/LureboundScarecrow.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/LureboundScarecrow.java @@ -34,8 +34,7 @@ import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.StateTriggeredAbility; -import mage.abilities.common.ZoneChangeTriggeredAbility; -import mage.abilities.effects.Effect; +import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.SacrificeSourceEffect; import mage.cards.Card; @@ -64,7 +63,7 @@ public class LureboundScarecrow extends CardImpl { this.toughness = new MageInt(4); // As Lurebound Scarecrow enters the battlefield, choose a color. - this.addAbility(new AsEntersBattlefieldTriggeredAbility(new LureboundScarecrowChooseColorEffect())); + this.addAbility(new AsEntersBattlefieldAbility(new LureboundScarecrowChooseColorEffect())); // When you control no permanents of the chosen color, sacrifice Lurebound Scarecrow. this.addAbility(new LureboundScarecrowTriggeredAbility()); @@ -80,27 +79,6 @@ public class LureboundScarecrow extends CardImpl { } } -class AsEntersBattlefieldTriggeredAbility extends ZoneChangeTriggeredAbility { - - public AsEntersBattlefieldTriggeredAbility(Effect effect) { - this(effect, false); - } - - public AsEntersBattlefieldTriggeredAbility(Effect effect, boolean optional) { - super(Constants.Zone.STACK, effect, "As this enters the battlefield, ", optional); - } - - public AsEntersBattlefieldTriggeredAbility(AsEntersBattlefieldTriggeredAbility ability) { - super(ability); - } - - @Override - public AsEntersBattlefieldTriggeredAbility copy() { - return new AsEntersBattlefieldTriggeredAbility(this); - } - -} - class LureboundScarecrowChooseColorEffect extends OneShotEffect { public LureboundScarecrowChooseColorEffect() { diff --git a/Mage/src/mage/abilities/common/AsEntersBattlefieldAbility.java b/Mage/src/mage/abilities/common/AsEntersBattlefieldAbility.java new file mode 100644 index 00000000000..426e02c5eff --- /dev/null +++ b/Mage/src/mage/abilities/common/AsEntersBattlefieldAbility.java @@ -0,0 +1,62 @@ +/* + * 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.common; + +import mage.Constants; +import mage.abilities.StaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.EntersBattlefieldEffect; + +/** + * + * @author North + */ +public class AsEntersBattlefieldAbility extends StaticAbility { + + public AsEntersBattlefieldAbility(Effect effect) { + super(Constants.Zone.BATTLEFIELD, new EntersBattlefieldEffect(effect)); + } + + public AsEntersBattlefieldAbility(Effect effect, String text) { + super(Constants.Zone.BATTLEFIELD, new EntersBattlefieldEffect(effect, text)); + } + + public AsEntersBattlefieldAbility(AsEntersBattlefieldAbility ability) { + super(ability); + } + + @Override + public AsEntersBattlefieldAbility copy() { + return new AsEntersBattlefieldAbility(this); + } + + @Override + public String getRule() { + return "As {this} enters the battlefield, " + super.getRule(); + } +}