mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-04 22:07:52 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user