Skip to content

Commit 0a8f421

Browse files
committed
Fix max health formula
1 parent c197cf8 commit 0a8f421

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Client/mods/deathmatch/logic/CClientPed.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -1706,14 +1706,12 @@ void CClientPed::SetUsesCollision(bool bUsesCollision)
17061706

17071707
float CClientPed::GetMaxHealth()
17081708
{
1709-
// TODO: Verify this formula
1710-
17111709
// Grab his player health stat
17121710
float fStat = GetStat(MAX_HEALTH);
17131711

17141712
// Do a linear interpolation to get how much health this would allow
1715-
// Assumes: 100 health = 569 stat, 200 health = 1000 stat.
1716-
float fMaxHealth = 100.0f + (100.0f / 431.0f * (fStat - 569.0f));
1713+
// Assumes: 100 health = 569 stat, 176 health = 1000 stat.
1714+
float fMaxHealth = fStat * 0.176f;
17171715

17181716
// Return the max health. Make sure it can't be below 1
17191717
if (fMaxHealth < 1.0f)

Server/mods/deathmatch/logic/CPed.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -369,14 +369,12 @@ bool CPed::HasWeaponType(unsigned char ucWeaponType)
369369

370370
float CPed::GetMaxHealth()
371371
{
372-
// TODO: Verify this formula
373-
374372
// Grab his player health stat
375373
float fStat = GetPlayerStat(24 /*MAX_HEALTH*/);
376374

377375
// Do a linear interpolation to get how much health this would allow
378-
// Assumes: 100 health = 569 stat, 200 health = 1000 stat.
379-
float fMaxHealth = 100.0f + (100.0f / 431.0f * (fStat - 569.0f));
376+
// Assumes: 100 health = 569 stat, 176 health = 1000 stat.
377+
float fMaxHealth = fStat * 0.176f;
380378

381379
// Return the max health. Make sure it can't be below 1
382380
if (fMaxHealth < 1.0f)

0 commit comments

Comments
 (0)