mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +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
This commit is contained in:
@@ -476,15 +476,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 (CreatureBoundary::const_iterator it = boundary->cbegin(); it != boundary->cend(); ++it)
|
||||
if (!(*it)->IsWithinBoundary(&jumpTo))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
Position GetRandomPositionAround(Creature* anubarak)
|
||||
{
|
||||
static float DISTANCE_MIN = 10.0f;
|
||||
@@ -501,7 +492,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