diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/EndlessOne.java b/Mage.Sets/src/mage/sets/battleforzendikar/EndlessOne.java index e71faed3d5b..54a615e10a1 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/EndlessOne.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/EndlessOne.java @@ -29,18 +29,12 @@ package mage.sets.battleforzendikar; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -56,7 +50,7 @@ public class EndlessOne extends CardImpl { this.toughness = new MageInt(0); // Endless One enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new EndlessOneEffect(), "with X +1/+1 counters on it")); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); } public EndlessOne(final EndlessOne card) { @@ -68,37 +62,3 @@ public class EndlessOne extends CardImpl { return new EndlessOne(this); } } - -class EndlessOneEffect extends OneShotEffect { - - public EndlessOneEffect() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - public EndlessOneEffect(final EndlessOneEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public EndlessOneEffect copy() { - return new EndlessOneEffect(this); - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java b/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java index d371e9adcc1..6d57185c284 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java @@ -31,17 +31,14 @@ import java.util.List; import java.util.UUID; import mage.Mana; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.ManaEffect; import mage.abilities.mana.ManaAbility; import mage.cards.CardImpl; import mage.choices.ChoiceColor; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; @@ -60,7 +57,7 @@ public class AstralCornucopia extends CardImpl { this.expansionSetCode = "BNG"; // Astral Cornucopia enters the battlefield with X charge counters on it. - this.addAbility(new EntersBattlefieldAbility(new AstralCornucopiaEffect(), "with X charge counters on it")); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.CHARGE.createInstance()))); // {T}: Choose a color. Add one mana of that color to your mana pool for each charge counter on Astral Cornucopia. this.addAbility(new AstralCornucopiaManaAbility()); @@ -76,39 +73,6 @@ public class AstralCornucopia extends CardImpl { } } -class AstralCornucopiaEffect extends OneShotEffect { - - public AstralCornucopiaEffect() { - super(Outcome.Benefit); - } - - public AstralCornucopiaEffect(final AstralCornucopiaEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.CHARGE.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public AstralCornucopiaEffect copy() { - return new AstralCornucopiaEffect(this); - } -} - class AstralCornucopiaManaAbility extends ManaAbility { public AstralCornucopiaManaAbility() { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/OrochiHatchery.java b/Mage.Sets/src/mage/sets/championsofkamigawa/OrochiHatchery.java index 1e2e16c7413..ca6ed57092f 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/OrochiHatchery.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/OrochiHatchery.java @@ -29,23 +29,18 @@ package mage.sets.championsofkamigawa; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.dynamicvalue.common.CountersCount; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.game.permanent.token.SnakeToken; /** @@ -58,7 +53,7 @@ public class OrochiHatchery extends CardImpl { this.expansionSetCode = "CHK"; // Orochi Hatchery enters the battlefield with X charge counters on it. - this.addAbility(new EntersBattlefieldAbility(new OrochiHatcheryEffect(), "with X charge counters on it")); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.CHARGE.createInstance()))); // {5}, {T}: Put a 1/1 green Snake creature token onto the battlefield for each charge counter on Orochi Hatchery. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SnakeToken(), new CountersCount(CounterType.CHARGE)), new GenericManaCost(5)); @@ -76,36 +71,3 @@ public class OrochiHatchery extends CardImpl { } } - -class OrochiHatcheryEffect extends OneShotEffect { - - public OrochiHatcheryEffect() { - super(Outcome.Benefit); - } - - public OrochiHatcheryEffect(final OrochiHatcheryEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.CHARGE.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public OrochiHatcheryEffect copy() { - return new OrochiHatcheryEffect(this); - } -} diff --git a/Mage.Sets/src/mage/sets/commander2013/NayaSoulbeast.java b/Mage.Sets/src/mage/sets/commander2013/NayaSoulbeast.java index a858e59187f..b375229ce70 100644 --- a/Mage.Sets/src/mage/sets/commander2013/NayaSoulbeast.java +++ b/Mage.Sets/src/mage/sets/commander2013/NayaSoulbeast.java @@ -104,7 +104,7 @@ class NayaSoulbeastCastEffect extends OneShotEffect { MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { int cmc = 0; - for (UUID playerId :controller.getInRange()) { + for (UUID playerId : controller.getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { if (player.getLibrary().size() > 0) { @@ -137,12 +137,12 @@ class NayaSoulbeastReplacementEffect extends ReplacementEffectImpl { public NayaSoulbeastReplacementEffect(final NayaSoulbeastReplacementEffect effect) { super(effect); } - + @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; } - + @Override public boolean applies(GameEvent event, Ability source, Game game) { return event.getTargetId().equals(source.getSourceId()); @@ -152,7 +152,7 @@ class NayaSoulbeastReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Object object = this.getValue("NayaSoulbeastCounters"); if (object instanceof Integer) { - int amount = ((Integer)object); + int amount = ((Integer) object); new AddCountersSourceEffect(CounterType.P1P1.createInstance(amount)).apply(game, source); } return false; diff --git a/Mage.Sets/src/mage/sets/commander2014/LifebloodHydra.java b/Mage.Sets/src/mage/sets/commander2014/LifebloodHydra.java index 89228518820..a0f13d131dd 100644 --- a/Mage.Sets/src/mage/sets/commander2014/LifebloodHydra.java +++ b/Mage.Sets/src/mage/sets/commander2014/LifebloodHydra.java @@ -30,11 +30,10 @@ package mage.sets.commander2014; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; -import mage.abilities.effects.EntersBattlefieldEffect; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.constants.CardType; @@ -63,7 +62,7 @@ public class LifebloodHydra extends CardImpl { this.addAbility(TrampleAbility.getInstance()); // Lifeblood Hydra enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new LifebloodHydraComesIntoPlayEffect(), "with X +1/+1 counters on it")); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); // When Lifeblood Hydra dies, you gain life and draw cards equal to its power. this.addAbility(new DiesTriggeredAbility(new LifebloodHydraEffect(), false)); @@ -79,41 +78,6 @@ public class LifebloodHydra extends CardImpl { } } -class LifebloodHydraComesIntoPlayEffect extends OneShotEffect { - - public LifebloodHydraComesIntoPlayEffect() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - public LifebloodHydraComesIntoPlayEffect(final LifebloodHydraComesIntoPlayEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && !permanent.isFaceDown(game)) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public LifebloodHydraComesIntoPlayEffect copy() { - return new LifebloodHydraComesIntoPlayEffect(this); - } - -} - class LifebloodHydraEffect extends OneShotEffect { public LifebloodHydraEffect() { diff --git a/Mage.Sets/src/mage/sets/conspiracy/GrenzoDungeonWarden.java b/Mage.Sets/src/mage/sets/conspiracy/GrenzoDungeonWarden.java index e583ec71adf..2a152f5c5d6 100644 --- a/Mage.Sets/src/mage/sets/conspiracy/GrenzoDungeonWarden.java +++ b/Mage.Sets/src/mage/sets/conspiracy/GrenzoDungeonWarden.java @@ -30,12 +30,11 @@ package mage.sets.conspiracy; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.EntersBattlefieldEffect; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; @@ -64,7 +63,7 @@ public class GrenzoDungeonWarden extends CardImpl { this.toughness = new MageInt(2); // Grenzo, Dungeon Warden enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new GrenzoDungeonWardenEtBEffect())); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); // {2}: Put the bottom card of your library into your graveyard. If it's a creature card with power less than or equal to Grenzo's power, put it onto the battlefield. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GrenzoDungeonWardenEffect(), new GenericManaCost(2))); @@ -80,40 +79,6 @@ public class GrenzoDungeonWarden extends CardImpl { } } -class GrenzoDungeonWardenEtBEffect extends OneShotEffect { - - GrenzoDungeonWardenEtBEffect() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - GrenzoDungeonWardenEtBEffect(final GrenzoDungeonWardenEtBEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public GrenzoDungeonWardenEtBEffect copy() { - return new GrenzoDungeonWardenEtBEffect(this); - } -} - class GrenzoDungeonWardenEffect extends OneShotEffect { GrenzoDungeonWardenEffect() { diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/SavagebornHydra.java b/Mage.Sets/src/mage/sets/dragonsmaze/SavagebornHydra.java index 1ed4e842ea6..bee58de919f 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/SavagebornHydra.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/SavagebornHydra.java @@ -29,23 +29,17 @@ package mage.sets.dragonsmaze; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.ActivateAsSorceryActivatedAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.DoubleStrikeAbility; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -65,7 +59,7 @@ public class SavagebornHydra extends CardImpl { this.addAbility(DoubleStrikeAbility.getInstance()); // Savageborn Hydra enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new SavageBornHydraEffect(), true)); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); // {1}{RG}: Put a +1/+1 counter on Savageborn Hydra. Activate this ability only any time you could cast a sorcery. this.addAbility(new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new ManaCostsImpl("{1}{R/G}"))); @@ -80,37 +74,3 @@ public class SavagebornHydra extends CardImpl { return new SavagebornHydra(this); } } - -class SavageBornHydraEffect extends OneShotEffect { - - public SavageBornHydraEffect() { - super(Outcome.BoostCreature); - staticText = "with X +1/+1 counters on it"; - } - - public SavageBornHydraEffect(final SavageBornHydraEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public SavageBornHydraEffect copy() { - return new SavageBornHydraEffect(this); - } -} diff --git a/Mage.Sets/src/mage/sets/gatecrash/NimbusSwimmer.java b/Mage.Sets/src/mage/sets/gatecrash/NimbusSwimmer.java index e7dbf68a9cb..eacb454a99b 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/NimbusSwimmer.java +++ b/Mage.Sets/src/mage/sets/gatecrash/NimbusSwimmer.java @@ -29,18 +29,13 @@ package mage.sets.gatecrash; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -59,7 +54,7 @@ public class NimbusSwimmer extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); // Nimbus Swimmer enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new NimbusSwimmerEffect(), true)); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); } public NimbusSwimmer(final NimbusSwimmer card) { @@ -71,37 +66,3 @@ public class NimbusSwimmer extends CardImpl { return new NimbusSwimmer(this); } } - -class NimbusSwimmerEffect extends OneShotEffect { - - public NimbusSwimmerEffect() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - public NimbusSwimmerEffect(final NimbusSwimmerEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public NimbusSwimmerEffect copy() { - return new NimbusSwimmerEffect(this); - } -} diff --git a/Mage.Sets/src/mage/sets/innistrad/MikaeusTheLunarch.java b/Mage.Sets/src/mage/sets/innistrad/MikaeusTheLunarch.java index c87a6c44bc4..2eb92ada3ea 100644 --- a/Mage.Sets/src/mage/sets/innistrad/MikaeusTheLunarch.java +++ b/Mage.Sets/src/mage/sets/innistrad/MikaeusTheLunarch.java @@ -30,26 +30,21 @@ package mage.sets.innistrad; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RemoveCountersSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.Effect; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.counter.AddCountersAllEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @author nantuko @@ -73,7 +68,7 @@ public class MikaeusTheLunarch extends CardImpl { this.toughness = new MageInt(0); // Mikaeus, the Lunarch enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new MikaeusTheLunarchEffect())); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); // {T}: Put a +1/+1 counter on Mikaeus. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new TapSourceCost())); @@ -94,38 +89,3 @@ public class MikaeusTheLunarch extends CardImpl { return new MikaeusTheLunarch(this); } } - -class MikaeusTheLunarchEffect extends OneShotEffect { - - public MikaeusTheLunarchEffect() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - public MikaeusTheLunarchEffect(final MikaeusTheLunarchEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public MikaeusTheLunarchEffect copy() { - return new MikaeusTheLunarchEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/BribersPurse.java b/Mage.Sets/src/mage/sets/khansoftarkir/BribersPurse.java index ac166275b31..4e539b0a845 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/BribersPurse.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/BribersPurse.java @@ -29,24 +29,19 @@ package mage.sets.khansoftarkir; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RemoveCountersSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.combat.CantAttackBlockTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.Counter; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; /** @@ -60,7 +55,7 @@ public class BribersPurse extends CardImpl { this.expansionSetCode = "KTK"; // Briber's Purse enters the battlefield with X gem counters on it. - this.addAbility(new EntersBattlefieldAbility(new BribersPurseEffect(), "{this} enters the battlefield with X gem counters on it")); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(new Counter("gem")))); // {1}, {T}, Remove a gem counter from Briber's Purse: Target creature can't attack or block this turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantAttackBlockTargetEffect(Duration.EndOfTurn), new GenericManaCost(1)); @@ -79,36 +74,3 @@ public class BribersPurse extends CardImpl { return new BribersPurse(this); } } - -class BribersPurseEffect extends OneShotEffect { - - public BribersPurseEffect() { - super(Outcome.Benefit); - } - - public BribersPurseEffect(final BribersPurseEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(new Counter("gem", amount), game); - } - } - } - return true; - } - - @Override - public BribersPurseEffect copy() { - return new BribersPurseEffect(this); - } -} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/HoodedHydra.java b/Mage.Sets/src/mage/sets/khansoftarkir/HoodedHydra.java index 9f577aba4dc..00f8710f667 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/HoodedHydra.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/HoodedHydra.java @@ -30,7 +30,6 @@ package mage.sets.khansoftarkir; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; @@ -38,19 +37,15 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.effects.AsTurnedFaceUpEffect; import mage.abilities.effects.Effect; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.MorphAbility; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.game.permanent.token.SnakeToken; /** @@ -69,7 +64,7 @@ public class HoodedHydra extends CardImpl { this.toughness = new MageInt(0); // Hooded Hydra enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new HoodedHydraEffect1(), "with X +1/+1 counters on it")); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); // When Hooded Hydra dies, put a 1/1 green Snake creature token onto the battlefield for each +1/+1 counter on it. this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new SnakeToken("KTK"), new CountersCount(CounterType.P1P1)), false)); @@ -95,38 +90,3 @@ public class HoodedHydra extends CardImpl { return new HoodedHydra(this); } } - -class HoodedHydraEffect1 extends OneShotEffect { - - public HoodedHydraEffect1() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - public HoodedHydraEffect1(final HoodedHydraEffect1 effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && !permanent.isFaceDown(game)) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public HoodedHydraEffect1 copy() { - return new HoodedHydraEffect1(this); - } - -} diff --git a/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java b/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java index 76a4fe38a78..5030d6044f3 100644 --- a/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java +++ b/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java @@ -30,14 +30,13 @@ package mage.sets.magic2012; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.SourceHasCounterCondition; import mage.abilities.decorator.ConditionalContinuousEffect; -import mage.abilities.effects.EntersBattlefieldEffect; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; @@ -67,8 +66,13 @@ public class PrimordialHydra extends CardImpl { this.power = new MageInt(0); this.toughness = new MageInt(0); - this.addAbility(new EntersBattlefieldAbility(new PrimordialHydraEntersEffect(), "{this} enters the battlefield with X +1/+1 counters on it")); + // Primordial Hydra enters the battlefield with X +1/+1 counters on it. + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); + + // At the beginning of your upkeep, double the number of +1/+1 counters on Primordial Hydra. this.addAbility(new BeginningOfUpkeepTriggeredAbility(new PrimordialHydraDoubleEffect(), TargetController.YOU, false)); + + // Primordial Hydra has trample as long as it has ten or more +1/+1 counters on it. ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance()), new SourceHasCounterCondition(CounterType.P1P1, 10), staticText); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); @@ -84,39 +88,6 @@ public class PrimordialHydra extends CardImpl { } } -class PrimordialHydraEntersEffect extends OneShotEffect { - - public PrimordialHydraEntersEffect() { - super(Outcome.BoostCreature); - } - - public PrimordialHydraEntersEffect(final PrimordialHydraEntersEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public PrimordialHydraEntersEffect copy() { - return new PrimordialHydraEntersEffect(this); - } -} - class PrimordialHydraDoubleEffect extends OneShotEffect { PrimordialHydraDoubleEffect() { diff --git a/Mage.Sets/src/mage/sets/magic2014/VastwoodHydra.java b/Mage.Sets/src/mage/sets/magic2014/VastwoodHydra.java index 128e2d989fd..9ac69ece96e 100644 --- a/Mage.Sets/src/mage/sets/magic2014/VastwoodHydra.java +++ b/Mage.Sets/src/mage/sets/magic2014/VastwoodHydra.java @@ -30,12 +30,11 @@ package mage.sets.magic2014; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.dynamicvalue.common.CountersCount; -import mage.abilities.effects.EntersBattlefieldEffect; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; @@ -70,7 +69,8 @@ public class VastwoodHydra extends CardImpl { this.toughness = new MageInt(0); // Vastwood Hydra enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new VastwoodHydraEffect())); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); + // When Vastwood Hydra dies, you may distribute a number of +1/+1 counters equal to the number of +1/+1 counters on Vastwood Hydra among any number of creatures you control. Ability ability = new DiesTriggeredAbility(new VastwoodHydraDistributeEffect(), true); ability.addTarget(new TargetCreaturePermanentAmount(new CountersCount(CounterType.P1P1), filter)); @@ -87,41 +87,6 @@ public class VastwoodHydra extends CardImpl { } } -class VastwoodHydraEffect extends OneShotEffect { - - public VastwoodHydraEffect() { - super(Outcome.BoostCreature); - staticText = "with X +1/+1 counters on it"; - } - - public VastwoodHydraEffect(final VastwoodHydraEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public VastwoodHydraEffect copy() { - return new VastwoodHydraEffect(this); - } - -} - class VastwoodHydraDistributeEffect extends OneShotEffect { public VastwoodHydraDistributeEffect() { diff --git a/Mage.Sets/src/mage/sets/magic2015/GenesisHydra.java b/Mage.Sets/src/mage/sets/magic2015/GenesisHydra.java index af7a92c7e13..703a9f5a0cf 100644 --- a/Mage.Sets/src/mage/sets/magic2015/GenesisHydra.java +++ b/Mage.Sets/src/mage/sets/magic2015/GenesisHydra.java @@ -31,10 +31,10 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.SpellAbility; -import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.EntersBattlefieldEffect; +import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CastSourceTriggeredAbility; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; @@ -51,7 +51,6 @@ import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.game.Game; -import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetCard; @@ -72,8 +71,9 @@ public class GenesisHydra extends CardImpl { // When you cast Genesis Hydra, reveal the top X cards of your library. You may put a nonland permanent card with converted mana cost X or less from among them onto the battlefield. Then shuffle the rest into your library. this.addAbility(new CastSourceTriggeredAbility(new GenesisHydraPutOntoBattlefieldEffect(), false)); + // Genesis Hydra enters the battlefield with X +1/+1 counters on it. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new GenesisHydraEntersBattlefieldEffect()))); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); } public GenesisHydra(final GenesisHydra card) { @@ -86,43 +86,6 @@ public class GenesisHydra extends CardImpl { } } -class GenesisHydraEntersBattlefieldEffect extends OneShotEffect { - - public GenesisHydraEntersBattlefieldEffect() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - public GenesisHydraEntersBattlefieldEffect(final GenesisHydraEntersBattlefieldEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - } - return true; - } - - @Override - public GenesisHydraEntersBattlefieldEffect copy() { - return new GenesisHydraEntersBattlefieldEffect(this); - } - -} - class GenesisHydraPutOntoBattlefieldEffect extends OneShotEffect { public GenesisHydraPutOntoBattlefieldEffect() { diff --git a/Mage.Sets/src/mage/sets/magicorigins/HangarbackWalker.java b/Mage.Sets/src/mage/sets/magicorigins/HangarbackWalker.java index 0b0a72bf055..652cbf4a8c0 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/HangarbackWalker.java +++ b/Mage.Sets/src/mage/sets/magicorigins/HangarbackWalker.java @@ -30,25 +30,20 @@ package mage.sets.magicorigins; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.dynamicvalue.common.CountersCount; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.game.permanent.token.ThopterColorlessToken; /** @@ -65,7 +60,7 @@ public class HangarbackWalker extends CardImpl { this.toughness = new MageInt(0); // Hangarback Walker enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new HangarbackWalkerEffect(), "with X +1/+1 counters on it")); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); // When Hangarback Walker dies, put a 1/1 colorless Thopter artifact creature token with flying onto the battlefield for each +1/+1 counter on Hangarback Walker. this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new ThopterColorlessToken(), new CountersCount(CounterType.P1P1)), false)); @@ -85,38 +80,3 @@ public class HangarbackWalker extends CardImpl { return new HangarbackWalker(this); } } - -class HangarbackWalkerEffect extends OneShotEffect { - - public HangarbackWalkerEffect() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - public HangarbackWalkerEffect(final HangarbackWalkerEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public HangarbackWalkerEffect copy() { - return new HangarbackWalkerEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java b/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java index afab045802d..4192513f685 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java +++ b/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java @@ -29,12 +29,11 @@ package mage.sets.mirrodin; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.effects.Effect; -import mage.abilities.effects.EntersBattlefieldEffect; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; @@ -58,7 +57,7 @@ public class ChaliceOfTheVoid extends CardImpl { this.expansionSetCode = "MRD"; // Chalice of the Void enters the battlefield with X charge counters on it. - this.addAbility(new EntersBattlefieldAbility(new ChaliceOfTheVoidEffect(), "with X charge counters on it")); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.CHARGE.createInstance()))); // Whenever a player casts a spell with converted mana cost equal to the number of charge counters on Chalice of the Void, counter that spell. this.addAbility(new ChaliceOfTheVoidTriggeredAbility()); @@ -74,39 +73,6 @@ public class ChaliceOfTheVoid extends CardImpl { } } -class ChaliceOfTheVoidEffect extends OneShotEffect { - - public ChaliceOfTheVoidEffect() { - super(Outcome.Benefit); - } - - public ChaliceOfTheVoidEffect(final ChaliceOfTheVoidEffect effect) { - super(effect); - } - - @java.lang.Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.CHARGE.createInstance(amount), game); - } - } - } - return true; - } - - @java.lang.Override - public ChaliceOfTheVoidEffect copy() { - return new ChaliceOfTheVoidEffect(this); - } -} - class ChaliceOfTheVoidTriggeredAbility extends TriggeredAbilityImpl { public ChaliceOfTheVoidTriggeredAbility() { diff --git a/Mage.Sets/src/mage/sets/returntoravnica/ManaBloom.java b/Mage.Sets/src/mage/sets/returntoravnica/ManaBloom.java index f0d423cd6f4..87a8f09f4b8 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/ManaBloom.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/ManaBloom.java @@ -29,27 +29,22 @@ package mage.sets.returntoravnica; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.common.SourceHasCounterCondition; import mage.abilities.costs.common.RemoveCountersSourceCost; import mage.abilities.decorator.ConditionalTriggeredAbility; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.AddManaOfAnyColorEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.abilities.mana.ActivateOncePerTurnManaAbility; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -64,7 +59,7 @@ public class ManaBloom extends CardImpl { this.expansionSetCode = "RTR"; // Mana Bloom enters the battlefield with X charge counters on it. - this.addAbility(new EntersBattlefieldAbility(new ManaBloomEffect(), rule)); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.CHARGE.createInstance()))); // Remove a charge counter from Mana Bloom: Add one mana of any color to your mana pool. Activate this ability only once each turn. Ability ability = new ActivateOncePerTurnManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance())); @@ -85,39 +80,3 @@ public class ManaBloom extends CardImpl { return new ManaBloom(this); } } - -class ManaBloomEffect extends OneShotEffect { - - public ManaBloomEffect() { - super(Outcome.Benefit); - } - - public ManaBloomEffect(final ManaBloomEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - // delete to prevent using it again if put into battlefield from other effect - setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null); - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.CHARGE.createInstance(amount), game); - return true; - } - } - } - return true; - } - - @Override - public ManaBloomEffect copy() { - return new ManaBloomEffect(this); - } -} diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/MagaTraitorToMortals.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/MagaTraitorToMortals.java index 028f9299594..ac4e94bcef7 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/MagaTraitorToMortals.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/MagaTraitorToMortals.java @@ -30,20 +30,15 @@ package mage.sets.saviorsofkamigawa; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.dynamicvalue.common.CountersCount; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.TargetPlayer; /** @@ -63,7 +58,7 @@ public class MagaTraitorToMortals extends CardImpl { this.toughness = new MageInt(0); // Maga, Traitor to Mortals enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new MagaTraitorToMortalsEnterBattlefieldEffect())); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); // When Maga enters the battlefield, target player loses life equal to the number of +1/+1 counters on it. Ability ability = new EntersBattlefieldTriggeredAbility( @@ -81,38 +76,3 @@ public class MagaTraitorToMortals extends CardImpl { return new MagaTraitorToMortals(this); } } - -class MagaTraitorToMortalsEnterBattlefieldEffect extends OneShotEffect { - - public MagaTraitorToMortalsEnterBattlefieldEffect() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - public MagaTraitorToMortalsEnterBattlefieldEffect(final MagaTraitorToMortalsEnterBattlefieldEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public MagaTraitorToMortalsEnterBattlefieldEffect copy() { - return new MagaTraitorToMortalsEnterBattlefieldEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/ChimericMass.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/ChimericMass.java index 6ca59c6d7b8..ed95ec8d7af 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/ChimericMass.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/ChimericMass.java @@ -29,26 +29,20 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.dynamicvalue.common.CountersCount; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; /** @@ -61,7 +55,7 @@ public class ChimericMass extends CardImpl { this.expansionSetCode = "SOM"; // Chimeric Mass enters the battlefield with X charge counters on it. - this.addAbility(new EntersBattlefieldAbility(new ChimericMassEffect(), "{this} enters the battlefield with X charge counters on it")); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.CHARGE.createInstance()))); // {1}: Until end of turn, Chimeric Mass becomes a Construct artifact creature with "This creature's power and toughness are each equal to the number of charge counters on it." this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChimericMassToken(), "", Duration.EndOfTurn), new GenericManaCost(1))); @@ -78,39 +72,6 @@ public class ChimericMass extends CardImpl { } -class ChimericMassEffect extends OneShotEffect { - - public ChimericMassEffect() { - super(Outcome.Benefit); - } - - public ChimericMassEffect(final ChimericMassEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.CHARGE.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public ChimericMassEffect copy() { - return new ChimericMassEffect(this); - } -} - class ChimericMassToken extends Token { public ChimericMassToken() { diff --git a/Mage.Sets/src/mage/sets/shardsofalara/FeralHydra.java b/Mage.Sets/src/mage/sets/shardsofalara/FeralHydra.java index a6d8eeda839..5eed25187ea 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/FeralHydra.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/FeralHydra.java @@ -29,24 +29,18 @@ package mage.sets.shardsofalara; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -64,7 +58,8 @@ public class FeralHydra extends CardImpl { this.toughness = new MageInt(0); // Feral Hydra enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new FeralHydraEffect(), true)); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); + // {3}: Put a +1/+1 counter on Feral Hydra. Any player may activate this ability. SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new ManaCostsImpl("{3}")); ability.setMayActivate(TargetController.ANY); @@ -81,37 +76,3 @@ public class FeralHydra extends CardImpl { return new FeralHydra(this); } } - -class FeralHydraEffect extends OneShotEffect { - - public FeralHydraEffect() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - public FeralHydraEffect(final FeralHydraEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public FeralHydraEffect copy() { - return new FeralHydraEffect(this); - } -} diff --git a/Mage.Sets/src/mage/sets/shardsofalara/SigilOfDistinction.java b/Mage.Sets/src/mage/sets/shardsofalara/SigilOfDistinction.java index dc7aa39b6e6..d390ef3ac8c 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/SigilOfDistinction.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/SigilOfDistinction.java @@ -28,14 +28,11 @@ package mage.sets.shardsofalara; import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.RemoveCountersSourceCost; import mage.abilities.dynamicvalue.common.CountersCount; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; @@ -44,8 +41,6 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @author Loki @@ -58,7 +53,7 @@ public class SigilOfDistinction extends CardImpl { this.subtype.add("Equipment"); // Sigil of Distinction enters the battlefield with X charge counters on it. - this.addAbility(new EntersBattlefieldAbility(new SigilOfDistinctionEffect(), "{this} enters the battlefield with X charge counters on it")); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.CHARGE.createInstance()))); // Equipped creature gets +1/+1 for each charge counter on Sigil of Distinction. BoostEquippedEffect effect = new BoostEquippedEffect(new CountersCount(CounterType.CHARGE), new CountersCount(CounterType.CHARGE)); @@ -78,37 +73,3 @@ public class SigilOfDistinction extends CardImpl { return new SigilOfDistinction(this); } } - -class SigilOfDistinctionEffect extends OneShotEffect { - - public SigilOfDistinctionEffect() { - super(Outcome.Benefit); - } - - public SigilOfDistinctionEffect(final SigilOfDistinctionEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.CHARGE.createInstance(amount), game); - return true; - } - } - } - return true; - } - - @Override - public SigilOfDistinctionEffect copy() { - return new SigilOfDistinctionEffect(this); - } -} diff --git a/Mage.Sets/src/mage/sets/tempest/Krakilin.java b/Mage.Sets/src/mage/sets/tempest/Krakilin.java index 55ac185a0ef..4f1cb03d1bd 100644 --- a/Mage.Sets/src/mage/sets/tempest/Krakilin.java +++ b/Mage.Sets/src/mage/sets/tempest/Krakilin.java @@ -29,22 +29,16 @@ package mage.sets.tempest; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.RegenerateSourceEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -60,7 +54,7 @@ public class Krakilin extends CardImpl { this.toughness = new MageInt(0); // Krakilin enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new KrakilinEffect())); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); // {1}{G}: Regenerate Krakilin. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{1}{G}"))); @@ -75,37 +69,3 @@ public class Krakilin extends CardImpl { return new Krakilin(this); } } - -class KrakilinEffect extends OneShotEffect { - - public KrakilinEffect() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - public KrakilinEffect(final KrakilinEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public KrakilinEffect copy() { - return new KrakilinEffect(this); - } -} diff --git a/Mage.Sets/src/mage/sets/theros/MistcutterHydra.java b/Mage.Sets/src/mage/sets/theros/MistcutterHydra.java index 7fa563f6761..8ccd965236b 100644 --- a/Mage.Sets/src/mage/sets/theros/MistcutterHydra.java +++ b/Mage.Sets/src/mage/sets/theros/MistcutterHydra.java @@ -30,23 +30,17 @@ package mage.sets.theros; import java.util.UUID; import mage.MageInt; import mage.ObjectColor; -import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.CantBeCounteredAbility; import mage.abilities.common.EntersBattlefieldAbility; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.ProtectionAbility; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.counters.CounterType; import mage.filter.FilterObject; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -75,7 +69,7 @@ public class MistcutterHydra extends CardImpl { // protection from blue this.addAbility(new ProtectionAbility(filter)); // Mistcutter Hydra enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new MistcutterHydraEffect())); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); } public MistcutterHydra(final MistcutterHydra card) { @@ -87,37 +81,3 @@ public class MistcutterHydra extends CardImpl { return new MistcutterHydra(this); } } - -class MistcutterHydraEffect extends OneShotEffect { - - public MistcutterHydraEffect() { - super(Outcome.BoostCreature); - staticText = "{this} enters the battlefield with X +1/+1 counters on it"; - } - - public MistcutterHydraEffect(final MistcutterHydraEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public MistcutterHydraEffect copy() { - return new MistcutterHydraEffect(this); - } -} diff --git a/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java b/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java index e06229d3abb..8e513985729 100644 --- a/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java +++ b/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java @@ -30,18 +30,15 @@ package mage.sets.visions; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.common.CantBlockAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.EntersBattlefieldEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.combat.CantAttackBlockUnlessPaysSourceEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; @@ -63,7 +60,7 @@ public class PhyrexianMarauder extends CardImpl { this.toughness = new MageInt(0); // Phyrexian Marauder enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new PhyrexianMarauderEntersEffect(), "with X +1/+1 counters on it")); + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); // Phyrexian Marauder can't block. this.addAbility(new CantBlockAbility()); @@ -82,39 +79,6 @@ public class PhyrexianMarauder extends CardImpl { } } -class PhyrexianMarauderEntersEffect extends OneShotEffect { - - PhyrexianMarauderEntersEffect() { - super(Outcome.BoostCreature); - } - - PhyrexianMarauderEntersEffect(final PhyrexianMarauderEntersEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && !permanent.isFaceDown(game)) { - SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); - if (spellAbility != null - && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) { - int amount = spellAbility.getManaCostsToPay().getX(); - if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); - } - } - } - return true; - } - - @Override - public PhyrexianMarauderEntersEffect copy() { - return new PhyrexianMarauderEntersEffect(this); - } -} - class PhyrexianMarauderCantAttackUnlessYouPayEffect extends CantAttackBlockUnlessPaysSourceEffect { PhyrexianMarauderCantAttackUnlessYouPayEffect() {