1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 06:39:49 +00:00
OpenMW/apps/openmw/mwmechanics/creaturestats.hpp

142 lines
3.3 KiB
C++
Raw Normal View History

#ifndef GAME_MWMECHANICS_CREATURESTATS_H
#define GAME_MWMECHANICS_CREATURESTATS_H
#include <set>
#include <string>
2012-07-22 14:29:54 +00:00
#include <stdexcept>
#include "stat.hpp"
#include "magiceffects.hpp"
#include "spells.hpp"
#include "activespells.hpp"
#include "aisequence.hpp"
namespace MWMechanics
{
2012-07-22 14:29:54 +00:00
/// \brief Common creature stats
///
///
class CreatureStats
{
Stat<int> mAttributes[8];
2012-09-15 15:12:42 +00:00
DynamicStat<float> mDynamic[3]; // health, magicka, fatigue
2010-09-15 13:32:35 +00:00
int mLevel;
Spells mSpells;
ActiveSpells mActiveSpells;
MagicEffects mMagicEffects;
int mAiSettings[4];
AiSequence mAiSequence;
2012-09-15 15:12:42 +00:00
float mLevelHealthBonus;
bool mDead;
2013-03-18 09:46:45 +00:00
bool mDied;
int mFriendlyHits;
bool mTalkedTo;
bool mAlarmed;
bool mAttacked;
bool mHostile;
2012-09-15 15:12:42 +00:00
2012-07-22 14:29:54 +00:00
public:
2012-09-15 15:12:42 +00:00
CreatureStats();
2012-07-22 14:29:54 +00:00
const Stat<int> & getAttribute(int index) const;
2012-09-15 15:12:42 +00:00
const DynamicStat<float> & getHealth() const;
2012-07-22 14:29:54 +00:00
2012-09-15 15:12:42 +00:00
const DynamicStat<float> & getMagicka() const;
2012-07-22 14:29:54 +00:00
2012-09-15 15:12:42 +00:00
const DynamicStat<float> & getFatigue() const;
2012-07-22 14:29:54 +00:00
const DynamicStat<float> & getDynamic (int index) const;
2012-07-22 14:29:54 +00:00
const Spells & getSpells() const;
const ActiveSpells & getActiveSpells() const;
const MagicEffects & getMagicEffects() const;
int getLevel() const;
int getAiSetting (int index) const;
///< 0: hello, 1 fight, 2 flee, 3 alarm
2012-07-22 14:29:54 +00:00
Stat<int> & getAttribute(int index);
Spells & getSpells();
ActiveSpells & getActiveSpells();
MagicEffects & getMagicEffects();
void setAttribute(int index, const Stat<int> &value);
2012-09-15 15:12:42 +00:00
void setHealth(const DynamicStat<float> &value);
2012-07-22 14:29:54 +00:00
2012-09-15 15:12:42 +00:00
void setMagicka(const DynamicStat<float> &value);
2012-07-22 14:29:54 +00:00
2012-09-15 15:12:42 +00:00
void setFatigue(const DynamicStat<float> &value);
2012-07-22 14:29:54 +00:00
void setDynamic (int index, const DynamicStat<float> &value);
2012-07-22 14:29:54 +00:00
void setSpells(const Spells &spells);
void setActiveSpells(const ActiveSpells &active);
void setMagicEffects(const MagicEffects &effects);
void setLevel(int level);
void setAiSetting (int index, int value);
///< 0: hello, 1 fight, 2 flee, 3 alarm
const AiSequence& getAiSequence() const;
AiSequence& getAiSequence();
float getFatigueTerm() const;
///< Return effective fatigue
2012-09-15 15:12:42 +00:00
// small hack to allow the fact that Health permanently increases by 10% of endurance on each level up
void increaseLevelHealthBonus(float value);
float getLevelHealthBonus() const;
bool isDead() const;
2013-03-18 09:46:45 +00:00
bool hasDied() const;
void clearHasDied();
void resurrect();
2012-11-09 17:16:29 +00:00
bool hasCommonDisease() const;
bool hasBlightDisease() const;
int getFriendlyHits() const;
///< Number of friendly hits received.
void friendlyHit();
///< Increase number of friendly hits by one.
bool hasTalkedToPlayer() const;
///< Has this creature talked with the player before?
void talkedToPlayer();
bool isAlarmed() const;
void setAlarmed (bool alarmed);
bool getAttacked() const;
void setAttacked (bool attacked);
bool isHostile() const;
void setHostile (bool hostile);
bool getCreatureTargetted() const;
};
}
#endif