mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
refactor(Core/ScriptedAI): few improvements with threat methods (#13146)
improve threat scripts Co-authored-by: Maelthyrr <lynethris@protonmail.ch>
This commit is contained in:
@@ -384,11 +384,35 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
|
||||
return apSpell[urand(0, spellCount - 1)];
|
||||
}
|
||||
|
||||
void ScriptedAI::DoResetThreat()
|
||||
void ScriptedAI::DoAddThreat(Unit* unit, float amount)
|
||||
{
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
me->GetThreatMgr().AddThreat(unit, amount);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoModifyThreatByPercent(Unit* unit, int32 pct)
|
||||
{
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
me->GetThreatMgr().ModifyThreatByPercent(unit, pct);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoResetThreat(Unit* unit)
|
||||
{
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
me->GetThreatMgr().ResetThreat(unit);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoResetThreatList()
|
||||
{
|
||||
if (!me->CanHaveThreatList() || me->GetThreatMgr().isThreatListEmpty())
|
||||
{
|
||||
LOG_ERROR("entities.unit.ai", "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = {})", me->GetEntry());
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -399,14 +423,8 @@ float ScriptedAI::DoGetThreat(Unit* unit)
|
||||
{
|
||||
if (!unit)
|
||||
return 0.0f;
|
||||
return me->GetThreatMgr().GetThreat(unit);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoModifyThreatPercent(Unit* unit, int32 pct)
|
||||
{
|
||||
if (!unit)
|
||||
return;
|
||||
me->GetThreatMgr().ModifyThreatByPercent(unit, pct);
|
||||
return me->GetThreatMgr().GetThreat(unit);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o)
|
||||
|
||||
Reference in New Issue
Block a user