From fef34b65f6cf932e7ca5c051fc2c9fb293d6705c Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 18 Oct 2015 23:47:51 +0200 Subject: [PATCH] * Some more changes for rework of ENTERS_THE_BATTLEFIELD event and card movement. --- .../src/mage/sets/commander2013/PrimalVigor.java | 10 ++++++---- .../mage/sets/khansoftarkir/HardenedScales.java | 15 +++++++++------ .../mage/sets/modernmasters/DoublingSeason.java | 12 ++++++++---- .../sets/returntoravnica/CorpsejackMenace.java | 10 ++-------- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/Mage.Sets/src/mage/sets/commander2013/PrimalVigor.java b/Mage.Sets/src/mage/sets/commander2013/PrimalVigor.java index ee069e6b00..468b0b9fae 100644 --- a/Mage.Sets/src/mage/sets/commander2013/PrimalVigor.java +++ b/Mage.Sets/src/mage/sets/commander2013/PrimalVigor.java @@ -51,7 +51,6 @@ public class PrimalVigor extends CardImpl { super(ownerId, 162, "Primal Vigor", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}"); this.expansionSetCode = "C13"; - // If one or more tokens would be put onto the battlefield, twice that many of those tokens are put onto the battlefield instead. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PrimalVigorTokenEffect())); // If one or more +1/+1 counters would be placed on a creature, twice that many +1/+1 counters are placed on that creature instead. @@ -121,7 +120,7 @@ class PrimalVigorCounterEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - event.setAmount(event.getAmount() *2); + event.setAmount(event.getAmount() * 2); return false; } @@ -132,8 +131,11 @@ class PrimalVigorCounterEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent target = game.getPermanent(event.getTargetId()); - if (target != null && target.getCardType().contains(CardType.CREATURE) + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent == null) { + permanent = game.getPermanentEntering(event.getTargetId()); + } + if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && event.getData() != null && event.getData().equals("+1/+1")) { return true; } diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/HardenedScales.java b/Mage.Sets/src/mage/sets/khansoftarkir/HardenedScales.java index 3ecbf0b73e..a83fa7b78b 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/HardenedScales.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/HardenedScales.java @@ -53,7 +53,6 @@ public class HardenedScales extends CardImpl { super(ownerId, 133, "Hardened Scales", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{G}"); this.expansionSetCode = "KTK"; - // If one or more +1/+1 counters would be placed on a creature you control, that many plus one +1/+1 counters are placed on it instead. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HardenedScalesEffect())); @@ -70,6 +69,7 @@ public class HardenedScales extends CardImpl { } class HardenedScalesEffect extends ReplacementEffectImpl { + HardenedScalesEffect() { super(Duration.WhileOnBattlefield, Outcome.BoostCreature, false); staticText = "If one or more +1/+1 counters would be placed on a creature you control, that many plus one +1/+1 counters are placed on it instead"; @@ -86,17 +86,20 @@ class HardenedScalesEffect extends ReplacementEffectImpl { return false; } - @Override + @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == EventType.ADD_COUNTERS; } - + @Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getData().equals(CounterType.P1P1.getName())) { - Permanent target = game.getPermanent(event.getTargetId()); - if (target != null && target.getControllerId().equals(source.getControllerId()) - && target.getCardType().contains(CardType.CREATURE)) { + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent == null) { + permanent = game.getPermanentEntering(event.getTargetId()); + } + if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) + && permanent.getCardType().contains(CardType.CREATURE)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/modernmasters/DoublingSeason.java b/Mage.Sets/src/mage/sets/modernmasters/DoublingSeason.java index 4c42462e1f..1067cb393f 100644 --- a/Mage.Sets/src/mage/sets/modernmasters/DoublingSeason.java +++ b/Mage.Sets/src/mage/sets/modernmasters/DoublingSeason.java @@ -113,6 +113,7 @@ class DoublingSeasonTokenEffect extends ReplacementEffectImpl { } class DoublingSeasonCounterEffect extends ReplacementEffectImpl { + DoublingSeasonCounterEffect() { super(Duration.WhileOnBattlefield, Outcome.BoostCreature, false); staticText = "If an effect would place one or more counters on a permanent you control, it places twice that many of those counters on that permanent instead"; @@ -128,15 +129,18 @@ class DoublingSeasonCounterEffect extends ReplacementEffectImpl { return false; } - @Override + @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ADD_COUNTERS; } - + @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent target = game.getPermanent(event.getTargetId()); - if (target != null && target.getControllerId().equals(source.getControllerId())) { + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent == null) { + permanent = game.getPermanentEntering(event.getTargetId()); + } + if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { return true; } return false; diff --git a/Mage.Sets/src/mage/sets/returntoravnica/CorpsejackMenace.java b/Mage.Sets/src/mage/sets/returntoravnica/CorpsejackMenace.java index 10bf030e45..5808579556 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/CorpsejackMenace.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/CorpsejackMenace.java @@ -93,14 +93,8 @@ class CorpsejackMenaceReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent == null) { - permanent = game.getPermanentEntering(event.getTargetId()); - } - if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(event.getAmount() * 2), game, event.getAppliedEffects()); - } - return true; + event.setAmount(event.getAmount() * 2); + return false; } @Override