- Added some simple SVar-based prediction of Reanimator decks, currently used by the Survival of the Fittest AI code.

- Added a worlds.txt entry for Kamigawa quest world.
This commit is contained in:
Agetian
2017-09-17 19:50:03 +00:00
parent 00cec4faa0
commit ebd3c33051
5 changed files with 34 additions and 0 deletions

View File

@@ -2736,4 +2736,21 @@ public class ComputerUtil {
return count;
}
public static boolean isPlayingReanimator(final Player ai) {
CardCollectionView inHand = ai.getCardsIn(ZoneType.Hand);
CardCollectionView inDeck = ai.getCardsIn(new ZoneType[] {ZoneType.Hand, ZoneType.Library});
Predicate<Card> markedAsReanimator = new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return "true".equalsIgnoreCase(card.getSVar("IsReanimatorCard"));
}
};
int numInHand = CardLists.filter(inHand, markedAsReanimator).size();
int numInDeck = CardLists.filter(inDeck, markedAsReanimator).size();
return numInHand > 0 || numInDeck >= 3;
}
}

View File

@@ -889,6 +889,13 @@ public class SpecialCardAi {
if (maxCMC != null && maxCMC.getCMC() < bestInLib.getCMC() && bestInLib.getCMC() >= 3) {
return maxCMC;
}
// We appear to be playing Reanimator (or we have a reanimator card in hand already), so it's
// worth to fill the graveyard now
if (ComputerUtil.isPlayingReanimator(ai)) {
CardCollection creatsInLibByCMC = new CardCollection(creatsInLib);
Collections.sort(creatsInLibByCMC, CardLists.CmcComparatorInv);
return creatsInLibByCMC.getFirst();
}
// probably nothing that is worth changing, so bail
return null;
@@ -915,6 +922,13 @@ public class SpecialCardAi {
Card bestInLib = atTargetCMCInLib != null ? atTargetCMCInLib.getFirst() : null;
if (bestInLib == null && ComputerUtil.isPlayingReanimator(ai)) {
// For Reanimator, we don't mind grabbing the biggest thing possible to recycle it again with SotF later.
CardCollection creatsInLibByCMC = new CardCollection(creatsInLib);
Collections.sort(creatsInLibByCMC, CardLists.CmcComparatorInv);
return creatsInLibByCMC.getFirst();
}
return bestInLib;
}
}