- Improved and fixed AI using Ashiok, Nightmare Weaver.

This commit is contained in:
Sloth
2014-04-24 16:12:14 +00:00
parent 84d93b7e41
commit dffdaad6b5
3 changed files with 12 additions and 7 deletions

View File

@@ -506,9 +506,8 @@ public class AiCostDecision extends CostDecisionMakerBase implements ICostVisito
if (c == null) {
final String sVar = ability.getSVar(amount);
if (sVar.equals("XChoice")) {
return null;
}
if (amount.equals("All")) {
c = AbilityUtils.calculateAmount(source, "ChosenX", ability);
} else if (amount.equals("All")) {
c = source.getCounters(cost.counter);
} else {
c = AbilityUtils.calculateAmount(source, amount, ability);

View File

@@ -87,9 +87,15 @@ public class ChooseCardAi extends SpellAbilityAi {
}
} else if (logic.equals("Ashiok")) {
final int loyalty = host.getCounters(CounterType.LOYALTY) - 1;
host.setSVar("ChosenX", "Number$" + loyalty);
choiceZone = ZoneType.smartValueOf(sa.getParam("ChoiceZone"));
choices = CardLists.getValidCards(choices, sa.getParam("Choices"), host.getController(), host);
for (int i = loyalty; i >= 0; i--) {
host.setSVar("ChosenX", "Number$" + i);
choices = ai.getGame().getCardsIn(choiceZone);
choices = CardLists.getValidCards(choices, sa.getParam("Choices"), host.getController(), host);
if (!choices.isEmpty()) {
return true;
}
}
if (choices.isEmpty()) {
return false;
}