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

@@ -138,7 +138,7 @@ public:
if (SwarmTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
{
DoCast(target, SPELL_CARRION_SWARM);
}
@@ -152,7 +152,7 @@ public:
{
for (uint8 i = 0; i < 3; ++i)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
target->CastSpell(target, SPELL_SLEEP, true);
}
SleepTimer = 60000;
@@ -167,7 +167,7 @@ public:
else AuraTimer -= diff;
if (InfernoTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_INFERNO);
DoCast(SelectTarget(SelectTargetMethod::Random, 0, 100, true), SPELL_INFERNO);
InfernoTimer = 45000;
Talk(SAY_INFERNO);
}

View File

@@ -490,7 +490,7 @@ public:
{
// Three doomfire can be up at the same time
Talk(SAY_DOOMFIRE);
Unit* temp = SelectTarget(SELECT_TARGET_RANDOM, 1);
Unit* temp = SelectTarget(SelectTargetMethod::Random, 1);
if (!temp)
temp = me->GetVictim();
@@ -647,19 +647,19 @@ public:
case EVENT_SPELL_FINGER_OF_DEATH:
if (CanUseFingerOfDeath())
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
Unit* target = SelectTarget(SelectTargetMethod::Random, 0);
DoCast(target, SPELL_FINGER_OF_DEATH);
DoCastVictim(SPELL_RED_SKY_EFFECT);
}
events.ScheduleEvent(EVENT_SPELL_FINGER_OF_DEATH, 3500);
break;
case EVENT_SPELL_GRIP_OF_THE_LEGION:
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_GRIP_OF_THE_LEGION);
DoCast(SelectTarget(SelectTargetMethod::Random, 0), SPELL_GRIP_OF_THE_LEGION);
events.ScheduleEvent(EVENT_SPELL_GRIP_OF_THE_LEGION, urand(5000, 25000));
break;
case EVENT_SPELL_AIR_BURST:
Talk(SAY_AIR_BURST);
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_AIR_BURST);
DoCast(SelectTarget(SelectTargetMethod::Random, 0), SPELL_AIR_BURST);
events.ScheduleEvent(EVENT_SPELL_AIR_BURST, urand(25000, 40000));
break;
case EVENT_SPELL_FEAR:

View File

@@ -141,14 +141,14 @@ public:
if (RainTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true), SPELL_RAIN_OF_FIRE);
DoCast(SelectTarget(SelectTargetMethod::Random, 0, 30, true), SPELL_RAIN_OF_FIRE);
RainTimer = 20000 + rand() % 15000;
}
else RainTimer -= diff;
if (DoomTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true), SPELL_DOOM);//never on tank
DoCast(SelectTarget(SelectTargetMethod::Random, 1, 100, true), SPELL_DOOM);//never on tank
DoomTimer = 45000 + rand() % 5000;
}
else DoomTimer -= diff;
@@ -269,7 +269,7 @@ public:
if (CrippleTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_CRIPPLE);
DoCast(SelectTarget(SelectTargetMethod::Random, 0, 100, true), SPELL_CRIPPLE);
CrippleTimer = 25000 + rand() % 5000;
}
else CrippleTimer -= diff;

View File

@@ -151,7 +151,7 @@ public:
else NovaTimer -= diff;
if (IceboltTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true), SPELL_ICEBOLT);
DoCast(SelectTarget(SelectTargetMethod::Random, 0, 40, true), SPELL_ICEBOLT);
IceboltTimer = 11000 + rand() % 20000;
}
else IceboltTimer -= diff;

View File

@@ -854,7 +854,7 @@ void hyjalAI::UpdateAI(uint32 diff)
break;
case TARGETTYPE_RANDOM:
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
target = SelectTarget(SelectTargetMethod::Random, 0);
break;
case TARGETTYPE_VICTIM:

View File

@@ -764,7 +764,7 @@ public:
void JustSummoned(Creature* summon) override
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30, true);
if (target)
summon->Attack(target, false);
summons.Summon(summon);
@@ -1365,7 +1365,7 @@ public:
forcemove = false;
if (forcemove)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
me->Attack(target, false);
}
if (MoveTimer <= diff)

View File

@@ -114,7 +114,7 @@ public:
switch (events.ExecuteEvent())
{
case EVENT_SPELL_CURSE_OF_EXERTION:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
me->CastSpell(target, SPELL_CURSE_OF_EXERTION, false);
events.RepeatEvent(9000);
break;
@@ -129,7 +129,7 @@ public:
case EVENT_SPELL_TIME_WARP:
Talk(SAY_TIME_WARP);
me->CastSpell(me, SPELL_TIME_WARP, false);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
me->CastSpell(target, DUNGEON_MODE(SPELL_TIME_STEP_N, SPELL_TIME_STEP_H), true);
events.RepeatEvent(25000);

View File

@@ -149,7 +149,7 @@ public:
events.RepeatEvent(8000);
break;
case EVENT_SPELL_CORRUPTING_BLIGHT:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
me->CastSpell(target, SPELL_CORRUPTING_BLIGHT, false);
events.RepeatEvent(12000);
break;

View File

@@ -149,13 +149,13 @@ public:
events.RepeatEvent(7000);
break;
case EVENT_SPELL_MIND_BLAST:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
me->CastSpell(target, DUNGEON_MODE(SPELL_MIND_BLAST_N, SPELL_MIND_BLAST_H), false);
events.RepeatEvent(6000);
break;
case EVENT_SPELL_SLEEP:
Talk(SAY_SLEEP);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
me->CastSpell(target, DUNGEON_MODE(SPELL_SLEEP_N, SPELL_SLEEP_H), false);
events.RepeatEvent(17000);
break;

View File

@@ -105,7 +105,7 @@ public:
events.RepeatEvent(20000);
break;
case EVENT_SPELL_CONSTRICTING_CHAINS:
if (Unit* pTarget = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, 50.0f, true))
if (Unit* pTarget = SelectTarget(SelectTargetMethod::MinThreat, 0, 50.0f, true))
me->CastSpell(pTarget, DUNGEON_MODE(SPELL_CONSTRICTING_CHAINS_N, SPELL_CONSTRICTING_CHAINS_H), false);
events.RepeatEvent(14000);
break;

View File

@@ -1177,7 +1177,7 @@ public:
switch (combatEvents.ExecuteEvent())
{
case EVENT_COMBAT_EXORCISM:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
me->CastSpell(target, DUNGEON_MODE(SPELL_ARTHAS_EXORCISM_N, SPELL_ARTHAS_EXORCISM_H), false);
combatEvents.RepeatEvent(7300);

View File

@@ -134,7 +134,7 @@ public:
events.ScheduleEvent(EVENT_WHIRLWIND, 25000);
break;
case EVENT_EXPLODING_SHOT:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 40.0f))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 40.0f))
me->CastSpell(target, SPELL_EXPLODING_SHOT, false);
events.ScheduleEvent(EVENT_EXPLODING_SHOT, 25000);
break;