mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- 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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user