mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 03:53:52 +00:00
Issue #256: moved magic effects update from MechanicsManager to Actors
This commit is contained in:
parent
1fddbf9a40
commit
e56ff9283d
4 changed files with 21 additions and 21 deletions
|
@ -14,7 +14,10 @@ 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);
|
// magic effects
|
||||||
|
adjustMagicEffects (ptr);
|
||||||
|
|
||||||
|
CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||||
|
|
||||||
// calculate dynamic stats
|
// calculate dynamic stats
|
||||||
int strength = creatureStats.mAttributes[0].getBase();
|
int strength = creatureStats.mAttributes[0].getBase();
|
||||||
|
@ -41,6 +44,21 @@ namespace MWMechanics
|
||||||
MWWorld::Class::get (ptr).getNpcStats (ptr));
|
MWWorld::Class::get (ptr).getNpcStats (ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Actors::adjustMagicEffects (const MWWorld::Ptr& creature)
|
||||||
|
{
|
||||||
|
CreatureStats& creatureStats = MWWorld::Class::get (creature).getCreatureStats (creature);
|
||||||
|
|
||||||
|
MagicEffects now = creatureStats.mSpells.getMagicEffects();
|
||||||
|
|
||||||
|
/// \todo add effects from active spells and equipment
|
||||||
|
|
||||||
|
MagicEffects diff = MagicEffects::diff (creatureStats.mMagicEffects, now);
|
||||||
|
|
||||||
|
creatureStats.mMagicEffects = now;
|
||||||
|
|
||||||
|
// TODO apply diff to other stats
|
||||||
|
}
|
||||||
|
|
||||||
Actors::Actors() : mDuration (0) {}
|
Actors::Actors() : mDuration (0) {}
|
||||||
|
|
||||||
void Actors::addActor (const MWWorld::Ptr& ptr)
|
void Actors::addActor (const MWWorld::Ptr& ptr)
|
||||||
|
|
|
@ -23,6 +23,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
void updateNpc (const MWWorld::Ptr& ptr, float duration, bool paused);
|
void updateNpc (const MWWorld::Ptr& ptr, float duration, bool paused);
|
||||||
|
|
||||||
|
void adjustMagicEffects (const MWWorld::Ptr& creature);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Actors();
|
Actors();
|
||||||
|
|
|
@ -138,26 +138,8 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// magic effects
|
|
||||||
adjustMagicEffects (ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::adjustMagicEffects (MWWorld::Ptr& creature)
|
|
||||||
{
|
|
||||||
MWMechanics::CreatureStats& creatureStats =
|
|
||||||
MWWorld::Class::get (creature).getCreatureStats (creature);
|
|
||||||
|
|
||||||
MagicEffects now = creatureStats.mSpells.getMagicEffects();
|
|
||||||
|
|
||||||
/// \todo add effects from active spells and equipment
|
|
||||||
|
|
||||||
MagicEffects diff = MagicEffects::diff (creatureStats.mMagicEffects, now);
|
|
||||||
|
|
||||||
creatureStats.mMagicEffects = now;
|
|
||||||
|
|
||||||
// TODO apply diff to other stats
|
|
||||||
}
|
|
||||||
|
|
||||||
MechanicsManager::MechanicsManager()
|
MechanicsManager::MechanicsManager()
|
||||||
: mUpdatePlayer (true), mClassSelected (false),
|
: mUpdatePlayer (true), mClassSelected (false),
|
||||||
|
|
|
@ -31,8 +31,6 @@ namespace MWMechanics
|
||||||
///< build player according to stored class/race/birthsign information. Will
|
///< build player according to stored class/race/birthsign information. Will
|
||||||
/// default to the values of the ESM::NPC object, if no explicit information is given.
|
/// default to the values of the ESM::NPC object, if no explicit information is given.
|
||||||
|
|
||||||
void adjustMagicEffects (MWWorld::Ptr& creature);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MechanicsManager ();
|
MechanicsManager ();
|
||||||
|
|
Loading…
Reference in a new issue