mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-17 17:14:36 +00:00
Code style
This commit is contained in:
@@ -19,21 +19,27 @@ bool CheckMountStateAction::Execute(Event event)
|
||||
bool enemy = AI_VALUE(Unit*, "enemy player target");
|
||||
// ignore grind target in BG or bots will dismount near any creature (eg: the rams in AV)
|
||||
bool dps = AI_VALUE(Unit*, "dps target");
|
||||
bool fartarget = (enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), 40.0f)) ||
|
||||
bool fartarget =
|
||||
(enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), 40.0f)) ||
|
||||
(dps && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "dps target"), 50.0f));
|
||||
bool attackdistance = false;
|
||||
// bool chasedistance = false;
|
||||
float attack_distance = 35.0f;
|
||||
if (PlayerbotAI::IsMelee(bot)) {
|
||||
if (PlayerbotAI::IsMelee(bot))
|
||||
{
|
||||
attack_distance = 5.0f;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
attack_distance = 30.0f;
|
||||
}
|
||||
|
||||
if (dps || enemy)
|
||||
{
|
||||
Unit* currentTarget = AI_VALUE(Unit*, "current target");
|
||||
attackdistance = (enemy || dps) && currentTarget && sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "current target"), attack_distance);
|
||||
attackdistance =
|
||||
(enemy || dps) && currentTarget &&
|
||||
sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "current target"), attack_distance);
|
||||
}
|
||||
|
||||
if (bot->IsMounted() && attackdistance)
|
||||
|
||||
@@ -789,9 +789,9 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
|
||||
|
||||
float dx = cos(angle) * needToGo + bx;
|
||||
float dy = sin(angle) * needToGo + by;
|
||||
float dz; // = std::max(bz, tz); // calc accurate z position to avoid stuck
|
||||
float dz; // = std::max(bz, tz); // calc accurate z position to avoid stuck
|
||||
|
||||
if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD)) // target is moving forward, predict the position
|
||||
if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD)) // target is moving forward, predict the position
|
||||
{
|
||||
float timeToGo = MoveDelay(abs(needToGo));
|
||||
float targetMoveDist = timeToGo * target->GetSpeed(MOVE_RUN);
|
||||
@@ -799,8 +799,9 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
|
||||
dx += targetMoveDist * cos(target->GetOrientation());
|
||||
dy += targetMoveDist * sin(target->GetOrientation());
|
||||
}
|
||||
|
||||
if (distanceToTarget > CONTACT_DISTANCE) {
|
||||
|
||||
if (distanceToTarget > CONTACT_DISTANCE)
|
||||
{
|
||||
dz = bz + (tz - bz) * (needToGo / distanceToTarget);
|
||||
}
|
||||
else
|
||||
@@ -808,7 +809,8 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
|
||||
dz = tz;
|
||||
}
|
||||
|
||||
if (!bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), dx, dy, dz))
|
||||
if (!bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(),
|
||||
bot->GetPositionZ(), dx, dy, dz))
|
||||
return false;
|
||||
|
||||
return MoveTo(target->GetMapId(), dx, dy, dz);
|
||||
|
||||
Reference in New Issue
Block a user