mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Preventing a crash by passing a dummy SpellAbility into Propaganda effects
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user