Talk:Damage: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(→‎Damage types: new section)
Line 68: Line 68:


Hi, is there really a difference between Physical/Impact and Laser/Electric types of damage? Or those are the same? --[[User:Factorles|Factorles]] ([[User talk:Factorles|talk]]) 13:20, 10 January 2024 (UTC)
Hi, is there really a difference between Physical/Impact and Laser/Electric types of damage? Or those are the same? --[[User:Factorles|Factorles]] ([[User talk:Factorles|talk]]) 13:20, 10 January 2024 (UTC)
: Hey, yes there is a difference. For example some entities have different resistances to these damage types. One example of that is the behemoth biter, it has resistance to physical damage but not impact damage, so it makes a difference whether you shoot it with a pistol or ram it with a tank. -- [[User:Bilka|Bilka]] ([[User talk:Bilka|talk]]) - <span style="color:#FF0000">Admin</span> 16:46, 22 February 2024 (UTC)

Revision as of 16:46, 22 February 2024

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)

The correct formula is currently on the page. It's taken directly from the game's files. -- Bilka (talk) - Admin 08:40, 27 March 2019 (UTC)

Damage types

Hi, is there really a difference between Physical/Impact and Laser/Electric types of damage? Or those are the same? --Factorles (talk) 13:20, 10 January 2024 (UTC)

Hey, yes there is a difference. For example some entities have different resistances to these damage types. One example of that is the behemoth biter, it has resistance to physical damage but not impact damage, so it makes a difference whether you shoot it with a pistol or ram it with a tank. -- Bilka (talk) - Admin 16:46, 22 February 2024 (UTC)