refactor(Core/AI) don't add currentTarget to the front of the SelectTargetList for MaxThreat/Random (#21965)

This commit is contained in:
Tereneckla
2025-05-05 19:17:10 +00:00
committed by GitHub
parent 2772da9bf2
commit a8b982dca8
46 changed files with 71 additions and 77 deletions

View File

@@ -67,7 +67,7 @@ public:
}).Schedule(25s, 32s, [this](TaskContext context)
{
Talk(SAY_SLEEP);
DoCastRandomTarget(SPELL_SLEEP, 1, 0.0f, true, false, false);
DoCastRandomTarget(SPELL_SLEEP, 0, 0.0f, true, false, false);
context.Repeat(35s, 48s);
}).Schedule(30s, 48s, [this](TaskContext context)
{

View File

@@ -81,7 +81,7 @@ struct boss_lieutenant_drake : public BossAI
context.Repeat(25s);
}).Schedule(1s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 40.0f))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, false, false))
{
DoCast(target, SPELL_EXPLODING_SHOT);
}

View File

@@ -57,7 +57,7 @@ struct boss_kurinnaxx : public BossAI
context.Repeat(8s, 10s);
}).Schedule(5s, 15s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.f, true, false))
{
target->CastSpell(target, SPELL_SAND_TRAP, true, nullptr, nullptr, me->GetGUID());
}

View File

@@ -50,16 +50,10 @@ struct npc_hivezara_stinger : public ScriptedAI
scheduler.Schedule(5s, [this](TaskContext context)
{
Unit* target = SelectTarget(SelectTargetMethod::Random, 1, [&](Unit* u)
{
return u && !u->IsPet() && u->IsWithinDist2d(me, 20.f) && u->HasAura(SPELL_HIVEZARA_CATALYST);
});
Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 20.0f, true, false, SPELL_HIVEZARA_CATALYST);
if (!target)
{
target = SelectTarget(SelectTargetMethod::Random, 1, [&](Unit* u)
{
return u && !u->IsPet() && u->IsWithinDist2d(me, 20.f);
});
target = SelectTarget(SelectTargetMethod::Random, 0, 20.0f, true, false);
}
if (target)

View File

@@ -98,7 +98,7 @@ struct boss_fankriss : public BossAI
})
.Schedule(15s, 20s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, false))
{
uint32 spellId = Acore::Containers::SelectRandomContainerElement(entangleSpells);
DoCast(target, spellId);

View File

@@ -115,7 +115,7 @@ struct boss_sartura : public BossAI
switch (eventId)
{
case EVENT_SARTURA_WHIRLWIND:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, false))
{
me->GetThreatMgr().ResetAllThreat();
me->AddThreat(target, 1000.0f);
@@ -199,7 +199,7 @@ struct npc_sartura_royal_guard : public ScriptedAI
switch (eventid)
{
case EVENT_GUARD_WHIRLWIND:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, false))
{
me->GetThreatMgr().ResetAllThreat();
me->AddThreat(target, 1000.0f);

View File

@@ -98,7 +98,7 @@ struct npc_anubisath_defender : public ScriptedAI
{
scheduler.Schedule(6s, 10s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 1))
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 0.0f, false, false))
DoCast(target, SPELL_PLAGUE, true);
context.Repeat(6s, 10s);
});