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

View File

@@ -3,7 +3,7 @@ ManaCost:1 U B
Types:Planeswalker Ashiok
Loyalty:3
A:AB$ Mill | Cost$ AddCounter<2/LOYALTY> | ValidTgts$ Opponent | NumCards$ 3 | Destination$ Exile | Planeswalker$ True | RememberMilled$ True | SpellDescription$ Exile the top three cards of target opponent's library.
A:AB$ ChooseCard | Cost$ SubCounter<X/LOYALTY> | References$ X | Choices$ Creature.cmcEQChosenX+IsRemembered | ChoiceZone$ Exile | Planeswalker$ True | SubAbility$ DBChangeZone | SpellDescription$ Put a creature card with converted mana cost X exiled with CARDNAME onto the battlefield under your control. That creature is a Nightmare in addition to its other types.
A:AB$ ChooseCard | Cost$ SubCounter<X/LOYALTY> | References$ X | Choices$ Creature.cmcEQChosenX+IsRemembered | ChoiceZone$ Exile | Planeswalker$ True | SubAbility$ DBChangeZone | AILogic$ Ashiok | SpellDescription$ Put a creature card with converted mana cost X exiled with CARDNAME onto the battlefield under your control. That creature is a Nightmare in addition to its other types.
SVar:DBChangeZone:DB$ ChangeZone | Defined$ ChosenCard | Origin$ Exile | Destination$ Battlefield | ChangeType$ Creature.cmcEQChosenX+IsRemembered | ChangeNum$ 1 | GainControl$ True | Imprint$ True | SubAbility$ DBAnimate
SVar:DBAnimate:DB$ Animate | Defined$ Imprinted | Types$ Nightmare | Permanent$ True | SubAbility$ DBCleanImprint
SVar:DBCleanImprint:DB$ Cleanup | ClearImprinted$ True