Talk:Damage: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 27: Line 27:
I will edit the article to reflect this.
I will edit the article to reflect this.
[[User:Frightning|Frightning]] ([[User talk:Frightning|talk]]) 07:01, 9 January 2018 (UTC)
[[User:Frightning|Frightning]] ([[User talk:Frightning|talk]]) 07:01, 9 January 2018 (UTC)
----
"Decrease resistance decreases the damage by specified number as long as the resulting damage wouldn't be less than 1."
So it should be "if R+1<=D" not "if R+1<D"?
"otherwise if D>1 " this is never true, since the normal ammo is already 5 + bonus.
"F = (1 - P) / (R+1) " The results of the calculation tests I've done do not feel right.
I think that the first poster is onto something. I combined his update with the wiki part to the complete (probably correct) fuction:
Func CalculateHPDamage($WeaponDamage, $FlatResistance, $PercentResistance)
Local $DmgDiff = $WeaponDamage - $FlatResistance
If $DmgDiff < 1 Then
Local $HPLost = (1 - $PercentResistance) / (2 - $DmgDiff)
Else
Local $HPLost = (1 - $PercentResistance) * $DmgDiff
EndIf
Return $HPLost
EndFunc  ;==>CalculateHPDamage
Shouldn't the correct formula be somewhere in the lua files?
[[User:Dux|Dux]] ([[User talk:Dux|talk]]) 20:19, 26 March 2019 (UTC)

Revision as of 20:19, 26 March 2019

After some testing in version 0.15.28 found out two things:

1) percentile resistance is applied second (i've edited the page about it);

2) flat resistance works little different than it's wrote in wiki:

[code]

let D = damage - flat resistance

if D < 1 then let D = 1 / (2 - D)

D is resulting damage

[/code]

This differs from what written in wiki in case of (damage - flat resistance) in range from 0 to 1 exclusive.

Don't really know how to correctly write it in wiki, so post it in discussion for now.


Regarding the above

I have confirmed that the above statement about percentage resistance being applied after flat is correct.

I am also quite sure that the above is also correct about the change of formula for accounting for high flat resistance against low damage happens when reduced damage (after only applying flat resistance, would be less than or equal to 1, as both formulas agree at only that value, hence the only way to preserve more raw damage=more actual damage and not have a jump discontinuity would be to make the transition there).

I will edit the article to reflect this. Frightning (talk) 07:01, 9 January 2018 (UTC)



"Decrease resistance decreases the damage by specified number as long as the resulting damage wouldn't be less than 1." So it should be "if R+1<=D" not "if R+1<D"?

"otherwise if D>1 " this is never true, since the normal ammo is already 5 + bonus.

"F = (1 - P) / (R+1) " The results of the calculation tests I've done do not feel right.

I think that the first poster is onto something. I combined his update with the wiki part to the complete (probably correct) fuction:

Func CalculateHPDamage($WeaponDamage, $FlatResistance, $PercentResistance)

Local $DmgDiff = $WeaponDamage - $FlatResistance

If $DmgDiff < 1 Then

Local $HPLost = (1 - $PercentResistance) / (2 - $DmgDiff)

Else

Local $HPLost = (1 - $PercentResistance) * $DmgDiff

EndIf

Return $HPLost

EndFunc  ;==>CalculateHPDamage


Shouldn't the correct formula be somewhere in the lua files?

Dux (talk) 20:19, 26 March 2019 (UTC)