예제 #1
0
파일: actors.cpp 프로젝트: Riverwolf/openmw
    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);
        }
    }
예제 #2
0
파일: stat.hpp 프로젝트: Adrian-Revk/openmw
 void setModifier (const T& modifier)
 {
     T diff =  modifier - mStatic.getModifier();
     mStatic.setModifier (modifier);
     setCurrent (getCurrent()+diff);
 }