Migrate DamageState thresholds to integer
While avoiding divisions. While there haven't been any desyncs to speak of recently (not in this part of the code, in any case), this still looks like an oversight from when we migrated away from using floats. This also makes it easier to expose the thresholds to modders later.
This commit is contained in:
@@ -63,13 +63,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (hp <= 0)
|
||||
return DamageState.Dead;
|
||||
|
||||
if (hp < MaxHP * 0.25f)
|
||||
if (hp * 100L < MaxHP * 25L)
|
||||
return DamageState.Critical;
|
||||
|
||||
if (hp < MaxHP * 0.5f)
|
||||
if (hp * 100L < MaxHP * 50L)
|
||||
return DamageState.Heavy;
|
||||
|
||||
if (hp < MaxHP * 0.75f)
|
||||
if (hp * 100L < MaxHP * 75L)
|
||||
return DamageState.Medium;
|
||||
|
||||
if (hp == MaxHP)
|
||||
|
||||
Reference in New Issue
Block a user