- Possible loop fix for Call of the Elements (#1649)

This commit is contained in:
kadeshar
2025-09-21 20:31:16 +02:00
committed by GitHub
parent 7f9eb9f1a0
commit c9fb2e35cb
2 changed files with 45 additions and 31 deletions

View File

@@ -121,9 +121,10 @@ bool SpiritWalkTrigger::IsActive()
// Fires the trigger if at least 2 of the totem slots are empty or out of range. // Fires the trigger if at least 2 of the totem slots are empty or out of range.
bool CallOfTheElementsTrigger::IsActive() bool CallOfTheElementsTrigger::IsActive()
{ {
Player* bot = botAI->GetBot(); if (!botAI->CanCastSpell(SPELL_CALL_OF_THE_ELEMENTS, bot, true))
if (!bot->HasSpell(66842)) {
return false; return false;
}
int emptyCount = 0; int emptyCount = 0;
static const uint8 slots[] = {SUMMON_SLOT_TOTEM_EARTH, SUMMON_SLOT_TOTEM_FIRE, SUMMON_SLOT_TOTEM_WATER, static const uint8 slots[] = {SUMMON_SLOT_TOTEM_EARTH, SUMMON_SLOT_TOTEM_FIRE, SUMMON_SLOT_TOTEM_WATER,
@@ -132,16 +133,32 @@ bool CallOfTheElementsTrigger::IsActive()
for (uint8 slot : slots) for (uint8 slot : slots)
{ {
ObjectGuid guid = bot->m_SummonSlot[slot]; ObjectGuid guid = bot->m_SummonSlot[slot];
bool possibleEmpty = false;
if (guid.IsEmpty()) if (guid.IsEmpty())
{ {
++emptyCount; possibleEmpty = true;
continue;
} }
else
{
Creature* totem = bot->GetMap()->GetCreature(guid); Creature* totem = bot->GetMap()->GetCreature(guid);
if (!totem || totem->GetDistance(bot) > 30.0f) if (!totem || totem->GetDistance(bot) > 30.0f)
{ {
++emptyCount; possibleEmpty = true;
}
}
if (!possibleEmpty)
{
continue;
}
if ((slot == SUMMON_SLOT_TOTEM_EARTH && bot->HasSpell(SPELL_STONESKIN_TOTEM_RANK_1)) ||
(slot == SUMMON_SLOT_TOTEM_FIRE && bot->HasSpell(SPELL_SEARING_TOTEM_RANK_1)) ||
(slot == SUMMON_SLOT_TOTEM_WATER && bot->HasSpell(SPELL_HEALING_STREAM_TOTEM_RANK_1)) ||
(slot == SUMMON_SLOT_TOTEM_AIR && bot->HasSpell(SPELL_NATURE_RESISTANCE_TOTEM_RANK_1)))
{
emptyCount++;
} }
} }
@@ -191,7 +208,6 @@ bool TotemicRecallTrigger::IsActive()
} }
} }
{
ObjectGuid guid = bot->m_SummonSlot[SUMMON_SLOT_TOTEM_WATER]; ObjectGuid guid = bot->m_SummonSlot[SUMMON_SLOT_TOTEM_WATER];
if (!guid.IsEmpty()) if (!guid.IsEmpty())
{ {
@@ -206,10 +222,8 @@ bool TotemicRecallTrigger::IsActive()
return false; return false;
} }
} }
}
{ guid = bot->m_SummonSlot[SUMMON_SLOT_TOTEM_FIRE];
ObjectGuid guid = bot->m_SummonSlot[SUMMON_SLOT_TOTEM_FIRE];
if (!guid.IsEmpty()) if (!guid.IsEmpty())
{ {
Creature* totem = bot->GetMap()->GetCreature(guid); Creature* totem = bot->GetMap()->GetCreature(guid);
@@ -223,7 +237,6 @@ bool TotemicRecallTrigger::IsActive()
return false; return false;
} }
} }
}
return !bot->m_SummonSlot[SUMMON_SLOT_TOTEM_EARTH].IsEmpty() || return !bot->m_SummonSlot[SUMMON_SLOT_TOTEM_EARTH].IsEmpty() ||
!bot->m_SummonSlot[SUMMON_SLOT_TOTEM_FIRE].IsEmpty() || !bot->m_SummonSlot[SUMMON_SLOT_TOTEM_FIRE].IsEmpty() ||
@@ -409,7 +422,7 @@ bool NoAirTotemTrigger::IsActive()
bool SetTotemTrigger::IsActive() bool SetTotemTrigger::IsActive()
{ {
if (!bot->HasSpell(66842)) if (!bot->HasSpell(SPELL_CALL_OF_THE_ELEMENTS))
return false; return false;
if (!bot->HasSpell(requiredSpellId)) if (!bot->HasSpell(requiredSpellId))
return false; return false;

View File

@@ -38,6 +38,7 @@ const uint32 SPELL_WINDFURY_TOTEM_RANK_1 = 8512;
const uint32 SPELL_NATURE_RESISTANCE_TOTEM_RANK_1 = 10595; const uint32 SPELL_NATURE_RESISTANCE_TOTEM_RANK_1 = 10595;
const uint32 SPELL_TOTEM_OF_WRATH_RANK_1 = 30706; const uint32 SPELL_TOTEM_OF_WRATH_RANK_1 = 30706;
const uint32 SPELL_TOTEMIC_RECALL = 36936; const uint32 SPELL_TOTEMIC_RECALL = 36936;
const uint32 SPELL_CALL_OF_THE_ELEMENTS = 66842;
class MainHandWeaponNoImbueTrigger : public BuffTrigger class MainHandWeaponNoImbueTrigger : public BuffTrigger
{ {