Files
mod-playerbots/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningTriggers.cpp
Bobblybook dd73fe8a90 Dungeon botAI bugfixes
- Utgarde Keep (Keleseth): Bots continue combat correctly after killing a frost tomb
- Utgarde Keep (Dalronn & Skarvald): Bots continue combat correctly after killing Dalronn
- Utgarde Keep (Ingvar): Tank correctly avoids Dark Smash in second phase
- Oculus (Drake combat): Bots more consistently attack the drakes in the air when flying around
- Halls of Lightning (Bjarngrim): Bots no longer acquire priority targets until in combat
2024-11-05 19:11:24 +11:00

94 lines
2.5 KiB
C++

#include "Playerbots.h"
#include "HallsOfLightningTriggers.h"
#include "AiObject.h"
#include "AiObjectContext.h"
bool StormforgedLieutenantTrigger::IsActive()
{
if (!botAI->IsDps(bot)) { return false; }
// Target is not findable from threat table using AI_VALUE2(),
// therefore need to search manually for the unit name
GuidVector targets = AI_VALUE(GuidVector, "possible targets");
for (auto& target : targets)
{
Unit* unit = botAI->GetUnit(target);
if (unit && unit->IsInCombat() &&
unit->GetEntry() == NPC_STORMFORGED_LIEUTENANT)
{
return true;
}
}
return false;
}
bool BjarngrimWhirlwindTrigger::IsActive()
{
Unit* boss = AI_VALUE2(Unit*, "find target", "general bjarngrim");
if (!boss) { return false; }
return boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(SPELL_WHIRLWIND_BJARNGRIM);
}
bool VolkhanTrigger::IsActive()
{
Unit* boss = AI_VALUE2(Unit*, "find target", "volkhan");
return boss && !botAI->IsTank(bot) && !botAI->IsHeal(bot);
}
bool IonarStaticOverloadTrigger::IsActive()
{
GuidVector members = AI_VALUE(GuidVector, "group members");
for (auto& member : members)
{
Unit* unit = botAI->GetUnit(member);
if (unit && unit->HasAura(SPELL_STATIC_OVERLOAD))
{
return true;
}
}
return false;
}
bool IonarBallLightningTrigger::IsActive()
{
if (botAI->IsMelee(bot)) { return false; }
Unit* boss = AI_VALUE2(Unit*, "find target", "ionar");
if (!boss) { return false; }
return boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(SPELL_BALL_LIGHTNING);
}
bool IonarTankAggroTrigger::IsActive()
{
if (!botAI->IsTank(bot)) { return false; }
Unit* boss = AI_VALUE2(Unit*, "find target", "ionar");
if (!boss) { return false; }
return AI_VALUE2(bool, "has aggro", "current target");
}
bool IonarDisperseTrigger::IsActive()
{
Unit* boss = AI_VALUE2(Unit*, "find target", "ionar");
if (!boss) { return false; }
return !bot->CanSeeOrDetect(boss) || boss->FindCurrentSpellBySpellId(SPELL_DISPERSE);
}
bool LokenRangedTrigger::IsActive()
{
return !botAI->IsMelee(bot) && AI_VALUE2(Unit*, "find target", "loken");
}
bool LokenLightningNovaTrigger::IsActive()
{
Unit* boss = AI_VALUE2(Unit*, "find target", "loken");
if (!boss) { return false; }
return boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(SPELL_LIGHTNING_NOVA);
}