|
|
|
@ -465,16 +465,6 @@ namespace MWScript
|
|
|
|
|
{
|
|
|
|
|
// Apply looping particles immediately for constant effects
|
|
|
|
|
MWBase::Environment::get().getWorld()->applyLoopingParticles(ptr);
|
|
|
|
|
|
|
|
|
|
// The spell may have an instant effect which must be handled immediately.
|
|
|
|
|
for (const auto& effect : creatureStats.getSpells().getMagicEffects())
|
|
|
|
|
{
|
|
|
|
|
if (effect.second.getMagnitude() <= 0)
|
|
|
|
|
continue;
|
|
|
|
|
MWMechanics::CastSpell cast(ptr, ptr);
|
|
|
|
|
if (cast.applyInstantEffect(ptr, ptr, effect.first, effect.second.getMagnitude()))
|
|
|
|
|
creatureStats.getSpells().purgeEffect(effect.first.mId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -491,7 +481,18 @@ namespace MWScript
|
|
|
|
|
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
ptr.getClass().getCreatureStats (ptr).getSpells().remove (id);
|
|
|
|
|
MWMechanics::CreatureStats& creatureStats = ptr.getClass().getCreatureStats(ptr);
|
|
|
|
|
// The spell may have an instant effect which must be handled before the spell's removal.
|
|
|
|
|
for (const auto& effect : creatureStats.getSpells().getMagicEffects())
|
|
|
|
|
{
|
|
|
|
|
if (effect.second.getMagnitude() <= 0)
|
|
|
|
|
continue;
|
|
|
|
|
MWMechanics::CastSpell cast(ptr, ptr);
|
|
|
|
|
if (cast.applyInstantEffect(ptr, ptr, effect.first, effect.second.getMagnitude()))
|
|
|
|
|
creatureStats.getSpells().purgeEffect(effect.first.mId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
creatureStats.getSpells().remove (id);
|
|
|
|
|
|
|
|
|
|
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
|
|
|
|
|
|
|
|
|
|