feat(Core/AI): convert SelectAggroTarget to enum class (#9893)
This commit is contained in:
+3
-3
@@ -83,14 +83,14 @@ public:
|
||||
events.ScheduleEvent(SPELL_SHADOWBOLT, urand(TIMER_SHADOWBOLT - 2000, TIMER_SHADOWBOLT + 2000));
|
||||
break;
|
||||
case SPELL_CURSE_TONGUES:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
|
||||
{
|
||||
DoCast(target, SPELL_CURSE_TONGUES);
|
||||
}
|
||||
events.ScheduleEvent(SPELL_CURSE_TONGUES, urand(TIMER_CURSE_TONGUES - 2000, TIMER_CURSE_TONGUES + 2000));
|
||||
break;
|
||||
case SPELL_CURSE_WEAKNESS:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
|
||||
{
|
||||
DoCast(target, SPELL_CURSE_WEAKNESS);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
events.ScheduleEvent(SPELL_DEMON_ARMOR, TIMER_DEMON_ARMOR);
|
||||
break;
|
||||
case SPELL_ENVELOPING_WEB:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
|
||||
DoCast(target, SPELL_ENVELOPING_WEB);
|
||||
events.ScheduleEvent(SPELL_ENVELOPING_WEB, urand(TIMER_ENVELOPING_WEB - 2000, TIMER_ENVELOPING_WEB + 2000));
|
||||
break;
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ public:
|
||||
switch (eventId)
|
||||
{
|
||||
case SPELL_HANDOFTHAURISSAN:
|
||||
DoCast(SelectTarget(SELECT_TARGET_RANDOM), SPELL_HANDOFTHAURISSAN);
|
||||
DoCast(SelectTarget(SelectTargetMethod::Random), SPELL_HANDOFTHAURISSAN);
|
||||
//DoCastVictim(SPELL_HANDOFTHAURISSAN);
|
||||
events.ScheduleEvent(SPELL_HANDOFTHAURISSAN, urand(4000, 7000));
|
||||
break;
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ public:
|
||||
//ShadowWordPain_Timer
|
||||
if (ShadowWordPain_Timer <= diff)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
|
||||
DoCast(target, SPELL_SHADOWWORDPAIN);
|
||||
ShadowWordPain_Timer = 7000;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
//ManaBurn_Timer
|
||||
if (ManaBurn_Timer <= diff)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
|
||||
DoCast(target, SPELL_MANABURN);
|
||||
ManaBurn_Timer = 10000;
|
||||
}
|
||||
|
||||
+2
-2
@@ -78,7 +78,7 @@ public:
|
||||
switch (eventId)
|
||||
{
|
||||
case SPELL_ARCANE_BOLT:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
|
||||
{
|
||||
DoCast(target, SPELL_ARCANE_BOLT);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
events.ScheduleEvent(SPELL_ARCANE_EXPLOSION, nextArcaneExplosionTime);
|
||||
break;
|
||||
case SPELL_POLYMORPH:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
|
||||
{
|
||||
DoCast(target, SPELL_POLYMORPH);
|
||||
}
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ public:
|
||||
_events.ScheduleEvent(EVENT_SPELL_SHADOWBOLTVOLLEY, 12000);
|
||||
break;
|
||||
case EVENT_SPELL_IMMOLATE:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
|
||||
{
|
||||
DoCast(target, SPELL_IMMOLATE);
|
||||
_events.ScheduleEvent(EVENT_SPELL_IMMOLATE, 25000);
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ struct boss_mor_grayhoof : public BossAI
|
||||
spell = Acore::Containers::SelectRandomContainerElement(faerieSpells);
|
||||
if (spell == SPELL_SLEEP)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.f, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.f, true))
|
||||
{
|
||||
me->CastSpell(target, SPELL_SLEEP);
|
||||
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ public:
|
||||
if (!Summoned && HealthBelowPct(51))
|
||||
{
|
||||
Talk(CALL_HELP);
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
|
||||
{
|
||||
if (Creature* warlord = me->SummonCreature(NPC_SPIRESTONE_WARLORD, SummonLocation1, TEMPSUMMON_TIMED_DESPAWN, 300 * IN_MILLISECONDS))
|
||||
warlord->AI()->AttackStart(target);
|
||||
|
||||
+1
-1
@@ -427,7 +427,7 @@ public:
|
||||
_events.ScheduleEvent(EVENT_STRIKE, urand(14000, 23000));
|
||||
break;
|
||||
case EVENT_ENCAGE:
|
||||
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), EVENT_ENCAGE, true);
|
||||
DoCast(SelectTarget(SelectTargetMethod::Random, 0, 100, true), EVENT_ENCAGE, true);
|
||||
_events.ScheduleEvent(EVENT_ENCAGE, urand(6000, 12000));
|
||||
break;
|
||||
default:
|
||||
|
||||
+1
-1
@@ -217,7 +217,7 @@ public:
|
||||
events.ScheduleEvent(EVENT_TERRIFYING_ROAR, 20 * IN_MILLISECONDS);
|
||||
break;
|
||||
case EVENT_BERSERKER_CHARGE:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 38.f, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 38.f, true))
|
||||
{
|
||||
DoCast(target, SPELL_BERSERKER_CHARGE);
|
||||
}
|
||||
|
||||
+4
-4
@@ -318,7 +318,7 @@ public:
|
||||
DoCastVictim(SPELL_SHADOWBOLT_VOLLEY);
|
||||
break;
|
||||
case 1:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40, true))
|
||||
DoCast(target, SPELL_SHADOWBOLT);
|
||||
break;
|
||||
}
|
||||
@@ -326,12 +326,12 @@ public:
|
||||
events.ScheduleEvent(EVENT_SHADOW_BOLT, urand(3000, 10000));
|
||||
break;
|
||||
case EVENT_FEAR:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40, true))
|
||||
DoCast(target, SPELL_FEAR);
|
||||
events.ScheduleEvent(EVENT_FEAR, urand(10000, 20000));
|
||||
break;
|
||||
case EVENT_MIND_CONTROL:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40, true))
|
||||
DoCast(target, SPELL_SHADOW_COMMAND);
|
||||
events.ScheduleEvent(EVENT_MIND_CONTROL, urand(30000, 35000));
|
||||
break;
|
||||
@@ -521,7 +521,7 @@ public:
|
||||
events.ScheduleEvent(EVENT_TAILLASH, 10000);
|
||||
break;
|
||||
case EVENT_CLASSCALL:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
|
||||
switch (target->getClass())
|
||||
{
|
||||
case CLASS_MAGE:
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ public:
|
||||
case EVENT_CONFLAGRATION:
|
||||
DoCastVictim(SPELL_CONFLAGRATION);
|
||||
if (me->GetVictim() && me->GetVictim()->HasAura(SPELL_CONFLAGRATION))
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100, true))
|
||||
me->TauntApply(target);
|
||||
events.ScheduleEvent(EVENT_CONFLAGRATION, 30000);
|
||||
break;
|
||||
|
||||
+1
-1
@@ -222,7 +222,7 @@ public:
|
||||
{
|
||||
//selects a random target that isn't the current victim and is a mana user (selects mana users) but not pets
|
||||
//it also ignores targets who have the aura. We don't want to place the debuff on the same target twice.
|
||||
if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 1, [&](Unit* u) { return u && !u->IsPet() && u->getPowerType() == POWER_MANA && !u->HasAura(SPELL_BURNINGADRENALINE); }))
|
||||
if (Unit *target = SelectTarget(SelectTargetMethod::Random, 1, [&](Unit* u) { return u && !u->IsPet() && u->getPowerType() == POWER_MANA && !u->HasAura(SPELL_BURNINGADRENALINE); }))
|
||||
{
|
||||
me->CastSpell(target, SPELL_BURNINGADRENALINE, true);
|
||||
}
|
||||
|
||||
+2
-2
@@ -95,7 +95,7 @@ public:
|
||||
}
|
||||
case EVENT_IGNITE_MANA:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_IGNITE_MANA))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_IGNITE_MANA))
|
||||
{
|
||||
DoCast(target, SPELL_IGNITE_MANA);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
}
|
||||
case EVENT_LIVING_BOMB:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
|
||||
{
|
||||
DoCast(target, SPELL_LIVING_BOMB);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
}
|
||||
case EVENT_RAIN_OF_FIRE:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
|
||||
{
|
||||
DoCast(target, SPELL_RAIN_OF_FIRE, true);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
{
|
||||
if (urand(0, 1))
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
|
||||
{
|
||||
DoCast(target, SPELL_SHADOW_BOLT_RANDOM);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
}
|
||||
case EVENT_LAVA_BOMB:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, MELEE_TARGET_LOOKUP_DIST, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, MELEE_TARGET_LOOKUP_DIST, true))
|
||||
{
|
||||
DoCast(target, SPELL_LAVA_BOMB);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
SelectTargetList(targets, [this](Unit* target)
|
||||
{
|
||||
return target && target->IsPlayer() && target->GetDistance(me) > MELEE_TARGET_LOOKUP_DIST && target->GetDistance(me) < 100.0f;
|
||||
}, 1, SELECT_TARGET_RANDOM);
|
||||
}, 1, SelectTargetMethod::Random);
|
||||
|
||||
if (!targets.empty())
|
||||
{
|
||||
|
||||
+1
-1
@@ -322,7 +322,7 @@ public:
|
||||
}
|
||||
case EVENT_TELEPORT_RANDOM:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
|
||||
{
|
||||
DoCastSelf(SPELL_HATE_TO_ZERO, true);
|
||||
DoCast(target, SPELL_TELEPORT_RANDOM);
|
||||
|
||||
@@ -344,7 +344,7 @@ public:
|
||||
|
||||
if (!IsVictimWithinMeleeRange())
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, [&](Unit* u) { return u && u->IsPlayer() && me->IsWithinMeleeRange(u); }))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, [&](Unit* u) { return u && u->IsPlayer() && me->IsWithinMeleeRange(u); }))
|
||||
{
|
||||
me->AttackerStateUpdate(target);
|
||||
me->SetTarget(target->GetGUID());
|
||||
@@ -380,7 +380,7 @@ public:
|
||||
}
|
||||
case EVENT_MIGHT_OF_RAGNAROS:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, [](Unit const* target)
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [](Unit const* target)
|
||||
{
|
||||
return target->IsPlayer() && target->getPowerType() == POWER_MANA;
|
||||
}))
|
||||
@@ -460,7 +460,7 @@ public:
|
||||
|
||||
me->RemoveAurasDueToSpell(SPELL_RAGNA_SUBMERGE_VISUAL);
|
||||
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
|
||||
{
|
||||
AttackStart(target);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
}
|
||||
case EVENT_SHAZZRAH_CURSE:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_SHAZZRAH_CURSE))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_SHAZZRAH_CURSE))
|
||||
{
|
||||
DoCast(target, SPELL_SHAZZRAH_CURSE);
|
||||
}
|
||||
|
||||
+2
-2
@@ -174,7 +174,7 @@ public:
|
||||
}
|
||||
case EVENT_SHADOW_WORD_PAIN:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_SHADOW_WORD_PAIN))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_SHADOW_WORD_PAIN))
|
||||
{
|
||||
DoCast(target, SPELL_SHADOW_WORD_PAIN);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
}
|
||||
case EVENT_IMMOLATE:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_IMMOLATE))
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_IMMOLATE))
|
||||
{
|
||||
DoCast(target, SPELL_IMMOLATE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user