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,36 +1,41 @@
/*
* 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 "SpellCastUsefulValue.h"
#include "LastSpellCastValue.h"
#include "Playerbots.h"
bool SpellCastUsefulValue::Calculate()
{
uint32 spellid = AI_VALUE2(uint32, "spell id", qualifier);
if (!spellid)
return true; // there can be known alternatives
if (!spellid)
return true; // there can be known alternatives
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
return true; // there can be known alternatives
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
return true; // there can be known alternatives
if ((spellInfo->Attributes & SPELL_ATTR0_ON_NEXT_SWING_NO_DAMAGE) != 0 || (spellInfo->Attributes & SPELL_ATTR0_ON_NEXT_SWING) != 0)
{
if (Spell* spell = bot->GetCurrentSpell(CURRENT_MELEE_SPELL))
if (spell->m_spellInfo->Id == spellid && spell->IsNextMeleeSwingSpell() && bot->HasUnitState(UNIT_STATE_MELEE_ATTACKING))
return false;
}
else
{
if ((spellInfo->Attributes & SPELL_ATTR0_ON_NEXT_SWING_NO_DAMAGE) != 0 ||
(spellInfo->Attributes & SPELL_ATTR0_ON_NEXT_SWING) != 0)
{
if (Spell* spell = bot->GetCurrentSpell(CURRENT_MELEE_SPELL))
if (spell->m_spellInfo->Id == spellid && spell->IsNextMeleeSwingSpell() &&
bot->HasUnitState(UNIT_STATE_MELEE_ATTACKING))
return false;
}
else
{
// uint32 lastSpellId = AI_VALUE(LastSpellCast&, "last spell cast").id;
// if (spellid == lastSpellId)
// if (Spell* const pSpell = bot->FindCurrentSpellBySpellId(lastSpellId))
// return false;
}
}
if (spellInfo->IsAutoRepeatRangedSpell() && bot->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL) && bot->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo->Id == spellid)
if (spellInfo->IsAutoRepeatRangedSpell() && bot->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL) &&
bot->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo->Id == spellid)
{
return false;
}
@@ -64,5 +69,5 @@ bool SpellCastUsefulValue::Calculate()
return false;
}
return true;
return true;
}