Improve AI logic for City of Brass. (#3902)

* - Improve AI logic for City of Brass.

* - Better implementation that avoids a specialized hint and checks the trigger.
This commit is contained in:
Agetian
2023-10-15 08:57:57 +03:00
committed by GitHub
parent 5e7d290829
commit 29b1d1ee1b

View File

@@ -1462,6 +1462,26 @@ public class ComputerUtilMana {
}
}
}
// exclude cards that will deal lethal damage when tapped
if (ai.canLoseLife() && !ai.cantLoseForZeroOrLessLife()) {
boolean dealsLethalOnTap = false;
for (Trigger t : card.getTriggers()) {
if (t.getMode() == TriggerType.Taps || t.getMode() == TriggerType.TapsForMana) {
SpellAbility trigSa = t.getOverridingAbility();
if (trigSa.getApi() == ApiType.DealDamage && trigSa.getParamOrDefault("Defined", "").equals("You")) {
int numDamage = AbilityUtils.calculateAmount(card, trigSa.getParam("NumDmg"), null);
numDamage = ai.staticReplaceDamage(numDamage, card, false);
if (ai.getLife() <= numDamage) {
dealsLethalOnTap = true;
break;
}
}
}
}
if (dealsLethalOnTap) {
continue;
}
}
if (card.isCreature() || card.isEnchanted()) {
otherManaSources.add(card);