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

@@ -358,7 +358,7 @@ public:
void JustSummoned(Creature* summon) override
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, false))
summon->AI()->AttackStart(target);
//if (IsHeroic())
@@ -468,7 +468,7 @@ public:
switch (action)
{
case ACTION_MARK_OF_THE_FALLEN_CHAMPION:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, true, -SPELL_MARK_OF_THE_FALLEN_CHAMPION))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, false, -SPELL_MARK_OF_THE_FALLEN_CHAMPION))
{
++_fallenChampionCastCount;
me->CastSpell(target, SPELL_MARK_OF_THE_FALLEN_CHAMPION, false);

View File

@@ -857,7 +857,7 @@ public:
events.Repeat(9s, 13s);
break;
case EVENT_SPELL_ADHERENT_CURSE_OF_TORPOR:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, false, false))
me->CastSpell(target, SPELL_CURSE_OF_TORPOR, false);
events.Repeat(9s, 13s);
break;

View File

@@ -482,7 +482,7 @@ class spell_marrowgar_coldflame : public SpellScript
void SelectTarget(std::list<WorldObject*>& targets)
{
targets.clear();
Unit* target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 1, -1.0f, true,true, -SPELL_IMPALED); // -1.0f as it takes into account object size
Unit* target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, -1.0f, true, false, -SPELL_IMPALED); // -1.0f as it takes into account object size
if (!target)
target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true); // if only tank or noone outside of boss' model
if (!target)

View File

@@ -209,7 +209,7 @@ public:
bool operator()(Unit const* target) const
{
if (!me || !target || !target->IsPlayer())
if (!me || !target || !target->IsPlayer() || target == me->GetThreatMgr().GetCurrentVictim())
return false;
if (me->IsWithinCombatRange(target, 7.0f))
@@ -640,7 +640,7 @@ public:
}
else
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, MalleableGooSelector(me)))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, MalleableGooSelector(me)))
{
Talk(EMOTE_MALLEABLE_GOO);
me->CastSpell(target, SPELL_MALLEABLE_GOO, true);

View File

@@ -627,7 +627,7 @@ public:
switch (eventId)
{
case EVENT_DEATH_PLAGUE:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, true, -SPELL_RECENTLY_INFECTED))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, false, -SPELL_RECENTLY_INFECTED))
{
Talk(EMOTE_DEATH_PLAGUE_WARNING, target);
DoCast(target, SPELL_DEATH_PLAGUE);
@@ -1161,7 +1161,7 @@ public:
Talk(SAY_SVALNA_AGGRO);
break;
case EVENT_IMPALING_SPEAR:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, true, -SPELL_IMPALING_SPEAR))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, false, -SPELL_IMPALING_SPEAR))
{
DoCast(me, SPELL_AETHER_SHIELD);
me->AddAura(70203, me);
@@ -1347,7 +1347,7 @@ public:
Events.ScheduleEvent(EVENT_ARNATH_SMITE, 4s, 7s);
break;
case EVENT_ARNATH_DOMINATE_MIND:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, true, -SPELL_DOMINATE_MIND))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, false, -SPELL_DOMINATE_MIND))
DoCast(target, SPELL_DOMINATE_MIND);
Events.ScheduleEvent(EVENT_ARNATH_DOMINATE_MIND, 28s, 37s);
break;
@@ -1425,7 +1425,7 @@ public:
Events.ScheduleEvent(EVENT_BRANDON_JUDGEMENT_OF_COMMAND, 8s, 13s);
break;
case EVENT_BRANDON_HAMMER_OF_BETRAYAL:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, false))
DoCast(target, SPELL_HAMMER_OF_BETRAYAL);
Events.ScheduleEvent(EVENT_BRANDON_HAMMER_OF_BETRAYAL, 45s, 60s);
break;
@@ -1552,12 +1552,12 @@ public:
Events.ScheduleEvent(EVENT_RUPERT_FEL_IRON_BOMB, 15s, 20s);
break;
case EVENT_RUPERT_MACHINE_GUN:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, false, false))
DoCast(target, SPELL_MACHINE_GUN);
Events.ScheduleEvent(EVENT_RUPERT_MACHINE_GUN, 25s, 30s);
break;
case EVENT_RUPERT_ROCKET_LAUNCH:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, false, false))
DoCast(target, SPELL_ROCKET_LAUNCH);
Events.ScheduleEvent(EVENT_RUPERT_ROCKET_LAUNCH, 10s, 15s);
break;