mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- AI Haste: grant to cards with affordable activated abilities with a tap cost.
This commit is contained in:
@@ -21,6 +21,7 @@ import forge.game.ability.ApiType;
|
|||||||
import forge.game.card.*;
|
import forge.game.card.*;
|
||||||
import forge.game.combat.Combat;
|
import forge.game.combat.Combat;
|
||||||
import forge.game.combat.CombatUtil;
|
import forge.game.combat.CombatUtil;
|
||||||
|
import forge.game.cost.Cost;
|
||||||
import forge.game.cost.CostPayEnergy;
|
import forge.game.cost.CostPayEnergy;
|
||||||
import forge.game.keyword.Keyword;
|
import forge.game.keyword.Keyword;
|
||||||
import forge.game.keyword.KeywordCollection;
|
import forge.game.keyword.KeywordCollection;
|
||||||
@@ -1311,9 +1312,21 @@ public class ComputerUtilCard {
|
|||||||
|
|
||||||
//2. grant haste
|
//2. grant haste
|
||||||
if (keywords.contains("Haste") && c.hasSickness() && !c.isTapped()) {
|
if (keywords.contains("Haste") && c.hasSickness() && !c.isTapped()) {
|
||||||
if (ComputerUtilCard.doesSpecifiedCreatureAttackAI(ai, pumped)) {
|
double baseChance = 0.0f;
|
||||||
chance += 0.5f + (0.5f * ComputerUtilCombat.damageIfUnblocked(pumped, opp, combat, true) / opp.getLife());
|
// non-combat Haste: has an activated ability with tap cost
|
||||||
|
for (SpellAbility ab : c.getSpellAbilities()) {
|
||||||
|
Cost abCost = ab.getPayCosts();
|
||||||
|
if (abCost != null && abCost.hasTapCost()
|
||||||
|
&& (!abCost.hasManaCost() || ComputerUtilMana.canPayManaCost(ab, ai, 0))) {
|
||||||
|
baseChance += 0.5f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// combat Haste: only grant it if the creature will attack
|
||||||
|
if (ComputerUtilCard.doesSpecifiedCreatureAttackAI(ai, pumped)) {
|
||||||
|
if (baseChance < 0.5f) { baseChance = 0.5f; }
|
||||||
|
chance += 0.5f * ComputerUtilCombat.damageIfUnblocked(pumped, opp, combat, true) / opp.getLife();
|
||||||
|
}
|
||||||
|
chance += baseChance;
|
||||||
}
|
}
|
||||||
|
|
||||||
//3. grant evasive
|
//3. grant evasive
|
||||||
|
|||||||
Reference in New Issue
Block a user