mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-17 02:40:28 +00:00
Run clang-format
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
|
||||
* and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
*/
|
||||
|
||||
#include "MoveToRpgTargetAction.h"
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "ChooseRpgTargetAction.h"
|
||||
#include "Event.h"
|
||||
@@ -13,11 +15,13 @@ bool MoveToRpgTargetAction::Execute(Event event)
|
||||
{
|
||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||
Unit* unit = botAI->GetUnit(guidP);
|
||||
if (unit && !unit->IsInWorld()) {
|
||||
if (unit && !unit->IsInWorld())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
GameObject* go = botAI->GetGameObject(guidP);
|
||||
if (go && !go->IsInWorld()) {
|
||||
if (go && !go->IsInWorld())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Player* player = guidP.GetPlayer();
|
||||
@@ -48,7 +52,7 @@ bool MoveToRpgTargetAction::Execute(Event event)
|
||||
|
||||
if (guidPP.IsPlayer())
|
||||
{
|
||||
AI_VALUE(GuidSet&,"ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target"));
|
||||
AI_VALUE(GuidSet&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target"));
|
||||
|
||||
RESET_AI_VALUE(GuidPosition, "rpg target");
|
||||
return false;
|
||||
@@ -56,7 +60,8 @@ bool MoveToRpgTargetAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
|
||||
if ((unit && unit->isMoving() && !urand(0, 20)) || !ChooseRpgTargetAction::isFollowValid(bot, wo) || guidP.distance(bot) > sPlayerbotAIConfig->reactDistance * 2 || !urand(0, 50))
|
||||
if ((unit && unit->isMoving() && !urand(0, 20)) || !ChooseRpgTargetAction::isFollowValid(bot, wo) ||
|
||||
guidP.distance(bot) > sPlayerbotAIConfig->reactDistance * 2 || !urand(0, 50))
|
||||
{
|
||||
AI_VALUE(GuidSet&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target"));
|
||||
RESET_AI_VALUE(GuidPosition, "rpg target");
|
||||
@@ -77,19 +82,20 @@ bool MoveToRpgTargetAction::Execute(Event event)
|
||||
if (bot->IsWithinLOS(x, y, z))
|
||||
{
|
||||
if (!unit || !unit->isMoving())
|
||||
angle = wo->GetAngle(bot) + (M_PI * irand(-25, 25) / 100.0); //Closest 45 degrees towards the target
|
||||
angle = wo->GetAngle(bot) + (M_PI * irand(-25, 25) / 100.0); // Closest 45 degrees towards the target
|
||||
else
|
||||
angle = wo->GetOrientation() + (M_PI * irand(-25, 25) / 100.0); //45 degrees infront of target (leading it's movement)
|
||||
angle = wo->GetOrientation() +
|
||||
(M_PI * irand(-25, 25) / 100.0); // 45 degrees infront of target (leading it's movement)
|
||||
|
||||
distance = frand(0.5f, 1.f);
|
||||
}
|
||||
else
|
||||
angle = 2 * M_PI * urand(0, 100) / 100.0; //A circle around the target.
|
||||
angle = 2 * M_PI * urand(0, 100) / 100.0; // A circle around the target.
|
||||
|
||||
x += cos(angle) * INTERACTION_DISTANCE * distance;
|
||||
y += sin(angle) * INTERACTION_DISTANCE * distance;
|
||||
|
||||
//WaitForReach(distance);
|
||||
// WaitForReach(distance);
|
||||
|
||||
bool couldMove = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user