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

@@ -225,7 +225,7 @@ public:
{
case EVENT_STATIC_DISRUPTION:
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
Unit* target = SelectTarget(SelectTargetMethod::Random, 1);
if (!target)
target = me->GetVictim();
if (target)
@@ -241,7 +241,7 @@ public:
}
case EVENT_GUST_OF_WIND:
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
Unit* target = SelectTarget(SelectTargetMethod::Random, 1);
if (!target)
target = me->GetVictim();
if (target)
@@ -255,7 +255,7 @@ public:
break;
case EVENT_ELECTRICAL_STORM:
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50, true);
if (!target)
{
EnterEvadeMode();
@@ -324,7 +324,7 @@ public:
Unit* bird = ObjectAccessor::GetUnit(*me, BirdGUIDs[i]);
if (!bird) //they despawned on die
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
x = target->GetPositionX() + irand(-10, 10);
y = target->GetPositionY() + irand(-10, 10);
@@ -420,7 +420,7 @@ public:
if (arrived)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
float x, y, z;
if (EagleSwoop_Timer)

View File

@@ -245,7 +245,7 @@ public:
if (ShockTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
if (target->IsNonMeleeSpellCast(false))
DoCast(target, SPELL_EARTHSHOCK);

View File

@@ -428,7 +428,7 @@ public:
if (SiphonSoul_Timer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 70, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 70, true);
Unit* trigger = DoSpawnCreature(NPC_TEMP_TRIGGER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 30000);
if (!target || !trigger)
{
@@ -488,7 +488,7 @@ public:
break;
case ABILITY_TARGET_ENEMY:
default:
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
target = SelectTarget(SelectTargetMethod::Random, 0, 100, true);
break;
case ABILITY_TARGET_HEAL:
target = DoSelectLowestHpFriendly(50, 0);
@@ -634,7 +634,7 @@ public:
if (urand(0, 1))
target = DoSelectLowestHpFriendly(50, 0);
else
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
target = SelectTarget(SelectTargetMethod::Random, 0);
if (target)
DoCast(target, SPELL_DISPEL_MAGIC, false);
}
@@ -651,7 +651,7 @@ public:
DoCast(target, SPELL_DISPEL_MAGIC, false);
}
else
me->CastSpell(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DISPEL_MAGIC, false);
me->CastSpell(SelectUnit(SelectTargetMethod::Random, 0), SPELL_DISPEL_MAGIC, false);
dispelmagic_timer = 12000;
} else dispelmagic_timer -= diff;*/
@@ -843,7 +843,7 @@ public:
if (venomspit_timer <= diff)
{
if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* victim = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(victim, SPELL_VENOM_SPIT, false);
venomspit_timer = 2500;
}
@@ -934,7 +934,7 @@ public:
}
if (coldstare_timer <= diff)
{
if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* victim = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(victim, SPELL_COLD_STARE, false);
coldstare_timer = 12000;
}

View File

@@ -408,7 +408,7 @@ public:
if (FireBreathTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
me->AttackStop();
me->GetMotionMaster()->Clear();

View File

@@ -425,7 +425,7 @@ public:
if (Surge_Timer <= diff)
{
Talk(SAY_SURGE);
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 45, true);
Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 45, true);
if (target)
DoCast(target, SPELL_SURGE);
Surge_Timer = urand(15000, 20000);

View File

@@ -338,7 +338,7 @@ public:
Vortex->CastSpell(Vortex, SPELL_CYCLONE_VISUAL, true);
Vortex->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Vortex->SetSpeed(MOVE_RUN, 1.0f);
Vortex->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0));
Vortex->AI()->AttackStart(SelectTarget(SelectTargetMethod::Random, 0));
DoZoneInCombat(Vortex);
}
}
@@ -399,7 +399,7 @@ public:
if (Grievous_Throw_Timer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(target, SPELL_GRIEVOUS_THROW, false);
Grievous_Throw_Timer = 10000;
}
@@ -430,7 +430,7 @@ public:
{
if (!TankGUID)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
TankGUID = me->GetVictim()->GetGUID();
me->SetSpeed(MOVE_RUN, 5.0f);
@@ -446,7 +446,7 @@ public:
{
Unit* target = me->GetVictim();
if (!target || !target->isTargetableForAttack()) target = ObjectAccessor::GetUnit(*me, TankGUID);
if (!target || !target->isTargetableForAttack()) target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (!target || !target->isTargetableForAttack()) target = SelectTarget(SelectTargetMethod::Random, 0);
if (target)
{
AttackStart(target);
@@ -481,7 +481,7 @@ public:
{
if (!TankGUID)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
TankGUID = me->GetVictim()->GetGUID();
me->SetSpeed(MOVE_RUN, 5.0f);
@@ -495,7 +495,7 @@ public:
Unit* target = me->GetVictim();
if (!target || !target->isTargetableForAttack())
{
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
target = SelectTarget(SelectTargetMethod::Random, 0);
AttackStart(target);
}
if (target)
@@ -512,7 +512,7 @@ public:
TankGUID.Clear();
}
else
AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0));
AttackStart(SelectTarget(SelectTargetMethod::Random, 0));
}
}
else
@@ -535,7 +535,7 @@ public:
if (Pillar_Of_Fire_Timer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
DoCast(target, SPELL_SUMMON_PILLAR);
Pillar_Of_Fire_Timer = 10000;
}
@@ -543,7 +543,7 @@ public:
if (Flame_Breath_Timer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
me->SetInFront(target);
DoCast(me, SPELL_FLAME_BREATH);
Flame_Breath_Timer = 10000;
@@ -592,7 +592,7 @@ public:
{
//if the vortex reach the target, it change his target to another player
if (me->IsWithinMeleeRange(me->GetVictim()))
AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0));
AttackStart(SelectTarget(SelectTargetMethod::Random, 0));
}
};