refactor(Core/Combat): Port TrinityCore heap-based threat system (#24715)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
Co-authored-by: Treeston <treeston.mmoc@gmail.com>
Co-authored-by: killerwife <killerwife@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
blinkysc
2026-03-18 13:36:59 -05:00
committed by GitHub
parent c80a0f1fad
commit 984baa92dd
101 changed files with 7045 additions and 2659 deletions
@@ -16,6 +16,7 @@
*/
#include "HomeMovementGenerator.h"
#include "CombatManager.h"
#include "Creature.h"
#include "CreatureAI.h"
#include "DisableMgr.h"
@@ -23,11 +24,13 @@
void HomeMovementGenerator<Creature>::DoInitialize(Creature* owner)
{
owner->GetCombatManager().SetEvadeState(EVADE_STATE_HOME);
_setTargetLocation(owner);
}
void HomeMovementGenerator<Creature>::DoFinalize(Creature* owner)
{
owner->GetCombatManager().SetEvadeState(EVADE_STATE_NONE);
owner->ClearUnitState(UNIT_STATE_EVADE);
if (arrived)
{
@@ -255,10 +255,17 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
{
i_recalculateTravel = false;
i_path = nullptr;
if (cOwner)
cOwner->SetCannotReachTarget();
owner->ClearUnitState(UNIT_STATE_CHASE_MOVE);
owner->SetInFront(target);
if (cOwner)
{
if (cOwner->IsWithinMeleeRange(target))
cOwner->SetCannotReachTarget();
else
cOwner->SetCannotReachTarget(target->GetGUID());
}
MovementInform(owner);
}
@@ -414,7 +414,6 @@ void FlightPathMovementGenerator::DoFinalize(Player* player)
if (player->m_taxi.empty())
{
player->getHostileRefMgr().setOnlineOfflineState(true);
// update z position to ground and orientation for landing point
// this prevent cheating with landing point at lags
// when client side flight end early in comparison server side
@@ -443,7 +442,6 @@ void FlightPathMovementGenerator::DoReset(Player* player)
if (player->pvpInfo.EndTimer)
player->UpdatePvP(false, true); // PvP flag timer immediately ends when starting taxi
player->getHostileRefMgr().setOnlineOfflineState(false);
player->AddUnitState(UNIT_STATE_IN_FLIGHT);
player->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);