refactor(Core/Combat): DeleteThreatLists() become ClearAllThreat() (#11824)

refactor(Chore/Combat): DeleteThreatLists() become ClearAllThreat()
This commit is contained in:
Maelthyr
2022-05-23 10:51:52 +02:00
committed by GitHub
parent ae3ecb0f1a
commit dfc6adb081
40 changed files with 62 additions and 63 deletions

View File

@@ -550,7 +550,7 @@ public:
me->SetReactState(REACT_PASSIVE);
me->RemoveAllAuras();
AddCreatureAddonAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->Clear();
me->StopMoving();
@@ -580,7 +580,7 @@ public:
me->SetReactState(REACT_PASSIVE);
me->RemoveAllAuras();
AddCreatureAddonAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->Clear();
me->SetRegeneratingHealth(false);

View File

@@ -133,7 +133,7 @@ public:
{
t->RemoveAura(SPELL_CHANGE_VEHICLE);
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->SetHealth(me->GetMaxHealth());
if( pInstance )

View File

@@ -523,7 +523,7 @@ public:
if (TeamIdInInstance == TEAM_ALLIANCE)
c->UpdateEntry(NPC_JAINA_PART2);
}
c->DeleteThreatList();
c->GetThreatMgr().ClearAllThreat();
c->CombatStop(true);
c->InterruptNonMeleeSpells(true);
c->GetMotionMaster()->Clear();
@@ -540,7 +540,7 @@ public:
}
if (Creature* c = instance->GetCreature(NPC_LichKingGUID))
{
c->DeleteThreatList();
c->GetThreatMgr().ClearAllThreat();
c->CombatStop(true);
c->InterruptNonMeleeSpells(true);
c->GetMotionMaster()->Clear();
@@ -915,7 +915,7 @@ public:
if (TrashActive[i])
if (Creature* c = instance->GetCreature(NPC_TrashGUID[i]))
{
c->DeleteThreatList();
c->GetThreatMgr().ClearAllThreat();
c->CombatStop(true);
c->InterruptNonMeleeSpells(true);
c->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
@@ -1126,7 +1126,7 @@ public:
if (Creature* c = instance->GetCreature(NPC_LichKingGUID))
{
c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
c->DeleteThreatList();
c->GetThreatMgr().ClearAllThreat();
c->CombatStop(true);
c->InterruptNonMeleeSpells(true);
c->SetVisible(false);

View File

@@ -1123,7 +1123,7 @@ public:
return;
me->RemoveEvadeAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->LoadCreaturesAddon(true);
me->SetLootRecipient(nullptr);

View File

@@ -1202,7 +1202,7 @@ public:
if (!attacker || attacker == me || attacker == me->GetVictim() || (det != DIRECT_DAMAGE && det != SPELL_DIRECT_DAMAGE))
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->AddThreat(attacker, 500000000.0f);
}

View File

@@ -784,7 +784,7 @@ public:
{
if (!me->IsAlive())
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->MoveTargetedHome();
Reset();
@@ -1120,7 +1120,7 @@ public:
{
if (!me->IsAlive())
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->MoveTargetedHome();
Reset();
@@ -1496,7 +1496,7 @@ struct gunship_npc_AI : public ScriptedAI
{
if (!me->IsAlive() || !me->IsInCombat())
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->MoveTargetedHome();
Reset();
@@ -1557,7 +1557,7 @@ struct npc_gunship_boarding_addAI : public ScriptedAI
{
if (!me->IsAlive() || !me->IsInCombat())
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->MoveTargetedHome();
Reset();

View File

@@ -515,7 +515,7 @@ public:
{
darnavan->RemoveAllAuras();
darnavan->SetFaction(FACTION_FRIENDLY);
darnavan->DeleteThreatList();
darnavan->GetThreatMgr().ClearAllThreat();
darnavan->CombatStop(true);
darnavan->GetMotionMaster()->MoveIdle();
darnavan->StopMoving();

View File

@@ -1139,7 +1139,7 @@ public:
void StartAttack()
{
GetCaster()->ClearUnitState(UNIT_STATE_CASTING);
GetCaster()->DeleteThreatList();
GetCaster()->GetThreatMgr().ClearAllThreat();
GetCaster()->ToCreature()->SetInCombatWithZone();
GetCaster()->ToCreature()->AI()->AttackStart(GetHitUnit());
GetCaster()->AddThreat(GetHitUnit(), 500000000.0f); // value seen in sniff

View File

@@ -1647,7 +1647,7 @@ public:
return;
}
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(false);
}
@@ -3370,7 +3370,7 @@ public:
if (!me->IsAlive())
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(false);
}
};

View File

@@ -766,7 +766,7 @@ public:
_handledWP4 = false;
me->CombatStop();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
}
}

View File

@@ -710,7 +710,7 @@ public:
me->SendMeleeAttackStop(me->GetVictim());
me->GetMotionMaster()->MoveTakeoff(MI_POINT_PH_3_FIGHT_POSITION, CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ() - 5.0f, me->GetSpeed(MOVE_RUN));
me->DeleteThreatList(); // players on vehicle are unattackable -> leads to EnterEvadeMode() because target is not acceptable!
me->GetThreatMgr().ClearAllThreat(); // players on vehicle are unattackable -> leads to EnterEvadeMode() because target is not acceptable!
// mount players:
Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();

View File

@@ -239,7 +239,7 @@ public:
if (!_allowDeath)
{
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
damage = 0;

View File

@@ -208,7 +208,7 @@ public:
void LeaveCombat()
{
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->LoadCreaturesAddon(true);
me->SetLootRecipient(nullptr);

View File

@@ -258,7 +258,7 @@ public:
if (param == ACTION_CALLBACK)
{
me->SetSpeed(MOVE_RUN, 2.5f);
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->MoveTargetedHome();
returning = true;

View File

@@ -384,7 +384,7 @@ struct violet_hold_trashAI : public npc_escortAI
me->SetHomePosition(1845.577759f + rand_norm() * 5 - 2.5f, 800.681152f + rand_norm() * 5 - 2.5f, 44.104248f, M_PI);
}
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
if (HasEscortState(STATE_ESCORT_ESCORTING))
{

View File

@@ -74,7 +74,7 @@ public:
Creature* owner = GetOwner()->ToCreature();
owner->RemoveAllAurasExceptType(SPELL_AURA_DUMMY);
owner->CombatStop(true);
owner->DeleteThreatList();
owner->GetThreatMgr().ClearAllThreat();
owner->GetMotionMaster()->Clear(false);
owner->GetMotionMaster()->MoveFollow(GetCaster(), 4.0f, M_PI, MOTION_SLOT_ACTIVE);
owner->CastSpell(owner, SPELL_SUBDUED, true);