1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 19:19:56 +00:00
openmw-tes3mp/apps/openmw/mwmechanics/creaturestats.hpp

173 lines
4.1 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;
2013-07-13 21:24:52 +00:00
bool mAttackingOrSpell;//for the player, this is true if the left mouse button is pressed, false if not.
2012-09-15 15:12:42 +00:00
int mAttackType;
2012-09-15 15:12:42 +00:00
2013-07-26 15:08:52 +00:00
std::string mLastHitObject; // The last object to hit this actor
2013-08-09 12:14:58 +00:00
protected:
bool mIsWerewolf;
Stat<int> mWerewolfAttributes[8];
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;
2013-08-04 02:29:44 +00:00
bool getAttackingOrSpell() const;
2013-07-13 21:24:52 +00:00
2012-07-22 14:29:54 +00:00
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);
2013-08-04 02:29:44 +00:00
void setAttackingOrSpell(bool attackingOrSpell);
2013-07-13 21:24:52 +00:00
enum AttackType
{
AT_Slash,
AT_Thrust,
AT_Chop
};
void setAttackType(int attackType) { mAttackType = attackType; }
int getAttackType() { return mAttackType; }
2012-07-22 14:29:54 +00:00
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
float getLevelHealthBonus() const;
void levelUp();
void updateHealth();
///< Calculate health based on endurance and strength.
/// Called at character creation and at level up.
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;
2013-07-26 15:08:52 +00:00
2013-07-31 19:25:14 +00:00
float getEvasion() const;
2013-07-26 15:08:52 +00:00
void setLastHitObject(const std::string &objectid);
const std::string &getLastHitObject() const;
};
}
#endif