fix(Scripts/SunwellPlateau): Dark Fiends should use threat table and not deal melee damage (#21991)
This commit is contained in:
@@ -209,7 +209,54 @@ struct npc_dark_fiend : public ScriptedAI
|
|||||||
|
|
||||||
me->m_Events.AddEventAtOffset([this]() {
|
me->m_Events.AddEventAtOffset([this]() {
|
||||||
me->SetReactState(REACT_AGGRESSIVE);
|
me->SetReactState(REACT_AGGRESSIVE);
|
||||||
if (Unit* target = SelectTargetFromPlayerList(200.0f, 0, true))
|
Unit* target = nullptr;
|
||||||
|
if (InstanceScript* instance = me->GetInstanceScript())
|
||||||
|
{
|
||||||
|
if (Creature* muru = instance->GetCreature(DATA_MURU))
|
||||||
|
{
|
||||||
|
if (muru->IsAlive() && !muru->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
|
||||||
|
{
|
||||||
|
std::list<HostileReference*> const& threatList = muru->GetThreatMgr().GetThreatList();
|
||||||
|
std::vector<Unit*> validTargets;
|
||||||
|
|
||||||
|
for (HostileReference* ref : threatList)
|
||||||
|
{
|
||||||
|
if (Unit* unit = ObjectAccessor::GetUnit(*muru, ref->getUnitGuid()))
|
||||||
|
{
|
||||||
|
if (unit->IsPlayer() && unit->IsAlive() && unit->IsWithinDist(me, 50.0f))
|
||||||
|
validTargets.push_back(unit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!validTargets.empty())
|
||||||
|
target = validTargets[urand(0, validTargets.size() - 1)];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Creature* entropius = me->FindNearestCreature(NPC_ENTROPIUS, 100.0f))
|
||||||
|
{
|
||||||
|
std::list<HostileReference*> const& threatList = entropius->GetThreatMgr().GetThreatList();
|
||||||
|
std::vector<Unit*> validTargets;
|
||||||
|
|
||||||
|
for (HostileReference* ref : threatList)
|
||||||
|
{
|
||||||
|
if (Unit* unit = ObjectAccessor::GetUnit(*entropius, ref->getUnitGuid()))
|
||||||
|
{
|
||||||
|
if (unit->IsPlayer() && unit->IsAlive() && unit->IsWithinDist(me, 50.0f))
|
||||||
|
{
|
||||||
|
validTargets.push_back(unit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!validTargets.empty())
|
||||||
|
target = validTargets[urand(0, validTargets.size() - 1)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target)
|
||||||
{
|
{
|
||||||
AttackStart(target);
|
AttackStart(target);
|
||||||
me->AddThreat(target, 100000.0f);
|
me->AddThreat(target, 100000.0f);
|
||||||
@@ -255,8 +302,6 @@ struct npc_dark_fiend : public ScriptedAI
|
|||||||
me->DespawnOrUnsummon();
|
me->DespawnOrUnsummon();
|
||||||
}, 1s);
|
}, 1s);
|
||||||
}
|
}
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user