Fix player regen
This commit is contained in:
parent
366b42de61
commit
5311ada582
@ -148,26 +148,36 @@ void Player::Init()
|
|||||||
float maxArmour = BY_GAME(pInfo->m_nMaxArmour, pInfo->m_nMaxArmour, 100);
|
float maxArmour = BY_GAME(pInfo->m_nMaxArmour, pInfo->m_nMaxArmour, 100);
|
||||||
|
|
||||||
static float prevVal = 0;
|
static float prevVal = 0;
|
||||||
float curVal = (player->m_fHealth == player->m_fMaxHealth) ? player->m_fHealth : player->m_fArmour;
|
float curVal = player->m_fHealth;
|
||||||
|
|
||||||
|
if (player->m_fHealth >= player->m_fMaxHealth)
|
||||||
|
{
|
||||||
|
curVal = player->m_fArmour;
|
||||||
|
}
|
||||||
|
|
||||||
if (curVal != prevVal)
|
if (curVal != prevVal)
|
||||||
{
|
{
|
||||||
lastDmg = timer;
|
lastDmg = timer;
|
||||||
curVal = prevVal;
|
prevVal = curVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timer - lastDmg > 5000 && timer - lastTimer > 1000)
|
if (timer - lastDmg > 5000 && timer - lastTimer > 1000)
|
||||||
{
|
{
|
||||||
if (player->m_fHealth != maxHealth || player->m_fArmour != maxArmour)
|
if (player->m_fHealth < maxHealth || player->m_fArmour < maxArmour)
|
||||||
{
|
{
|
||||||
if (player->m_fHealth != maxHealth)
|
if (player->m_fHealth < maxHealth)
|
||||||
{
|
{
|
||||||
player->m_fHealth += 0.2f;
|
player->m_fHealth += 0.2f;
|
||||||
prevVal = player->m_fHealth;
|
prevVal = player->m_fHealth;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player->m_fArmour += 0.2f;
|
// Only give armour if player has some already
|
||||||
prevVal = player->m_fArmour;
|
if (player->m_fArmour >= 1)
|
||||||
|
{
|
||||||
|
player->m_fArmour += 0.2f;
|
||||||
|
prevVal = player->m_fArmour;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastTimer = timer;
|
lastTimer = timer;
|
||||||
|
Loading…
Reference in New Issue
Block a user