- Some improvements to Momir/MoJhoSto basic land strategy.

This commit is contained in:
Agetian
2018-11-09 15:42:40 +03:00
parent 676b8ca2e9
commit c1260dd4e1
6 changed files with 64 additions and 7 deletions

View File

@@ -436,6 +436,34 @@ public class AiController {
if (landList.isEmpty()) {
return null;
}
// Some considerations for Momir/MoJhoSto
boolean hasMomir = !CardLists.filter(player.getCardsIn(ZoneType.Command),
CardPredicates.nameEquals("Momir Vig, Simic Visionary Avatar")).isEmpty();
if (hasMomir) {
String landStrategy = getProperty(AiProps.MOMIR_BASIC_LAND_STRATEGY);
if (landStrategy.equalsIgnoreCase("random")) {
// Pick a completely random basic land
return Aggregates.random(landList);
} else if (landStrategy.toLowerCase().startsWith("preforder:")) {
// Pick a basic land in order of preference, or play a random one if nothing is preferred
String order = landStrategy.substring(10);
for (char c : order.toCharArray()) {
byte color = MagicColor.fromName(c);
for (Card land : landList) {
for (final SpellAbility m : ComputerUtilMana.getAIPlayableMana(land)) {
AbilityManaPart mp = m.getManaPart();
if (mp.canProduce(MagicColor.toShortString(color), m)) {
return land;
}
}
}
return Aggregates.random(landList);
}
}
// If nothing is done here, proceeds to the default land picking strategy
}
//Skip reflected lands.
CardCollection unreflectedLands = new CardCollection(landList);
for (Card l : landList) {

View File

@@ -108,13 +108,14 @@ public enum AiProps { /** */
INTUITION_ALTERNATIVE_LOGIC ("false"), /** */
EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD ("2"),
EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE("2"), /** */
MOMIR_BASIC_LAND_STRATEGY("default"), /** */
MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA("5"), /** */
MOJHOSTO_CHANCE_TO_PREFER_JHOIRA_OVER_MOMIR ("50"), /** */
MOJHOSTO_CHANCE_TO_USE_JHOIRA_COPY_INSTANT ("20"), /** */
// Experimental features, must be removed after extensive testing and, ideally, defaulting
AI_IN_DANGER_THRESHOLD("4"), /** */
AI_IN_DANGER_MAX_THRESHOLD("4"); /** */
// Experimental features, must be promoted or removed after extensive testing and, ideally, defaulting
// <-- There are no experimental options here -->
AI_IN_DANGER_THRESHOLD("4"),
AI_IN_DANGER_MAX_THRESHOLD("4");
private final String strDefaultVal;