diff --git a/Mage.Sets/src/mage/sets/tempest/FurnaceOfRath.java b/Mage.Sets/src/mage/sets/tempest/FurnaceOfRath.java index 930a74cfce..2508b04cc9 100644 --- a/Mage.Sets/src/mage/sets/tempest/FurnaceOfRath.java +++ b/Mage.Sets/src/mage/sets/tempest/FurnaceOfRath.java @@ -36,7 +36,11 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ReplacementEffectImpl; import mage.cards.CardImpl; import mage.game.Game; +import mage.game.events.DamageEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.players.Player; /** * @@ -83,13 +87,13 @@ class FurnaceOfRathEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - switch (event.getType()) { - case DAMAGE_PLAYER: - event.setAmount(event.getAmount() * 2); - return true; - case DAMAGE_CREATURE: - event.setAmount(event.getAmount() * 2); - return true; + if (!event.getAppliedEffects().contains(this.getId())) { + switch (event.getType()) { + case DAMAGE_PLAYER: + return true; + case DAMAGE_CREATURE: + return true; + } } return false; } @@ -101,6 +105,21 @@ class FurnaceOfRathEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return apply(game, source); + DamageEvent damageEvent = (DamageEvent)event; + damageEvent.getAppliedEffects().add(getId()); + if (damageEvent.getType() == EventType.DAMAGE_PLAYER) { + Player targetPlayer = game.getPlayer(event.getTargetId()); + if (targetPlayer != null) { + targetPlayer.damage(damageEvent.getAmount()*2, damageEvent.getSourceId(), game, damageEvent.isPreventable(), damageEvent.isCombatDamage(), event.getAppliedEffects()); + return true; + } + } else { + Permanent targetPermanent = game.getPermanent(event.getTargetId()); + if (targetPermanent != null) { + targetPermanent.damage(damageEvent.getAmount()*2, damageEvent.getSourceId(), game, damageEvent.isPreventable(), damageEvent.isCombatDamage(), event.getAppliedEffects()); + return true; + } + } + return false; } } diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index 160b2c64c0..9ccd5be737 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -562,6 +562,7 @@ public abstract class PermanentImpl> extends CardImpl return damage(damageAmount, sourceId, game, preventable, combat, false, null); } + @Override public int damage(int damageAmount, UUID sourceId, Game game, boolean preventable, boolean combat, ArrayList appliedEffects) { return damage(damageAmount, sourceId, game, preventable, combat, false, appliedEffects); } diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index cdb3a279cc..07d50c41a0 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -878,11 +878,21 @@ public abstract class PlayerImpl> implements Player, Ser } return 0; } - @Override public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable) { + return doDamage(damage, sourceId, game, combatDamage, preventable, null); + } + + @Override + public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable, ArrayList appliedEffects) { + return doDamage(damage, sourceId, game, combatDamage, preventable, appliedEffects); + } + + + private int doDamage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable, ArrayList appliedEffects) { if (damage > 0 && canDamage(game.getObject(sourceId), game)) { GameEvent event = new DamagePlayerEvent(playerId, sourceId, playerId, damage, preventable, combatDamage); + event.setAppliedEffects(appliedEffects); if (!game.replaceEvent(event)) { int actualDamage = event.getAmount(); if (actualDamage > 0) {