From 1d7188b8f5471202bcc9c5918378dadb6750d7ea Mon Sep 17 00:00:00 2001 From: Agetian Date: Tue, 4 Dec 2018 16:17:03 +0300 Subject: [PATCH] - Minor logic tweak (Buyback) + AI property - hasXInAnyCostPart doesn't need a SA parameter now that it's in Cost. - Fixed a minor mistype on mobile Forge. --- forge-ai/src/main/java/forge/ai/AiController.java | 6 ++++-- forge-ai/src/main/java/forge/ai/AiProps.java | 1 + forge-gui/res/ai/Cautious.ai | 4 ++++ forge-gui/res/ai/Default.ai | 4 ++++ forge-gui/res/ai/Experimental.ai | 4 ++++ forge-gui/res/ai/Reckless.ai | 4 ++++ 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/AiController.java b/forge-ai/src/main/java/forge/ai/AiController.java index cdc86dd4c0f..36bbf6542b8 100644 --- a/forge-ai/src/main/java/forge/ai/AiController.java +++ b/forge-ai/src/main/java/forge/ai/AiController.java @@ -709,8 +709,10 @@ public class AiController { } // Trying to play a card that has Buyback without a Buyback cost, look for possible additional considerations - if (card.hasKeyword(Keyword.BUYBACK) && !sa.isBuyBackAbility() && !canPlaySpellWithoutBuyback(card, sa)) { - return AiPlayDecision.NeedsToPlayCriteriaNotMet; + if (getBooleanProperty(AiProps.TRY_TO_PRESERVE_BUYBACK_SPELLS)) { + if (card.hasKeyword(Keyword.BUYBACK) && !sa.isBuyBackAbility() && !canPlaySpellWithoutBuyback(card, sa)) { + return AiPlayDecision.NeedsToPlayCriteriaNotMet; + } } // When processing a new SA, clear the previously remembered cards that have been marked to avoid re-entry diff --git a/forge-ai/src/main/java/forge/ai/AiProps.java b/forge-ai/src/main/java/forge/ai/AiProps.java index 23b3b791fe6..1f8b56a9720 100644 --- a/forge-ai/src/main/java/forge/ai/AiProps.java +++ b/forge-ai/src/main/java/forge/ai/AiProps.java @@ -58,6 +58,7 @@ public enum AiProps { /** */ THRESHOLD_TOKEN_CHUMP_TO_SAVE_PLANESWALKER ("135"), /** */ THRESHOLD_NONTOKEN_CHUMP_TO_SAVE_PLANESWALKER ("110"), /** */ CHUMP_TO_SAVE_PLANESWALKER_ONLY_ON_LETHAL ("true"), /** */ + TRY_TO_PRESERVE_BUYBACK_SPELLS ("true"), /** */ MIN_SPELL_CMC_TO_COUNTER ("0"), /** */ CHANCE_TO_COUNTER_CMC_1 ("50"), /** */ CHANCE_TO_COUNTER_CMC_2 ("75"), /** */ diff --git a/forge-gui/res/ai/Cautious.ai b/forge-gui/res/ai/Cautious.ai index 0e732f97963..05b1d3460d7 100644 --- a/forge-gui/res/ai/Cautious.ai +++ b/forge-gui/res/ai/Cautious.ai @@ -244,6 +244,10 @@ BOUNCE_ALL_ELSEWHERE_NONCREAT_EVAL_DIFF=3 # library to put some into the graveyard. INTUITION_ALTERNATIVE_LOGIC=true +# If enabled, the AI will run some additional checks in order to try to preserve spells that have Buyback and not +# use them unless absolutely necessary (or unless multiple copies are in hand). +TRY_TO_PRESERVE_BUYBACK_SPELLS=true + # How big of a difference is allowed between the revealed card CMC and the currently castable CMC to still put the # card on top of the library EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=2 diff --git a/forge-gui/res/ai/Default.ai b/forge-gui/res/ai/Default.ai index 8e03095a670..e00c218cdf6 100644 --- a/forge-gui/res/ai/Default.ai +++ b/forge-gui/res/ai/Default.ai @@ -245,6 +245,10 @@ BOUNCE_ALL_ELSEWHERE_NONCREAT_EVAL_DIFF=3 # library to put some into the graveyard. INTUITION_ALTERNATIVE_LOGIC=true +# If enabled, the AI will run some additional checks in order to try to preserve spells that have Buyback and not +# use them unless absolutely necessary (or unless multiple copies are in hand). +TRY_TO_PRESERVE_BUYBACK_SPELLS=true + # How big of a difference is allowed between the revealed card CMC and the currently castable CMC to still put the # card on top of the library EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=2 diff --git a/forge-gui/res/ai/Experimental.ai b/forge-gui/res/ai/Experimental.ai index b5f8624f8a2..5b9048770f5 100644 --- a/forge-gui/res/ai/Experimental.ai +++ b/forge-gui/res/ai/Experimental.ai @@ -245,6 +245,10 @@ BOUNCE_ALL_ELSEWHERE_NONCREAT_EVAL_DIFF=5 # library to put some into the graveyard. INTUITION_ALTERNATIVE_LOGIC=true +# If enabled, the AI will run some additional checks in order to try to preserve spells that have Buyback and not +# use them unless absolutely necessary (or unless multiple copies are in hand). +TRY_TO_PRESERVE_BUYBACK_SPELLS=true + # How big of a difference is allowed between the revealed card CMC and the currently castable CMC to still put the # card on top of the library EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=2 diff --git a/forge-gui/res/ai/Reckless.ai b/forge-gui/res/ai/Reckless.ai index 188cf8199a9..4641fe37b0b 100644 --- a/forge-gui/res/ai/Reckless.ai +++ b/forge-gui/res/ai/Reckless.ai @@ -245,6 +245,10 @@ BOUNCE_ALL_ELSEWHERE_NONCREAT_EVAL_DIFF=3 # library to put some into the graveyard. INTUITION_ALTERNATIVE_LOGIC=true +# If enabled, the AI will run some additional checks in order to try to preserve spells that have Buyback and not +# use them unless absolutely necessary (or unless multiple copies are in hand). +TRY_TO_PRESERVE_BUYBACK_SPELLS=false + # How big of a difference is allowed between the revealed card CMC and the currently castable CMC to still put the # card on top of the library EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD=1