mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Sudden Demise - Color choice is now done on resolution time.
This commit is contained in:
parent
436a6be297
commit
b97049d0a7
1 changed files with 12 additions and 10 deletions
|
@ -55,7 +55,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue