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

@@ -74,7 +74,7 @@ public:
{
if (urand(0, 1))
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, false))
{
DoCast(target, SPELL_SHADOW_BOLT_RANDOM);
}

View File

@@ -353,7 +353,7 @@ public:
}
case EVENT_TELEPORT_RANDOM:
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, false))
{
DoCastSelf(SPELL_HATE_TO_ZERO, true);
DoCast(target, SPELL_TELEPORT_RANDOM);

View File

@@ -214,7 +214,7 @@ struct boss_netherspite : public BossAI
context.Repeat(90s);
}).Schedule(15s, PORTAL_PHASE, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_VOIDZONE, 1, 45.0f, true, true);
DoCastRandomTarget(SPELL_VOIDZONE, 0, 45.0f, true, true, false);
context.Repeat(15s);
});
}

View File

@@ -127,7 +127,7 @@ struct boss_malchezaar : public BossAI
scheduler.Schedule(20s, 30s, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_AMPLIFY_DAMAGE, 1);
DoCastRandomTarget(SPELL_AMPLIFY_DAMAGE, 0, 0.0f, true, false, false);
context.Repeat();
}).Schedule(20s, [this](TaskContext context)
{

View File

@@ -1210,7 +1210,7 @@ struct boss_romulo : public ScriptedAI
_scheduler.Schedule(15s, GROUP_COMBAT, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true, false))
{
if (target && !me->HasInArc(M_PI, target))
{

View File

@@ -307,7 +307,7 @@ public:
if (victim && (target->GetGUID() == victim->GetGUID()))
{
me->AddThreat(victim, -1000000); // drop current player, add a ton to second. This should guarantee that we don't end up with both 1 and 2 in a cage...
if (Unit* newTarget = SelectTarget(SelectTargetMethod::MaxThreat, 1, 200.0f)) // search in whole room
if (Unit* newTarget = SelectTarget(SelectTargetMethod::MaxThreat, 0, 200.0f, false, false)) // search in whole room
{
me->AddThreat(newTarget, 1000000);
}

View File

@@ -208,7 +208,7 @@ public:
events.ScheduleEvent(EVENT_CURSE_OF_TONGUES, 20s);
break;
case EVENT_DOMINATE_MIND:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 20.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 20.0f, true, false))
{
me->CastSpell(target, SPELL_DOMINATE_MIND, false);
}

View File

@@ -84,7 +84,7 @@ struct boss_akilzon : public BossAI
scheduler.Schedule(10s, 20s, GROUP_STATIC_DISRUPTION, [this](TaskContext context)
{
Unit* target = SelectTarget(SelectTargetMethod::Random, 1);
Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, false, false);
if (!target)
target = me->GetVictim();
if (target)
@@ -99,7 +99,7 @@ struct boss_akilzon : public BossAI
ScheduleTimedEvent(20s, 30s, [&] {
if (scheduler.GetNextGroupOccurrence(GROUP_ELECTRICAL_STORM) > 5s)
DoCastRandomTarget(SPELL_GUST_OF_WIND, 1);
DoCastRandomTarget(SPELL_GUST_OF_WIND, 0, 0.0f, true, false, false);
}, 20s, 30s);
ScheduleTimedEvent(10s, 20s, [&] {

View File

@@ -205,7 +205,7 @@ struct boss_zuljin : public BossAI
if (me->HasAura(SPELL_LYNX_RUSH_HASTE))
return;
DoCastRandomTarget(SPELL_CLAW_RAGE_CHARGE, 1);
DoCastRandomTarget(SPELL_CLAW_RAGE_CHARGE, 0, 0.0f, true, false, true);
}, 15s, 20s);
ScheduleTimedEvent(14s, [&] {

View File

@@ -122,7 +122,7 @@ struct boss_hazzarah : public BossAI
case EVENT_CHAIN_BURN:
if (me->GetPowerPct(POWER_MANA) > 5.f) // totally guessed
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, [&](Unit* u) { return u && !u->IsPet() && u->getPowerType() == POWER_MANA; }))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [&](Unit* u) { return u && !u->IsPet() && u->getPowerType() == POWER_MANA && u != me->GetVictim(); }))
{
DoCast(target, SPELL_CHAIN_BURN);
}

View File

@@ -150,7 +150,7 @@ public:
events.ScheduleEvent(EVENT_VANISH, 38s, 45s);
return;
case EVENT_AMBUSH:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, false, false))
{
me->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation());
DoCast(target, SPELL_AMBUSH, true);

View File

@@ -90,7 +90,7 @@ struct boss_twilight_corrupter : public ScriptedAI
_scheduler
.Schedule(12s, 18s, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_CREATURE_OF_NIGHTMARE, 1, 100.f);
DoCastRandomTarget(SPELL_CREATURE_OF_NIGHTMARE, 0, 100.f, true, false, false);
context.Repeat(35s, 45s);
})
.Schedule(9s, 16s, [this](TaskContext context)