Skip to content

Commit cdc3831

Browse files
Synchronize changes from 1.6 master branch [ci skip]
4653b7e Fix max health formula (PR #3934, Fixes #3807)
2 parents abc8dd5 + 4653b7e commit cdc3831

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,14 +1713,12 @@ void CClientPed::SetUsesCollision(bool bUsesCollision)
17131713

17141714
float CClientPed::GetMaxHealth()
17151715
{
1716-
// TODO: Verify this formula
1717-
17181716
// Grab his player health stat
17191717
float fStat = GetStat(MAX_HEALTH);
17201718

17211719
// Do a linear interpolation to get how much health this would allow
1722-
// Assumes: 100 health = 569 stat, 200 health = 1000 stat.
1723-
float fMaxHealth = 100.0f + (100.0f / 431.0f * (fStat - 569.0f));
1720+
// Assumes: 100 health = 569 stat, 176 health = 1000 stat.
1721+
float fMaxHealth = fStat * 0.176f;
17241722

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

Server/mods/deathmatch/logic/CPed.cpp

Lines changed: 2 additions & 4 deletions
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)