adjust initial magicka based on Fortify Maximum Magicka effect

This commit is contained in:
Marc Zinnschlag 2010-09-30 15:58:31 +02:00
parent 98405a5716
commit 6fe6f3d282
3 changed files with 23 additions and 2 deletions

View file

@ -66,6 +66,20 @@ namespace MWMechanics
}
}
EffectParam MagicEffects::get (const EffectKey& key) const
{
Collection::const_iterator iter = mCollection.find (key);
if (iter==mCollection.end())
{
return EffectParam();
}
else
{
return iter->second;
}
}
MagicEffects MagicEffects::diff (const MagicEffects& prev, const MagicEffects& now)
{
MagicEffects result;

View file

@ -17,6 +17,8 @@ namespace MWMechanics
EffectKey();
EffectKey (int id, int arg = -1) : mId (id), mArg (arg) {}
EffectKey (const ESM::ENAMstruct& effect);
};
@ -64,6 +66,9 @@ namespace MWMechanics
void add (const EffectKey& key, const EffectParam& param);
EffectParam get (const EffectKey& key) const;
///< This function can safely be used for keys that are not present.
static MagicEffects diff (const MagicEffects& prev, const MagicEffects& now);
///< Return changes from \a prev to \a now.
};

View file

@ -147,9 +147,11 @@ namespace MWMechanics
int agility = creatureStats.mAttributes[3].getBase();
int endurance = creatureStats.mAttributes[5].getBase();
double magickaFactor = creatureStats.mMagicEffects.get (EffectKey (84)).mMagnitude*0.1 + 0.5;
creatureStats.mDynamic[0].setBase (static_cast<int> (0.5 * (strength + endurance)));
// TODO: calculate factor
creatureStats.mDynamic[1].setBase (static_cast<int> (intelligence + 1 * intelligence));
creatureStats.mDynamic[1].setBase (static_cast<int> (intelligence +
magickaFactor * intelligence));
creatureStats.mDynamic[2].setBase (strength+willpower+agility+endurance);
for (int i=0; i<3; ++i)