Issue #342: handle magic effects 79-82 and 17-20

actorid
Marc Zinnschlag 13 years ago
parent a3652f16ce
commit 76de2f7360

@ -19,6 +19,7 @@ namespace MWMechanics
// magic effects
adjustMagicEffects (ptr);
calculateDynamicStats (ptr);
calculateCreatureStatModifiers (ptr);
}
void Actors::updateNpc (const MWWorld::Ptr& ptr, float duration, bool paused)
@ -67,6 +68,29 @@ namespace MWMechanics
creatureStats.mDynamic[2].setBase (strength+willpower+agility+endurance);
}
void Actors::calculateCreatureStatModifiers (const MWWorld::Ptr& ptr)
{
CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
// attributes
for (int i=0; i<5; ++i)
{
int modifier = creatureStats.mMagicEffects.get (EffectKey (79, i)).mMagnitude
- creatureStats.mMagicEffects.get (EffectKey (17, i)).mMagnitude;
creatureStats.mAttributes[0].setModifier (modifier);
}
// dynamic stats
for (int i=0; i<3; ++i)
{
int modifier = creatureStats.mMagicEffects.get (EffectKey (80+i)).mMagnitude
- creatureStats.mMagicEffects.get (EffectKey (18+i)).mMagnitude;
creatureStats.mDynamic[0].setModifier (modifier);
}
}
Actors::Actors() : mDuration (0) {}
void Actors::addActor (const MWWorld::Ptr& ptr)

@ -29,6 +29,8 @@ namespace MWMechanics
void calculateDynamicStats (const MWWorld::Ptr& ptr);
void calculateCreatureStatModifiers (const MWWorld::Ptr& ptr);
public:
Actors();

@ -147,7 +147,7 @@ namespace MWMechanics
void modify (const T& diff)
{
mStatic.modify (diff);
modifyCurrent (diff);
setCurrent (getCurrent()+diff);
}
void setCurrent (const T& value)
@ -159,6 +159,13 @@ namespace MWMechanics
else if (mCurrent>getModified())
mCurrent = getModified();
}
void setModifier (const T& modifier)
{
T diff = modifier - mStatic.getModifier();
mStatic.setModifier (modifier);
setCurrent (getCurrent()+diff);
}
};
template<typename T>

Loading…
Cancel
Save