- Fixed Imminent Doom.

This commit is contained in:
Jeff 2017-07-07 15:49:16 -05:00
parent 45d03370ec
commit 525652d41e

View file

@ -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;