mirror of
https://github.com/correl/mage.git
synced 2024-12-28 03:00:10 +00:00
commit
fe64f7d88d
1 changed files with 13 additions and 5 deletions
|
@ -9,7 +9,9 @@ import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.stack.Spell;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetSpell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -21,6 +23,7 @@ public final class Ionize extends CardImpl {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}{R}");
|
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}{R}");
|
||||||
|
|
||||||
// Counter target spell. Ionize deals 2 damage to that spell's controller.
|
// Counter target spell. Ionize deals 2 damage to that spell's controller.
|
||||||
|
this.getSpellAbility().addTarget(new TargetSpell());
|
||||||
this.getSpellAbility().addEffect(new IonizeEffect());
|
this.getSpellAbility().addEffect(new IonizeEffect());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,11 +56,16 @@ class IonizeEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(game.getControllerId(source.getSourceId()));
|
boolean result = false;
|
||||||
new CounterTargetEffect().apply(game, source);
|
Spell spell = game.getStack().getSpell(source.getFirstTarget());
|
||||||
if (player == null) {
|
if (spell != null) {
|
||||||
return false;
|
Player spellController = game.getPlayer(spell.getControllerId());
|
||||||
}
|
|
||||||
return player.damage(2, source.getSourceId(), game, false, true) > 0;
|
result = game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
|
||||||
|
if (spellController != null) {
|
||||||
|
spellController.damage(2, source.getSourceId(), game, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue