1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 23:49:55 +00:00
openmw-tes3mp/apps/openmw/mwmechanics/npcstats.hpp

139 lines
4.7 KiB
C++
Raw Normal View History

2010-08-19 10:49:13 +00:00
#ifndef GAME_MWMECHANICS_NPCSTATS_H
#define GAME_MWMECHANICS_NPCSTATS_H
#include <map>
#include <set>
#include <string>
2012-09-15 15:12:42 +00:00
#include <vector>
2010-08-19 10:49:13 +00:00
2013-08-09 06:27:03 +00:00
#include "creaturestats.hpp"
namespace ESM
{
struct Class;
2014-02-16 14:06:34 +00:00
struct NpcStats;
}
2010-08-19 10:49:13 +00:00
namespace MWMechanics
{
/// \brief Additional stats for NPCs
2013-08-09 06:27:03 +00:00
class NpcStats : public CreatureStats
2010-08-19 10:49:13 +00:00
{
2012-11-09 13:42:09 +00:00
int mDisposition;
SkillValue mSkill[ESM::Skill::Length]; // SkillValue.mProgress used by the player only
2012-11-09 23:29:36 +00:00
int mReputation;
int mCrimeId;
// ----- used by the player only, maybe should be moved at some point -------
int mBounty;
int mWerewolfKills;
/// Used only for the player and for NPC's with ranks, modified by scripts; other NPCs have maximum one faction defined in their NPC record
std::map<std::string, int> mFactionRank;
std::set<std::string> mExpelled;
std::map<std::string, int> mFactionReputation;
2012-09-15 15:12:42 +00:00
int mLevelProgress; // 0-10
std::vector<int> mSkillIncreases; // number of skill increases for each attribute (resets after leveling up)
std::vector<int> mSpecIncreases; // number of skill increases for each specialization (accumulates throughout the entire game)
2012-09-25 08:48:57 +00:00
std::set<std::string> mUsedIds;
// ---------------------------------------------------------------------------
2012-09-25 08:48:57 +00:00
/// Countdown to getting damage while underwater
float mTimeToStartDrowning;
bool mIsWerewolf;
public:
2011-01-18 09:45:29 +00:00
NpcStats();
2012-11-09 19:18:38 +00:00
int getBaseDisposition() const;
void setBaseDisposition(int disposition);
2012-11-09 23:29:36 +00:00
int getReputation() const;
void setReputation(int reputation);
int getCrimeId() const;
void setCrimeId(int id);
const SkillValue& getSkill (int index) const;
SkillValue& getSkill (int index);
void setSkill(int index, const SkillValue& value);
int getFactionRank(const std::string &faction) const;
const std::map<std::string, int>& getFactionRanks() const;
/// Increase the rank in this faction by 1, if such a rank exists.
void raiseRank(const std::string& faction);
/// Lower the rank in this faction by 1, if such a rank exists.
void lowerRank(const std::string& faction);
/// Join this faction, setting the initial rank to 0.
void joinFaction(const std::string& faction);
const std::set<std::string>& getExpelled() const { return mExpelled; }
bool getExpelled(const std::string& factionID) const;
void expell(const std::string& factionID);
void clearExpelled(const std::string& factionID);
2015-01-27 16:32:21 +00:00
bool isInFaction (const std::string& faction) const;
2015-02-04 22:15:12 +00:00
float getSkillProgressRequirement (int skillIndex, const ESM::Class& class_) const;
void useSkill (int skillIndex, const ESM::Class& class_, int usageType = -1, float extraFactor=1.f);
///< Increase skill by usage.
2012-09-15 15:12:42 +00:00
2018-03-24 10:43:18 +00:00
void increaseSkill (int skillIndex, const ESM::Class& class_, bool preserveProgress, bool readBook = false);
2012-09-15 17:06:56 +00:00
2012-09-15 15:12:42 +00:00
int getLevelProgress() const;
int getLevelupAttributeMultiplier(int attribute) const;
int getSkillIncreasesForSpecialization(int spec) const;
2012-09-15 15:12:42 +00:00
void levelUp();
void updateHealth();
///< Calculate health based on endurance and strength.
/// Called at character creation.
2012-09-25 08:48:57 +00:00
void flagAsUsed (const std::string& id);
2015-01-16 16:56:19 +00:00
///< @note Id must be lower-case
2012-09-25 08:48:57 +00:00
bool hasBeenUsed (const std::string& id) const;
2015-01-16 16:56:19 +00:00
///< @note Id must be lower-case
2012-11-09 13:31:38 +00:00
int getBounty() const;
2012-11-09 13:31:38 +00:00
void setBounty (int bounty);
int getFactionReputation (const std::string& faction) const;
void setFactionReputation (const std::string& faction, int value);
bool hasSkillsForRank (const std::string& factionId, int rank) const;
bool isWerewolf() const;
2013-08-09 12:14:58 +00:00
void setWerewolf(bool set);
int getWerewolfKills() const;
2014-06-17 14:51:59 +00:00
/// Increments mWerewolfKills by 1.
void addWerewolfKill();
2013-08-28 00:13:49 +00:00
float getTimeToStartDrowning() const;
/// Sets time left for the creature to drown if it stays underwater.
/// @param time value from [0,20]
void setTimeToStartDrowning(float time);
2014-02-16 14:06:34 +00:00
void writeState (ESM::CreatureStats& state) const;
2014-02-16 14:06:34 +00:00
void writeState (ESM::NpcStats& state) const;
void readState (const ESM::CreatureStats& state);
2014-02-16 14:06:34 +00:00
void readState (const ESM::NpcStats& state);
2010-08-19 10:49:13 +00:00
};
}
#endif