Commit cc8e8c12 authored by Chris Robinson's avatar Chris Robinson

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

parent 0c8d4d9b
......@@ -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);
}
}
}
......
......@@ -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,
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment