mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-17 20:36:47 +00:00
Use the attack strength as determined by how long the attack was held
This commit is contained in:
parent
0c8d4d9be2
commit
cc8e8c1272
4 changed files with 30 additions and 7 deletions
|
@ -314,18 +314,24 @@ namespace MWClass
|
||||||
// hand-to-hand, which damages fatique unless in werewolf form).
|
// hand-to-hand, which damages fatique unless in werewolf form).
|
||||||
if(weapon)
|
if(weapon)
|
||||||
{
|
{
|
||||||
float health = othercls.getCreatureStats(victim).getHealth().getCurrent();
|
const unsigned char *att = NULL;
|
||||||
// FIXME: Modify damage based on strength?
|
|
||||||
if(type == MWMechanics::CreatureStats::AT_Chop)
|
if(type == MWMechanics::CreatureStats::AT_Chop)
|
||||||
health -= weapon->mBase->mData.mChop[1];
|
att = weapon->mBase->mData.mChop;
|
||||||
else if(type == MWMechanics::CreatureStats::AT_Slash)
|
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)
|
else if(type == MWMechanics::CreatureStats::AT_Thrust)
|
||||||
health -= weapon->mBase->mData.mThrust[1];
|
att = weapon->mBase->mData.mThrust;
|
||||||
|
|
||||||
|
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);
|
othercls.setActorHealth(victim, std::max(health, 0.0f), ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Npc::setActorHealth(const MWWorld::Ptr& ptr, float health, const MWWorld::Ptr& attacker) const
|
void Npc::setActorHealth(const MWWorld::Ptr& ptr, float health, const MWWorld::Ptr& attacker) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -493,6 +493,8 @@ bool CharacterController::updateNpcState()
|
||||||
animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete);
|
animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete);
|
||||||
if(mUpperBodyState == UpperCharState_MinAttackToMaxAttack)
|
if(mUpperBodyState == UpperCharState_MinAttackToMaxAttack)
|
||||||
{
|
{
|
||||||
|
stats.setAttackStrength(complete);
|
||||||
|
|
||||||
mAnimation->disable(mCurrentWeapon);
|
mAnimation->disable(mCurrentWeapon);
|
||||||
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
||||||
MWRender::Animation::Group_UpperBody, false,
|
MWRender::Animation::Group_UpperBody, false,
|
||||||
|
|
|
@ -31,6 +31,7 @@ MWMechanics::NpcStats::NpcStats()
|
||||||
, mWerewolf (false)
|
, mWerewolf (false)
|
||||||
, mWerewolfKills (0)
|
, mWerewolfKills (0)
|
||||||
, mProfit(0)
|
, mProfit(0)
|
||||||
|
, mAttackStrength(0.0f)
|
||||||
{
|
{
|
||||||
mSkillIncreases.resize (ESM::Attribute::Length);
|
mSkillIncreases.resize (ESM::Attribute::Length);
|
||||||
for (int i=0; i<ESM::Attribute::Length; ++i)
|
for (int i=0; i<ESM::Attribute::Length; ++i)
|
||||||
|
@ -47,6 +48,16 @@ void MWMechanics::NpcStats::setDrawState (DrawState_ state)
|
||||||
mDrawState = state;
|
mDrawState = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float MWMechanics::NpcStats::getAttackStrength() const
|
||||||
|
{
|
||||||
|
return mAttackStrength;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWMechanics::NpcStats::setAttackStrength(float value)
|
||||||
|
{
|
||||||
|
mAttackStrength = value;
|
||||||
|
}
|
||||||
|
|
||||||
int MWMechanics::NpcStats::getBaseDisposition() const
|
int MWMechanics::NpcStats::getBaseDisposition() const
|
||||||
{
|
{
|
||||||
return mDisposition;
|
return mDisposition;
|
||||||
|
|
|
@ -54,6 +54,7 @@ namespace MWMechanics
|
||||||
bool mWerewolf;
|
bool mWerewolf;
|
||||||
int mWerewolfKills;
|
int mWerewolfKills;
|
||||||
int mProfit;
|
int mProfit;
|
||||||
|
float mAttackStrength;
|
||||||
|
|
||||||
int mLevelProgress; // 0-10
|
int mLevelProgress; // 0-10
|
||||||
|
|
||||||
|
@ -70,9 +71,12 @@ namespace MWMechanics
|
||||||
void modifyProfit(int diff);
|
void modifyProfit(int diff);
|
||||||
|
|
||||||
DrawState_ getDrawState() const;
|
DrawState_ getDrawState() const;
|
||||||
|
|
||||||
void setDrawState (DrawState_ state);
|
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;
|
int getBaseDisposition() const;
|
||||||
|
|
||||||
void setBaseDisposition(int disposition);
|
void setBaseDisposition(int disposition);
|
||||||
|
|
Loading…
Reference in a new issue