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.
This commit is contained in:
Seravy
2018-02-13 13:56:06 +01:00
parent 36917c0d18
commit b5dbb7da90

View File

@@ -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;
}