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:
@@ -472,7 +472,7 @@ void ScriptedAI::DoResetThreat(Unit* unit)
|
||||
|
||||
void ScriptedAI::DoResetThreatList()
|
||||
{
|
||||
if (!me->CanHaveThreatList() || me->GetThreatMgr().isThreatListEmpty())
|
||||
if (!me->CanHaveThreatList() || me->GetThreatMgr().IsThreatListEmpty())
|
||||
{
|
||||
LOG_ERROR("entities.unit.ai", "DoResetThreatList called for creature that either cannot have threat list or has empty threat list (me entry = {})", me->GetEntry());
|
||||
return;
|
||||
@@ -714,11 +714,12 @@ void BossAI::TeleportCheaters()
|
||||
float x, y, z;
|
||||
me->GetPosition(x, y, z);
|
||||
|
||||
ThreatContainer::StorageType threatList = me->GetThreatMgr().GetThreatList();
|
||||
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
|
||||
if (Unit* target = (*itr)->getTarget())
|
||||
if (target->IsPlayer() && !IsInBoundary(target))
|
||||
target->NearTeleportTo(x, y, z, 0);
|
||||
for (auto const& pair : me->GetCombatManager().GetPvECombatRefs())
|
||||
{
|
||||
Unit* target = pair.second->GetOther(me);
|
||||
if (target->IsControlledByPlayer() && !IsInBoundary(target))
|
||||
target->NearTeleportTo(x, y, z, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void BossAI::JustSummoned(Creature* summon)
|
||||
|
||||
Reference in New Issue
Block a user