- 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()) { if (landList.isEmpty()) {
return null; 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. //Skip reflected lands.
CardCollection unreflectedLands = new CardCollection(landList); CardCollection unreflectedLands = new CardCollection(landList);
for (Card l : landList) { for (Card l : landList) {

View File

@@ -108,13 +108,14 @@ public enum AiProps { /** */
INTUITION_ALTERNATIVE_LOGIC ("false"), /** */ INTUITION_ALTERNATIVE_LOGIC ("false"), /** */
EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD ("2"), EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD ("2"),
EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE("2"), /** */ EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE("2"), /** */
MOMIR_BASIC_LAND_STRATEGY("default"), /** */
MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA("5"), /** */ MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA("5"), /** */
MOJHOSTO_CHANCE_TO_PREFER_JHOIRA_OVER_MOMIR ("50"), /** */ MOJHOSTO_CHANCE_TO_PREFER_JHOIRA_OVER_MOMIR ("50"), /** */
MOJHOSTO_CHANCE_TO_USE_JHOIRA_COPY_INSTANT ("20"), /** */ 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 --> // <-- There are no experimental options here -->
AI_IN_DANGER_THRESHOLD("4"),
AI_IN_DANGER_MAX_THRESHOLD("4");
private final String strDefaultVal; private final String strDefaultVal;

View File

@@ -211,7 +211,14 @@ EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=2
# doesn't have a land in hand # doesn't have a land in hand
EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE=2 EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE=2
# MoJhoSto casual variant properties # Momir/MoJhoSto casual variant properties
# Which lands the AI would prefer to play in Momir Basic and MoJhoSto modes. When set to "default", generally plays
# lands in WUBRG order. When set to "random", will play a completely random basic land from hand. When set to
# "preforder:XXX", where "XXX" is a list of color specifications, will play basic lands in this preferred order,
# and if no preferred land can be found, will play a random one (e.g. "preforder:RB" plays Mountains first, Swamps
# second, and then everything else randomly if no Mountains or Swamps are present).
MOMIR_BASIC_LAND_STRATEGY=preforder:RB
# MoJhoSto only casual variant properties
# How many lands the AI needs to have on the battlefield to begin considering activating Jhoira in MoJhoSto # How many lands the AI needs to have on the battlefield to begin considering activating Jhoira in MoJhoSto
MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=5 MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=5
# The chance that the AI will activate Jhoira instead of activating Momir # The chance that the AI will activate Jhoira instead of activating Momir

View File

@@ -211,7 +211,14 @@ EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=2
# doesn't have a land in hand # doesn't have a land in hand
EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE=2 EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE=2
# MoJhoSto casual variant properties # Momir/MoJhoSto casual variant properties
# Which lands the AI would prefer to play in Momir Basic and MoJhoSto modes. When set to "default", generally plays
# lands in WUBRG order. When set to "random", will play a completely random basic land from hand. When set to
# "preforder:XXX", where "XXX" is a list of color specifications, will play basic lands in this preferred order,
# and if no preferred land can be found, will play a random one (e.g. "preforder:RB" plays Mountains first, Swamps
# second, and then everything else randomly if no Mountains or Swamps are present).
MOMIR_BASIC_LAND_STRATEGY=default
# MoJhoSto only casual variant properties
# How many lands the AI needs to have on the battlefield to begin considering activating Jhoira in MoJhoSto # How many lands the AI needs to have on the battlefield to begin considering activating Jhoira in MoJhoSto
MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=4 MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=4
# The chance that the AI will activate Jhoira instead of activating Momir # The chance that the AI will activate Jhoira instead of activating Momir

View File

@@ -211,7 +211,14 @@ EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=2
# doesn't have a land in hand # doesn't have a land in hand
EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE=3 EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE=3
# MoJhoSto casual variant properties # Momir/MoJhoSto casual variant properties
# Which lands the AI would prefer to play in Momir Basic and MoJhoSto modes. When set to "default", generally plays
# lands in WUBRG order. When set to "random", will play a completely random basic land from hand. When set to
# "preforder:XXX", where "XXX" is a list of color specifications, will play basic lands in this preferred order,
# and if no preferred land can be found, will play a random one (e.g. "preforder:RB" plays Mountains first, Swamps
# second, and then everything else randomly if no Mountains or Swamps are present).
MOMIR_BASIC_LAND_STRATEGY=preforder:RB
# MoJhoSto only casual variant properties
# How many lands the AI needs to have on the battlefield to begin considering activating Jhoira in MoJhoSto # How many lands the AI needs to have on the battlefield to begin considering activating Jhoira in MoJhoSto
MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=4 MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=4
# The chance that the AI will activate Jhoira instead of activating Momir # The chance that the AI will activate Jhoira instead of activating Momir

View File

@@ -211,7 +211,14 @@ EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=1
# doesn't have a land in hand # doesn't have a land in hand
EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE=2 EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE=2
# MoJhoSto casual variant properties # Momir/MoJhoSto casual variant properties
# Which lands the AI would prefer to play in Momir Basic and MoJhoSto modes. When set to "default", generally plays
# lands in WUBRG order. When set to "random", will play a completely random basic land from hand. When set to
# "preforder:XXX", where "XXX" is a list of color specifications, will play basic lands in this preferred order,
# and if no preferred land can be found, will play a random one (e.g. "preforder:RB" plays Mountains first, Swamps
# second, and then everything else randomly if no Mountains or Swamps are present).
MOMIR_BASIC_LAND_STRATEGY=random
# MoJhoSto only casual variant properties
# How many lands the AI needs to have on the battlefield to begin considering activating Jhoira in MoJhoSto # How many lands the AI needs to have on the battlefield to begin considering activating Jhoira in MoJhoSto
MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=3 MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=3
# The chance that the AI will activate Jhoira instead of activating Momir # The chance that the AI will activate Jhoira instead of activating Momir