mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Issue #256: moved dynamic stats update from MechanicsManager to Actors
This commit is contained in:
parent
fdfddc8be7
commit
1fddbf9a40
@ -8,11 +8,30 @@
|
|||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
|
||||||
|
#include "creaturestats.hpp"
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
void Actors::updateActor (const MWWorld::Ptr& ptr, float duration)
|
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)
|
void Actors::updateNpc (const MWWorld::Ptr& ptr, float duration, bool paused)
|
||||||
|
@ -141,23 +141,6 @@ namespace MWMechanics
|
|||||||
|
|
||||||
// magic effects
|
// magic effects
|
||||||
adjustMagicEffects (ptr);
|
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)
|
void MechanicsManager::adjustMagicEffects (MWWorld::Ptr& creature)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user