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:
@@ -1104,7 +1104,7 @@ struct npc_maiev_illidan : public ScriptedAI
|
||||
void Reset() override
|
||||
{
|
||||
scheduler.CancelAll();
|
||||
me->m_Events.KillAllEvents(true);
|
||||
me->m_Events.KillAllEvents(false);
|
||||
}
|
||||
|
||||
void DoAction(int32 param) override
|
||||
|
||||
@@ -168,13 +168,14 @@ struct boss_supremus : public BossAI
|
||||
Unit* FindHatefulStrikeTarget()
|
||||
{
|
||||
Unit* target = nullptr;
|
||||
ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().GetThreatList();
|
||||
for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
|
||||
for (ThreatReference const* ref : me->GetThreatMgr().GetUnsortedThreatList())
|
||||
{
|
||||
Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
|
||||
if (unit && me->IsWithinMeleeRange(unit))
|
||||
if (!target || unit->GetHealth() > target->GetHealth())
|
||||
target = unit;
|
||||
if (Unit* unit = ref->GetVictim())
|
||||
{
|
||||
if (me->IsWithinMeleeRange(unit))
|
||||
if (!target || unit->GetHealth() > target->GetHealth())
|
||||
target = unit;
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
|
||||
@@ -215,8 +215,9 @@ class spell_black_template_harpooners_mark_aura : public AuraScript
|
||||
GetUnitOwner()->GetCreaturesWithEntryInRange(creatureList, 80.0f, NPC_DRAGON_TURTLE);
|
||||
for (std::list<Creature*>::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
|
||||
{
|
||||
(*itr)->TauntApply(GetUnitOwner());
|
||||
(*itr)->AddThreat(GetUnitOwner(), 10000000.0f);
|
||||
if ((*itr)->AI())
|
||||
(*itr)->AI()->AttackStart(GetUnitOwner());
|
||||
_turtleSet.insert((*itr)->GetGUID());
|
||||
}
|
||||
}
|
||||
@@ -226,7 +227,6 @@ class spell_black_template_harpooners_mark_aura : public AuraScript
|
||||
for (ObjectGuid const& guid : _turtleSet)
|
||||
if (Creature* turtle = ObjectAccessor::GetCreature(*GetUnitOwner(), guid))
|
||||
{
|
||||
turtle->TauntFadeOut(GetUnitOwner());
|
||||
turtle->AddThreat(GetUnitOwner(), -10000000.0f);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user