From 190f9dc0b3df156903071cd5bd0154a3dd3da2fc Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 14 Mar 2015 09:48:20 +0100 Subject: [PATCH] Reworked some replacement effects. --- .../GiselaBladeOfGoldnight.java | 63 +++++++++++-------- .../sets/betrayersofkamigawa/Overblaze.java | 20 +++--- .../darkascension/CurseOfBloodletting.java | 20 +++--- .../mage/sets/innistrad/InquisitorsFlail.java | 52 ++++++++------- .../mage/sets/innistrad/ParallelLives.java | 29 +++++---- .../src/mage/sets/magic2011/FireServant.java | 41 ++++++------ .../mage/sets/magic2013/RhoxFaithmender.java | 25 ++++---- .../sets/modernmasters/DoublingSeason.java | 10 ++- .../mage/sets/shadowmoor/BoonReflection.java | 28 +++++---- .../mage/sets/zendikar/QuestForPureFlame.java | 46 +++++++------- 10 files changed, 177 insertions(+), 157 deletions(-) diff --git a/Mage.Sets/src/mage/sets/avacynrestored/GiselaBladeOfGoldnight.java b/Mage.Sets/src/mage/sets/avacynrestored/GiselaBladeOfGoldnight.java index 42bb99a7fe..871ff82d7a 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/GiselaBladeOfGoldnight.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/GiselaBladeOfGoldnight.java @@ -27,7 +27,7 @@ */ package mage.sets.avacynrestored; -import mage.constants.*; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; @@ -35,12 +35,19 @@ import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.FlyingAbility; 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.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import static mage.game.events.GameEvent.EventType.DAMAGE_CREATURE; +import static mage.game.events.GameEvent.EventType.DAMAGE_PLANESWALKER; +import static mage.game.events.GameEvent.EventType.DAMAGE_PLAYER; import mage.game.permanent.Permanent; -import java.util.UUID; - /** * * @author noxx @@ -53,8 +60,6 @@ public class GiselaBladeOfGoldnight extends CardImpl { this.supertype.add("Legendary"); this.subtype.add("Angel"); - this.color.setRed(true); - this.color.setWhite(true); this.power = new MageInt(5); this.toughness = new MageInt(5); @@ -93,8 +98,35 @@ class GiselaBladeOfGoldnightDoubleDamageEffect extends ReplacementEffectImpl { return new GiselaBladeOfGoldnightDoubleDamageEffect(this); } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(EventType.DAMAGE_CREATURE) || + event.getType().equals(EventType.DAMAGE_PLANESWALKER) || + event.getType().equals(EventType.DAMAGE_PLAYER); + } + + @Override public boolean applies(GameEvent event, Ability source, Game game) { + return true; + } + + private void preventDamage(GameEvent event, Ability source, UUID target, Game game) { + int amount = (int)Math.ceil(event.getAmount() / 2.0); + GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, target, source.getSourceId(), source.getControllerId(), amount, false); + if (!game.replaceEvent(preventEvent)) { + event.setAmount(event.getAmount() - amount); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, target, source.getSourceId(), source.getControllerId(), amount)); + } + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { switch (event.getType()) { case DAMAGE_PLAYER: if (event.getTargetId().equals(source.getControllerId())) { @@ -116,25 +148,4 @@ class GiselaBladeOfGoldnightDoubleDamageEffect extends ReplacementEffectImpl { } return false; } - - private void preventDamage(GameEvent event, Ability source, UUID target, Game game) { - int amount = (int)Math.ceil(event.getAmount() / 2.0); - GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, target, source.getSourceId(), source.getControllerId(), amount, false); - if (!game.replaceEvent(preventEvent)) { - event.setAmount(event.getAmount() - amount); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, target, source.getSourceId(), source.getControllerId(), amount)); - } - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return apply(game, source); - } - } - diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/Overblaze.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/Overblaze.java index 0a18b424a3..50a66e1d77 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/Overblaze.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/Overblaze.java @@ -38,8 +38,6 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.game.Game; import mage.game.events.GameEvent; -import static mage.game.events.GameEvent.EventType.DAMAGE_CREATURE; -import static mage.game.events.GameEvent.EventType.DAMAGE_PLAYER; import mage.target.TargetPermanent; /** @@ -88,16 +86,15 @@ class FireServantEffect extends ReplacementEffectImpl { return new FireServantEffect(this); } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE) || + event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - switch (event.getType()) { - case DAMAGE_CREATURE: - case DAMAGE_PLAYER: - if (event.getSourceId().equals(this.getTargetPointer().getFirst(game, source))) { - event.setAmount(event.getAmount() * 2); - } - } - return false; + return event.getSourceId().equals(this.getTargetPointer().getFirst(game, source)); } @Override @@ -107,7 +104,8 @@ class FireServantEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return apply(game, source); + event.setAmount(event.getAmount() * 2); + return false; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/darkascension/CurseOfBloodletting.java b/Mage.Sets/src/mage/sets/darkascension/CurseOfBloodletting.java index 522e49f38d..7602ed7e91 100644 --- a/Mage.Sets/src/mage/sets/darkascension/CurseOfBloodletting.java +++ b/Mage.Sets/src/mage/sets/darkascension/CurseOfBloodletting.java @@ -41,9 +41,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; -import static mage.game.events.GameEvent.EventType.DAMAGE_PLAYER; import mage.game.permanent.Permanent; -import mage.players.Player; import mage.target.TargetPlayer; /** @@ -96,16 +94,18 @@ class CurseOfBloodlettingEffect extends ReplacementEffectImpl { return new CurseOfBloodlettingEffect(this); } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - switch (event.getType()) { - case DAMAGE_PLAYER: - Permanent enchantment = game.getPermanent(source.getSourceId()); - if (enchantment != null && - enchantment.getAttachedTo() != null && - event.getTargetId().equals(enchantment.getAttachedTo())) { - return true; - } + Permanent enchantment = game.getPermanent(source.getSourceId()); + if (enchantment != null && + enchantment.getAttachedTo() != null && + event.getTargetId().equals(enchantment.getAttachedTo())) { + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/innistrad/InquisitorsFlail.java b/Mage.Sets/src/mage/sets/innistrad/InquisitorsFlail.java index 360b4fcaee..053cec727c 100644 --- a/Mage.Sets/src/mage/sets/innistrad/InquisitorsFlail.java +++ b/Mage.Sets/src/mage/sets/innistrad/InquisitorsFlail.java @@ -27,21 +27,24 @@ */ package mage.sets.innistrad; -import mage.constants.*; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.keyword.EquipAbility; 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.game.Game; import mage.game.events.DamageCreatureEvent; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; -import java.util.UUID; - /** * @author nantuko */ @@ -87,29 +90,31 @@ class InquisitorsFlailEffect extends ReplacementEffectImpl { return new InquisitorsFlailEffect(this); } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE) || + event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER) || + event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { boolean isCombat = false; - switch (event.getType()) { - case DAMAGE_CREATURE: - case DAMAGE_PLAYER: - case DAMAGE_PLANESWALKER: - if (event instanceof DamageCreatureEvent) { - isCombat = ((DamageCreatureEvent) event).isCombatDamage(); - } else if (event instanceof DamageEvent) { - isCombat = ((DamageEvent) event).isCombatDamage(); - } - if (isCombat) { - Permanent equipment = game.getPermanent(source.getSourceId()); - if (equipment != null && equipment.getAttachedTo() != null) { - UUID attachedTo = equipment.getAttachedTo(); - if (event.getSourceId().equals(attachedTo)) { - event.setAmount(event.getAmount() * 2); - } else if (event.getTargetId().equals(attachedTo)) { - event.setAmount(event.getAmount() * 2); - } - } + if (event instanceof DamageCreatureEvent) { + isCombat = ((DamageCreatureEvent) event).isCombatDamage(); + } else if (event instanceof DamageEvent) { + isCombat = ((DamageEvent) event).isCombatDamage(); + } + if (isCombat) { + Permanent equipment = game.getPermanent(source.getSourceId()); + if (equipment != null && equipment.getAttachedTo() != null) { + UUID attachedTo = equipment.getAttachedTo(); + if (event.getSourceId().equals(attachedTo)) { + return true; + } else if (event.getTargetId().equals(attachedTo)) { + return true; } + } } return false; } @@ -121,7 +126,8 @@ class InquisitorsFlailEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return apply(game, source); + event.setAmount(event.getAmount() * 2); + return false; } } diff --git a/Mage.Sets/src/mage/sets/innistrad/ParallelLives.java b/Mage.Sets/src/mage/sets/innistrad/ParallelLives.java index b111b5f473..6c21df3813 100644 --- a/Mage.Sets/src/mage/sets/innistrad/ParallelLives.java +++ b/Mage.Sets/src/mage/sets/innistrad/ParallelLives.java @@ -28,17 +28,18 @@ package mage.sets.innistrad; import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +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.abilities.Ability; -import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ReplacementEffectImpl; -import mage.cards.CardImpl; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.StackObject; /** @@ -51,8 +52,6 @@ public class ParallelLives extends CardImpl { super(ownerId, 199, "Parallel Lives", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}"); this.expansionSetCode = "ISD"; - this.color.setGreen(true); - // If an effect would put one or more tokens onto the battlefield under your control, it puts twice that many of those tokens onto the battlefield instead. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ParallelLivesEffect())); } @@ -83,16 +82,15 @@ class ParallelLivesEffect extends ReplacementEffectImpl { return new ParallelLivesEffect(this); } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(EventType.CREATE_TOKEN); + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - switch (event.getType()) { - case CREATE_TOKEN: - StackObject spell = game.getStack().getStackObject(event.getSourceId()); - if (spell != null && spell.getControllerId().equals(source.getControllerId())) { - event.setAmount(event.getAmount() * 2); - } - } - return false; + StackObject spell = game.getStack().getStackObject(event.getSourceId()); + return spell != null && spell.getControllerId().equals(source.getControllerId()); } @Override @@ -102,7 +100,8 @@ class ParallelLivesEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return apply(game, source); + event.setAmount(event.getAmount() * 2); + return false; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/magic2011/FireServant.java b/Mage.Sets/src/mage/sets/magic2011/FireServant.java index 55ac584f90..3ce806c9ee 100644 --- a/Mage.Sets/src/mage/sets/magic2011/FireServant.java +++ b/Mage.Sets/src/mage/sets/magic2011/FireServant.java @@ -29,16 +29,16 @@ package mage.sets.magic2011; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ReplacementEffectImpl; 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.game.Game; import mage.game.events.GameEvent; import mage.game.stack.StackObject; @@ -53,10 +53,11 @@ public class FireServant extends CardImpl { super(ownerId, 137, "Fire Servant", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); this.expansionSetCode = "M11"; this.subtype.add("Elemental"); - this.color.setRed(true); + this.power = new MageInt(4); this.toughness = new MageInt(3); + // If a red instant or sorcery spell you control would deal damage, it deals double that damage instead. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new FireServantEffect())); } @@ -87,19 +88,20 @@ class FireServantEffect extends ReplacementEffectImpl { return new FireServantEffect(this); } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE) || + event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER) || + event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - switch (event.getType()) { - case DAMAGE_CREATURE: - case DAMAGE_PLAYER: - case DAMAGE_PLANESWALKER: - StackObject spell = game.getStack().getStackObject(event.getSourceId()); - if (spell != null && spell.getControllerId().equals(source.getControllerId()) && spell.getColor().isRed() && - (spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))) { - event.setAmount(event.getAmount() * 2); - } - } - return false; + StackObject spell = game.getStack().getStackObject(event.getSourceId()); + return spell != null && + spell.getControllerId().equals(source.getControllerId()) && + spell.getColor().isRed() && + (spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY)); } @Override @@ -109,7 +111,8 @@ class FireServantEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return apply(game, source); + event.setAmount(event.getAmount() * 2); + return false; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/magic2013/RhoxFaithmender.java b/Mage.Sets/src/mage/sets/magic2013/RhoxFaithmender.java index f8d9a87145..1c101952a6 100644 --- a/Mage.Sets/src/mage/sets/magic2013/RhoxFaithmender.java +++ b/Mage.Sets/src/mage/sets/magic2013/RhoxFaithmender.java @@ -28,16 +28,20 @@ package mage.sets.magic2013; import java.util.UUID; - -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.keyword.LifelinkAbility; 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.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -51,7 +55,6 @@ public class RhoxFaithmender extends CardImpl { this.subtype.add("Rhino"); this.subtype.add("Monk"); - this.color.setWhite(true); this.power = new MageInt(1); this.toughness = new MageInt(5); @@ -95,18 +98,18 @@ class RhoxFaithmenderEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return apply(game, source); + event.setAmount(event.getAmount() * 2); + return false; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(EventType.GAIN_LIFE); } @Override public boolean applies(GameEvent event, Ability source, Game game) { - switch (event.getType()) { - case GAIN_LIFE: - if (event.getPlayerId().equals(source.getControllerId()) && (source.getControllerId() != null)) { - event.setAmount(event.getAmount() * 2); - } - } - return false; + return event.getPlayerId().equals(source.getControllerId()) && (source.getControllerId() != null); } } diff --git a/Mage.Sets/src/mage/sets/modernmasters/DoublingSeason.java b/Mage.Sets/src/mage/sets/modernmasters/DoublingSeason.java index 44583eddf5..4c42462e1f 100644 --- a/Mage.Sets/src/mage/sets/modernmasters/DoublingSeason.java +++ b/Mage.Sets/src/mage/sets/modernmasters/DoublingSeason.java @@ -28,15 +28,15 @@ package mage.sets.modernmasters; import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +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.abilities.Ability; -import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ReplacementEffectImpl; -import mage.cards.CardImpl; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -52,8 +52,6 @@ public class DoublingSeason extends CardImpl { super(ownerId, 141, "Doubling Season", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}"); this.expansionSetCode = "MMA"; - this.color.setGreen(true); - // If an effect would put one or more tokens onto the battlefield under your control, it puts twice that many of those tokens onto the battlefield instead. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DoublingSeasonTokenEffect())); // 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. diff --git a/Mage.Sets/src/mage/sets/shadowmoor/BoonReflection.java b/Mage.Sets/src/mage/sets/shadowmoor/BoonReflection.java index 58b5f5f61b..d5c8268291 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/BoonReflection.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/BoonReflection.java @@ -28,14 +28,18 @@ package mage.sets.shadowmoor; import java.util.UUID; - -import mage.constants.*; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ReplacementEffectImpl; 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.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -48,8 +52,6 @@ public class BoonReflection extends CardImpl { super(ownerId, 5, "Boon Reflection", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}"); this.expansionSetCode = "SHM"; - this.color.setWhite(true); - // If you would gain life, you gain twice that much life instead. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoonReflectionEffect())); } @@ -87,17 +89,17 @@ class BoonReflectionEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return apply(game, source); + event.setAmount(event.getAmount() * 2); + return false; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(EventType.GAIN_LIFE); } @Override public boolean applies(GameEvent event, Ability source, Game game) { - switch (event.getType()) { - case GAIN_LIFE: - if (event.getPlayerId().equals(source.getControllerId()) && (source.getControllerId() != null)) { - event.setAmount(event.getAmount() * 2); - } - } - return false; + return event.getPlayerId().equals(source.getControllerId()) && (source.getControllerId() != null); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/zendikar/QuestForPureFlame.java b/Mage.Sets/src/mage/sets/zendikar/QuestForPureFlame.java index b1f90b7eb1..95a4f09d1e 100644 --- a/Mage.Sets/src/mage/sets/zendikar/QuestForPureFlame.java +++ b/Mage.Sets/src/mage/sets/zendikar/QuestForPureFlame.java @@ -28,10 +28,6 @@ package mage.sets.zendikar; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleActivatedAbility; @@ -40,8 +36,11 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.counter.AddCountersSourceEffect; 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.events.GameEvent; @@ -59,8 +58,6 @@ public class QuestForPureFlame extends CardImpl { super(ownerId, 144, "Quest for Pure Flame", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{R}"); this.expansionSetCode = "ZEN"; - this.color.setRed(true); - // Whenever a source you control deals damage to an opponent, you may put a quest counter on Quest for Pure Flame. this.addAbility(new QuestForPureFlameTriggeredAbility()); @@ -139,22 +136,24 @@ class QuestForPureFlameEffect extends ReplacementEffectImpl { } @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER) - || event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)) { - Permanent permanent = game.getPermanent(event.getSourceId()); - Player player = game.getPlayer(event.getSourceId()); - StackObject spell = game.getStack().getStackObject(event.getSourceId()); + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE) || + event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); + } - if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { - event.setAmount(event.getAmount() * 2); - } - if (player != null && player.getId().equals(source.getControllerId())) { - event.setAmount(event.getAmount() * 2); - } - if (spell != null && spell.getControllerId().equals(source.getControllerId())) { - event.setAmount(event.getAmount() * 2); - } + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Permanent permanent = game.getPermanent(event.getSourceId()); + if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { + return true; + } + Player player = game.getPlayer(event.getSourceId()); + if (player != null && player.getId().equals(source.getControllerId())) { + return true; + } + StackObject spell = game.getStack().getStackObject(event.getSourceId()); + if (spell != null && spell.getControllerId().equals(source.getControllerId())) { + return true; } return false; } @@ -166,6 +165,7 @@ class QuestForPureFlameEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return apply(game, source); + event.setAmount(event.getAmount() * 2); + return false; } -} \ No newline at end of file +}