- Preventing a crash by passing a dummy SpellAbility into Propaganda effects

This commit is contained in:
Sol
2014-03-05 03:53:07 +00:00
parent e2b0bb9c19
commit 34c2d37b46

View File

@@ -986,8 +986,22 @@ public class CombatUtil {
}
}
// Not a great solution, but prevents a crash by passing a fake SA for Propaganda payments
// If there's a better way of handling this somewhere deeper in the code, feel free to remove
SpellAbility fakeSA = new SpellAbility(c, attackCost) {
@Override
public boolean canPlay() {
return false;
}
@Override
public void resolve() {
}
};
boolean isFree = attackCost.getTotalMana().isZero() && attackCost.isOnlyManaCost(); // true if needless to pay
return isFree || c.getController().getController().payManaOptional(c, attackCost, null, "Pay additional cost to declare " + c + " an attacker", ManaPaymentPurpose.DeclareAttacker);
return isFree || c.getController().getController().payManaOptional(c, attackCost, fakeSA, "Pay additional cost to declare " + c + " an attacker", ManaPaymentPurpose.DeclareAttacker);
}
/**