- 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.

This commit is contained in:
Agetian
2017-09-28 04:41:38 +00:00
parent 6cbda005e8
commit a4c14c6be1

View File

@@ -76,12 +76,17 @@ public class ComputerUtil {
if (sa.isSpell() && !source.isCopiedSpell()) { if (sa.isSpell() && !source.isCopiedSpell()) {
if (source.getType().hasStringType("Arcane")) { if (source.getType().hasStringType("Arcane")) {
sa = AbilityUtils.addSpliceEffects(sa); sa = AbilityUtils.addSpliceEffects(sa);
AiPlayDecision postSpliceDecision = ((PlayerControllerAi)ai.getController()).getAi().canPlaySa(sa); if (sa.getSplicedCards() != null && !sa.getSplicedCards().isEmpty() && ai.getController().isAI()) {
if (postSpliceDecision != AiPlayDecision.WillPlay) { // we need to reconsider and retarget the SA after additional SAs have been added onto it via splice,
// for whatever reason the AI doesn't want to play the thing with the subs at this time // 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; return false;
} }
} }
}
source.setCastSA(sa); source.setCastSA(sa);
sa.setLastStateBattlefield(game.getLastStateBattlefield()); sa.setLastStateBattlefield(game.getLastStateBattlefield());