From e05a8a0f8f1b5d2dc37a83097f2e08e415ab5195 Mon Sep 17 00:00:00 2001 From: Agetian Date: Wed, 27 Sep 2017 18:53:25 +0000 Subject: [PATCH] - Attempting to fix Splice onto Arcane AI: when adding splice effects by the AI, actually reconsider the entire SA (with spliced subs) via the canPlay routine (and set targets while at it) before deciding whether to play it or not. Might not be optimal, but at least it seems to stop the AI from wasting splice cards and making them disappear from the game into the void. Improvements are welcome. git-svn-id: http://svn.slightlymagic.net/forge/trunk@35802 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 1fbfd28c..2c6b491a 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtil.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtil.java @@ -74,14 +74,19 @@ public class ComputerUtil { final Card source = sa.getHostCard(); 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; + } + } + source.setCastSA(sa); sa.setLastStateBattlefield(game.getLastStateBattlefield()); sa.setLastStateGraveyard(game.getLastStateGraveyard()); sa.setHostCard(game.getAction().moveToStack(source, sa)); - - if (source.getType().hasStringType("Arcane")) { - sa = AbilityUtils.addSpliceEffects(sa); - } } if (sa.getApi() == ApiType.Charm && !sa.isWrapper()) {