mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Merge branch 'CounterFromAbilityAI' into 'master'
Counter from ability ai See merge request core-developers/forge!224
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,27 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Null Brooch is special - it has a discard cost, but the AI will be
|
||||||
|
// discarding no cards, or is playing a deck where discarding is a benefit
|
||||||
|
// as defined in SpecialCardAi.NullBrooch
|
||||||
|
if (sa.hasParam("AILogic")) {
|
||||||
|
if ("NullBooch".equals(sa.getParam("AILogic"))) {
|
||||||
|
dontCounter = false;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
if (dontCounter) {
|
if (dontCounter) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user