mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 03:53:54 +00:00
Issue #256: moved dynamic stats update from MechanicsManager to Actors
This commit is contained in:
parent
fdfddc8be7
commit
1fddbf9a40
2 changed files with 19 additions and 17 deletions
|
@ -8,11 +8,30 @@
|
|||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
#include "creaturestats.hpp"
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
void Actors::updateActor (const MWWorld::Ptr& ptr, float duration)
|
||||
{
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
|
||||
// calculate dynamic stats
|
||||
int strength = creatureStats.mAttributes[0].getBase();
|
||||
int intelligence = creatureStats.mAttributes[1].getBase();
|
||||
int willpower = creatureStats.mAttributes[2].getBase();
|
||||
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)));
|
||||
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)
|
||||
creatureStats.mDynamic[i].setCurrent (creatureStats.mDynamic[i].getModified());
|
||||
}
|
||||
|
||||
void Actors::updateNpc (const MWWorld::Ptr& ptr, float duration, bool paused)
|
||||
|
|
|
@ -141,23 +141,6 @@ namespace MWMechanics
|
|||
|
||||
// magic effects
|
||||
adjustMagicEffects (ptr);
|
||||
|
||||
// calculate dynamic stats
|
||||
int strength = creatureStats.mAttributes[0].getBase();
|
||||
int intelligence = creatureStats.mAttributes[1].getBase();
|
||||
int willpower = creatureStats.mAttributes[2].getBase();
|
||||
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)));
|
||||
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)
|
||||
creatureStats.mDynamic[i].setCurrent (creatureStats.mDynamic[i].getModified());
|
||||
}
|
||||
|
||||
void MechanicsManager::adjustMagicEffects (MWWorld::Ptr& creature)
|
||||
|
|
Loading…
Reference in a new issue