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

@@ -124,7 +124,7 @@ struct boss_anzu : public BossAI
scheduler.DelayAll(3s);
}).Schedule(8s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 45.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 9, 45.0f, true, false))
{
DoCast(target, SPELL_CYCLONE);
}

View File

@@ -103,9 +103,9 @@ struct boss_talon_king_ikiss : public BossAI
}).Schedule(8s, [this](TaskContext context)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_POLYMORPH);
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, [&](Unit* target) -> bool
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [&](Unit* target) -> bool
{
return target && !target->IsImmunedToSpell(spellInfo);
return target && !target->IsImmunedToSpell(spellInfo) && target != me->GetThreatMgr().GetCurrentVictim();
}))
{
DoCast(target, SPELL_POLYMORPH);

View File

@@ -99,7 +99,7 @@ struct boss_gurtogg_bloodboil : public BossAI
}, 15s);
ScheduleTimedEvent(1min, [&] {
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 40.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true, false))
{
me->RemoveAurasByType(SPELL_AURA_MOD_TAUNT);
me->RemoveAurasDueToSpell(SPELL_ACIDIC_WOUND);

View File

@@ -65,9 +65,11 @@ enum Misc
struct ShadowOfDeathSelector
{
Unit const* _tank;
ShadowOfDeathSelector(Unit const* tank) : _tank(tank) {}
bool operator()(Unit const* target) const
{
return target && !target->HasAura(SPELL_SHADOW_OF_DEATH) && !target->HasAura(SPELL_POSSESS_SPIRIT_IMMUNE);
return target && !target->HasAura(SPELL_SHADOW_OF_DEATH) && !target->HasAura(SPELL_POSSESS_SPIRIT_IMMUNE) && target != _tank;
}
};
@@ -113,7 +115,7 @@ struct boss_teron_gorefiend : public BossAI
ScheduleTimedEvent(10s, [&]
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, ShadowOfDeathSelector()))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, ShadowOfDeathSelector(me->GetThreatMgr().GetCurrentVictim())))
me->CastSpell(target, SPELL_SHADOW_OF_DEATH, false);
}, 30s, 50s);

View File

@@ -91,7 +91,7 @@ struct boss_najentus : public BossAI
ScheduleTimedEvent(21s, [&]
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, false, false))
{
DoCast(target, SPELL_IMPALING_SPINE);
target->CastSpell(target, SPELL_SUMMON_IMPALING_SPINE, true);

View File

@@ -73,7 +73,7 @@ struct boss_mekgineer_steamrigger : public BossAI
context.Repeat(35100ms, 54100ms);
}).Schedule(6050ms, 17650ms, [this](TaskContext context)
{
if (DoCastRandomTarget(SPELL_SAW_BLADE, 1) != SPELL_CAST_OK)
if (DoCastRandomTarget(SPELL_SAW_BLADE, 0, 0.0f, true, false, false) != SPELL_CAST_OK)
{
DoCastVictim(SPELL_SAW_BLADE);
}

View File

@@ -100,7 +100,7 @@ struct boss_the_black_stalker : public BossAI
void JustSummoned(Creature* summon) override
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, false, false))
summon->AI()->AttackStart(target);
else if (me->GetVictim())
summon->AI()->AttackStart(me->GetVictim());

View File

@@ -95,7 +95,7 @@ struct boss_gruul : public BossAI
context.Repeat(39900ms, 55700ms);
}).Schedule(5600ms, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 1, 5.0f))
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 5.0f, false, false))
{
DoCast(target, SPELL_HURTFUL_STRIKE);
}

View File

@@ -169,7 +169,7 @@ struct boss_warbringer_omrogg : public BossAI
context.Schedule(200ms, GROUP_NON_BURNING_PHASE, [this](TaskContext context)
{
DoResetThreatList();
if (Unit* newTarget = SelectTarget(SelectTargetMethod::Random, 1))
if (Unit* newTarget = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, false, false))
me->AddThreat(newTarget, 2250.f);
HandleHeadTalk(SAY_ON_BEATDOWN);
context.Schedule(1200ms, GROUP_NON_BURNING_PHASE, [this](TaskContext /*context*/)
@@ -199,7 +199,7 @@ struct boss_warbringer_omrogg : public BossAI
context.Schedule(2200ms, [this](TaskContext context)
{
DoResetThreatList();
if (Unit* newTarget = SelectTarget(SelectTargetMethod::Random, 1))
if (Unit* newTarget = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, false, false))
me->AddThreat(newTarget, 2250.f);
me->SetReactState(REACT_AGGRESSIVE);
context.Schedule(4850ms, 8500ms, GROUP_BURNING_PHASE, [this](TaskContext context)

View File

@@ -115,7 +115,7 @@ struct boss_pathaleon_the_calculator : public BossAI
context.Repeat(15s);
}).Schedule(10s, 15s, [this](TaskContext context)
{
if (DoCastRandomTarget(SPELL_DOMINATION, 1, 50.0f) == SPELL_CAST_OK)
if (DoCastRandomTarget(SPELL_DOMINATION, 0, 50.0f, true, false, false) == SPELL_CAST_OK)
{
Talk(SAY_DOMINATION);
}

View File

@@ -92,7 +92,7 @@ struct boss_harbinger_skyriss : public BossAI
context.Repeat(25s);
}).Schedule(30s, [this](TaskContext context)
{
if (DoCastRandomTarget(SPELL_DOMINATION, 1, 30.0f) == SPELL_CAST_OK)
if (DoCastRandomTarget(SPELL_DOMINATION, 0, 30.0f, true, false, false) == SPELL_CAST_OK)
{
Talk(SAY_MIND);
}

View File

@@ -75,7 +75,7 @@ struct boss_thorngrin_the_tender : public BossAI
scheduler.Schedule(6s, [this](TaskContext context)
{
if (DoCastRandomTarget(SPELL_SACRIFICE, 1) == SPELL_CAST_OK)
if (DoCastRandomTarget(SPELL_SACRIFICE, 0, 0.0f, true, false, false) == SPELL_CAST_OK)
{
Talk(SAY_CAST_SACRIFICE);
}

View File

@@ -80,7 +80,7 @@ struct boss_doomwalker : public ScriptedAI
context.Repeat(10s, 25s);
}).Schedule(10s, 30s, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_CHAIN_LIGHTNING, 1);
DoCastRandomTarget(SPELL_CHAIN_LIGHTNING, 0, 0.0f, true, false, false);
context.Repeat(7s, 27s);
}).Schedule(25s, 35s, [this](TaskContext context)
{