fix: POS_FIGHTING state

This commit is contained in:
rtw1x1
2025-12-19 15:38:13 +00:00
committed by GitHub
parent da619922cb
commit e6b609c817
5 changed files with 76 additions and 0 deletions

View File

@@ -1592,6 +1592,24 @@ void CHARACTER::SendDamagePacket(LPCHARACTER pAttacker, int Damage, BYTE DamageF
}
}
#ifdef FIX_BATTLE_INACTIVITY_TIMEOUT
void CHARACTER::EnterCombat()
{
if (!IsPC())
return;
if (!IsPosition(POS_FIGHTING))
{
SetPosition(POS_FIGHTING);
SetNextStatePulse(1);
}
// Start the 10s window if it hasn't started yet.
if (m_dwLastCombatTime == 0)
m_dwLastCombatTime = get_dword_time();
}
#ifdef FIX_BATTLE_INACTIVITY_TIMEOUT
//
// CHARACTER::Damage 메소드는 this가 데미지를 입게 한다.
//
@@ -2287,6 +2305,22 @@ bool CHARACTER::Damage(LPCHARACTER pAttacker, int dam, EDamageType type) // retu
//
if (!cannot_dead)
{
#ifdef FIX_BATTLE_INACTIVITY_TIMEOUT
// REAL combat activity only: final damage > 0
if (dam > 0)
{
// Victim received real damage
UpdateLastCombatTime();
EnterCombat();
// Attacker dealt real damage
if (pAttacker)
{
pAttacker->UpdateLastCombatTime();
pAttacker->EnterCombat();
}
}
#endif
PointChange(POINT_HP, -dam, false);
}