From b5dbb7da9081429b2b724d05bf5541ee2265dd60 Mon Sep 17 00:00:00 2001 From: Seravy Date: Tue, 13 Feb 2018 13:56:06 +0100 Subject: [PATCH] Countering from abilities will have a 100% chance to get used, unless it costs cards to activate, otherwise normal counter settings are used. This ensures the AI never wastes an opportunity to counter a spell if it does not cost him a card - holding a "tap to counter target spell" ability for later use is generally bad as the AI cannot determine if they need the mana later or not - but in most cases they don't. Required for cards Null Brooch and Ertai Wizard Adept in Tempest quest world. --- .../src/main/java/forge/ai/ability/CounterAi.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/forge-ai/src/main/java/forge/ai/ability/CounterAi.java b/forge-ai/src/main/java/forge/ai/ability/CounterAi.java index f60c65c4cdd..1b2848ed480 100644 --- a/forge-ai/src/main/java/forge/ai/ability/CounterAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/CounterAi.java @@ -7,6 +7,9 @@ import forge.game.ability.ApiType; import forge.game.card.Card; import forge.game.card.CardFactoryUtil; import forge.game.cost.Cost; +import forge.game.cost.CostDiscard; +import forge.game.cost.CostExile; +import forge.game.cost.CostSacrifice; import forge.game.player.Player; import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbilityStackInstance; @@ -201,6 +204,17 @@ public class CounterAi extends SpellAbilityAi { } } + // Should ALWAYS counter if it doesn't spend a card, otherwise it wastes an opportunity + // to gain card advantage + if (sa.isAbility() + && (!sa.getPayCosts().hasSpecificCostType(CostDiscard.class)) + && (!sa.getPayCosts().hasSpecificCostType(CostSacrifice.class)) + && (!sa.getPayCosts().hasSpecificCostType(CostExile.class)) + // maybe also disallow CostPayLife? + ) { + dontCounter = false; + } + if (dontCounter) { return false; }