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