From 46534e3abe354e535b9d97a8c566da0861546172 Mon Sep 17 00:00:00 2001 From: Yunfan Li <56597220+liyunfan1223@users.noreply.github.com> Date: Sat, 11 Jan 2025 01:41:56 +0800 Subject: [PATCH] Fix/Enhance warlock pet spells (#860) --- src/strategy/actions/GenericActions.cpp | 26 ++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/strategy/actions/GenericActions.cpp b/src/strategy/actions/GenericActions.cpp index 2731fdd7..9f76e1e2 100644 --- a/src/strategy/actions/GenericActions.cpp +++ b/src/strategy/actions/GenericActions.cpp @@ -24,21 +24,37 @@ bool TogglePetSpellAutoCastAction::Execute(Event event) { return false; } + // hack on high level spell after low level initialization + std::vector shouldRemove; + for (unsigned int& m_autospell : pet->m_autospells) + { + if (!pet->HasSpell(m_autospell)) + { + shouldRemove.push_back(m_autospell); + } + } + for (unsigned int spellId : shouldRemove) + { + auto autospellItr = std::find(pet->m_autospells.begin(), pet->m_autospells.end(), spellId); + if (autospellItr != pet->m_autospells.end()) + pet->m_autospells.erase(autospellItr); + } bool toggled = false; for (PetSpellMap::const_iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr) { if (itr->second.state == PETSPELL_REMOVED) continue; - + uint32 spellId = itr->first; const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (spellInfo->IsPassive()) + if (!spellInfo->IsAutocastable()) continue; bool shouldApply = true; - // imp's spell, felhunte's intelligence, cat stealth - if (spellId == 4511 || spellId == 1742 || spellId == 54424 || spellId == 57564 || spellId == 57565 || - spellId == 57566 || spellId == 57567 || spellId == 24450) + // spellId == 4511 || spellId == 54424 || spellId == 57564 || spellId == 57565 || + // spellId == 57566 || spellId == 57567 || + // cat stealth, prowl + if (spellId == 1742 || spellId == 24450) { shouldApply = false; }