diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 0ba633df23..7a033d78f5 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -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); + } } } diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index b4b1143c28..404d748408 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -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, diff --git a/apps/openmw/mwmechanics/npcstats.cpp b/apps/openmw/mwmechanics/npcstats.cpp index def91a6c54..50c1278567 100644 --- a/apps/openmw/mwmechanics/npcstats.cpp +++ b/apps/openmw/mwmechanics/npcstats.cpp @@ -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