Reapply "Dungeon code cleanup"

This reverts commit 3f7f306124.
This commit is contained in:
Bobblybook
2024-10-20 15:59:42 +11:00
parent 3f7f306124
commit 159cd1ad71
16 changed files with 106 additions and 151 deletions

View File

@@ -14,7 +14,7 @@ bool AttackFrostTombAction::Execute(Event event)
for (auto i = targets.begin(); i != targets.end(); ++i)
{
Unit* unit = botAI->GetUnit(*i);
if (unit && unit->GetName() == "Frost Tomb")
if (unit && unit->GetEntry() == NPC_FROST_TOMB)
{
frostTomb = unit;
break;
@@ -31,7 +31,9 @@ bool AttackFrostTombAction::Execute(Event event)
bool AttackDalronnAction::Execute(Event event)
{
Unit* boss = AI_VALUE2(Unit*, "find target", "dalronn the controller");
if (!boss || AI_VALUE(Unit*, "current target") == boss)
if (!boss) { return false; }
if (AI_VALUE(Unit*, "current target") == boss)
{
return false;
}
@@ -42,10 +44,7 @@ bool IngvarStopCastingAction::Execute(Event event)
{
// Doesn't work, this action gets queued behind the current spell instead of interrupting it
Unit* boss = AI_VALUE2(Unit*, "find target", "ingvar the plunderer");
if (!boss)
{
return false;
}
if (!boss) { return false; }
int32 my_spell_id = AI_VALUE(uint32, "active spell");
if (!my_spell_id || my_spell_id == 0)
@@ -54,10 +53,7 @@ bool IngvarStopCastingAction::Execute(Event event)
}
Spell* spell = bot->FindCurrentSpellBySpellId(my_spell_id);
if (!spell)
{
return false;
}
if (!spell) { return false; }
// bot->Yell("cancelling spell="+std::to_string(my_spell_id), LANG_UNIVERSAL);
bot->InterruptSpell(spell->GetCurrentContainer(), false, true, true);
@@ -71,10 +67,7 @@ bool IngvarDodgeSmashAction::isUseful() { return !AI_VALUE2(bool, "behind", "cur
bool IngvarDodgeSmashAction::Execute(Event event)
{
Unit* boss = AI_VALUE2(Unit*, "find target", "ingvar the plunderer");
if (!boss)
{
return false;
}
if (!boss) { return false; }
float distance = bot->GetExactDist2d(boss->GetPosition());
// Extra units to move into the boss, instead of being just 1 pixel past his midpoint.
@@ -88,10 +81,7 @@ bool IngvarSmashReturnAction::isUseful() { return AI_VALUE2(bool, "behind", "cur
bool IngvarSmashReturnAction::Execute(Event event)
{
Unit* boss = AI_VALUE2(Unit*, "find target", "ingvar the plunderer");
if (!boss)
{
return false;
}
if (!boss) { return false; }
float distance = bot->GetExactDist2d(boss->GetPosition());
return Move(bot->GetAngle(boss), distance + bot->GetMeleeReach());