mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
update
This commit is contained in:
parent
4afb23d093
commit
c2bd0724e8
@ -199,8 +199,7 @@ class BattleDamage{
|
||||
}
|
||||
|
||||
private fun getHealthDependantDamageRatio(combatant: ICombatant): Float {
|
||||
return if (combatant.getUnitType() == UnitType.City) 0.75f
|
||||
else if(combatant.getCivInfo().nation.unique == "Units fight as though they were at full strength even when damaged" && !combatant.getUnitType().isAirUnit())
|
||||
return if(combatant.getCivInfo().nation.unique == "Units fight as though they were at full strength even when damaged" && !combatant.getUnitType().isAirUnit())
|
||||
1f
|
||||
else 1 - (100 - combatant.getHealth()) / 300f// Each 3 points of health reduces damage dealt by 1% like original game
|
||||
}
|
||||
@ -228,12 +227,12 @@ class BattleDamage{
|
||||
if(attacker.isRanged()) return 0
|
||||
if(defender.getUnitType().isCivilian()) return 0
|
||||
val ratio = getAttackingStrength(attacker,defender) / getDefendingStrength(attacker,defender)
|
||||
return (damageModifier(ratio, true) * getHealthDependantDamageRatio(defender)).toInt()
|
||||
return (damageModifier(ratio, true) * (if(defender.getUnitType() == UnitType.City) 1.00f else getHealthDependantDamageRatio(defender))).toInt()
|
||||
}
|
||||
|
||||
fun calculateDamageToDefender(attacker: ICombatant, defender: ICombatant): Int {
|
||||
val ratio = getAttackingStrength(attacker,defender) / getDefendingStrength(attacker,defender)
|
||||
return (damageModifier(ratio,false) * getHealthDependantDamageRatio(attacker)).toInt()
|
||||
return (damageModifier(ratio,false) * (if(attacker.getUnitType() == UnitType.City) 0.75f else getHealthDependantDamageRatio(attacker))).toInt()
|
||||
}
|
||||
|
||||
fun damageModifier(attackerToDefenderRatio:Float, damageToAttacker:Boolean): Float {
|
||||
|
@ -26,7 +26,7 @@ class CityCombatant(val city: CityInfo) : ICombatant {
|
||||
}
|
||||
|
||||
override fun getUnitType(): UnitType = UnitType.City
|
||||
override fun getAttackingStrength(): Int = getCityStrength()*2/5 // I remember reading this but I don't recall where
|
||||
override fun getAttackingStrength(): Int = getCityStrength() //If we don't need to multiply by a modifier number (0.75) in Damage Calculations, getCityStrength() should multiply by 1/1.54488 (about 2/3 not 2/5), i use another mathod, because in original game the city only has strength attribute (in other words, City's AttackingStrength() = getCityStrength() in original game).
|
||||
override fun getDefendingStrength(): Int{
|
||||
if(isDefeated()) return 1
|
||||
return getCityStrength()
|
||||
|
Loading…
x
Reference in New Issue
Block a user