Core/Players: Fixed spells being unintentionally removed by talent swaps when they are learned from more than one spell (affects balance druid Celesial Alignment and Incarnation)

Port From (https://github.com/TrinityCore/TrinityCore/commit/2c6ddcce3d6374a82214bb0ddb9d7432351982c9)
This commit is contained in:
Hondacrx
2024-10-09 00:25:13 -04:00
parent 4c3074d462
commit 3c3c84b736
3 changed files with 27 additions and 1 deletions
@@ -2331,6 +2331,18 @@ namespace Game.Entities
foreach (var spellNode in spell_bounds)
{
bool hasOtherSpellTeachingThis = Global.SpellMgr.GetSpellLearnedBySpellMapBounds(spellNode.Spell).Any(learnNode =>
{
if (learnNode.SourceSpell == spellId)
return false;
if (!learnNode.Active)
return false;
return HasSpell(learnNode.SourceSpell);
});
if (hasOtherSpellTeachingThis)
continue;
RemoveSpell(spellNode.Spell, disabled);
if (spellNode.OverridesSpell != 0)
RemoveOverrideSpell(spellNode.OverridesSpell, spellNode.Spell);