feat(Core/AI): convert SelectAggroTarget to enum class (#9893)

This commit is contained in:
Kargatum
2021-12-29 05:13:12 +07:00
committed by GitHub
parent e928d8b67e
commit c81891fc11
236 changed files with 622 additions and 598 deletions

View File

@@ -130,7 +130,7 @@ public:
me->CastSpell(me, SPELL_ASTRAL_DECONSTRUCTION, true);
break;
case EVENT_SPELL_HATEFUL_BOLT:
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, urand(1, 2), 40.0f))
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, urand(1, 2), 40.0f))
me->CastSpell(target, SPELL_HATEFUL_BOLT, false);
events.ScheduleEvent(EVENT_SPELL_HATEFUL_BOLT, urand(5000, 7500) * (events.GetNextEventTime(EVENT_SPELL_BERSERK) == 0 ? 1 : 2));
break;

View File

@@ -97,12 +97,12 @@ public:
events.ScheduleEvent(EVENT_SPELL_REPENTANCE, urand(25000, 35000));
break;
case EVENT_SPELL_HOLY_FIRE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
me->CastSpell(target, SPELL_HOLY_FIRE, true);
events.ScheduleEvent(EVENT_SPELL_HOLY_FIRE, urand(8000, 18000));
break;
case EVENT_SPELL_HOLY_WRATH:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
me->CastSpell(target, SPELL_HOLY_WRATH, true);
events.ScheduleEvent(EVENT_SPELL_HOLY_WRATH, urand(20000, 25000));
break;

View File

@@ -398,7 +398,7 @@ public:
_events.ScheduleEvent(EVENT_RANDOM_YELL, urand(30000, 70000));
break;
case EVENT_SPELL_CHARGE:
if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 24.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::MinDistance, 0, 24.0f, true))
me->CastSpell(target, SPELL_CHARGE_MIDNIGHT, false);
_events.ScheduleEvent(EVENT_SPELL_CHARGE, 20000);
break;

View File

@@ -218,7 +218,7 @@ public:
me->CastSpell(me, SPELL_BERSERK, true);
break;
case EVENT_SPELL_BLIND:
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 10.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 1, 10.0f, true))
me->CastSpell(target, SPELL_BLIND, false);
events.ScheduleEvent(EVENT_SPELL_BLIND, urand(25000, 40000));
break;
@@ -235,7 +235,7 @@ public:
return;
case EVENT_SPELL_GARROTE:
Talk(SAY_SPECIAL);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
target->CastSpell(target, SPELL_GARROTE, true);
me->CastSpell(me, SPELL_VANISH_TELEPORT, false);
events.SetPhase(0);

View File

@@ -270,7 +270,7 @@ public:
// Void Zone
if (VoidZoneTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1, 45, true), SPELL_VOIDZONE, true);
DoCast(SelectTarget(SelectTargetMethod::Random, 1, 45, true), SPELL_VOIDZONE, true);
VoidZoneTimer = 15000;
}
else
@@ -323,7 +323,7 @@ public:
// Netherbreath
if (NetherbreathTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40, true))
DoCast(target, SPELL_NETHERBREATH);
NetherbreathTimer = urand(5000, 7000);
}

View File

@@ -320,7 +320,7 @@ public:
if (CharredEarthTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(target, SPELL_CHARRED_EARTH);
CharredEarthTimer = 20000;
}
@@ -329,7 +329,7 @@ public:
if (TailSweepTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
if (!me->HasInArc(M_PI, target))
DoCast(target, SPELL_TAIL_SWEEP);
TailSweepTimer = 15000;
@@ -339,7 +339,7 @@ public:
if (SearingCindersTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(target, SPELL_SEARING_CINDERS);
SearingCindersTimer = 10000;
}
@@ -385,7 +385,7 @@ public:
if (DistractingAshTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(target, SPELL_DISTRACTING_ASH);
DistractingAshTimer = 2000; //timer wrong
}
@@ -406,7 +406,7 @@ public:
if (FireballBarrageTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::MinDistance, 0))
DoCast(target, SPELL_FIREBALL_BARRAGE);
FireballBarrageTimer = 20000;
}

View File

@@ -373,7 +373,7 @@ public:
// if phase == 1 target the tank, otherwise anyone but the tank
Unit* target = phase == 1
? me->GetVictim()
: SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
: SelectTarget(SelectTargetMethod::Random, 1, 100, true);
if (target)
{
@@ -422,7 +422,7 @@ public:
{
if (AmplifyDamageTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100, true);
if (target)
{
@@ -492,7 +492,7 @@ public:
void changetarget()
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
{
if (me->GetVictim())
{

View File

@@ -133,7 +133,7 @@ public:
events.ScheduleEvent(EVENT_SPELL_ACIDIC_FANG, urand(12000, 18000));
break;
case EVENT_SPELL_HYAKISS_WEB:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f))
me->CastSpell(target, SPELL_HYAKISS_WEB, false);
events.ScheduleEvent(EVENT_SPELL_HYAKISS_WEB, 15000);
break;
@@ -146,7 +146,7 @@ public:
events.ScheduleEvent(EVENT_SPELL_WING_BUFFET, urand(12000, 18000));
break;
case EVENT_SPELL_DIVE:
if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, FarthestTargetSelector(me, 40.0f, false, true)))
if (Unit* target = SelectTarget(SelectTargetMethod::MinDistance, 0, FarthestTargetSelector(me, 40.0f, false, true)))
me->CastSpell(target, SPELL_DIVE, false);
events.ScheduleEvent(EVENT_SPELL_DIVE, 20000);
break;

View File

@@ -286,7 +286,7 @@ public:
{
if (!me->IsNonMeleeSpellCast(false))
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true);
if (!target)
return;
@@ -330,7 +330,7 @@ public:
DoCast(me, SPELL_AOE_CS);
break;
case 1:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(target, SPELL_CHAINSOFICE);
break;
}
@@ -412,7 +412,7 @@ public:
if (ElementalOne)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100, true);
if (!target)
return;
@@ -426,7 +426,7 @@ public:
if (ElementalTwo)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100, true);
if (!target)
return;
@@ -440,7 +440,7 @@ public:
if (ElementalThree)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100, true);
if (!target)
return;
@@ -454,7 +454,7 @@ public:
if (ElementalFour)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100, true);
if (!target)
return;

View File

@@ -380,7 +380,7 @@ public:
if (SacrificeTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100, true);
if (target && target->IsAlive())
{
DoCast(target, SPELL_SACRIFICE, true);
@@ -401,7 +401,7 @@ public:
if (ShadowboltTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT);
DoCast(SelectTarget(SelectTargetMethod::MaxThreat, 0), SPELL_SHADOW_BOLT);
ShadowboltTimer = 10000;
}
else

View File

@@ -212,7 +212,7 @@ public:
if (WaterBoltTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_WATERBOLT);
DoCast(SelectTarget(SelectTargetMethod::Random, 0), SPELL_WATERBOLT);
WaterBoltTimer = TitoDied ? 1500 : 5000;
}
else
@@ -419,7 +419,7 @@ public:
if (BrainWipeTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(target, SPELL_BRAIN_WIPE);
BrainWipeTimer = 20000;
}
@@ -909,7 +909,7 @@ public:
{
if (!IsChasing)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
{
Talk(SAY_WOLF_HOOD);
DoCast(target, SPELL_LITTLE_RED_RIDING_HOOD, true);
@@ -1324,7 +1324,7 @@ public:
if (BackwardLungeTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100, true);
if (target && !me->HasInArc(M_PI, target))
{
DoCast(target, SPELL_BACKWARD_LUNGE);
@@ -1344,7 +1344,7 @@ public:
if (DeadlySwatheTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(target, SPELL_DEADLY_SWATHE);
DeadlySwatheTimer = urand(15000, 25000);
}
@@ -1464,7 +1464,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff)
if (BlindingPassionTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(target, SPELL_BLINDING_PASSION);
BlindingPassionTimer = urand(30000, 45000);
}
@@ -1481,7 +1481,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff)
if (PowerfulAttractionTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_POWERFUL_ATTRACTION);
DoCast(SelectTarget(SelectTargetMethod::Random, 0), SPELL_POWERFUL_ATTRACTION);
PowerfulAttractionTimer = urand(5000, 30000);
}
else