refactor(Core/Combat): Code style and improvement of ThreatMgr (#12992)

This commit is contained in:
Maelthyr
2022-09-25 20:20:34 +02:00
committed by GitHub
parent ddcf0e79b6
commit 1f472bddd3
61 changed files with 212 additions and 196 deletions

View File

@@ -325,7 +325,7 @@ public:
return;
// Now lets get archimode threat list
ThreatContainer::StorageType const& t_list = me->GetThreatMgr().getThreatList();
ThreatContainer::StorageType const& t_list = me->GetThreatMgr().GetThreatList();
if (t_list.empty())
return;
@@ -435,7 +435,7 @@ public:
if (victim && me->IsWithinMeleeRange(victim))
return false;
ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList();
ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().GetThreatList();
if (threatlist.empty())
return false;

View File

@@ -423,7 +423,7 @@ class spell_vem_knockback : public SpellScript
{
if (Creature* cCaster = GetCaster()->ToCreature())
{
cCaster->GetThreatMgr().modifyThreatPercent(target, -80);
cCaster->GetThreatMgr().ModifyThreatByPercent(target, -80);
}
}
}

View File

@@ -180,7 +180,7 @@ struct boss_ouro : public BossAI
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_SAND_BLAST && target)
me->GetThreatMgr().modifyThreatPercent(target, 100);
me->GetThreatMgr().ModifyThreatByPercent(target, 100);
}
void Emerge()

View File

@@ -169,8 +169,8 @@ struct boss_sartura : public BossAI
if (Unit* originalTarget = SelectTarget(SelectTargetMethod::Random, 0))
{
_savedTargetGUID = originalTarget->GetGUID();
_savedTargetThreat = me->GetThreatMgr().getThreat(originalTarget);
me->GetThreatMgr().modifyThreatPercent(originalTarget, -100);
_savedTargetThreat = me->GetThreatMgr().GetThreat(originalTarget);
me->GetThreatMgr().ModifyThreatByPercent(originalTarget, -100);
}
aggroReset = true;
events.ScheduleEvent(EVENT_SARTURA_AGGRO_RESET_END, 5000);
@@ -190,7 +190,7 @@ struct boss_sartura : public BossAI
events.CancelEvent(EVENT_SARTURA_AGGRO_RESET);
if (Unit* originalTarget = ObjectAccessor::GetUnit(*me, _savedTargetGUID))
{
me->GetThreatMgr().addThreat(originalTarget, _savedTargetThreat);
me->GetThreatMgr().AddThreat(originalTarget, _savedTargetThreat);
_savedTargetGUID.Clear();
}
aggroReset = false;
@@ -286,8 +286,8 @@ struct npc_sartura_royal_guard : public ScriptedAI
if (Unit* originalTarget = SelectTarget(SelectTargetMethod::Random, 0))
{
_savedTargetGUID = originalTarget->GetGUID();
_savedTargetThreat = me->GetThreatMgr().getThreat(originalTarget);
me->GetThreatMgr().modifyThreatPercent(originalTarget, -100);
_savedTargetThreat = me->GetThreatMgr().GetThreat(originalTarget);
me->GetThreatMgr().ModifyThreatByPercent(originalTarget, -100);
}
aggroReset = true;
events.ScheduleEvent(EVENT_GUARD_AGGRO_RESET_END, 5000);
@@ -307,7 +307,7 @@ struct npc_sartura_royal_guard : public ScriptedAI
events.CancelEvent(EVENT_GUARD_AGGRO_RESET);
if (Unit* originalTarget = ObjectAccessor::GetUnit(*me, _savedTargetGUID))
{
me->GetThreatMgr().addThreat(originalTarget, _savedTargetThreat);
me->GetThreatMgr().AddThreat(originalTarget, _savedTargetThreat);
_savedTargetGUID.Clear();
}
aggroReset = false;

View File

@@ -189,7 +189,7 @@ class spell_arcane_vacuum : public SpellScript
Unit* hitUnit = GetHitUnit();
if (caster && hitUnit && hitUnit->ToPlayer())
{
caster->GetThreatMgr().modifyThreatPercent(hitUnit, -100);
caster->GetThreatMgr().ModifyThreatByPercent(hitUnit, -100);
caster->CastSpell(hitUnit, SPELL_ARCANE_VACUUM_TP, true);
}
}