OpenMW
apps/openmw/mwmechanics/npcstats.hpp
Go to the documentation of this file.
00001 #ifndef GAME_MWMECHANICS_NPCSTATS_H
00002 #define GAME_MWMECHANICS_NPCSTATS_H
00003 
00004 #include <map>
00005 #include <set>
00006 #include <string>
00007 #include <vector>
00008 
00009 #include "stat.hpp"
00010 #include "drawstate.hpp"
00011 
00012 #include "creaturestats.hpp"
00013 
00014 namespace ESM
00015 {
00016     struct Class;
00017 }
00018 
00019 namespace MWMechanics
00020 {
00025 
00026     class NpcStats : public CreatureStats
00027     {
00028         public:
00029 
00030             enum Flag
00031             {
00032                 Flag_ForceRun = 1,
00033                 Flag_ForceSneak = 2,
00034                 Flag_Run = 4,
00035                 Flag_Sneak = 8
00036             };
00037 
00038         private:
00039 
00043             std::map<std::string, int> mFactionRank;
00044 
00045             DrawState_ mDrawState;
00046             int mDisposition;
00047             unsigned int mMovementFlags;
00048             Stat<float> mSkill[27];
00049             Stat<float> mWerewolfSkill[27];
00050             int mBounty;
00051             std::set<std::string> mExpelled;
00052             std::map<std::string, int> mFactionReputation;
00053             bool mVampire;
00054             int mReputation;
00055             int mWerewolfKills;
00056             int mProfit;
00057             float mAttackStrength;
00058 
00059             int mLevelProgress; // 0-10
00060 
00061             std::vector<int> mSkillIncreases; // number of skill increases for each attribute
00062 
00063             std::set<std::string> mUsedIds;
00064 
00066             float mTimeToStartDrowning;
00068             float mLastDrowningHit;
00069 
00070         public:
00071 
00072             NpcStats();
00073 
00075             int getProfit() const;
00076             void modifyProfit(int diff);
00077 
00078             DrawState_ getDrawState() const;
00079             void setDrawState (DrawState_ state);
00080 
00082             float getAttackStrength() const;
00083             void setAttackStrength(float value);
00084 
00085             int getBaseDisposition() const;
00086 
00087             void setBaseDisposition(int disposition);
00088 
00089             int getReputation() const;
00090 
00091             void setReputation(int reputation);
00092 
00093             bool getMovementFlag (Flag flag) const;
00094 
00095             void setMovementFlag (Flag flag, bool state);
00096 
00097             const Stat<float>& getSkill (int index) const;
00098             Stat<float>& getSkill (int index);
00099 
00100             const std::map<std::string, int>& getFactionRanks() const;
00101             std::map<std::string, int>& getFactionRanks();
00102 
00103             const std::set<std::string>& getExpelled() const;
00104             std::set<std::string>& getExpelled();
00105 
00106             bool isSameFaction (const NpcStats& npcStats) const;
00108 
00109             float getSkillGain (int skillIndex, const ESM::Class& class_, int usageType = -1,
00110                 int level = -1) const;
00114 
00115             void useSkill (int skillIndex, const ESM::Class& class_, int usageType = -1);
00117 
00118             void increaseSkill (int skillIndex, const ESM::Class& class_, bool preserveProgress);
00119 
00120             int getLevelProgress() const;
00121 
00122             int getLevelupAttributeMultiplier(int attribute) const;
00123 
00124             void levelUp();
00125 
00126             void flagAsUsed (const std::string& id);
00127 
00128             bool hasBeenUsed (const std::string& id) const;
00129 
00130             int getBounty() const;
00131 
00132             void setBounty (int bounty);
00133 
00134             int getFactionReputation (const std::string& faction) const;
00135 
00136             void setFactionReputation (const std::string& faction, int value);
00137 
00138             bool isVampire() const;
00139 
00140             void setVampire (bool set);
00141 
00142             bool hasSkillsForRank (const std::string& factionId, int rank) const;
00143 
00144             bool isWerewolf() const;
00145 
00146             void setWerewolf(bool set);
00147 
00148             int getWerewolfKills() const;
00149 
00150             float getTimeToStartDrowning() const;
00153             void setTimeToStartDrowning(float time);
00154     };
00155 }
00156 
00157 #endif