Prevent mana not deducting from pool when manually paying mana costs

This commit is contained in:
drdev
2013-12-02 05:56:18 +00:00
parent 05f7a9b30a
commit 598d2da9d6

View File

@@ -40,7 +40,8 @@ public abstract class InputPayMana extends InputSyncronizedBase {
protected ManaCostBeingPaid manaCost; protected ManaCostBeingPaid manaCost;
protected final SpellAbility saPaidFor; protected final SpellAbility saPaidFor;
boolean bPaid = false; private boolean bPaid = false;
private Boolean canPayManaCost = null;
protected InputPayMana(SpellAbility saToPayFor) { protected InputPayMana(SpellAbility saToPayFor) {
this.player = saToPayFor.getActivatingPlayer(); this.player = saToPayFor.getActivatingPlayer();
@@ -302,7 +303,8 @@ public abstract class InputPayMana extends InputSyncronizedBase {
protected final void updateMessage() { protected final void updateMessage() {
if (supportAutoPay()) { if (supportAutoPay()) {
//use AI utility to determine if mana cost can be paid if (canPayManaCost == null) {
//use AI utility to determine if mana cost can be paid if that hasn't been determined yet
Evaluator<Boolean> proc = new Evaluator<Boolean>() { Evaluator<Boolean> proc = new Evaluator<Boolean>() {
@Override @Override
public Boolean evaluate() { public Boolean evaluate() {
@@ -310,7 +312,9 @@ public abstract class InputPayMana extends InputSyncronizedBase {
} }
}; };
player.getController().runAsAi(proc); player.getController().runAsAi(proc);
if (proc.getResult()) { canPayManaCost = proc.getResult();
}
if (canPayManaCost) {
ButtonUtil.enableAllFocusOk(); //enabled Auto button if mana cost can be paid ButtonUtil.enableAllFocusOk(); //enabled Auto button if mana cost can be paid
} }
} }