mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
feat(Core/Unit): Implement DoCastRandomTarget() helper (#8876)
This commit is contained in:
@@ -205,6 +205,19 @@ void UnitAI::DoCastAOE(uint32 spellId, bool triggered)
|
||||
me->CastSpell((Unit*)nullptr, spellId, triggered);
|
||||
}
|
||||
|
||||
void UnitAI::DoCastRandomTarget(uint32 spellId, uint32 threatTablePosition, float dist, bool playerOnly, bool triggered)
|
||||
{
|
||||
if (!triggered && me->HasUnitState(UNIT_STATE_CASTING))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, threatTablePosition, dist, playerOnly))
|
||||
{
|
||||
me->CastSpell(target, spellId, triggered);
|
||||
}
|
||||
}
|
||||
|
||||
#define UPDATE_TARGET(a) {if (AIInfo->target<a) AIInfo->target=a;}
|
||||
|
||||
void UnitAI::FillAISpellInfo()
|
||||
|
||||
@@ -300,6 +300,7 @@ public:
|
||||
void DoCastToAllHostilePlayers(uint32 spellid, bool triggered = false);
|
||||
void DoCastVictim(uint32 spellId, bool triggered = false);
|
||||
void DoCastAOE(uint32 spellId, bool triggered = false);
|
||||
void DoCastRandomTarget(uint32 spellId, uint32 threatTablePosition = 0, float dist = 0.0f, bool playerOnly = true, bool triggered = false);
|
||||
|
||||
float DoGetSpellMaxRange(uint32 spellId, bool positive = false);
|
||||
|
||||
|
||||
@@ -201,10 +201,7 @@ public:
|
||||
events.ScheduleEvent(EVENT_FLAME_BREAK, 10 * IN_MILLISECONDS);
|
||||
break;
|
||||
case EVENT_IMMOLATE:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
{
|
||||
DoCast(target, SPELL_IMMOLATE);
|
||||
}
|
||||
DoCastRandomTarget(SPELL_IMMOLATE, 0, 100.0f);
|
||||
events.ScheduleEvent(EVENT_IMMOLATE, 8 * IN_MILLISECONDS);
|
||||
break;
|
||||
case EVENT_TERRIFYING_ROAR:
|
||||
|
||||
Reference in New Issue
Block a user