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

View File

@@ -184,7 +184,7 @@ class spell_pet_guard_dog : public AuraScript
return;
float addThreat = CalculatePct(static_cast<float>(procSpellInfo->Effects[EFFECT_0].CalcValue(caster)), aurEff->GetAmount());
target->GetThreatMgr().AddThreat(caster, addThreat, SPELL_SCHOOL_MASK_NORMAL, GetSpellInfo());
target->GetThreatMgr().AddThreat(caster, addThreat, GetSpellInfo());
}
void Register() override

View File

@@ -106,12 +106,10 @@ struct npc_pet_mage_mirror_image : CasterAI
// Xinef: Inherit Master's Threat List (not yet implemented)
//owner->CastSpell((Unit*)nullptr, SPELL_MAGE_MASTERS_THREAT_LIST, true);
HostileReference* ref = owner->getHostileRefMgr().getFirst();
while (ref)
for (auto const& pair : owner->GetThreatMgr().GetThreatenedByMeList())
{
if (Unit* unit = ref->GetSource()->GetOwner())
unit->AddThreat(me, ref->GetThreat() - ref->getTempThreatModifier());
ref = ref->next();
if (Unit* unit = pair.second->GetOwner())
unit->GetThreatMgr().AddThreat(me, pair.second->GetThreat());
}
_ebonGargoyleGUID.Clear();