Use the attack strength as determined by how long the attack was held

This commit is contained in:
Chris Robinson 2013-07-24 03:18:53 -07:00
parent 0c8d4d9be2
commit cc8e8c1272
4 changed files with 30 additions and 7 deletions

View file

@ -314,16 +314,22 @@ namespace MWClass
// hand-to-hand, which damages fatique unless in werewolf form).
if(weapon)
{
float health = othercls.getCreatureStats(victim).getHealth().getCurrent();
// FIXME: Modify damage based on strength?
const unsigned char *att = NULL;
if(type == MWMechanics::CreatureStats::AT_Chop)
health -= weapon->mBase->mData.mChop[1];
att = weapon->mBase->mData.mChop;
else if(type == MWMechanics::CreatureStats::AT_Slash)
health -= weapon->mBase->mData.mSlash[1];
att = weapon->mBase->mData.mSlash;
else if(type == MWMechanics::CreatureStats::AT_Thrust)
health -= weapon->mBase->mData.mThrust[1];
att = weapon->mBase->mData.mThrust;
othercls.setActorHealth(victim, std::max(health, 0.0f), ptr);
if(att)
{
float health = othercls.getCreatureStats(victim).getHealth().getCurrent();
// FIXME: Modify damage based on strength attribute?
health -= att[0] + ((att[1]-att[0])*Npc::getNpcStats(ptr).getAttackStrength());
othercls.setActorHealth(victim, std::max(health, 0.0f), ptr);
}
}
}

View file

@ -493,6 +493,8 @@ bool CharacterController::updateNpcState()
animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete);
if(mUpperBodyState == UpperCharState_MinAttackToMaxAttack)
{
stats.setAttackStrength(complete);
mAnimation->disable(mCurrentWeapon);
mAnimation->play(mCurrentWeapon, Priority_Weapon,
MWRender::Animation::Group_UpperBody, false,

View file

@ -31,6 +31,7 @@ MWMechanics::NpcStats::NpcStats()
, mWerewolf (false)
, mWerewolfKills (0)
, mProfit(0)
, mAttackStrength(0.0f)
{
mSkillIncreases.resize (ESM::Attribute::Length);
for (int i=0; i<ESM::Attribute::Length; ++i)
@ -47,6 +48,16 @@ void MWMechanics::NpcStats::setDrawState (DrawState_ state)
mDrawState = state;
}
float MWMechanics::NpcStats::getAttackStrength() const
{
return mAttackStrength;
}
void MWMechanics::NpcStats::setAttackStrength(float value)
{
mAttackStrength = value;
}
int MWMechanics::NpcStats::getBaseDisposition() const
{
return mDisposition;

View file

@ -54,6 +54,7 @@ namespace MWMechanics
bool mWerewolf;
int mWerewolfKills;
int mProfit;
float mAttackStrength;
int mLevelProgress; // 0-10
@ -70,9 +71,12 @@ namespace MWMechanics
void modifyProfit(int diff);
DrawState_ getDrawState() const;
void setDrawState (DrawState_ state);
/// When attacking, stores how strong the attack should be (0 = weakest, 1 = strongest)
float getAttackStrength() const;
void setAttackStrength(float value);
int getBaseDisposition() const;
void setBaseDisposition(int disposition);