refactor(Core/Combat): implement compatiblity layer for ResetAllThreat() (#11778)
* implement ResetAllThreat() * .
This commit is contained in:
@@ -376,7 +376,7 @@ void ScriptedAI::DoResetThreat()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
}
|
}
|
||||||
|
|
||||||
float ScriptedAI::DoGetThreat(Unit* unit)
|
float ScriptedAI::DoGetThreat(Unit* unit)
|
||||||
|
|||||||
@@ -233,6 +233,9 @@ public:
|
|||||||
// Reset all aggro without modifying the threadlist.
|
// Reset all aggro without modifying the threadlist.
|
||||||
void resetAllAggro();
|
void resetAllAggro();
|
||||||
|
|
||||||
|
// -- compatibility layer for combat rewrite
|
||||||
|
void ResetAllThreat() { resetAllAggro(); }
|
||||||
|
|
||||||
// Reset all aggro of unit in threadlist satisfying the predicate.
|
// Reset all aggro of unit in threadlist satisfying the predicate.
|
||||||
template<class PREDICATE> void resetAggro(PREDICATE predicate)
|
template<class PREDICATE> void resetAggro(PREDICATE predicate)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -597,7 +597,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (Creature* creatureCaster = caster->ToCreature())
|
if (Creature* creatureCaster = caster->ToCreature())
|
||||||
{
|
{
|
||||||
creatureCaster->getThreatMgr().resetAllAggro();
|
creatureCaster->getThreatMgr().ResetAllThreat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ public:
|
|||||||
|
|
||||||
if (Creature* creatureCaster = caster->ToCreature())
|
if (Creature* creatureCaster = caster->ToCreature())
|
||||||
{
|
{
|
||||||
creatureCaster->getThreatMgr().resetAllAggro();
|
creatureCaster->getThreatMgr().ResetAllThreat();
|
||||||
creatureCaster->getThreatMgr().addThreat(target, 1);
|
creatureCaster->getThreatMgr().addThreat(target, 1);
|
||||||
creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to.
|
creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ public:
|
|||||||
void HandleDummy(SpellEffIndex effIndex)
|
void HandleDummy(SpellEffIndex effIndex)
|
||||||
{
|
{
|
||||||
PreventHitDefaultEffect(effIndex);
|
PreventHitDefaultEffect(effIndex);
|
||||||
GetCaster()->getThreatMgr().resetAllAggro();
|
GetCaster()->getThreatMgr().ResetAllThreat();
|
||||||
if (Unit* target = GetHitUnit())
|
if (Unit* target = GetHitUnit())
|
||||||
GetCaster()->CastSpell(target, SPELL_BLINK, true);
|
GetCaster()->CastSpell(target, SPELL_BLINK, true);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -296,7 +296,7 @@ public:
|
|||||||
uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0;
|
uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0;
|
||||||
if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) )
|
if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) )
|
||||||
{
|
{
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
me->AddThreat(target, 10000.0f);
|
me->AddThreat(target, 10000.0f);
|
||||||
AttackStart(target);
|
AttackStart(target);
|
||||||
me->CastSpell(target, SPELL_MINIONS_CHARGE, false);
|
me->CastSpell(target, SPELL_MINIONS_CHARGE, false);
|
||||||
@@ -749,7 +749,7 @@ public:
|
|||||||
uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0;
|
uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0;
|
||||||
if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) )
|
if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) )
|
||||||
{
|
{
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
me->AddThreat(target, 10000.0f);
|
me->AddThreat(target, 10000.0f);
|
||||||
AttackStart(target);
|
AttackStart(target);
|
||||||
me->CastSpell(target, SPELL_MINIONS_CHARGE, false);
|
me->CastSpell(target, SPELL_MINIONS_CHARGE, false);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public:
|
|||||||
if (me->HealthBelowPct(50))
|
if (me->HealthBelowPct(50))
|
||||||
{
|
{
|
||||||
Talk(SAY_FLESH);
|
Talk(SAY_FLESH);
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
me->CastSpell((Unit*)nullptr, SPELL_TURN_FLESH, false);
|
me->CastSpell((Unit*)nullptr, SPELL_TURN_FLESH, false);
|
||||||
|
|
||||||
events.Reset();
|
events.Reset();
|
||||||
@@ -257,7 +257,7 @@ public:
|
|||||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
{
|
{
|
||||||
PreventDefaultAction();
|
PreventDefaultAction();
|
||||||
GetUnitOwner()->getThreatMgr().resetAllAggro();
|
GetUnitOwner()->getThreatMgr().ResetAllThreat();
|
||||||
GetUnitOwner()->GetMotionMaster()->Clear();
|
GetUnitOwner()->GetMotionMaster()->Clear();
|
||||||
GetUnitOwner()->CastSpell((Unit*)nullptr, SPELL_TURN_BONES, false);
|
GetUnitOwner()->CastSpell((Unit*)nullptr, SPELL_TURN_BONES, false);
|
||||||
GetUnitOwner()->GetAI()->DoAction(ACTION_TURN_BONES);
|
GetUnitOwner()->GetAI()->DoAction(ACTION_TURN_BONES);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ public:
|
|||||||
case EVENT_ECK_SPRING:
|
case EVENT_ECK_SPRING:
|
||||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 30.0f, true))
|
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 30.0f, true))
|
||||||
{
|
{
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
me->AddThreat(target, 500.0f);
|
me->AddThreat(target, 500.0f);
|
||||||
me->CastSpell(target, SPELL_ECK_SPRING, false);
|
me->CastSpell(target, SPELL_ECK_SPRING, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -930,7 +930,7 @@ public:
|
|||||||
ScriptedAI::AttackStart(who);
|
ScriptedAI::AttackStart(who);
|
||||||
if (!targetGUID)
|
if (!targetGUID)
|
||||||
{
|
{
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
me->AddThreat(who, 1000000.0f);
|
me->AddThreat(who, 1000000.0f);
|
||||||
targetGUID = who->GetGUID();
|
targetGUID = who->GetGUID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1779,7 +1779,7 @@ public:
|
|||||||
for (ThreatContainer::StorageType::const_iterator iter = target_tl.begin(); iter != target_tl.end(); ++iter)
|
for (ThreatContainer::StorageType::const_iterator iter = target_tl.begin(); iter != target_tl.end(); ++iter)
|
||||||
me->getThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat());
|
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)
|
for (ThreatContainer::StorageType::const_iterator iter = me_tl.begin(); iter != me_tl.end(); ++iter)
|
||||||
c->getThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat());
|
c->getThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1674,7 +1674,7 @@ public:
|
|||||||
if (!target || !caster)
|
if (!target || !caster)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
caster->getThreatMgr().resetAllAggro();
|
caster->getThreatMgr().ResetAllThreat();
|
||||||
caster->GetAI()->AttackStart(target); // Chase target
|
caster->GetAI()->AttackStart(target); // Chase target
|
||||||
caster->AddThreat(target, 10000000.0f);
|
caster->AddThreat(target, 10000000.0f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public:
|
|||||||
heat->ModStackAmount(-1);
|
heat->ModStackAmount(-1);
|
||||||
}
|
}
|
||||||
me->CastSpell(me, SPELL_MOLTEN, true);
|
me->CastSpell(me, SPELL_MOLTEN, true);
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1158,7 +1158,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_playerAttack = true;
|
_playerAttack = true;
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
me->CallForHelp(40.0f);
|
me->CallForHelp(40.0f);
|
||||||
AttackStart(who);
|
AttackStart(who);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ public:
|
|||||||
if (switchTimer >= 10000)
|
if (switchTimer >= 10000)
|
||||||
{
|
{
|
||||||
switchTimer = 0;
|
switchTimer = 0;
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
if (Player* player = SelectTargetFromPlayerList(100.0f))
|
if (Player* player = SelectTargetFromPlayerList(100.0f))
|
||||||
me->AddThreat(player, 100000.0f);
|
me->AddThreat(player, 100000.0f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -619,7 +619,7 @@ public:
|
|||||||
me->SetDisableGravity(false);
|
me->SetDisableGravity(false);
|
||||||
break;
|
break;
|
||||||
case EVENT_START_PHASE_3_LAND:
|
case EVENT_START_PHASE_3_LAND:
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||||
me->SetTarget(me->GetVictim()->GetGUID());
|
me->SetTarget(me->GetVictim()->GetGUID());
|
||||||
AttackStart(me->GetVictim());
|
AttackStart(me->GetVictim());
|
||||||
@@ -632,7 +632,7 @@ public:
|
|||||||
// ///////////////////////////
|
// ///////////////////////////
|
||||||
case EVENT_PHASE_4_START:
|
case EVENT_PHASE_4_START:
|
||||||
me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true);
|
me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true);
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
me->GetMotionMaster()->MoveChase(me->GetVictim(), 35.0f);
|
me->GetMotionMaster()->MoveChase(me->GetVictim(), 35.0f);
|
||||||
events.Reset();
|
events.Reset();
|
||||||
events.ScheduleEvent(EVENT_SPELL_SHADOW_BLAST, 11000);
|
events.ScheduleEvent(EVENT_SPELL_SHADOW_BLAST, 11000);
|
||||||
@@ -655,7 +655,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
case EVENT_REMOVE_DEMON_FORM:
|
case EVENT_REMOVE_DEMON_FORM:
|
||||||
me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true);
|
me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true);
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
events.Reset();
|
events.Reset();
|
||||||
if (summons.HasEntry(NPC_MAIEV_SHADOWSONG))
|
if (summons.HasEntry(NPC_MAIEV_SHADOWSONG))
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -355,7 +355,7 @@ public:
|
|||||||
void HandleScriptEffect(SpellEffIndex effIndex)
|
void HandleScriptEffect(SpellEffIndex effIndex)
|
||||||
{
|
{
|
||||||
PreventHitDefaultEffect(effIndex);
|
PreventHitDefaultEffect(effIndex);
|
||||||
GetCaster()->getThreatMgr().resetAllAggro();
|
GetCaster()->getThreatMgr().ResetAllThreat();
|
||||||
|
|
||||||
if (roll_chance_i(33))
|
if (roll_chance_i(33))
|
||||||
if (Unit* target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true))
|
if (Unit* target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true))
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ struct npc_pet_mage_mirror_image : CasterAI
|
|||||||
|
|
||||||
if (selection)
|
if (selection)
|
||||||
{
|
{
|
||||||
me->getThreatMgr().resetAllAggro();
|
me->getThreatMgr().ResetAllThreat();
|
||||||
me->AddThreat(selection, 1000000.0f);
|
me->AddThreat(selection, 1000000.0f);
|
||||||
|
|
||||||
if (owner->IsInCombat())
|
if (owner->IsInCombat())
|
||||||
|
|||||||
Reference in New Issue
Block a user