mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-20 02:53:53 +00:00
Issue #219: added various creature and NPC stats; implemented respective filters
This commit is contained in:
parent
e97f3003ab
commit
7e8d4bb3c9
8 changed files with 100 additions and 18 deletions
|
@ -125,10 +125,6 @@ namespace MWDialogue
|
|||
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
|
||||
break;
|
||||
|
||||
case 60://PC Vampire
|
||||
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
|
||||
break;
|
||||
|
||||
case 61://Level
|
||||
if(!selectCompare<int,int>(comp,1,select.mI)) return false;
|
||||
break;
|
||||
|
@ -137,10 +133,6 @@ namespace MWDialogue
|
|||
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
|
||||
break;
|
||||
|
||||
case 63://Talked to PC
|
||||
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
|
||||
break;
|
||||
|
||||
case 64://PC Health
|
||||
if(!selectCompare<int,int>(comp,50,select.mI)) return false;
|
||||
break;
|
||||
|
@ -149,10 +141,6 @@ namespace MWDialogue
|
|||
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
|
||||
break;
|
||||
|
||||
case 66://Friend hit
|
||||
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
|
||||
break;
|
||||
|
||||
case 71://Should Attack
|
||||
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
|
||||
break;
|
||||
|
|
|
@ -241,6 +241,13 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
return static_cast<int> (MWWorld::Class::get (player).
|
||||
getNpcStats (player).getSkill (select.getArgument()).getModified());
|
||||
|
||||
case SelectWrapper::Function_FriendlyHit:
|
||||
{
|
||||
int hits = MWWorld::Class::get (mActor).getCreatureStats (mActor).getFriendlyHits();
|
||||
|
||||
return hits>4 ? 4 : hits;
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
throw std::runtime_error ("unknown integer select function");
|
||||
|
@ -307,6 +314,14 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
return expelled.find (faction)!=expelled.end();
|
||||
}
|
||||
|
||||
case SelectWrapper::Function_PcVampire:
|
||||
|
||||
return MWWorld::Class::get (player).getNpcStats (player).isVampire();
|
||||
|
||||
case SelectWrapper::Function_TalkedToPc:
|
||||
|
||||
return MWWorld::Class::get (mActor).getCreatureStats (mActor).hasTalkedToPlayer();
|
||||
|
||||
default:
|
||||
|
||||
|
|
|
@ -76,7 +76,12 @@ MWDialogue::SelectWrapper::Function MWDialogue::SelectWrapper::decodeFunction()
|
|||
case 50: return Function_Choice;
|
||||
case 51: case 52: case 53: case 54: case 55: case 56: case 57: return Function_PcAttribute;
|
||||
case 58: return Function_PcCorprus;
|
||||
// 59-66
|
||||
// 59
|
||||
case 60: return Function_PcVampire;
|
||||
// 61, 62
|
||||
case 63: return Function_TalkedToPc;
|
||||
// 64, 65
|
||||
case 66: return Function_FriendlyHit;
|
||||
case 67: case 68: case 69: case 70: return Function_AiSetting;
|
||||
// 71-77
|
||||
}
|
||||
|
@ -177,6 +182,7 @@ MWDialogue::SelectWrapper::Type MWDialogue::SelectWrapper::getType() const
|
|||
Function_Choice,
|
||||
Function_AiSetting,
|
||||
Function_PcAttribute, Function_PcSkill,
|
||||
Function_FriendlyHit,
|
||||
Function_None // end marker
|
||||
};
|
||||
|
||||
|
@ -193,6 +199,7 @@ MWDialogue::SelectWrapper::Type MWDialogue::SelectWrapper::getType() const
|
|||
Function_SameFaction,
|
||||
Function_PcCommonDisease, Function_PcBlightDisease, Function_PcCorprus,
|
||||
Function_PcExpelled,
|
||||
Function_PcVampire, Function_TalkedToPc,
|
||||
Function_None // end marker
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,10 @@ namespace MWDialogue
|
|||
Function_PcCommonDisease, Function_PcBlightDisease, Function_PcCorprus,
|
||||
Function_AiSetting,
|
||||
Function_PcAttribute, Function_PcSkill,
|
||||
Function_PcExpelled
|
||||
Function_PcExpelled,
|
||||
Function_PcVampire,
|
||||
Function_FriendlyHit,
|
||||
Function_TalkedToPc
|
||||
};
|
||||
|
||||
enum Type
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
namespace MWMechanics
|
||||
{
|
||||
CreatureStats::CreatureStats()
|
||||
: mLevel (0), mLevelHealthBonus(0.f), mDead (false)
|
||||
: mLevel (0), mLevelHealthBonus(0.f), mDead (false), mFriendlyHits (0), mTalkedTo (false)
|
||||
{
|
||||
for (int i=0; i<4; ++i)
|
||||
mAiSettings[i] = 0;
|
||||
|
@ -216,4 +216,24 @@ namespace MWMechanics
|
|||
{
|
||||
return mSpells.hasBlightDisease();
|
||||
}
|
||||
|
||||
int CreatureStats::getFriendlyHits() const
|
||||
{
|
||||
return mFriendlyHits;
|
||||
}
|
||||
|
||||
void CreatureStats::friendlyHit()
|
||||
{
|
||||
++mFriendlyHits;
|
||||
}
|
||||
|
||||
bool CreatureStats::hasTalkedToPlayer() const
|
||||
{
|
||||
return mTalkedTo;
|
||||
}
|
||||
|
||||
void CreatureStats::talkedToPlayer()
|
||||
{
|
||||
mTalkedTo = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,9 @@ namespace MWMechanics
|
|||
int mAiSettings[4];
|
||||
AiSequence mAiSequence;
|
||||
float mLevelHealthBonus;
|
||||
bool mDead;
|
||||
bool mDead;
|
||||
int mFriendlyHits;
|
||||
bool mTalkedTo;
|
||||
|
||||
public:
|
||||
CreatureStats();
|
||||
|
@ -99,7 +101,18 @@ namespace MWMechanics
|
|||
|
||||
bool hasCommonDisease() const;
|
||||
|
||||
bool hasBlightDisease() const;
|
||||
bool hasBlightDisease() const;
|
||||
|
||||
int getFriendlyHits() const;
|
||||
///< Number of friendly hits received.
|
||||
|
||||
void friendlyHit();
|
||||
///< Increase number of friendly hits by one.
|
||||
|
||||
bool hasTalkedToPlayer() const;
|
||||
///< Has this creature talked with the player before?
|
||||
|
||||
void talkedToPlayer();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
MWMechanics::NpcStats::NpcStats()
|
||||
: mMovementFlags (0), mDrawState (DrawState_Nothing), mBounty (0)
|
||||
, mLevelProgress(0), mDisposition(0)
|
||||
, mLevelProgress(0), mDisposition(0), mVampire (0)
|
||||
|
||||
{
|
||||
mSkillIncreases.resize (ESM::Attribute::Length);
|
||||
|
@ -274,3 +274,29 @@ void MWMechanics::NpcStats::setBounty (int bounty)
|
|||
{
|
||||
mBounty = bounty;
|
||||
}
|
||||
|
||||
int MWMechanics::NpcStats::getFactionReputation (const std::string& faction) const
|
||||
{
|
||||
std::map<std::string, int>::const_iterator iter = mFactionReputation.find (faction);
|
||||
|
||||
if (iter==mFactionReputation.end())
|
||||
return 0;
|
||||
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
void MWMechanics::NpcStats::setFactionReputation (const std::string& faction, int value)
|
||||
{
|
||||
mFactionReputation[faction] = value;
|
||||
}
|
||||
|
||||
bool MWMechanics::NpcStats::isVampire() const
|
||||
{
|
||||
return mVampire;
|
||||
}
|
||||
|
||||
void MWMechanics::NpcStats::setVampire (bool set)
|
||||
{
|
||||
mVampire = set;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ namespace MWMechanics
|
|||
Stat<float> mSkill[27];
|
||||
int mBounty;
|
||||
std::set<std::string> mExpelled;
|
||||
std::map<std::string, int> mFactionReputation;
|
||||
bool mVampire;
|
||||
|
||||
int mLevelProgress; // 0-10
|
||||
|
||||
|
@ -108,6 +110,14 @@ namespace MWMechanics
|
|||
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);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue