void Actors::calculateCreatureStatModifiers (const MWWorld::Ptr& ptr) { CreatureStats &creatureStats = MWWorld::Class::get(ptr).getCreatureStats(ptr); const MagicEffects &effects = creatureStats.getMagicEffects(); // attributes for(int i = 0;i < ESM::Attribute::Length;++i) { Stat<int> stat = creatureStats.getAttribute(i); stat.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifyAttribute, i)).mMagnitude - effects.get(EffectKey(ESM::MagicEffect::DrainAttribute, i)).mMagnitude); creatureStats.setAttribute(i, stat); } // dynamic stats for(int i = 0;i < 3;++i) { DynamicStat<float> stat = creatureStats.getDynamic(i); stat.setModifier(effects.get(EffectKey(80+i)).mMagnitude - effects.get(EffectKey(18+i)).mMagnitude); creatureStats.setDynamic(i, stat); } }
void setModifier (const T& modifier) { T diff = modifier - mStatic.getModifier(); mStatic.setModifier (modifier); setCurrent (getCurrent()+diff); }