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

@@ -185,7 +185,7 @@ public:
events.RepeatEvent(16000);
break;
case EVENT_SPELL_HAMMER_RIGHTEOUS:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 55.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 55.0f, true) )
{
char buffer[100];
sprintf(buffer, "Eadric the Pure targets %s with the Hammer of the Righteous!", target->GetName().c_str());
@@ -358,12 +358,12 @@ public:
case 0:
break;
case EVENT_SPELL_SMITE:
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_SMITE, false);
events.RepeatEvent(urand(3000, 4000));
break;
case EVENT_SPELL_HOLY_FIRE:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true) )
me->CastSpell(target, SPELL_HOLY_FIRE, false);
events.RepeatEvent(urand(9000, 12000));
break;
@@ -451,12 +451,12 @@ public:
events.ScheduleEvent(EVENT_SPELL_WAKING_NIGHTMARE, urand(20000, 30000));
break;
case EVENT_SPELL_OLD_WOUNDS:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 10.0f, true) )
me->CastSpell(target, SPELL_OLD_WOUNDS, true);
events.RepeatEvent(12000);
break;
case EVENT_SPELL_SHADOWS_PAST:
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_SHADOWS_PAST, false);
events.RepeatEvent(urand(15000, 20000));
break;
@@ -695,7 +695,7 @@ public:
events.RepeatEvent(urand(35000, 45000));
break;
case EVENT_PRIESTESS_SPELL_MIND_CONTROL_H:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true) )
me->CastSpell(target, SPELL_MIND_CONTROL_H, false);
events.RepeatEvent(urand(22000, 30000));
break;

View File

@@ -263,7 +263,7 @@ public:
events.RepeatEvent(urand(5000, 6000));
break;
case EVENT_SPELL_DEATH_RESPITE:
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_DEATH_RESPITE, false);
events.RepeatEvent(urand(13000, 15000));
break;
@@ -273,7 +273,7 @@ public:
events.RepeatEvent(urand(15000, 17000));
break;
case EVENT_SPELL_DESECRATION:
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_DESECRATION, false);
events.RepeatEvent(urand(14000, 17000));
break;
@@ -282,7 +282,7 @@ public:
events.RepeatEvent(urand(2000, 4000));
break;
case EVENT_SPELL_MARKED_DEATH:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.000000f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.000000f, true) )
me->CastSpell(target, SPELL_MARKED_DEATH, false);
events.RepeatEvent(9000);
break;
@@ -426,7 +426,7 @@ public:
case SPELL_CLAW_N:
case SPELL_CLAW_H:
DoResetThreat();
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f))
{
me->AddThreat(target, 100.0f);
AttackStart(target);

View File

@@ -802,7 +802,7 @@ public:
events.RepeatEvent(22000);
break;
case EVEMT_MAGE_SPELL_POLYMORPH:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true) )
me->CastSpell(target, SPELL_POLYMORPH, false);
events.RepeatEvent(8000);
break;
@@ -810,7 +810,7 @@ public:
/****************** SHAMAN ******************/
case EVENT_SHAMAN_SPELL_CHAIN_LIGHTNING:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true) )
me->CastSpell(target, SPELL_CHAIN_LIGHTNING, false);
events.RepeatEvent(16000);
break;
@@ -852,7 +852,7 @@ public:
{
if( !UnitTargetGUID )
{
if( Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 30.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::MinDistance, 0, 30.0f, true) )
{
me->CastSpell(target, SPELL_SHOOT, false);
UnitTargetGUID = target->GetGUID();
@@ -896,7 +896,7 @@ public:
events.RepeatEvent(14000);
break;
case EVENT_ROGUE_SPELL_POISON_BOTTLE:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true) )
me->CastSpell(target, SPELL_POISON_BOTTLE, false);
events.RepeatEvent(19000);
break;

View File

@@ -457,7 +457,7 @@ public:
{
AttackStart(target);
DoZoneInCombat();
if( Unit* t = SelectTarget(SELECT_TARGET_RANDOM, 0, 250.0f, true) )
if( Unit* t = SelectTarget(SelectTargetMethod::Random, 0, 250.0f, true) )
{
me->AddThreat(t, 20000.0f);
AttackStart(t);
@@ -674,7 +674,7 @@ public:
case 0:
break;
case EVENT_SPELL_SHADOW_STRIKE:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 250.0f, true) )
me->CastSpell(target, SPELL_SHADOW_STRIKE, false);
events.RepeatEvent(urand(30000, 45000));
break;
@@ -768,7 +768,7 @@ public:
}
DoZoneInCombat();
DoResetThreat();
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 250.0f, true) )
{
if (!next)
{

View File

@@ -466,7 +466,7 @@ public:
EventMapGCD(events, 1500);
break;
case EVENT_SPELL_HEX:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 20.0f, true) )
me->CastSpell(target, SPELL_HEX, false);
events.RepeatEvent(45000);
EventMapGCD(events, 1500);
@@ -613,7 +613,7 @@ public:
events.RepeatEvent(10000);
break;
case EVENT_SPELL_HAMMER_OF_JUSTICE:
if( Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 15.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::MaxDistance, 0, 15.0f, true) )
{
me->CastSpell(target, SPELL_HAMMER_OF_JUSTICE, false);
events.RepeatEvent(40000);
@@ -714,7 +714,7 @@ public:
EventMapGCD(events, 1500);
break;
case EVENT_SPELL_DISPEL:
if( Unit* target = (urand(0, 1) ? SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 30.0f, true) : SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_DISPEL, 40.0f)) )
if( Unit* target = (urand(0, 1) ? SelectTarget(SelectTargetMethod::MaxThreat, 0, 30.0f, true) : SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_DISPEL, 40.0f)) )
me->CastSpell(target, SPELL_DISPEL, false);
events.RepeatEvent(urand(10000, 15000));
EventMapGCD(events, 1500);
@@ -874,7 +874,7 @@ public:
events.RepeatEvent(6000);
break;
case EVENT_SPELL_DISPEL:
if( Unit* target = (urand(0, 1) ? SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 30.0f, true) : SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_DISPEL, 40.0f)) )
if( Unit* target = (urand(0, 1) ? SelectTarget(SelectTargetMethod::MaxThreat, 0, 30.0f, true) : SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_DISPEL, 40.0f)) )
me->CastSpell(target, SPELL_DISPEL, false);
events.RepeatEvent(urand(10000, 15000));
EventMapGCD(events, 1500);
@@ -1011,7 +1011,7 @@ public:
EventMapGCD(events, 1500);
break;
case EVENT_SPELL_FEAR:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 20.0f, true) )
me->CastSpell(target, SPELL_FEAR, false);
events.RepeatEvent(urand(10000, 15000));
EventMapGCD(events, 1500);
@@ -1175,7 +1175,7 @@ public:
events.RepeatEvent(6000);
break;
case EVENT_SPELL_POLYMORPH:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true) )
me->CastSpell(target, SPELL_POLYMORPH, false);
events.RepeatEvent(15000);
EventMapGCD(events, 1500);
@@ -1323,7 +1323,7 @@ public:
EventMapGCD(events, 1500);
break;
case EVENT_SPELL_WYVERN_STING:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 35.0f, true) )
{
me->CastSpell(target, SPELL_WYVERN_STING, false);
events.RepeatEvent(60000);
@@ -1457,7 +1457,7 @@ public:
EventMapGCD(events, 1500);
break;
case EVENT_SPELL_ENTANGLING_ROOTS:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true) )
me->CastSpell(target, SPELL_ENTANGLING_ROOTS, false);
events.RepeatEvent(urand(10000, 15000));
EventMapGCD(events, 1500);
@@ -1469,7 +1469,7 @@ public:
EventMapGCD(events, 1500);
break;
case EVENT_SPELL_CYCLONE:
if( Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 20.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::MaxDistance, 0, 20.0f, true) )
me->CastSpell(target, SPELL_CYCLONE, false);
events.RepeatEvent(urand(25000, 40000));
EventMapGCD(events, 1500);
@@ -1926,7 +1926,7 @@ public:
events.RepeatEvent(5000);
break;
case EVENT_SPELL_BLIND:
if( Unit* target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, 20.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::MinThreat, 0, 20.0f, true) )
{
me->CastSpell(target, SPELL_BLIND, false);
events.RepeatEvent(120000);
@@ -2074,7 +2074,7 @@ public:
events.RepeatEvent(5000);
break;
}
if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 25.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 25.0f, true) )
{
me->CastSpell(target, SPELL_EARTH_SHOCK_ENH, false);
events.RepeatEvent(urand(6000, 8000));
@@ -2089,7 +2089,7 @@ public:
events.RepeatEvent(5000);
break;
}
if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 5.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 5.0f, true) )
{
me->CastSpell(target, SPELL_LAVA_LASH, false);
events.RepeatEvent(urand(6000, 8000));
@@ -2104,7 +2104,7 @@ public:
events.RepeatEvent(5000);
break;
}
if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 5.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 5.0f, true) )
{
me->CastSpell(target, SPELL_STORMSTRIKE, false);
events.RepeatEvent(urand(8000, 9000));
@@ -2217,7 +2217,7 @@ public:
events.RepeatEvent(5000);
break;
}
if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 5.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 5.0f, true) )
{
me->CastSpell(target, SPELL_CRUSADER_STRIKE, false);
events.RepeatEvent(urand(6000, 8000));
@@ -2252,7 +2252,7 @@ public:
events.RepeatEvent(5000);
break;
case EVENT_SPELL_HAMMER_OF_JUSTICE_RET:
if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 15.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 15.0f, true) )
{
me->CastSpell(target, SPELL_HAMMER_OF_JUSTICE_RET, false);
events.RepeatEvent(40000);
@@ -2272,7 +2272,7 @@ public:
events.RepeatEvent(5000);
break;
case EVENT_SPELL_JUDGEMENT_OF_COMMAND:
if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 20.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 20.0f, true) )
{
me->CastSpell(target, SPELL_JUDGEMENT_OF_COMMAND, false);
events.RepeatEvent(urand(10000, 15000));
@@ -2282,7 +2282,7 @@ public:
events.RepeatEvent(5000);
break;
case EVENT_SPELL_REPENTANCE:
if( Unit* target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, 20.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::MinThreat, 0, 20.0f, true) )
{
me->CastSpell(target, SPELL_REPENTANCE, false);
events.RepeatEvent(60000);

View File

@@ -211,12 +211,12 @@ public:
events.RepeatEvent(urand(10000, 15000));
break;
case EVENT_SPELL_FEL_LIGHTNING:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true) )
me->CastSpell(target, SPELL_FEL_LIGHTNING, false);
events.RepeatEvent(urand(10000, 15000));
break;
case EVENT_SPELL_INCINERATE_FLESH:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true) )
{
Talk(EMOTE_INCINERATE, target);
Talk(SAY_INCINERATE);
@@ -230,7 +230,7 @@ public:
events.RepeatEvent(urand(25000, 45000));
break;
case EVENT_SPELL_LEGION_FLAME:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true) )
{
Talk(EMOTE_LEGION_FLAME, target);
me->CastSpell(target, SPELL_LEGION_FLAME, false);
@@ -238,7 +238,7 @@ public:
events.RepeatEvent(30000);
break;
case EVENT_SPELL_TOUCH_OF_JARAXXUS:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true) )
me->CastSpell(target, SPELL_TOUCH_OF_JARAXXUS, false);
events.RepeatEvent(urand(10000, 15000));
break;
@@ -334,7 +334,7 @@ public:
case 0:
break;
case EVENT_SPELL_FEL_STEAK:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 44.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 44.0f, true) )
{
DoResetThreat();
me->AddThreat(target, 50000.0f);
@@ -418,7 +418,7 @@ public:
events.RepeatEvent(urand(15000, 25000));
break;
case EVENT_SPELL_SPINNING_PAIN_SPIKE:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 140.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 140.0f, true) )
me->CastSpell(target, SPELL_SPINNING_PAIN_SPIKE, false);
events.RepeatEvent(urand(25000, 30000));
break;

View File

@@ -623,7 +623,7 @@ struct boss_jormungarAI : public ScriptedAI
}
break;
case EVENT_SPELL_SPRAY:
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_SPRAY, false);
events.RepeatEvent(20000);
break;
@@ -884,7 +884,7 @@ public:
events.RepeatEvent(urand(15000, 20000));
break;
case EVENT_SPELL_ARCTIC_BREATH:
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 90.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 90.0f, true) )
me->CastSpell(target, SPELL_ARCTIC_BREATH, false);
events.RepeatEvent(urand(20000, 30000));
break;
@@ -906,7 +906,7 @@ public:
events.RescheduleEvent(EVENT_GAZE, 2000);
break;
case EVENT_GAZE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 500.0f, true) )
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 500.0f, true) )
{
TargetGUID = target->GetGUID();
me->SetGuidValue(UNIT_FIELD_TARGET, TargetGUID);

View File

@@ -383,7 +383,7 @@ struct boss_twin_valkyrAI : public ScriptedAI
}
/*
if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, essenceId) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, essenceId) )
me->CastSpell(target, me->GetEntry()==NPC_LIGHTBANE ? SPELL_LIGHT_TOUCH : SPELL_DARK_TOUCH, false);
events.RepeatEvent(urand(45000,50000));
*/