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
|
|
|
|
2010-09-16 08:45:08 +00:00
|
|
|
#include "stat.hpp"
|
|
|
|
|
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
|
|
|
|
///
|
2012-04-13 08:49:45 +00:00
|
|
|
/// \note For technical reasons the spell list and the currently selected spell is also handled by
|
|
|
|
/// CreatureStats, even though they are actually NPC stats.
|
2010-08-19 10:49:13 +00:00
|
|
|
|
2013-08-09 06:27:03 +00:00
|
|
|
class NpcStats : public CreatureStats
|
2010-08-19 10:49:13 +00:00
|
|
|
{
|
2012-07-06 16:23:48 +00:00
|
|
|
/// NPCs other than the player can only have one faction. But for the sake of consistency
|
|
|
|
/// we use the same data structure for the PC and the NPCs.
|
|
|
|
/// \note the faction key must be in lowercase
|
|
|
|
std::map<std::string, int> mFactionRank;
|
2011-01-18 09:45:29 +00:00
|
|
|
|
2012-11-09 13:42:09 +00:00
|
|
|
int mDisposition;
|
2014-05-12 19:04:02 +00:00
|
|
|
SkillValue mSkill[ESM::Skill::Length];
|
|
|
|
SkillValue mWerewolfSkill[ESM::Skill::Length];
|
2012-11-09 13:31:38 +00:00
|
|
|
int mBounty;
|
2012-11-10 11:28:40 +00:00
|
|
|
std::set<std::string> mExpelled;
|
2012-11-10 12:20:41 +00:00
|
|
|
std::map<std::string, int> mFactionReputation;
|
2012-11-09 23:29:36 +00:00
|
|
|
int mReputation;
|
2014-04-05 14:26:14 +00:00
|
|
|
int mCrimeId;
|
2012-11-15 19:00:27 +00:00
|
|
|
int mWerewolfKills;
|
2013-03-31 11:13:46 +00:00
|
|
|
int mProfit;
|
2012-07-06 16:23:48 +00:00
|
|
|
|
2012-09-15 15:12:42 +00:00
|
|
|
int mLevelProgress; // 0-10
|
|
|
|
|
|
|
|
std::vector<int> mSkillIncreases; // number of skill increases for each attribute
|
|
|
|
|
2012-09-25 08:48:57 +00:00
|
|
|
std::set<std::string> mUsedIds;
|
|
|
|
|
2013-08-07 13:34:11 +00:00
|
|
|
/// Countdown to getting damage while underwater
|
|
|
|
float mTimeToStartDrowning;
|
|
|
|
/// time since last hit from drowning
|
|
|
|
float mLastDrowningHit;
|
|
|
|
|
2014-01-26 20:08:11 +00:00
|
|
|
float mLevelHealthBonus;
|
|
|
|
|
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();
|
|
|
|
|
2013-03-31 11:13:46 +00:00
|
|
|
/// for mercenary companions. starts out as 0, and changes when items are added or removed through the UI.
|
|
|
|
int getProfit() const;
|
|
|
|
void modifyProfit(int diff);
|
|
|
|
|
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);
|
2012-07-06 16:23:48 +00:00
|
|
|
|
2013-08-09 08:14:08 +00:00
|
|
|
const std::map<std::string, int>& getFactionRanks() const;
|
2012-07-06 16:23:48 +00:00
|
|
|
std::map<std::string, int>& getFactionRanks();
|
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
|
|
|
|
2012-11-10 08:35:50 +00:00
|
|
|
bool isSameFaction (const NpcStats& npcStats) const;
|
|
|
|
///< Do *this and \a npcStats share a faction?
|
|
|
|
|
2012-07-06 19:07:04 +00:00
|
|
|
float getSkillGain (int skillIndex, const ESM::Class& class_, int usageType = -1,
|
|
|
|
int level = -1) const;
|
|
|
|
///< \param usageType: Usage specific factor, specified in the respective skill record;
|
|
|
|
/// -1: use a factor of 1.0 instead.
|
|
|
|
/// \param level Level to base calculation on; -1: use current level.
|
2012-07-09 19:15:52 +00:00
|
|
|
|
|
|
|
void useSkill (int skillIndex, const ESM::Class& class_, int usageType = -1);
|
|
|
|
///< Increase skill by usage.
|
2012-09-15 15:12:42 +00:00
|
|
|
|
2012-09-15 17:06:56 +00:00
|
|
|
void increaseSkill (int skillIndex, const ESM::Class& class_, bool preserveProgress);
|
|
|
|
|
2012-09-15 15:12:42 +00:00
|
|
|
int getLevelProgress() const;
|
|
|
|
|
|
|
|
int getLevelupAttributeMultiplier(int attribute) const;
|
|
|
|
|
|
|
|
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.
|
|
|
|
/// Called at character creation and at level up.
|
|
|
|
|
2012-09-25 08:48:57 +00:00
|
|
|
void flagAsUsed (const std::string& id);
|
2012-11-15 19:00:27 +00:00
|
|
|
|
2012-09-25 08:48:57 +00:00
|
|
|
bool hasBeenUsed (const std::string& id) const;
|
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
|
|
|
|
|
|
|
void writeState (ESM::NpcStats& state) const;
|
|
|
|
|
|
|
|
void readState (const ESM::NpcStats& state);
|
2010-08-19 10:49:13 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|