mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
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:
@@ -7,6 +7,9 @@ import forge.game.ability.ApiType;
|
|||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.card.CardFactoryUtil;
|
import forge.game.card.CardFactoryUtil;
|
||||||
import forge.game.cost.Cost;
|
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.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.game.spellability.SpellAbilityStackInstance;
|
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) {
|
if (dontCounter) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user