2010-08-19 10:49:13 +00:00
|
|
|
#ifndef GAME_MWMECHANICS_NPCSTATS_H
|
|
|
|
#define GAME_MWMECHANICS_NPCSTATS_H
|
|
|
|
|
|
|
|
#include <map>
|
2012-04-07 16:37:41 +00:00
|
|
|
#include <set>
|
2012-07-06 13:50:26 +00:00
|
|
|
#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"
|
|
|
|
|
2012-07-06 19:07:04 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
struct Class;
|
2014-02-16 14:06:34 +00:00
|
|
|
struct NpcStats;
|
2012-07-06 19:07:04 +00:00
|
|
|
}
|
|
|
|
|
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;
|
2015-02-04 22:24:49 +00:00
|
|
|
SkillValue mSkill[ESM::Skill::Length]; // SkillValue.mProgress used by the player only
|
2015-06-21 15:27:52 +00:00
|
|
|
|
2012-11-09 23:29:36 +00:00
|
|
|
int mReputation;
|
2014-04-05 14:26:14 +00:00
|
|
|
int mCrimeId;
|
2015-01-20 18:30:39 +00:00
|
|
|
|
|
|
|
// ----- used by the player only, maybe should be moved at some point -------
|
|
|
|
int mBounty;
|
|
|
|
int mWerewolfKills;
|
2019-05-14 06:12:40 +00:00
|
|
|
/// 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
|
2015-01-20 18:30:39 +00:00
|
|
|
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
|
2016-06-26 01:22:58 +00:00
|
|
|
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;
|
2015-01-20 18:30:39 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
2012-09-25 08:48:57 +00:00
|
|
|
|
2013-08-07 13:34:11 +00:00
|
|
|
/// Countdown to getting damage while underwater
|
|
|
|
float mTimeToStartDrowning;
|
|
|
|
|
2015-06-21 15:27:52 +00:00
|
|
|
bool mIsWerewolf;
|
|
|
|
|
2012-07-06 16:23:48 +00:00
|
|
|
public:
|
2011-01-18 09:45:29 +00:00
|
|
|
|
2012-07-06 13:50:26 +00:00
|
|
|
NpcStats();
|
|
|
|
|
2012-11-09 19:18:38 +00:00
|
|
|
int getBaseDisposition() const;
|
|
|
|
void setBaseDisposition(int disposition);
|
2012-11-05 10:07:43 +00:00
|
|
|
|
2012-11-09 23:29:36 +00:00
|
|
|
int getReputation() const;
|
|
|
|
void setReputation(int reputation);
|
2012-11-05 10:07:43 +00:00
|
|
|
|
2014-04-05 14:26:14 +00:00
|
|
|
int getCrimeId() const;
|
|
|
|
void setCrimeId(int id);
|
|
|
|
|
2014-01-03 00:59:15 +00:00
|
|
|
const SkillValue& getSkill (int index) const;
|
|
|
|
SkillValue& getSkill (int index);
|
2015-06-21 15:27:52 +00:00
|
|
|
void setSkill(int index, const SkillValue& value);
|
2012-07-06 16:23:48 +00:00
|
|
|
|
2019-05-14 06:12:40 +00:00
|
|
|
int getFactionRank(const std::string &faction) const;
|
2013-08-09 08:14:08 +00:00
|
|
|
const std::map<std::string, int>& getFactionRanks() const;
|
2019-05-14 06:12:40 +00:00
|
|
|
|
2014-10-05 14:47:55 +00:00
|
|
|
/// 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);
|
2012-11-15 19:00:27 +00:00
|
|
|
|
2014-01-08 17:59:00 +00:00
|
|
|
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);
|
2012-07-06 16:23:48 +00:00
|
|
|
|
2015-01-27 16:32:21 +00:00
|
|
|
bool isInFaction (const std::string& faction) const;
|
2012-11-10 08:35:50 +00:00
|
|
|
|
2015-02-04 22:15:12 +00:00
|
|
|
float getSkillProgressRequirement (int skillIndex, const ESM::Class& class_) const;
|
2012-07-09 19:15:52 +00:00
|
|
|
|
2014-09-25 10:25:57 +00:00
|
|
|
void useSkill (int skillIndex, const ESM::Class& class_, int usageType = -1, float extraFactor=1.f);
|
2012-07-09 19:15:52 +00:00
|
|
|
///< 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;
|
|
|
|
|
2016-06-26 01:22:58 +00:00
|
|
|
int getSkillIncreasesForSpecialization(int spec) const;
|
|
|
|
|
2012-09-15 15:12:42 +00:00
|
|
|
void levelUp();
|
2012-11-15 19:00:27 +00:00
|
|
|
|
2014-01-26 20:08:11 +00:00
|
|
|
void updateHealth();
|
|
|
|
///< Calculate health based on endurance and strength.
|
2014-08-10 15:09:14 +00:00
|
|
|
/// Called at character creation.
|
2014-01-26 20:08:11 +00:00
|
|
|
|
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-11-15 19:00:27 +00:00
|
|
|
|
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-15 19:00:27 +00:00
|
|
|
|
2012-11-09 13:31:38 +00:00
|
|
|
int getBounty() const;
|
2012-11-15 19:00:27 +00:00
|
|
|
|
2012-11-09 13:31:38 +00:00
|
|
|
void setBounty (int bounty);
|
2012-11-15 19:00:27 +00:00
|
|
|
|
2012-11-10 12:20:41 +00:00
|
|
|
int getFactionReputation (const std::string& faction) const;
|
2012-11-15 19:00:27 +00:00
|
|
|
|
2012-11-10 12:20:41 +00:00
|
|
|
void setFactionReputation (const std::string& faction, int value);
|
2012-11-15 19:00:27 +00:00
|
|
|
|
2012-11-12 12:23:25 +00:00
|
|
|
bool hasSkillsForRank (const std::string& factionId, int rank) const;
|
2012-11-15 19:00:27 +00:00
|
|
|
|
|
|
|
bool isWerewolf() const;
|
|
|
|
|
2013-08-09 12:14:58 +00:00
|
|
|
void setWerewolf(bool set);
|
2012-11-15 19:00:27 +00:00
|
|
|
|
|
|
|
int getWerewolfKills() const;
|
2013-08-07 13:34:11 +00:00
|
|
|
|
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;
|
2013-08-07 13:34:11 +00:00
|
|
|
/// 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
|
|
|
|
2020-03-17 10:15:19 +00:00
|
|
|
void writeState (ESM::CreatureStats& state) const;
|
2014-02-16 14:06:34 +00:00
|
|
|
void writeState (ESM::NpcStats& state) const;
|
|
|
|
|
2020-03-17 10:15:19 +00:00
|
|
|
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
|