mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-05 12:15:34 +00:00
AiCombat: Handle Start to Min and Min to Max durations of 0 (found in Riekling animation)
This commit is contained in:
parent
516014c071
commit
523c2715e3
2 changed files with 10 additions and 4 deletions
|
@ -118,6 +118,7 @@ namespace MWMechanics
|
|||
mStrength = 0;
|
||||
mCell = NULL;
|
||||
mLastTargetPos = Ogre::Vector3(0,0,0);
|
||||
mMinMaxAttackDurationInitialised = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -219,8 +220,6 @@ namespace MWMechanics
|
|||
if(smoothTurn(actor, Ogre::Degree(mMovement.mRotation[0]), 0)) mMovement.mRotation[0] = 0;
|
||||
}
|
||||
|
||||
mTimerAttack -= duration;
|
||||
|
||||
//TODO: Some skills affect period of strikes.For berserk-like style period ~ 0.25f
|
||||
float attacksPeriod = 1.0f;
|
||||
|
||||
|
@ -228,12 +227,16 @@ namespace MWMechanics
|
|||
|
||||
if(mReadyToAttack)
|
||||
{
|
||||
if (mMinMaxAttackDuration[0][0] == 0)
|
||||
if (!mMinMaxAttackDurationInitialised)
|
||||
{
|
||||
// TODO: this must be updated when a different weapon is equipped
|
||||
getMinMaxAttackDuration(actor, mMinMaxAttackDuration);
|
||||
mMinMaxAttackDurationInitialised = true;
|
||||
}
|
||||
|
||||
if (mTimerAttack <= 0) mAttack = false;
|
||||
if (mTimerAttack < 0) mAttack = false;
|
||||
|
||||
mTimerAttack -= duration;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -326,6 +329,8 @@ namespace MWMechanics
|
|||
else attackType = ESM::Weapon::AT_Chop; // cause it's =0
|
||||
|
||||
mStrength = static_cast<float>(rand()) / RAND_MAX;
|
||||
|
||||
// Note: may be 0 for some animations
|
||||
mTimerAttack = mMinMaxAttackDuration[attackType][0] +
|
||||
(mMinMaxAttackDuration[attackType][1] - mMinMaxAttackDuration[attackType][0]) * mStrength;
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace MWMechanics
|
|||
|
||||
float mStrength; // this is actually make sense only in ranged combat
|
||||
float mMinMaxAttackDuration[3][2]; // slash, thrust, chop has different durations
|
||||
bool mMinMaxAttackDurationInitialised;
|
||||
|
||||
bool mForceNoShortcut;
|
||||
ESM::Position mShortcutFailPos;
|
||||
|
|
Loading…
Reference in a new issue