From 525652d41e0a429a7c759be1fb655edd367ef655 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 7 Jul 2017 15:49:16 -0500 Subject: [PATCH] - Fixed Imminent Doom. --- Mage.Sets/src/mage/cards/i/ImminentDoom.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/cards/i/ImminentDoom.java b/Mage.Sets/src/mage/cards/i/ImminentDoom.java index 701f1b4715..a0853af415 100644 --- a/Mage.Sets/src/mage/cards/i/ImminentDoom.java +++ b/Mage.Sets/src/mage/cards/i/ImminentDoom.java @@ -28,6 +28,7 @@ package mage.cards.i; import java.util.UUID; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldAbility; @@ -84,8 +85,8 @@ class ImminentDoomTriggeredAbility extends TriggeredAbilityImpl { super(Zone.BATTLEFIELD, new ImminentDoomEffect()); } - public ImminentDoomTriggeredAbility(final ImminentDoomTriggeredAbility abiltity) { - super(abiltity); + public ImminentDoomTriggeredAbility(final ImminentDoomTriggeredAbility ability) { + super(ability); } @Override @@ -103,10 +104,13 @@ class ImminentDoomTriggeredAbility extends TriggeredAbilityImpl { if (event.getPlayerId().equals(this.getControllerId())) { Permanent imminentDoom = game.getPermanent(getSourceId()); Spell spell = game.getStack().getSpell(event.getTargetId()); - return (spell != null + if (spell != null && imminentDoom != null - && spell.getConvertedManaCost() == imminentDoom.getCounters(game).getCount(CounterType.DOOM)); - } + && spell.getConvertedManaCost() == imminentDoom.getCounters(game).getCount(CounterType.DOOM)) { + game.getState().setValue("ImminentDoomCount", imminentDoom.getCounters(game).getCount(CounterType.DOOM)); // store its current value + return true; + } + } return false; } @@ -135,10 +139,10 @@ class ImminentDoomEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent imminentDoom = game.getPermanent(source.getSourceId()); if (imminentDoom != null) { - int count = imminentDoom.getCounters(game).getCount(CounterType.DOOM); - Effect effect = new DamageTargetEffect(count); + Effect effect = new DamageTargetEffect((int) game.getState().getValue("ImminentDoomCount")); effect.apply(game, source); imminentDoom.addCounters(CounterType.DOOM.createInstance(), source, game); + game.getState().setValue("ImminentDoomCount", 0); // reset to 0 to avoid any silliness return true; } return false;