From 03795f1aaebf01576c318c36270571585fc83ca1 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Fri, 19 Apr 2019 18:57:36 +0400 Subject: [PATCH] * Fixed AI game freeze on choose new targets (#5023); --- Mage/src/main/java/mage/game/stack/StackObjImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Mage/src/main/java/mage/game/stack/StackObjImpl.java b/Mage/src/main/java/mage/game/stack/StackObjImpl.java index beadf908f5..8af461dfdb 100644 --- a/Mage/src/main/java/mage/game/stack/StackObjImpl.java +++ b/Mage/src/main/java/mage/game/stack/StackObjImpl.java @@ -188,6 +188,11 @@ public abstract class StackObjImpl implements StackObject { newTarget.clearChosen(); } } + + // workaround to stop infinite AI choose (remove after chooseTarget can be called with extra filter to disable some ids) + if (iteration > 10) { + break; + } } while (targetController.canRespond() && (targetId.equals(newTarget.getFirstTarget()) || newTarget.getTargets().size() != 1)); // choose a new target