- Decoupled the sac target and search goal in AI BirthingPod.

This commit is contained in:
Agetian
2017-01-23 10:47:26 +00:00
parent 280e4d10b2
commit 50dc536bdd
2 changed files with 8 additions and 5 deletions

View File

@@ -81,17 +81,20 @@ public class SpecialCardAi {
return false;
}
String definedPref = StringUtils.split(source.getSVar("AIPreference"), "$")[1];
String overridePrefix = definedPref.contains(".") ? definedPref + "+" : definedPref + ".";
String definedSac = StringUtils.split(source.getSVar("AIPreference"), "$")[1];
String definedGoal = sa.hasParam("AISearchGoal") ? sa.getParam("AISearchGoal") : "Creature";
CardCollection listToSac = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.restriction(definedPref.split(","), ai, source, sa));
System.out.println("sac = " + definedSac + ", goal = " + definedGoal);
String overridePrefix = definedGoal.contains(".") ? definedGoal + "+" : definedGoal + ".";
CardCollection listToSac = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.restriction(definedSac.split(","), ai, source, sa));
listToSac.sort(!sacWorst ? CardLists.CmcComparatorInv : Collections.reverseOrder(CardLists.CmcComparatorInv));
for (Card sacCandidate : listToSac) {
int sacCMC = sacCandidate.getCMC();
int goalCMC = sacCMC + 1;
CardCollection listGoal = CardLists.filter(ai.getCardsIn(ZoneType.Library), CardPredicates.restriction(definedPref.split(","), ai, source, sa));
CardCollection listGoal = CardLists.filter(ai.getCardsIn(ZoneType.Library), CardPredicates.restriction(definedGoal.split(","), ai, source, sa));
if (!anyCMC) {
// e.g. Birthing Pod - ensure we have a valid card to upgrade to

View File

@@ -1,7 +1,7 @@
Name:Natural Order
ManaCost:2 G G
Types:Sorcery
A:SP$ ChangeZone | Cost$ 2 G G Sac<1/Creature.Green/green creature> | Origin$ Library | Destination$ Battlefield | ChangeType$ Creature.Green | ChangeNum$ 1 | AILogic$ BirthingPod.SacWorst+AnyCMCGoal | SpellDescription$ Search your library for a green creature card and put it onto the battlefield. Then shuffle your library.
A:SP$ ChangeZone | Cost$ 2 G G Sac<1/Creature.Green/green creature> | Origin$ Library | Destination$ Battlefield | ChangeType$ Creature.Green | ChangeNum$ 1 | AILogic$ BirthingPod.SacWorst+AnyCMCGoal | AISearchGoal$ Creature.Green | SpellDescription$ Search your library for a green creature card and put it onto the battlefield. Then shuffle your library.
# AI Preference is needed to make the AI consider the ability. Further constraints are defined by AILogic BirthingPod.
SVar:AIPreference:SacCost$Creature.Green
SVar:Picture:http://www.wizards.com/global/images/magic/general/natural_order.jpg