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,13 +1,15 @@
/*
* 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 "AttackAction.h"
#include "CreatureAI.h"
#include "Event.h"
#include "LootObjectStack.h"
#include "Playerbots.h"
#include "ServerFacade.h"
#include "CreatureAI.h"
#include "Unit.h"
bool AttackAction::Execute(Event event)
@@ -15,8 +17,9 @@ bool AttackAction::Execute(Event event)
Unit* target = GetTarget();
if (!target)
return false;
if (!target->IsInWorld()) {
if (!target->IsInWorld())
{
return false;
}
return Attack(target);
@@ -36,7 +39,7 @@ bool AttackMyTargetAction::Execute(Event event)
return false;
}
botAI->GetAiObjectContext()->GetValue<GuidVector>("prioritized targets")->Set({guid});
bool result = Attack(botAI->GetUnit(guid));
if (result)
@@ -47,7 +50,8 @@ bool AttackMyTargetAction::Execute(Event event)
bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
{
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE || bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE ||
bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
{
if (verbose)
botAI->TellError("I cannot attack in flight");
@@ -109,16 +113,18 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
context->GetValue<Unit*>("current target")->Set(target);
context->GetValue<LootObjectStack*>("available loot")->Get()->Add(guid);
bool melee = bot->IsWithinMeleeRange(target) || botAI->IsMelee(bot);
bot->Attack(target, melee);
if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target)) {
if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target))
{
sServerFacade->SetFacingTo(bot, target);
}
botAI->ChangeEngine(BOT_STATE_COMBAT);
if (!bot->GetVictim()) {
if (!bot->GetVictim())
{
return false;
}
/* prevent pet dead immediately in group */
@@ -141,12 +147,6 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
return true;
}
bool AttackDuelOpponentAction::isUseful()
{
return AI_VALUE(Unit*, "duel target");
}
bool AttackDuelOpponentAction::isUseful() { return AI_VALUE(Unit*, "duel target"); }
bool AttackDuelOpponentAction::Execute(Event event)
{
return Attack(AI_VALUE(Unit*, "duel target"));
}
bool AttackDuelOpponentAction::Execute(Event event) { return Attack(AI_VALUE(Unit*, "duel target")); }