Sudden Demise - Color choice is now done on resolution time.

This commit is contained in:
LevelX2 2013-12-02 23:31:07 +01:00
parent 436a6be297
commit b97049d0a7

View file

@ -54,8 +54,7 @@ public class SuddenDemise extends CardImpl<SuddenDemise> {
this.color.setRed(true); this.color.setRed(true);
// Choose a color. Sudden Demise deals X damage to each creature of the chosen color. // Choose a color. Sudden Demise deals X damage to each creature of the chosen color.
this.getSpellAbility().addChoice(new ChoiceColor());
this.getSpellAbility().addEffect(new SuddenDemiseDamageEffect()); this.getSpellAbility().addEffect(new SuddenDemiseDamageEffect());
} }
@ -89,15 +88,18 @@ class SuddenDemiseDamageEffect extends OneShotEffect<SuddenDemiseDamageEffect> {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); if (controller != null) {
if (controller != null && choice != null) { ChoiceColor choice = new ChoiceColor();
final int damage = source.getManaCostsToPay().getX(); controller.choose(outcome, choice, game);
FilterPermanent filter = new FilterCreaturePermanent(); if (choice.getColor() != null) {
filter.add(new ColorPredicate(choice.getColor())); final int damage = source.getManaCostsToPay().getX();
for (Permanent permanent:game.getBattlefield().getActivePermanents(filter, source.getControllerId(), id, game)) { FilterPermanent filter = new FilterCreaturePermanent();
permanent.damage(damage, source.getSourceId(), game, true, false); filter.add(new ColorPredicate(choice.getColor()));
for (Permanent permanent:game.getBattlefield().getActivePermanents(filter, source.getControllerId(), id, game)) {
permanent.damage(damage, source.getSourceId(), game, true, false);
}
return true;
} }
return true;
} }
return false; return false;
} }