mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Update AI damage prevention prediction code
This commit is contained in:
@@ -5170,10 +5170,11 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
return damage;
|
||||
}
|
||||
|
||||
for (final Card ca : getGame().getCardsIn(ZoneType.Battlefield)) {
|
||||
for (final Card ca : getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final ReplacementEffect re : ca.getReplacementEffects()) {
|
||||
Map<String, String> params = re.getMapParams();
|
||||
if (!re.getMode().equals(ReplacementType.DamageDone) || !params.containsKey("PreventionEffect")) {
|
||||
if (!re.getMode().equals(ReplacementType.DamageDone) ||
|
||||
(!params.containsKey("PreventionEffect") && !params.containsKey("Prevent"))) {
|
||||
continue;
|
||||
}
|
||||
if (params.containsKey("ValidSource")
|
||||
@@ -5195,6 +5196,14 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (params.containsKey("Prevent")) {
|
||||
return 0;
|
||||
} else if (re.getOverridingAbility() != null) {
|
||||
SpellAbility repSA = re.getOverridingAbility();
|
||||
if (repSA.getApi() == ApiType.ReplaceDamage) {
|
||||
return Math.max(0, damage - AbilityUtils.calculateAmount(ca, repSA.getParam("Amount"), repSA));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user