mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Merge branch 'master' into 'master'
Improved AI Haste chance calculation. See merge request core-developers/forge!1203
This commit is contained in:
@@ -1312,21 +1312,22 @@ 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()) {
|
||||||
double baseChance = 0.0f;
|
double nonCombatChance = 0.0f;
|
||||||
|
double combatChance = 0.0f;
|
||||||
// non-combat Haste: has an activated ability with tap cost
|
// non-combat Haste: has an activated ability with tap cost
|
||||||
for (SpellAbility ab : c.getSpellAbilities()) {
|
for (SpellAbility ab : c.getSpellAbilities()) {
|
||||||
Cost abCost = ab.getPayCosts();
|
Cost abCost = ab.getPayCosts();
|
||||||
if (abCost != null && abCost.hasTapCost()
|
if (abCost != null && abCost.hasTapCost()
|
||||||
&& (!abCost.hasManaCost() || ComputerUtilMana.canPayManaCost(ab, ai, 0))) {
|
&& (!abCost.hasManaCost() || ComputerUtilMana.canPayManaCost(ab, ai, 0))) {
|
||||||
baseChance += 0.5f;
|
nonCombatChance += 0.5f;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// combat Haste: only grant it if the creature will attack
|
// combat Haste: only grant it if the creature will attack
|
||||||
if (ComputerUtilCard.doesSpecifiedCreatureAttackAI(ai, pumped)) {
|
if (ComputerUtilCard.doesSpecifiedCreatureAttackAI(ai, pumped)) {
|
||||||
if (baseChance < 0.5f) { baseChance = 0.5f; }
|
combatChance += 0.5f + (0.5f * ComputerUtilCombat.damageIfUnblocked(pumped, opp, combat, true) / opp.getLife());
|
||||||
chance += 0.5f * ComputerUtilCombat.damageIfUnblocked(pumped, opp, combat, true) / opp.getLife();
|
|
||||||
}
|
}
|
||||||
chance += baseChance;
|
chance += nonCombatChance + combatChance;
|
||||||
}
|
}
|
||||||
|
|
||||||
//3. grant evasive
|
//3. grant evasive
|
||||||
|
|||||||
Reference in New Issue
Block a user