fix(Core/Players): charmed players cast highest known spell rank (#26674)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Andrew
2026-07-18 21:23:51 -03:00
committed by GitHub
parent b391cfc8cd
commit 92bc564d88

View File

@@ -15838,6 +15838,24 @@ void Player::PrepareCharmAISpells()
}
}
}
// The selection above can leave a lower rank of a spell chain in a slot (e.g. the
// secondary damage slot for a caster whose top spells are ranks of one chain). While
// charmed the player should cast the highest rank it knows, so walk each slot up its
// chain to the top learned rank.
for (uint32& charmSpellId : m_charmAISpells)
{
if (!charmSpellId)
continue;
while (uint32 nextRank = sSpellMgr->GetNextSpellInChain(charmSpellId))
{
if (!HasActiveSpell(nextRank))
break;
charmSpellId = nextRank;
}
}
}
void Player::AddRefundReference(ObjectGuid itemGUID)