mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Predict poison from triggers for Poisonous
This commit is contained in:
@@ -60,7 +60,7 @@ import forge.util.collect.FCollection;
|
|||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* ComputerCombatUtil class.
|
* ComputerCombatUtil class.
|
||||||
* </p>
|
* </p>;
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id: ComputerUtil.java 19179 2013-01-25 18:48:29Z Max mtg $
|
* @version $Id: ComputerUtil.java 19179 2013-01-25 18:48:29Z Max mtg $
|
||||||
@@ -253,9 +253,8 @@ public class ComputerUtilCombat {
|
|||||||
poison += pd;
|
poison += pd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (attacker.hasKeyword(Keyword.POISONOUS) && damage > 0) {
|
if (damage > 0) {
|
||||||
// TODO need to check for magnitude 1, each of their triggers could be replaced to 0
|
poison += predictPoisonFromTriggers(attacker, attacked, damage);
|
||||||
poison += attacker.getKeywordMagnitude(Keyword.POISONOUS);
|
|
||||||
}
|
}
|
||||||
return poison;
|
return poison;
|
||||||
}
|
}
|
||||||
@@ -373,12 +372,11 @@ public class ComputerUtilCombat {
|
|||||||
unblocked.add(attacker);
|
unblocked.add(attacker);
|
||||||
} else if (attacker.hasKeyword(Keyword.TRAMPLE)
|
} else if (attacker.hasKeyword(Keyword.TRAMPLE)
|
||||||
&& (getAttack(attacker) > totalShieldDamage(attacker, blockers))) {
|
&& (getAttack(attacker) > totalShieldDamage(attacker, blockers))) {
|
||||||
|
int trampleDamage = getAttack(attacker) - totalShieldDamage(attacker, blockers);
|
||||||
if (attacker.hasKeyword(Keyword.INFECT)) {
|
if (attacker.hasKeyword(Keyword.INFECT)) {
|
||||||
poison += getAttack(attacker) - totalShieldDamage(attacker, blockers);
|
poison += trampleDamage;
|
||||||
}
|
|
||||||
if (attacker.hasKeyword(Keyword.POISONOUS)) {
|
|
||||||
poison += attacker.getKeywordMagnitude(Keyword.POISONOUS);
|
|
||||||
}
|
}
|
||||||
|
poison += predictPoisonFromTriggers(attacker, ai, trampleDamage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2475,4 +2473,25 @@ public class ComputerUtilCombat {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int predictPoisonFromTriggers(Card attacker, Player attacked, int damage) {
|
||||||
|
int pd = 0, poison = 0;
|
||||||
|
int damageAfterRepl = predictDamageTo(attacked, damage, attacker, true);
|
||||||
|
if (damageAfterRepl > 0) {
|
||||||
|
for (Trigger t : attacker.getTriggers()) {
|
||||||
|
if (t.getMode() == TriggerType.DamageDone && "True".equals(t.getParam("CombatDamage"))) {
|
||||||
|
SpellAbility ab = t.getOverridingAbility();
|
||||||
|
if (ab.getApi() == ApiType.Poison && "TriggeredTarget".equals(ab.getParam("Defined"))) {
|
||||||
|
pd += AbilityUtils.calculateAmount(attacker, ab.getParam("Num"), ab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
poison += pd;
|
||||||
|
if (pd > 0 && attacker.hasKeyword(Keyword.DOUBLE_STRIKE)) {
|
||||||
|
poison += pd;
|
||||||
|
}
|
||||||
|
// TODO: Predict replacement effects for counters (doubled, reduced, additional counters, etc.)
|
||||||
|
}
|
||||||
|
return poison;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user