Allow spell casting during movement

This commit is contained in:
Yunfan Li
2024-08-03 15:37:10 +08:00
parent 7227ff11ab
commit 1a92743dfd
8 changed files with 263 additions and 221 deletions

View File

@@ -6,6 +6,7 @@
#include "LastMovementValue.h"
#include "Playerbots.h"
#include "Timer.h"
LastMovement::LastMovement() { clear(); }
@@ -38,17 +39,19 @@ void LastMovement::clear()
lastAreaTrigger = 0;
lastFlee = 0;
nextTeleport = 0;
msTime = 0;
lastdelayTime = 0;
}
void LastMovement::Set(Unit* follow)
{
Set(0, 0.0f, 0.0f, 0.0f, 0.0f);
Set(0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
setShort(WorldPosition());
setPath(TravelPath());
lastFollow = follow;
}
void LastMovement::Set(uint32 mapId, float x, float y, float z, float ori)
void LastMovement::Set(uint32 mapId, float x, float y, float z, float ori, float delayTime)
{
lastMoveToMapId = mapId;
lastMoveToX = x;
@@ -57,6 +60,8 @@ void LastMovement::Set(uint32 mapId, float x, float y, float z, float ori)
lastMoveToOri = ori;
lastFollow = nullptr;
lastMoveShort = WorldPosition(mapId, x, y, z, ori);
msTime = getMSTime();
lastdelayTime = delayTime;
}
void LastMovement::setShort(WorldPosition point)

View File

@@ -35,7 +35,7 @@ public:
void clear();
void Set(Unit* follow);
void Set(uint32 mapId, float x, float y, float z, float ori);
void Set(uint32 mapId, float x, float y, float z, float ori, float delayTime);
void setShort(WorldPosition point);
void setPath(TravelPath path);
@@ -50,7 +50,9 @@ public:
float lastMoveToY;
float lastMoveToZ;
float lastMoveToOri;
float lastdelayTime;
WorldPosition lastMoveShort;
uint32 msTime;
TravelPath lastPath;
time_t nextTeleport;
std::future<TravelPath> future;

View File

@@ -82,8 +82,7 @@ bool PartyMemberToHeal::Check(Unit* player)
// sServerFacade->GetDistance2d(bot, player) < (player->IsPlayer() && botAI->IsTank((Player*)player) ? 50.0f
// : 40.0f);
return player->GetMapId() == bot->GetMapId() && !player->IsCharmed() &&
bot->GetDistance2d(player) < sPlayerbotAIConfig->healDistance * 2 &&
bot->IsWithinLOS(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
bot->GetDistance2d(player) < sPlayerbotAIConfig->healDistance * 2 && bot->IsWithinLOSInMap(player);
}
Unit* PartyMemberToProtect::Calculate()