mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-25 16:43:33 +00:00
Handle werewolf stats
This commit is contained in:
parent
72a399054f
commit
ae183cb3e4
@ -13,7 +13,8 @@ namespace MWMechanics
|
|||||||
: mLevel (0), mLevelHealthBonus(0.f), mDead (false), mDied (false), mFriendlyHits (0),
|
: mLevel (0), mLevelHealthBonus(0.f), mDead (false), mDied (false), mFriendlyHits (0),
|
||||||
mTalkedTo (false), mAlarmed (false),
|
mTalkedTo (false), mAlarmed (false),
|
||||||
mAttacked (false), mHostile (false),
|
mAttacked (false), mHostile (false),
|
||||||
mAttackingOrSpell(false), mAttackType(AT_Chop)
|
mAttackingOrSpell(false), mAttackType(AT_Chop),
|
||||||
|
mIsWerewolf(false)
|
||||||
{
|
{
|
||||||
for (int i=0; i<4; ++i)
|
for (int i=0; i<4; ++i)
|
||||||
mAiSettings[i] = 0;
|
mAiSettings[i] = 0;
|
||||||
@ -77,7 +78,7 @@ namespace MWMechanics
|
|||||||
if (index < 0 || index > 7) {
|
if (index < 0 || index > 7) {
|
||||||
throw std::runtime_error("attribute index is out of range");
|
throw std::runtime_error("attribute index is out of range");
|
||||||
}
|
}
|
||||||
return mAttributes[index];
|
return (!mIsWerewolf ? mAttributes[index] : mWerewolfAttributes[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DynamicStat<float> &CreatureStats::getHealth() const
|
const DynamicStat<float> &CreatureStats::getHealth() const
|
||||||
@ -131,7 +132,7 @@ namespace MWMechanics
|
|||||||
if (index < 0 || index > 7) {
|
if (index < 0 || index > 7) {
|
||||||
throw std::runtime_error("attribute index is out of range");
|
throw std::runtime_error("attribute index is out of range");
|
||||||
}
|
}
|
||||||
return mAttributes[index];
|
return (!mIsWerewolf ? mAttributes[index] : mWerewolfAttributes[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DynamicStat<float> &CreatureStats::getDynamic(int index) const
|
const DynamicStat<float> &CreatureStats::getDynamic(int index) const
|
||||||
@ -167,7 +168,10 @@ namespace MWMechanics
|
|||||||
if (index < 0 || index > 7) {
|
if (index < 0 || index > 7) {
|
||||||
throw std::runtime_error("attribute index is out of range");
|
throw std::runtime_error("attribute index is out of range");
|
||||||
}
|
}
|
||||||
mAttributes[index] = value;
|
if(!mIsWerewolf)
|
||||||
|
mAttributes[index] = value;
|
||||||
|
else
|
||||||
|
mWerewolfAttributes[index] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatureStats::setHealth(const DynamicStat<float> &value)
|
void CreatureStats::setHealth(const DynamicStat<float> &value)
|
||||||
|
@ -40,6 +40,10 @@ namespace MWMechanics
|
|||||||
|
|
||||||
std::string mLastHitObject; // The last object to hit this actor
|
std::string mLastHitObject; // The last object to hit this actor
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool mIsWerewolf;
|
||||||
|
Stat<int> mWerewolfAttributes[8];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CreatureStats();
|
CreatureStats();
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ MWMechanics::NpcStats::NpcStats()
|
|||||||
, mDisposition(0)
|
, mDisposition(0)
|
||||||
, mVampire (0)
|
, mVampire (0)
|
||||||
, mReputation(0)
|
, mReputation(0)
|
||||||
, mWerewolf (false)
|
|
||||||
, mWerewolfKills (0)
|
, mWerewolfKills (0)
|
||||||
, mProfit(0)
|
, mProfit(0)
|
||||||
, mAttackStrength(0.0f)
|
, mAttackStrength(0.0f)
|
||||||
@ -90,7 +89,7 @@ const MWMechanics::Stat<float>& MWMechanics::NpcStats::getSkill (int index) cons
|
|||||||
if (index<0 || index>=27)
|
if (index<0 || index>=27)
|
||||||
throw std::runtime_error ("skill index out of range");
|
throw std::runtime_error ("skill index out of range");
|
||||||
|
|
||||||
return mSkill[index];
|
return (!mIsWerewolf ? mSkill[index] : mWerewolfSkill[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
MWMechanics::Stat<float>& MWMechanics::NpcStats::getSkill (int index)
|
MWMechanics::Stat<float>& MWMechanics::NpcStats::getSkill (int index)
|
||||||
@ -98,7 +97,7 @@ MWMechanics::Stat<float>& MWMechanics::NpcStats::getSkill (int index)
|
|||||||
if (index<0 || index>=27)
|
if (index<0 || index>=27)
|
||||||
throw std::runtime_error ("skill index out of range");
|
throw std::runtime_error ("skill index out of range");
|
||||||
|
|
||||||
return mSkill[index];
|
return (!mIsWerewolf ? mSkill[index] : mWerewolfSkill[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<std::string, int>& MWMechanics::NpcStats::getFactionRanks() const
|
const std::map<std::string, int>& MWMechanics::NpcStats::getFactionRanks() const
|
||||||
@ -194,6 +193,10 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
|
|||||||
|
|
||||||
void MWMechanics::NpcStats::useSkill (int skillIndex, const ESM::Class& class_, int usageType)
|
void MWMechanics::NpcStats::useSkill (int skillIndex, const ESM::Class& class_, int usageType)
|
||||||
{
|
{
|
||||||
|
// Don't increase skills as a werewolf
|
||||||
|
if(mIsWerewolf)
|
||||||
|
return;
|
||||||
|
|
||||||
float base = getSkill (skillIndex).getBase();
|
float base = getSkill (skillIndex).getBase();
|
||||||
|
|
||||||
int level = static_cast<int> (base);
|
int level = static_cast<int> (base);
|
||||||
@ -369,12 +372,34 @@ bool MWMechanics::NpcStats::hasSkillsForRank (const std::string& factionId, int
|
|||||||
|
|
||||||
bool MWMechanics::NpcStats::isWerewolf() const
|
bool MWMechanics::NpcStats::isWerewolf() const
|
||||||
{
|
{
|
||||||
return mWerewolf;
|
return mIsWerewolf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWMechanics::NpcStats::setWerewolf (bool set)
|
void MWMechanics::NpcStats::setWerewolf (bool set)
|
||||||
{
|
{
|
||||||
mWerewolf = set;
|
if(set != false)
|
||||||
|
{
|
||||||
|
const MWWorld::Store<ESM::GameSetting> &gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
|
for(size_t i = 0;i < ESM::Attribute::Length;i++)
|
||||||
|
{
|
||||||
|
mWerewolfAttributes[i] = getAttribute(i);
|
||||||
|
// Oh, Bethesda. It's "Intelligence".
|
||||||
|
std::string name = "fWerewolf"+((i==ESM::Attribute::Intelligence) ? std::string("Intellegence") :
|
||||||
|
ESM::Attribute::sAttributeNames[i]);
|
||||||
|
mWerewolfAttributes[i].setModified(int(gmst.find(name)->getFloat()), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(size_t i = 0;i < ESM::Skill::Length;i++)
|
||||||
|
{
|
||||||
|
mWerewolfSkill[i] = getSkill(i);
|
||||||
|
// "Mercantile"! >_<
|
||||||
|
std::string name = "fWerewolf"+((i==ESM::Skill::Mercantile) ? std::string("Merchantile") :
|
||||||
|
ESM::Skill::sSkillNames[i]);
|
||||||
|
mWerewolfSkill[i].setModified(int(gmst.find(name)->getFloat()), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mIsWerewolf = set;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MWMechanics::NpcStats::getWerewolfKills() const
|
int MWMechanics::NpcStats::getWerewolfKills() const
|
||||||
|
@ -46,12 +46,12 @@ namespace MWMechanics
|
|||||||
int mDisposition;
|
int mDisposition;
|
||||||
unsigned int mMovementFlags;
|
unsigned int mMovementFlags;
|
||||||
Stat<float> mSkill[27];
|
Stat<float> mSkill[27];
|
||||||
|
Stat<float> mWerewolfSkill[27];
|
||||||
int mBounty;
|
int mBounty;
|
||||||
std::set<std::string> mExpelled;
|
std::set<std::string> mExpelled;
|
||||||
std::map<std::string, int> mFactionReputation;
|
std::map<std::string, int> mFactionReputation;
|
||||||
bool mVampire;
|
bool mVampire;
|
||||||
int mReputation;
|
int mReputation;
|
||||||
bool mWerewolf;
|
|
||||||
int mWerewolfKills;
|
int mWerewolfKills;
|
||||||
int mProfit;
|
int mProfit;
|
||||||
float mAttackStrength;
|
float mAttackStrength;
|
||||||
@ -143,7 +143,7 @@ namespace MWMechanics
|
|||||||
|
|
||||||
bool isWerewolf() const;
|
bool isWerewolf() const;
|
||||||
|
|
||||||
void setWerewolf (bool set);
|
void setWerewolf(bool set);
|
||||||
|
|
||||||
int getWerewolfKills() const;
|
int getWerewolfKills() const;
|
||||||
|
|
||||||
|
@ -13,6 +13,17 @@ const Attribute::AttributeID Attribute::sAttributeIds[Attribute::Length] = {
|
|||||||
Attribute::Luck
|
Attribute::Luck
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const std::string Attribute::sAttributeNames[Attribute::Length] = {
|
||||||
|
"Strength",
|
||||||
|
"Intelligence",
|
||||||
|
"Willpower",
|
||||||
|
"Agility",
|
||||||
|
"Speed",
|
||||||
|
"Endurance",
|
||||||
|
"Personality",
|
||||||
|
"Luck"
|
||||||
|
};
|
||||||
|
|
||||||
const std::string Attribute::sGmstAttributeIds[Attribute::Length] = {
|
const std::string Attribute::sGmstAttributeIds[Attribute::Length] = {
|
||||||
"sAttributeStrength",
|
"sAttributeStrength",
|
||||||
"sAttributeIntelligence",
|
"sAttributeIntelligence",
|
||||||
|
@ -28,6 +28,7 @@ struct Attribute
|
|||||||
std::string mName, mDescription;
|
std::string mName, mDescription;
|
||||||
|
|
||||||
static const AttributeID sAttributeIds[Length];
|
static const AttributeID sAttributeIds[Length];
|
||||||
|
static const std::string sAttributeNames[Length];
|
||||||
static const std::string sGmstAttributeIds[Length];
|
static const std::string sGmstAttributeIds[Length];
|
||||||
static const std::string sGmstAttributeDescIds[Length];
|
static const std::string sGmstAttributeDescIds[Length];
|
||||||
static const std::string sAttributeIcons[Length];
|
static const std::string sAttributeIcons[Length];
|
||||||
|
@ -9,6 +9,35 @@
|
|||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
|
const std::string Skill::sSkillNames[Length] = {
|
||||||
|
"Block",
|
||||||
|
"Armorer",
|
||||||
|
"Mediumarmor",
|
||||||
|
"Heavyarmor",
|
||||||
|
"Bluntweapon",
|
||||||
|
"Longblade",
|
||||||
|
"Axe",
|
||||||
|
"Spear",
|
||||||
|
"Athletics",
|
||||||
|
"Enchant",
|
||||||
|
"Destruction",
|
||||||
|
"Alteration",
|
||||||
|
"Illusion",
|
||||||
|
"Conjuration",
|
||||||
|
"Mysticism",
|
||||||
|
"Restoration",
|
||||||
|
"Alchemy",
|
||||||
|
"Unarmored",
|
||||||
|
"Security",
|
||||||
|
"Sneak",
|
||||||
|
"Acrobatics",
|
||||||
|
"Lightarmor",
|
||||||
|
"Shortblade",
|
||||||
|
"Marksman",
|
||||||
|
"Mercantile",
|
||||||
|
"Speechcraft",
|
||||||
|
"Handtohand",
|
||||||
|
};
|
||||||
const std::string Skill::sSkillNameIds[Length] = {
|
const std::string Skill::sSkillNameIds[Length] = {
|
||||||
"sSkillBlock",
|
"sSkillBlock",
|
||||||
"sSkillArmorer",
|
"sSkillArmorer",
|
||||||
|
@ -69,6 +69,7 @@ struct Skill
|
|||||||
HandToHand = 26,
|
HandToHand = 26,
|
||||||
Length
|
Length
|
||||||
};
|
};
|
||||||
|
static const std::string sSkillNames[Length];
|
||||||
static const std::string sSkillNameIds[Length];
|
static const std::string sSkillNameIds[Length];
|
||||||
static const std::string sIconNames[Length];
|
static const std::string sIconNames[Length];
|
||||||
static const boost::array<SkillEnum, Length> sSkillIds;
|
static const boost::array<SkillEnum, Length> sSkillIds;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user