use of eidolons.game.battlecraft.rules.combat.attack.AttackCalculator in project Eidolons by IDemiurge.
the class DamageCalculator method precalculateDamage.
/**
* Calculates damage for AI's FutureBuilder (AttackEffect)
*
* @param attack
* @return
*/
public static int precalculateDamage(Attack attack, Boolean min_max_normal) {
BattleFieldObject attacked = attack.getAttacked();
Unit attacker = attack.getAttacker();
if (!attacked.checkPassive(UnitEnums.STANDARD_PASSIVES.SNEAK_IMMUNE)) {
attack.setSneak(SneakRule.checkSneak(attack.getRef()));
}
// TODO ref.setFuture(true) -> average dice, auto-reset action etc
AttackCalculator calculator = new AttackCalculator(attack, true);
if (min_max_normal != null)
if (min_max_normal) {
calculator.setMin(true);
} else {
calculator.setMax(true);
}
int amount = calculator.calculateFinalDamage();
DAMAGE_TYPE dmg_type = attack.getDamageType();
if (dmg_type == DAMAGE_TYPE.PURE || dmg_type == DAMAGE_TYPE.POISON) {
return amount;
}
if (!(attacked instanceof Unit)) {
return amount;
}
int blocked = attacked.getGame().getArmorSimulator().getShieldDamageBlocked(amount, (Unit) attacked, attacker, attack.getAction(), attack.getWeapon(), attack.getDamageType());
blocked += attacked.getGame().getArmorSimulator().getArmorBlockDamage(amount, (Unit) attacked, attacker, attack.getAction());
amount = calculateDamage(true, attacked, attacker, amount, null, blocked, attack.getDamageType());
if (attack.getAction().isAttackGeneric()) {
return amount;
}
return amount;
}
use of eidolons.game.battlecraft.rules.combat.attack.AttackCalculator in project Eidolons by IDemiurge.
the class AttackAnimation method start.
@Override
public void start() {
if (isRecalc()) {
int damage = new AttackCalculator(attack, true).calculateFinalDamage();
super.start();
return;
}
super.start();
}
Aggregations