From 52863adf4969e66cc4185b5a02c27a1ce625bbec Mon Sep 17 00:00:00 2001 From: Agetian Date: Thu, 28 Sep 2017 04:41:38 +0000 Subject: [PATCH] - Some improvements to the Splice AI: do not reconsider the SA unless at least something was chosen for splice to save processing time; reset the targets on the main SA because it'll need to be retargeted anyway. git-svn-id: http://svn.slightlymagic.net/forge/trunk@35805 269b9781-a132-4a9b-9d4e-f004f1b56b58 --- forge-ai/src/main/java/forge/ai/ComputerUtil.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtil.java b/forge-ai/src/main/java/forge/ai/ComputerUtil.java index 2c6b491a..0cb88edf 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtil.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtil.java @@ -76,10 +76,15 @@ public class ComputerUtil { if (sa.isSpell() && !source.isCopiedSpell()) { if (source.getType().hasStringType("Arcane")) { sa = AbilityUtils.addSpliceEffects(sa); - AiPlayDecision postSpliceDecision = ((PlayerControllerAi)ai.getController()).getAi().canPlaySa(sa); - if (postSpliceDecision != AiPlayDecision.WillPlay) { - // for whatever reason the AI doesn't want to play the thing with the subs at this time - return false; + if (sa.getSplicedCards() != null && !sa.getSplicedCards().isEmpty() && ai.getController().isAI()) { + // we need to reconsider and retarget the SA after additional SAs have been added onto it via splice, + // otherwise the AI will fail to add the card to stack and that'll knock it out of the game + sa.resetTargets(); + if (((PlayerControllerAi) ai.getController()).getAi().canPlaySa(sa) != AiPlayDecision.WillPlay) { + // for whatever reason the AI doesn't want to play the thing with the spliced subs anymore, + // proceeding past this point may result in an illegal play + return false; + } } }