diff --git a/forge-ai/src/main/java/forge/ai/AiController.java b/forge-ai/src/main/java/forge/ai/AiController.java index 9714c8fe38a..6b00f8122c3 100644 --- a/forge-ai/src/main/java/forge/ai/AiController.java +++ b/forge-ai/src/main/java/forge/ai/AiController.java @@ -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) { diff --git a/forge-ai/src/main/java/forge/ai/AiProps.java b/forge-ai/src/main/java/forge/ai/AiProps.java index b9ee8d741e7..aefc58df58e 100644 --- a/forge-ai/src/main/java/forge/ai/AiProps.java +++ b/forge-ai/src/main/java/forge/ai/AiProps.java @@ -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; diff --git a/forge-gui/res/ai/Cautious.ai b/forge-gui/res/ai/Cautious.ai index 60888c980ef..968fbbe85e0 100644 --- a/forge-gui/res/ai/Cautious.ai +++ b/forge-gui/res/ai/Cautious.ai @@ -211,7 +211,14 @@ EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=2 # doesn't have a land in hand 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 MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=5 # The chance that the AI will activate Jhoira instead of activating Momir diff --git a/forge-gui/res/ai/Default.ai b/forge-gui/res/ai/Default.ai index ba41dc8e5c8..d5d4fba548c 100644 --- a/forge-gui/res/ai/Default.ai +++ b/forge-gui/res/ai/Default.ai @@ -211,7 +211,14 @@ EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=2 # doesn't have a land in hand 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 MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=4 # The chance that the AI will activate Jhoira instead of activating Momir diff --git a/forge-gui/res/ai/Experimental.ai b/forge-gui/res/ai/Experimental.ai index c48eedbe7c9..d4d178d700b 100644 --- a/forge-gui/res/ai/Experimental.ai +++ b/forge-gui/res/ai/Experimental.ai @@ -211,7 +211,14 @@ EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=2 # doesn't have a land in hand 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 MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=4 # The chance that the AI will activate Jhoira instead of activating Momir diff --git a/forge-gui/res/ai/Reckless.ai b/forge-gui/res/ai/Reckless.ai index 57f13150d73..ae421d52e7a 100644 --- a/forge-gui/res/ai/Reckless.ai +++ b/forge-gui/res/ai/Reckless.ai @@ -211,7 +211,14 @@ EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=1 # doesn't have a land in hand 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 MOJHOSTO_NUM_LANDS_TO_ACTIVATE_JHOIRA=3 # The chance that the AI will activate Jhoira instead of activating Momir