refactor(Core/Combat): implement compatiblity layer for ResetAllThreat() (#11778)

* implement ResetAllThreat()

* .
This commit is contained in:
Maelthyr
2022-05-17 17:01:25 +02:00
committed by GitHub
parent 758463ffe1
commit 5ede1177c5
17 changed files with 23 additions and 20 deletions

View File

@@ -597,7 +597,7 @@ public:
{
if (Creature* creatureCaster = caster->ToCreature())
{
creatureCaster->getThreatMgr().resetAllAggro();
creatureCaster->getThreatMgr().ResetAllThreat();
}
}
}

View File

@@ -170,7 +170,7 @@ public:
if (Creature* creatureCaster = caster->ToCreature())
{
creatureCaster->getThreatMgr().resetAllAggro();
creatureCaster->getThreatMgr().ResetAllThreat();
creatureCaster->getThreatMgr().addThreat(target, 1);
creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to.
}

View File

@@ -393,7 +393,7 @@ public:
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->getThreatMgr().resetAllAggro();
GetCaster()->getThreatMgr().ResetAllThreat();
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_BLINK, true);
}

View File

@@ -296,7 +296,7 @@ public:
uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0;
if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) )
{
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
me->AddThreat(target, 10000.0f);
AttackStart(target);
me->CastSpell(target, SPELL_MINIONS_CHARGE, false);
@@ -749,7 +749,7 @@ public:
uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0;
if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) )
{
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
me->AddThreat(target, 10000.0f);
AttackStart(target);
me->CastSpell(target, SPELL_MINIONS_CHARGE, false);

View File

@@ -161,7 +161,7 @@ public:
if (me->HealthBelowPct(50))
{
Talk(SAY_FLESH);
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
me->CastSpell((Unit*)nullptr, SPELL_TURN_FLESH, false);
events.Reset();
@@ -257,7 +257,7 @@ public:
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PreventDefaultAction();
GetUnitOwner()->getThreatMgr().resetAllAggro();
GetUnitOwner()->getThreatMgr().ResetAllThreat();
GetUnitOwner()->GetMotionMaster()->Clear();
GetUnitOwner()->CastSpell((Unit*)nullptr, SPELL_TURN_BONES, false);
GetUnitOwner()->GetAI()->DoAction(ACTION_TURN_BONES);

View File

@@ -125,7 +125,7 @@ public:
case EVENT_ECK_SPRING:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 30.0f, true))
{
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
me->AddThreat(target, 500.0f);
me->CastSpell(target, SPELL_ECK_SPRING, false);
}

View File

@@ -930,7 +930,7 @@ public:
ScriptedAI::AttackStart(who);
if (!targetGUID)
{
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
me->AddThreat(who, 1000000.0f);
targetGUID = who->GetGUID();
}

View File

@@ -1779,7 +1779,7 @@ public:
for (ThreatContainer::StorageType::const_iterator iter = target_tl.begin(); iter != target_tl.end(); ++iter)
me->getThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat());
c->getThreatMgr().resetAllAggro();
c->getThreatMgr().ResetAllThreat();
for (ThreatContainer::StorageType::const_iterator iter = me_tl.begin(); iter != me_tl.end(); ++iter)
c->getThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat());
}

View File

@@ -1674,7 +1674,7 @@ public:
if (!target || !caster)
return;
caster->getThreatMgr().resetAllAggro();
caster->getThreatMgr().ResetAllThreat();
caster->GetAI()->AttackStart(target); // Chase target
caster->AddThreat(target, 10000000.0f);
}

View File

@@ -138,7 +138,7 @@ public:
heat->ModStackAmount(-1);
}
me->CastSpell(me, SPELL_MOLTEN, true);
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
}
}
}

View File

@@ -1158,7 +1158,7 @@ public:
}
}
_playerAttack = true;
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
me->CallForHelp(40.0f);
AttackStart(who);
}

View File

@@ -191,7 +191,7 @@ public:
if (switchTimer >= 10000)
{
switchTimer = 0;
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
if (Player* player = SelectTargetFromPlayerList(100.0f))
me->AddThreat(player, 100000.0f);
}

View File

@@ -619,7 +619,7 @@ public:
me->SetDisableGravity(false);
break;
case EVENT_START_PHASE_3_LAND:
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetTarget(me->GetVictim()->GetGUID());
AttackStart(me->GetVictim());
@@ -632,7 +632,7 @@ public:
// ///////////////////////////
case EVENT_PHASE_4_START:
me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true);
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
me->GetMotionMaster()->MoveChase(me->GetVictim(), 35.0f);
events.Reset();
events.ScheduleEvent(EVENT_SPELL_SHADOW_BLAST, 11000);
@@ -655,7 +655,7 @@ public:
break;
case EVENT_REMOVE_DEMON_FORM:
me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true);
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
events.Reset();
if (summons.HasEntry(NPC_MAIEV_SHADOWSONG))
{

View File

@@ -355,7 +355,7 @@ public:
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->getThreatMgr().resetAllAggro();
GetCaster()->getThreatMgr().ResetAllThreat();
if (roll_chance_i(33))
if (Unit* target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true))

View File

@@ -164,7 +164,7 @@ struct npc_pet_mage_mirror_image : CasterAI
if (selection)
{
me->getThreatMgr().resetAllAggro();
me->getThreatMgr().ResetAllThreat();
me->AddThreat(selection, 1000000.0f);
if (owner->IsInCombat())