From 15715cec1019de066f735fa372ae3dabe65bd563 Mon Sep 17 00:00:00 2001 From: Seravy Date: Sun, 11 Feb 2018 18:34:33 +0100 Subject: [PATCH] Tested and now it works, unfortunately it's not as smart as I originally wanted, but it'll do. --- .../src/main/java/forge/ai/AiAttackController.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/AiAttackController.java b/forge-ai/src/main/java/forge/ai/AiAttackController.java index ab13ace79a2..51fc355cac3 100644 --- a/forge-ai/src/main/java/forge/ai/AiAttackController.java +++ b/forge-ai/src/main/java/forge/ai/AiAttackController.java @@ -1092,18 +1092,12 @@ public class AiAttackController { // Check if the card actually has an ability the AI can and wants to play, if not, attacking is fine! boolean wantability = false; for (SpellAbility sa : attacker.getSpellAbilities()) { + // Do not attack if we can afford using the ability. if (sa.isAbility()) { - if (ai.getController().isAI()) { - AiPlayDecision canplay = ((PlayerControllerAi) ai.getController()).getAi().canPlaySa(sa); - switch (canplay) { - case WillPlay: - case WaitForMain2: - case AnotherTime: - // Might be an ability that requires a target not present right now, like Ertai, Wizard Adept - case TargetingFailed: - return false; - } + if (ComputerUtilCost.canPayCost(sa, ai)) { + return false; } + // TODO Eventually The Ai will need to learn to predict if they have any use for the ability before next untap or not. } } }