Skip to content

Commit

Permalink
InfClassCharacter: Fix inconsistent poisoning
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaffeine committed Dec 2, 2023
1 parent d12eb21 commit ad61af1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/game/server/infclass/entities/infccharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void CInfClassCharacter::Destroy()
void CInfClassCharacter::Tick()
{
const vec2 PrevPos = m_Core.m_Pos;
const int CurrentTick = Server()->Tick();

if(m_pClass)
{
Expand All @@ -202,7 +203,7 @@ void CInfClassCharacter::Tick()

if(m_Poison > 0)
{
if(m_PoisonTick == 0)
if(m_PoisonTick <= CurrentTick)
{
m_Poison--;
vec2 Force(0, 0);
Expand All @@ -213,7 +214,7 @@ void CInfClassCharacter::Tick()
int Damage = maximum(Config()->m_InfPoisonDamage, 1);
const float PoisonDurationSeconds = Config()->m_InfPoisonDuration / 1000.0;
const float DamageIntervalSeconds = PoisonDurationSeconds / Damage;
m_PoisonTick = Server()->TickSpeed() * DamageIntervalSeconds;
m_PoisonTick = CurrentTick + Server()->TickSpeed() * DamageIntervalSeconds;
}

const CInfClassPlayer *pPoisonerPlayer = GameController()->GetPlayer(m_PoisonFrom);
Expand All @@ -222,10 +223,6 @@ void CInfClassCharacter::Tick()
GameServer()->CreateDeath(GetPos(), m_PoisonFrom);
}
}
else
{
m_PoisonTick--;
}
}

if(m_LastHelper.m_Tick > 0)
Expand Down Expand Up @@ -285,6 +282,8 @@ void CInfClassCharacter::TickPaused()
{
m_DamageZoneTick++;
}
if(m_PoisonTick)
m_PoisonTick++;
}

void CInfClassCharacter::Snap(int SnappingClient)
Expand Down Expand Up @@ -964,6 +963,7 @@ void CInfClassCharacter::Poison(int Count, int From, DAMAGE_TYPE DamageType)
void CInfClassCharacter::ResetPoisonEffect()
{
m_Poison = 0;
// Do not reset m_PoisonTick here to prevent extra poisoning
}

void CInfClassCharacter::ResetMovementsInput()
Expand Down

0 comments on commit ad61af1

Please sign in to comment.