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

@@ -219,7 +219,7 @@ public:
switch (events.ExecuteEvent())
{
case EVENT_IMPALE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
me->CastSpell(target, RAID_MODE(SPELL_IMPALE_10, SPELL_IMPALE_25), false);
}

View File

@@ -203,7 +203,7 @@ public:
events.RepeatEvent(urand(7000, 15000));
break;
case EVENT_RAIN_OF_FIRE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
me->CastSpell(target, RAID_MODE(SPELL_RAIN_OF_FIRE_10, SPELL_RAIN_OF_FIRE_25), false);
}

View File

@@ -346,7 +346,7 @@ public:
events.RepeatEvent(15000);
return;
case EVENT_PUNISH:
if (!SelectTarget(SELECT_TARGET_NEAREST, 0, 45.0f, true))
if (!SelectTarget(SelectTargetMethod::MaxDistance, 0, 45.0f, true))
{
me->CastSpell(me, TABLE_SPELL_PUNISH[horsemanId], false);
Talk(EMOTE_RAGECAST);
@@ -361,7 +361,7 @@ public:
if ((me->GetEntry() == NPC_LADY_BLAUMEUX || me->GetEntry() == NPC_SIR_ZELIEK))
{
if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 45.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::MaxDistance, 0, 45.0f, true))
{
me->CastSpell(target, RAID_MODE(TABLE_SPELL_PRIMARY_10[horsemanId], TABLE_SPELL_PRIMARY_25[horsemanId]), false);
}

View File

@@ -453,7 +453,7 @@ public:
me->CastSpell(me, SPELL_TELEPORT_LIVE, false);
}
me->getThreatMgr().resetAggro(NotOnSameSide(me));
if (Unit* pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0))
if (Unit* pTarget = SelectTarget(SelectTargetMethod::MaxDistance, 0))
{
me->getThreatMgr().addThreat(pTarget, 100.0f);
AttackStart(pTarget);

View File

@@ -177,7 +177,7 @@ public:
events.RepeatEvent(20000);
break;
case EVENT_MUTATING_INJECTION:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true, -SPELL_MUTATING_INJECTION))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, -SPELL_MUTATING_INJECTION))
{
me->CastSpell(target, SPELL_MUTATING_INJECTION, false);
}

View File

@@ -410,14 +410,14 @@ public:
events.RepeatEvent(urand(15000, 30000));
break;
case EVENT_SHADOW_FISSURE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
{
me->CastSpell(target, SPELL_SHADOW_FISURE, false);
}
events.RepeatEvent(25000);
break;
case EVENT_FROST_BLAST:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1, 0), 0, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, RAID_MODE(1, 0), 0, true))
{
me->CastSpell(target, SPELL_FROST_BLAST, false);
}
@@ -427,7 +427,7 @@ public:
case EVENT_CHAINS:
for (uint8 i = 0; i < 3; ++i)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true, -SPELL_CHAINS_OF_KELTHUZAD))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 200, true, -SPELL_CHAINS_OF_KELTHUZAD))
{
me->CastSpell(target, SPELL_CHAINS_OF_KELTHUZAD, true);
}

View File

@@ -132,7 +132,7 @@ public:
if (cr->GetEntry() == NPC_MAEXXNA_SPIDERLING)
{
cr->SetInCombatWithZone();
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
cr->AI()->AttackStart(target);
}
@@ -201,7 +201,7 @@ public:
Talk(EMOTE_WEB_WRAP);
for (uint8 i = 0; i < RAID_MODE(1, 2); ++i)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0, true, -SPELL_WEB_WRAP))
{
target->RemoveAura(RAID_MODE(SPELL_WEB_SPRAY_10, SPELL_WEB_SPRAY_25));
uint8 pos = urand(0, 2);

View File

@@ -162,7 +162,7 @@ public:
events.RepeatEvent(15000);
break;
case EVENT_JAGGED_KNIFE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f))
{
me->CastSpell(target, SPELL_JAGGED_KNIFE, false);
}

View File

@@ -272,7 +272,7 @@ public:
case EVENT_BLIZZARD:
{
Creature* cr;
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
{
cr = me->SummonCreature(NPC_BLIZZARD, *target, TEMPSUMMON_TIMED_DESPAWN, 16000);
}

View File

@@ -359,7 +359,7 @@ public:
}
else if (ballLightningEnabled)
{
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat))
{
me->CastSpell(target, SPELL_BALL_LIGHTNING, false);
}
@@ -582,7 +582,7 @@ public:
me->RemoveAurasDueToSpell(me->GetEntry() == NPC_STALAGG ? SPELL_STALAGG_CHAIN : SPELL_FEUGEN_CHAIN);
cr->InterruptNonMeleeSpells(true);
}
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 1000.f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 1000.f, true))
{
cr->CastStop(SPELL_TESLA_SHOCK);
cr->CastSpell(target, SPELL_TESLA_SHOCK, true);