Fixed Imminent Doom.
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,9 +104,12 @@ 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;
