Finally got round to writing this up, here is a sudo code explanation of how we do the damage calculation for air combat. the wiki was pretty close just a few things where missing. I hope this will clear up any gaps. feel free to ask more questions if something isn't clear.
Code:
if ( AttackerAgility < OurAgility ){
DifferenceFactor = Min( Our Agility / Attacker Agility, BIGGEST_AGILITY_FACTOR_DIFF )
AgilityMitigation =( ( DifferenceFactor - 1 ) * ( AirAttack * COMBAT_BETTER_AGILITY_DAMAGE_REDUCTION ) ).Rounded
}
if ( AttackerSpeed > OurSpeed){
DifferenceFactor =Min( AttackerSpeed / OurSpeed, BIGGEST_SPEED_FACTOR_DIFF );
SpeedBonus =( ( DifferenceFactor - 1 ) * (AirAttack*COMBAT_BETTER_SPEED_DAMAGE_INCREASE ) ).Rounded
SpeedBonus +=( AttackerSpeed * TOP_SPEED_DAMAGE_BONUS_FACTOR / 100* AirAttack).Rounded
}
FinalAirAttack += SpeedBonus - AgilityMitigation
MaxKillCount =Min( TargetablePlaneCount, AirWingSize - DelayedLosses )
RemainingTargetablePlaneCount -=
AttackingPlanes / COMBAT_MULTIPLANE_CAP ).Rounded
ClampMin(RemainingTargetablePlaneCount, 0 )
DamageScale = IsCarrierFight ? COMBAT_DAMAGE_SCALE_CARRIER : COMBAT_DAMAGE_SCALE
CalcKillCount= Max( 0.01, ( FinalAirAttack * DamageScale * 0.1 ) / OurDefense )
if ( CalcKillCount< MaxKillCount ){
KillCount = CalcKillCount.Truncated
if ( RANDOM < ( UnlimitedKillCountWithDecimals - KillCount ) ){
++KillCount
}
}
else{
KillCount = MaxKillCount
}
DelayedLosses += KillCount #this lets us run combat losses over multiple calcs without issue.
- 5
- 2