mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Remove cooldown for ranged back up (bug #5129)
This commit is contained in:
parent
16922f8000
commit
ff5a042f5b
2 changed files with 27 additions and 24 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
Bug #4127: Weapon animation looks choppy
|
||||
Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses
|
||||
Bug #5129: Stuttering animation on Centurion Archer
|
||||
|
||||
0.48.0
|
||||
------
|
||||
|
|
|
@ -515,13 +515,35 @@ namespace MWMechanics
|
|||
|
||||
bool targetUsesRanged = false;
|
||||
float rangeAttackOfTarget = ActionWeapon(targetWeapon).getCombatRange(targetUsesRanged);
|
||||
|
||||
if (mMovement.mPosition[0] || mMovement.mPosition[1])
|
||||
|
||||
if (mMovement.mPosition[0])
|
||||
{
|
||||
mTimerCombatMove = 0.1f + 0.1f * Misc::Rng::rollClosedProbability(prng);
|
||||
mCombatMove = true;
|
||||
}
|
||||
else if (isDistantCombat)
|
||||
// dodge movements (for NPCs and bipedal creatures)
|
||||
// Note: do not use for ranged combat yet since in couple with back up behaviour can move actor out of cliff
|
||||
else if (actor.getClass().isBipedal(actor) && !isDistantCombat)
|
||||
{
|
||||
float moveDuration = 0;
|
||||
float angleToTarget = Misc::normalizeAngle(mMovement.mRotation[2] - actor.getRefData().getPosition().rot[2]);
|
||||
// Apply a big side step if enemy tries to get around and come from behind.
|
||||
// Otherwise apply a random side step (kind of dodging) with some probability
|
||||
// if actor is within range of target's weapon.
|
||||
if (std::abs(angleToTarget) > osg::PI / 4)
|
||||
moveDuration = 0.2f;
|
||||
else if (distToTarget <= rangeAttackOfTarget && Misc::Rng::rollClosedProbability(prng) < 0.25)
|
||||
moveDuration = 0.1f + 0.1f * Misc::Rng::rollClosedProbability(prng);
|
||||
if (moveDuration > 0)
|
||||
{
|
||||
mMovement.mPosition[0] = Misc::Rng::rollProbability(prng) < 0.5 ? 1.0f : -1.0f; // to the left/right
|
||||
mTimerCombatMove = moveDuration;
|
||||
mCombatMove = true;
|
||||
}
|
||||
}
|
||||
|
||||
mMovement.mPosition[1] = 0;
|
||||
if (isDistantCombat)
|
||||
{
|
||||
// Backing up behaviour
|
||||
// Actor backs up slightly further away than opponent's weapon range
|
||||
|
@ -561,26 +583,6 @@ namespace MWMechanics
|
|||
|
||||
mMovement.mPosition[1] = -1;
|
||||
}
|
||||
// dodge movements (for NPCs and bipedal creatures)
|
||||
// Note: do not use for ranged combat yet since in couple with back up behaviour can move actor out of cliff
|
||||
else if (actor.getClass().isBipedal(actor))
|
||||
{
|
||||
float moveDuration = 0;
|
||||
float angleToTarget = Misc::normalizeAngle(mMovement.mRotation[2] - actor.getRefData().getPosition().rot[2]);
|
||||
// Apply a big side step if enemy tries to get around and come from behind.
|
||||
// Otherwise apply a random side step (kind of dodging) with some probability
|
||||
// if actor is within range of target's weapon.
|
||||
if (std::abs(angleToTarget) > osg::PI / 4)
|
||||
moveDuration = 0.2f;
|
||||
else if (distToTarget <= rangeAttackOfTarget && Misc::Rng::rollClosedProbability(prng) < 0.25)
|
||||
moveDuration = 0.1f + 0.1f * Misc::Rng::rollClosedProbability(prng);
|
||||
if (moveDuration > 0)
|
||||
{
|
||||
mMovement.mPosition[0] = Misc::Rng::rollProbability(prng) < 0.5 ? 1.0f : -1.0f; // to the left/right
|
||||
mTimerCombatMove = moveDuration;
|
||||
mCombatMove = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AiCombatStorage::updateCombatMove(float duration)
|
||||
|
@ -598,7 +600,7 @@ namespace MWMechanics
|
|||
void AiCombatStorage::stopCombatMove()
|
||||
{
|
||||
mTimerCombatMove = 0;
|
||||
mMovement.mPosition[1] = mMovement.mPosition[0] = 0;
|
||||
mMovement.mPosition[0] = 0;
|
||||
mCombatMove = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue