mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Tested and now it works, unfortunately it's not as smart as I originally wanted, but it'll do.
This commit is contained in:
@@ -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!
|
// Check if the card actually has an ability the AI can and wants to play, if not, attacking is fine!
|
||||||
boolean wantability = false;
|
boolean wantability = false;
|
||||||
for (SpellAbility sa : attacker.getSpellAbilities()) {
|
for (SpellAbility sa : attacker.getSpellAbilities()) {
|
||||||
|
// Do not attack if we can afford using the ability.
|
||||||
if (sa.isAbility()) {
|
if (sa.isAbility()) {
|
||||||
if (ai.getController().isAI()) {
|
if (ComputerUtilCost.canPayCost(sa, ai)) {
|
||||||
AiPlayDecision canplay = ((PlayerControllerAi) ai.getController()).getAi().canPlaySa(sa);
|
return false;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// TODO Eventually The Ai will need to learn to predict if they have any use for the ability before next untap or not.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user