Run clang-format

This commit is contained in:
Yunfan Li
2024-08-04 10:23:36 +08:00
parent 44da167492
commit 53611c9040
835 changed files with 35085 additions and 31861 deletions

View File

@@ -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;