mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 02:46:33 +01:00
Core/AI: AreaBoundary refactor
- Added an auxiliary function IsInBounds to base CreatureAI
- Changed container to vector. Set had no sense because we're storing new pointers, they have different addresses even if the boundary is the same
(cherry picked from commit 2f99fa09c9)
This commit is contained in:
@@ -483,15 +483,6 @@ class npc_anubarak_anub_ar_assassin : public CreatureScript
|
||||
{
|
||||
npc_anubarak_anub_ar_assassinAI(Creature* creature) : npc_anubarak_pet_template(creature, false), _backstabTimer(6 * IN_MILLISECONDS) { }
|
||||
|
||||
bool IsInBounds(Position const& jumpTo, CreatureBoundary const* boundary)
|
||||
{
|
||||
if (!boundary)
|
||||
return true;
|
||||
for (AreaBoundary const* it : *boundary)
|
||||
if (!it->IsWithinBoundary(&jumpTo))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
Position GetRandomPositionAround(Creature* anubarak)
|
||||
{
|
||||
static float DISTANCE_MIN = 10.0f;
|
||||
@@ -508,7 +499,7 @@ class npc_anubarak_anub_ar_assassin : public CreatureScript
|
||||
Position jumpTo;
|
||||
do
|
||||
jumpTo = GetRandomPositionAround(anubarak);
|
||||
while (!IsInBounds(jumpTo, boundary));
|
||||
while (!CreatureAI::IsInBounds(boundary, &jumpTo));
|
||||
me->GetMotionMaster()->MoveJump(jumpTo, 40.0f, 40.0f);
|
||||
DoCastSelf(SPELL_ASSASSIN_VISUAL, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user