mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Fix so Auto payment occurs in Game thread
This commit is contained in:
@@ -25,6 +25,7 @@ import forge.game.spellability.AbilityManaPart;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.util.Evaluator;
|
||||
import forge.util.ThreadUtil;
|
||||
import forge.view.ButtonUtil;
|
||||
|
||||
/**
|
||||
@@ -288,13 +289,19 @@ public abstract class InputPayMana extends InputSyncronizedBase {
|
||||
protected void onOk() {
|
||||
if (supportAutoPay()) {
|
||||
//use AI utility to automatically pay mana cost if possible
|
||||
Runnable proc = new Runnable() {
|
||||
final Runnable proc = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ComputerUtilMana.payManaCost(manaCost, saPaidFor, player);
|
||||
}
|
||||
};
|
||||
runAsAi(proc);
|
||||
//must run in game thread as certain payment actions can only be automated there
|
||||
ThreadUtil.invokeInGameThreadAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
runAsAi(proc);
|
||||
}
|
||||
});
|
||||
this.showMessage();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user