OpenMW
Public Types | Public Member Functions | Private Attributes
MWMechanics::NpcStats Class Reference

Additional stats for NPCs. More...

#include <npcstats.hpp>

List of all members.

Public Types

enum  Flag { Flag_ForceRun = 1, Flag_ForceSneak = 2, Flag_Run = 4, Flag_Sneak = 8 }

Public Member Functions

 NpcStats ()
int getProfit () const
 for mercenary companions. starts out as 0, and changes when items are added or removed through the UI.
void modifyProfit (int diff)
DrawState_ getDrawState () const
void setDrawState (DrawState_ state)
float getAttackStrength () const
 When attacking, stores how strong the attack should be (0 = weakest, 1 = strongest)
void setAttackStrength (float value)
int getBaseDisposition () const
void setBaseDisposition (int disposition)
int getReputation () const
void setReputation (int reputation)
bool getMovementFlag (Flag flag) const
void setMovementFlag (Flag flag, bool state)
const Stat< float > & getSkill (int index) const
Stat< float > & getSkill (int index)
const std::map< std::string,
int > & 
getFactionRanks () const
std::map< std::string, int > & getFactionRanks ()
const std::set< std::string > & getExpelled () const
std::set< std::string > & getExpelled ()
bool isSameFaction (const NpcStats &npcStats) const
 Do *this and npcStats share a faction?
float getSkillGain (int skillIndex, const ESM::Class &class_, int usageType=-1, int level=-1) const
void useSkill (int skillIndex, const ESM::Class &class_, int usageType=-1)
 Increase skill by usage.
void increaseSkill (int skillIndex, const ESM::Class &class_, bool preserveProgress)
int getLevelProgress () const
int getLevelupAttributeMultiplier (int attribute) const
void levelUp ()
void flagAsUsed (const std::string &id)
bool hasBeenUsed (const std::string &id) const
int getBounty () const
void setBounty (int bounty)
int getFactionReputation (const std::string &faction) const
void setFactionReputation (const std::string &faction, int value)
bool isVampire () const
void setVampire (bool set)
bool hasSkillsForRank (const std::string &factionId, int rank) const
bool isWerewolf () const
void setWerewolf (bool set)
int getWerewolfKills () const
float getTimeToStartDrowning () const
void setTimeToStartDrowning (float time)

Private Attributes

std::map< std::string, int > mFactionRank
DrawState_ mDrawState
int mDisposition
unsigned int mMovementFlags
Stat< float > mSkill [27]
Stat< float > mWerewolfSkill [27]
int mBounty
std::set< std::string > mExpelled
std::map< std::string, int > mFactionReputation
bool mVampire
int mReputation
int mWerewolfKills
int mProfit
float mAttackStrength
int mLevelProgress
std::vector< int > mSkillIncreases
std::set< std::string > mUsedIds
float mTimeToStartDrowning
 Countdown to getting damage while underwater.
float mLastDrowningHit
 time since last hit from drowning

Detailed Description

Additional stats for NPCs.

Note:
For technical reasons the spell list and the currently selected spell is also handled by CreatureStats, even though they are actually NPC stats.

Member Enumeration Documentation

Enumerator:
Flag_ForceRun 
Flag_ForceSneak 
Flag_Run 
Flag_Sneak 

Constructor & Destructor Documentation


Member Function Documentation

void MWMechanics::NpcStats::flagAsUsed ( const std::string &  id)

When attacking, stores how strong the attack should be (0 = weakest, 1 = strongest)

const std::set< std::string > & MWMechanics::NpcStats::getExpelled ( ) const
std::set< std::string > & MWMechanics::NpcStats::getExpelled ( )
const std::map< std::string, int > & MWMechanics::NpcStats::getFactionRanks ( ) const
std::map< std::string, int > & MWMechanics::NpcStats::getFactionRanks ( )
int MWMechanics::NpcStats::getFactionReputation ( const std::string &  faction) const

for mercenary companions. starts out as 0, and changes when items are added or removed through the UI.

const MWMechanics::Stat< float > & MWMechanics::NpcStats::getSkill ( int  index) const
float MWMechanics::NpcStats::getSkillGain ( int  skillIndex,
const ESM::Class class_,
int  usageType = -1,
int  level = -1 
) const
Parameters:
usageType,:Usage specific factor, specified in the respective skill record; -1: use a factor of 1.0 instead.
levelLevel to base calculation on; -1: use current level.
bool MWMechanics::NpcStats::hasBeenUsed ( const std::string &  id) const
bool MWMechanics::NpcStats::hasSkillsForRank ( const std::string &  factionId,
int  rank 
) const
void MWMechanics::NpcStats::increaseSkill ( int  skillIndex,
const ESM::Class class_,
bool  preserveProgress 
)
Todo:
check if character is the player, if levelling is ever implemented for NPCs
bool MWMechanics::NpcStats::isSameFaction ( const NpcStats npcStats) const

Do *this and npcStats share a faction?

Reimplemented from MWMechanics::CreatureStats.

void MWMechanics::NpcStats::setBaseDisposition ( int  disposition)
void MWMechanics::NpcStats::setBounty ( int  bounty)
void MWMechanics::NpcStats::setFactionReputation ( const std::string &  faction,
int  value 
)
void MWMechanics::NpcStats::setMovementFlag ( Flag  flag,
bool  state 
)
void MWMechanics::NpcStats::setReputation ( int  reputation)

Sets time left for the creature to drown if it stays underwater.

Parameters:
timevalue from [0,20]
void MWMechanics::NpcStats::useSkill ( int  skillIndex,
const ESM::Class class_,
int  usageType = -1 
)

Increase skill by usage.


Member Data Documentation

std::set<std::string> MWMechanics::NpcStats::mExpelled [private]
std::map<std::string, int> MWMechanics::NpcStats::mFactionRank [private]

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> MWMechanics::NpcStats::mFactionReputation [private]

time since last hit from drowning

unsigned int MWMechanics::NpcStats::mMovementFlags [private]
Stat<float> MWMechanics::NpcStats::mSkill[27] [private]
std::vector<int> MWMechanics::NpcStats::mSkillIncreases [private]

Countdown to getting damage while underwater.

std::set<std::string> MWMechanics::NpcStats::mUsedIds [private]

The documentation for this class was generated from the following files: