You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
15 years ago
|
|
||
|
#include "creature.hpp"
|
||
|
|
||
|
#include <components/esm/loadcrea.hpp>
|
||
|
|
||
|
#include "../mwmechanics/creaturestats.hpp"
|
||
|
|
||
15 years ago
|
#include "../mwworld/ptr.hpp"
|
||
15 years ago
|
|
||
15 years ago
|
namespace MWClass
|
||
15 years ago
|
{
|
||
15 years ago
|
MWMechanics::CreatureStats& Creature::getCreatureStats (const MWWorld::Ptr& ptr) const
|
||
15 years ago
|
{
|
||
|
if (!ptr.getRefData().getCreatureStats().get())
|
||
|
{
|
||
|
boost::shared_ptr<MWMechanics::CreatureStats> stats (
|
||
|
new MWMechanics::CreatureStats);
|
||
|
|
||
15 years ago
|
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref = ptr.get<ESM::Creature>();
|
||
15 years ago
|
|
||
|
stats->mAttributes[0].set (ref->base->data.strength);
|
||
|
stats->mAttributes[1].set (ref->base->data.intelligence);
|
||
|
stats->mAttributes[2].set (ref->base->data.willpower);
|
||
|
stats->mAttributes[3].set (ref->base->data.agility);
|
||
|
stats->mAttributes[4].set (ref->base->data.speed);
|
||
|
stats->mAttributes[5].set (ref->base->data.endurance);
|
||
|
stats->mAttributes[6].set (ref->base->data.personality);
|
||
|
stats->mAttributes[7].set (ref->base->data.luck);
|
||
|
stats->mDynamic[0].set (ref->base->data.health);
|
||
|
stats->mDynamic[1].set (ref->base->data.mana);
|
||
|
stats->mDynamic[2].set (ref->base->data.fatigue);
|
||
|
|
||
|
ptr.getRefData().getCreatureStats() = stats;
|
||
|
}
|
||
|
|
||
|
return *ptr.getRefData().getCreatureStats();
|
||
|
}
|
||
|
|
||
|
void Creature::registerSelf()
|
||
|
{
|
||
|
boost::shared_ptr<Class> instance (new Creature);
|
||
|
|
||
|
registerClass (typeid (ESM::Creature).name(), instance);
|
||
|
}
|
||
|
}
|