1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00
OpenMW/apps/openmw/mwmechanics/npcstats.hpp

139 lines
4.7 KiB
C++
Raw Normal View History

2010-08-19 12:49:13 +02:00
#ifndef GAME_MWMECHANICS_NPCSTATS_H
#define GAME_MWMECHANICS_NPCSTATS_H
#include <map>
#include <set>
#include <string>
2012-09-15 17:12:42 +02:00
#include <vector>
2010-08-19 12:49:13 +02:00
2013-08-08 23:27:03 -07:00
#include "creaturestats.hpp"
namespace ESM
{
struct Class;
2014-02-16 15:06:34 +01:00
struct NpcStats;
}
2010-08-19 12:49:13 +02:00
namespace MWMechanics
{
/// \brief Additional stats for NPCs
2013-08-08 23:27:03 -07:00
class NpcStats : public CreatureStats
2010-08-19 12:49:13 +02:00
{
2012-11-09 14:42:09 +01:00
int mDisposition;
SkillValue mSkill[ESM::Skill::Length]; // SkillValue.mProgress used by the player only
2012-11-10 00:29:36 +01: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 17:12:42 +02: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 10:48:57 +02:00
std::set<std::string> mUsedIds;
// ---------------------------------------------------------------------------
2012-09-25 10:48:57 +02:00
/// Countdown to getting damage while underwater
float mTimeToStartDrowning;
bool mIsWerewolf;
public:
2011-01-18 10:45:29 +01:00
NpcStats();
2012-11-09 20:18:38 +01:00
int getBaseDisposition() const;
void setBaseDisposition(int disposition);
2012-11-10 00:29:36 +01: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 17:32:21 +01:00
bool isInFaction (const std::string& faction) const;
2015-02-04 23:15:12 +01: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 17:12:42 +02:00
2018-03-24 13:43:18 +03:00
void increaseSkill (int skillIndex, const ESM::Class& class_, bool preserveProgress, bool readBook = false);
2012-09-15 19:06:56 +02:00
2012-09-15 17:12:42 +02:00
int getLevelProgress() const;
int getLevelupAttributeMultiplier(int attribute) const;
int getSkillIncreasesForSpecialization(int spec) const;
2012-09-15 17:12:42 +02:00
void levelUp();
void updateHealth();
///< Calculate health based on endurance and strength.
/// Called at character creation.
2012-09-25 10:48:57 +02:00
void flagAsUsed (const std::string& id);
2015-01-16 17:56:19 +01:00
///< @note Id must be lower-case
2012-09-25 10:48:57 +02:00
bool hasBeenUsed (const std::string& id) const;
2015-01-16 17:56:19 +01:00
///< @note Id must be lower-case
2012-11-09 14:31:38 +01:00
int getBounty() const;
2012-11-09 14:31:38 +01: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 05:14:58 -07:00
void setWerewolf(bool set);
int getWerewolfKills() const;
2014-06-17 16:51:59 +02:00
/// Increments mWerewolfKills by 1.
void addWerewolfKill();
2013-08-27 17:13:49 -07: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 15:06:34 +01:00
void writeState (ESM::CreatureStats& state) const;
2014-02-16 15:06:34 +01:00
void writeState (ESM::NpcStats& state) const;
void readState (const ESM::CreatureStats& state);
2014-02-16 15:06:34 +01:00
void readState (const ESM::NpcStats& state);
2010-08-19 12:49:13 +02:00
};
}
#endif