Remove active effects from the player when transforming

pull/3169/head
Evil Eye 3 years ago
parent caafd0c667
commit ec735529da

@ -1787,10 +1787,15 @@ namespace MWMechanics
// Update the GUI only when called on the player
MWBase::WindowManager* windowManager = MWBase::Environment::get().getWindowManager();
// Transforming removes all temporary effects
actor.getClass().getCreatureStats(actor).getActiveSpells().purge([] (const auto& params)
{
return params.getType() == ESM::ActiveSpells::Type_Consumable || params.getType() == ESM::ActiveSpells::Type_Temporary;
}, actor);
mActors.updateActor(actor, 0.f);
if (werewolf)
{
// Remove CE enchantments before saving stats
mActors.updateActor(actor, 0.f);
player->saveStats();
player->setWerewolfStats();
windowManager->forceHide(MWGui::GW_Inventory);

Loading…
Cancel
Save