forked from mirror/openmw-tes3mp
Issue #342: handle magic effects 79-82 and 17-20
This commit is contained in:
parent
a3652f16ce
commit
76de2f7360
3 changed files with 34 additions and 1 deletions
|
@ -19,6 +19,7 @@ namespace MWMechanics
|
||||||
// magic effects
|
// magic effects
|
||||||
adjustMagicEffects (ptr);
|
adjustMagicEffects (ptr);
|
||||||
calculateDynamicStats (ptr);
|
calculateDynamicStats (ptr);
|
||||||
|
calculateCreatureStatModifiers (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actors::updateNpc (const MWWorld::Ptr& ptr, float duration, bool paused)
|
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);
|
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) {}
|
Actors::Actors() : mDuration (0) {}
|
||||||
|
|
||||||
void Actors::addActor (const MWWorld::Ptr& ptr)
|
void Actors::addActor (const MWWorld::Ptr& ptr)
|
||||||
|
|
|
@ -29,6 +29,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
void calculateDynamicStats (const MWWorld::Ptr& ptr);
|
void calculateDynamicStats (const MWWorld::Ptr& ptr);
|
||||||
|
|
||||||
|
void calculateCreatureStatModifiers (const MWWorld::Ptr& ptr);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Actors();
|
Actors();
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace MWMechanics
|
||||||
void modify (const T& diff)
|
void modify (const T& diff)
|
||||||
{
|
{
|
||||||
mStatic.modify (diff);
|
mStatic.modify (diff);
|
||||||
modifyCurrent (diff);
|
setCurrent (getCurrent()+diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCurrent (const T& value)
|
void setCurrent (const T& value)
|
||||||
|
@ -159,6 +159,13 @@ namespace MWMechanics
|
||||||
else if (mCurrent>getModified())
|
else if (mCurrent>getModified())
|
||||||
mCurrent = getModified();
|
mCurrent = getModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setModifier (const T& modifier)
|
||||||
|
{
|
||||||
|
T diff = modifier - mStatic.getModifier();
|
||||||
|
mStatic.setModifier (modifier);
|
||||||
|
setCurrent (getCurrent()+diff);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
Loading…
Reference in a new issue