This commit is contained in:
YueR 2019-09-29 22:54:22 +08:00
parent 9f28c2f60d
commit 5e0bbc69df

View file

@ -227,12 +227,12 @@ class BattleDamage{
if(defender.getUnitType().isCivilian()) return 0
val ratio = getAttackingStrength(attacker,defender) / getDefendingStrength(attacker,defender)
val i = if (ratio < 1) -1 else 1
return ((24 + 12 * Random().nextFloat()) * ((ratio.pow(i) + 3).pow(4) / 512 + 0.5).pow(i) * getHealthDependantDamageRatio(defender)).toInt()
return ((24 + 12 * Random().nextFloat()) * (((ratio.pow(i) + 3).pow(4) / 512 + 0.5).pow(i)) * getHealthDependantDamageRatio(defender)).toInt()
}
fun calculateDamageToDefender(attacker: ICombatant, defender: ICombatant): Int {
val ratio = getAttackingStrength(attacker,defender) / getDefendingStrength(attacker,defender)
val i = if (ratio < 1) -1 else 1
return ((24 + 12 * Random().nextFloat()) * ((ratio.pow(i) + 3).pow(4) / 512 + 0.5).pow(i) * getHealthDependantDamageRatio(attacker)).toInt()
return ((24 + 12 * Random().nextFloat()) / (((ratio.pow(i) + 3).pow(4) / 512 + 0.5).pow(i)) * getHealthDependantDamageRatio(attacker)).toInt()
}
}