mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Movement: Add LOS check for fleeingmovement target point.
Prevents fleeing or feared units from going to upper floor ignoring walls/ceilings with mmaps on(and usually get stucked). Current implementation just randomly selects a distance and angle against the frighting unit, when in narrow circumstance such as underground caves, such targeting point would be at another floor. Closes #11300 Ref #9475 (needs fixed confirmation)
This commit is contained in:
@@ -57,7 +57,7 @@ class ItemChatLink : public ChatLink
|
||||
{
|
||||
public:
|
||||
ItemChatLink() : ChatLink(), _item(NULL), _suffix(NULL), _property(NULL)
|
||||
{
|
||||
{
|
||||
memset(_data, 0, sizeof(_data));
|
||||
}
|
||||
virtual bool Initialize(std::istringstream& iss);
|
||||
@@ -102,7 +102,7 @@ class AchievementChatLink : public ChatLink
|
||||
{
|
||||
public:
|
||||
AchievementChatLink() : ChatLink(), _guid(0), _achievement(NULL)
|
||||
{
|
||||
{
|
||||
memset(_data, 0, sizeof(_data));
|
||||
}
|
||||
virtual bool Initialize(std::istringstream& iss);
|
||||
|
||||
@@ -537,7 +537,7 @@ class MapObject
|
||||
|
||||
protected:
|
||||
MapObject() : _moveState(MAP_OBJECT_CELL_MOVE_NONE)
|
||||
{
|
||||
{
|
||||
_newPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,11 +96,11 @@ class MotionMaster //: private std::stack<MovementGenerator *>
|
||||
}
|
||||
void push(_Ty _Val) { ++_top; Impl[_top] = _Val; }
|
||||
|
||||
bool needInitTop() const
|
||||
{
|
||||
bool needInitTop() const
|
||||
{
|
||||
if (empty())
|
||||
return false;
|
||||
return _needInit[_top];
|
||||
return _needInit[_top];
|
||||
}
|
||||
void InitTop();
|
||||
public:
|
||||
@@ -120,15 +120,15 @@ class MotionMaster //: private std::stack<MovementGenerator *>
|
||||
|
||||
bool empty() const { return (_top < 0); }
|
||||
int size() const { return _top + 1; }
|
||||
_Ty top() const
|
||||
{
|
||||
_Ty top() const
|
||||
{
|
||||
ASSERT(!empty());
|
||||
return Impl[_top];
|
||||
return Impl[_top];
|
||||
}
|
||||
_Ty GetMotionSlot(int slot) const
|
||||
{
|
||||
_Ty GetMotionSlot(int slot) const
|
||||
{
|
||||
ASSERT(slot >= 0);
|
||||
return Impl[slot];
|
||||
return Impl[slot];
|
||||
}
|
||||
|
||||
void DirectDelete(_Ty curr);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "MoveSplineInit.h"
|
||||
#include "MoveSpline.h"
|
||||
#include "Player.h"
|
||||
#include "VMapFactory.h"
|
||||
|
||||
#define MIN_QUIET_DISTANCE 28.0f
|
||||
#define MAX_QUIET_DISTANCE 43.0f
|
||||
@@ -43,6 +44,20 @@ void FleeingMovementGenerator<T>::_setTargetLocation(T* owner)
|
||||
float x, y, z;
|
||||
_getPoint(owner, x, y, z);
|
||||
|
||||
// Add LOS check for target point
|
||||
Position mypos;
|
||||
owner->GetPosition(&mypos);
|
||||
bool isInLOS = VMAP::VMapFactory::createOrGetVMapManager()->isInLineOfSight(owner->GetMapId(),
|
||||
mypos.m_positionX,
|
||||
mypos.m_positionY,
|
||||
mypos.m_positionZ + 2.0f,
|
||||
x, y, z + 2.0f);
|
||||
if (!isInLOS)
|
||||
{
|
||||
i_nextCheckTime.Reset(200);
|
||||
return;
|
||||
}
|
||||
|
||||
PathGenerator path(owner);
|
||||
path.SetPathLengthLimit(30.0f);
|
||||
bool result = path.CalculatePath(x, y, z);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
Warden::Warden() : _session(NULL), _inputCrypto(16), _outputCrypto(16), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0),
|
||||
_dataSent(false), _previousTimestamp(0), _module(NULL), _initialized(false)
|
||||
{
|
||||
{
|
||||
memset(_inputKey, 0, sizeof(_inputKey));
|
||||
memset(_outputKey, 0, sizeof(_outputKey));
|
||||
memset(_seed, 0, sizeof(_seed));
|
||||
|
||||
@@ -228,7 +228,7 @@ class boss_akilzon : public CreatureScript
|
||||
case EVENT_STATIC_DISRUPTION:
|
||||
{
|
||||
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
|
||||
if (!target)
|
||||
if (!target)
|
||||
target = me->GetVictim();
|
||||
if (target)
|
||||
{
|
||||
@@ -244,7 +244,7 @@ class boss_akilzon : public CreatureScript
|
||||
case EVENT_GUST_OF_WIND:
|
||||
{
|
||||
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
|
||||
if (!target)
|
||||
if (!target)
|
||||
target = me->GetVictim();
|
||||
if (target)
|
||||
DoCast(target, SPELL_GUST_OF_WIND);
|
||||
|
||||
@@ -467,7 +467,7 @@ public:
|
||||
CallDragon(DATA_TENEBRON);
|
||||
break;
|
||||
case EVENT_CALL_SHADRON:
|
||||
CallDragon(DATA_SHADRON);
|
||||
CallDragon(DATA_SHADRON);
|
||||
break;
|
||||
case EVENT_CALL_VESPERON:
|
||||
CallDragon(DATA_VESPERON);
|
||||
|
||||
@@ -195,8 +195,8 @@ public:
|
||||
|
||||
struct npc_crystal_spike_triggerAI : public ScriptedAI
|
||||
{
|
||||
npc_crystal_spike_triggerAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
npc_crystal_spike_triggerAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
_count = 0;
|
||||
_despawntimer = 0;
|
||||
}
|
||||
|
||||
@@ -428,8 +428,8 @@ public:
|
||||
|
||||
struct npc_jennyAI : public ScriptedAI
|
||||
{
|
||||
npc_jennyAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
npc_jennyAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
setCrateNumber = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1125,7 +1125,7 @@ public:
|
||||
|
||||
struct npc_oscillating_frequency_scanner_master_bunnyAI : public ScriptedAI
|
||||
{
|
||||
npc_oscillating_frequency_scanner_master_bunnyAI(Creature* creature) : ScriptedAI(creature)
|
||||
npc_oscillating_frequency_scanner_master_bunnyAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
playerGuid = 0;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
|
||||
uint64 ownerGuid = me->GetOwnerGUID();
|
||||
if (!ownerGuid)
|
||||
return;
|
||||
|
||||
|
||||
// Find victim of Summon Gargoyle spell
|
||||
std::list<Unit*> targets;
|
||||
Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 30.0f);
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
class BasicEvent
|
||||
{
|
||||
public:
|
||||
BasicEvent()
|
||||
{
|
||||
to_Abort = false;
|
||||
BasicEvent()
|
||||
{
|
||||
to_Abort = false;
|
||||
m_addTime = 0;
|
||||
m_execTime = 0;
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ private:
|
||||
uint32 _lastChange;
|
||||
uint32 _delaytime;
|
||||
public:
|
||||
FreezeDetectorRunnable()
|
||||
{
|
||||
FreezeDetectorRunnable()
|
||||
{
|
||||
_loops = 0;
|
||||
_lastChange = 0;
|
||||
_delaytime = 0;
|
||||
|
||||
Reference in New Issue
Block a user