Remove spell effects on RemoveSpell

This commit is contained in:
Evil Eye 2025-08-02 12:16:46 +02:00
parent c89f88c4e6
commit 5ea3cca83b

View File

@ -537,7 +537,11 @@ namespace MWScript
return;
MWMechanics::CreatureStats& creatureStats = ptr.getClass().getCreatureStats(ptr);
creatureStats.getSpells().remove(id);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(id);
creatureStats.getSpells().remove(spell);
if (spell->mData.mType == ESM::Spell::ST_Ability || spell->mData.mType == ESM::Spell::ST_Blight
|| spell->mData.mType == ESM::Spell::ST_Curse || spell->mData.mType == ESM::Spell::ST_Disease)
creatureStats.getActiveSpells().removeEffectsBySourceSpellId(ptr, id);
MWBase::WindowManager* wm = MWBase::Environment::get().getWindowManager();