- 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
This commit is contained in:
Agetian 2017-09-28 04:41:38 +00:00
parent b140dcefc0
commit 52863adf49

View File

@ -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;
}
}
}