refactor(Core/UnitAI): Update target selector (#13169)

* refactor(Core/UnitAI): Update TargetSelector.

Cherry-pick:
*https://github.com/TrinityCore/TrinityCore/pull/19930

Co-authored-by: Treeston <treeston@users.noreply.github.com>

* fix GGC/CLang errors in scripts

* .

* missing a file and fix a script error

* .

* fix path changes dude to a miss click in the second commit

* .

Co-authored-by: Maelthyrr <lynethris@protonmail.ch>
Co-authored-by: Treeston <treeston@users.noreply.github.com>
This commit is contained in:
Maelthyr
2022-12-06 13:27:13 +01:00
committed by GitHub
parent 9fd5b39065
commit 3024bee3ba
27 changed files with 140 additions and 89 deletions

View File

@@ -95,7 +95,7 @@ public:
}
case EVENT_IGNITE_MANA:
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_IGNITE_MANA))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true, -SPELL_IGNITE_MANA))
{
DoCast(target, SPELL_IGNITE_MANA);
}

View File

@@ -94,10 +94,10 @@ public:
case EVENT_LAVA_BOMB_RANGED:
{
std::list<Unit*> targets;
SelectTargetList(targets, [this](Unit* target)
SelectTargetList(targets, 1, SelectTargetMethod::Random, 1, [this](Unit* target)
{
return target && target->IsPlayer() && target->GetDistance(me) > MELEE_TARGET_LOOKUP_DIST && target->GetDistance(me) < 100.0f;
}, 1, SelectTargetMethod::Random);
});
if (!targets.empty())
{

View File

@@ -71,7 +71,7 @@ public:
}
case EVENT_SHAZZRAH_CURSE:
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_SHAZZRAH_CURSE))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true, -SPELL_SHAZZRAH_CURSE))
{
DoCast(target, SPELL_SHAZZRAH_CURSE);
}

View File

@@ -174,7 +174,7 @@ public:
}
case EVENT_SHADOW_WORD_PAIN:
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_SHADOW_WORD_PAIN))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true, -SPELL_SHADOW_WORD_PAIN))
{
DoCast(target, SPELL_SHADOW_WORD_PAIN);
}
@@ -183,7 +183,7 @@ public:
}
case EVENT_IMMOLATE:
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_IMMOLATE))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true, -SPELL_IMMOLATE))
{
DoCast(target, SPELL_IMMOLATE);
}

View File

@@ -140,7 +140,7 @@ public:
events.ScheduleEvent(EVENT_SPELL_STOMP, 30000);
break;
case EVENT_SPELL_BURN:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, -SPELL_BURN_DAMAGE))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, true, -SPELL_BURN_DAMAGE))
me->CastSpell(target, SPELL_BURN, false);
events.ScheduleEvent(EVENT_SPELL_BURN, 60000);
break;

View File

@@ -215,7 +215,7 @@ public:
break;
case EVENT_MARK_OF_ARLOKK:
{
Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, urand(1, 3), 0.0f, false, -SPELL_MARK_OF_ARLOKK);
Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, urand(1, 3), 0.0f, false, true, -SPELL_MARK_OF_ARLOKK);
if (!target)
target = me->GetVictim();
if (target)