|
|
@ -503,8 +503,8 @@ namespace MWMechanics
|
|
|
|
targetWeapon = *weaponSlot;
|
|
|
|
targetWeapon = *weaponSlot;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool isRangedCombat = false;
|
|
|
|
bool targetUsesRanged = false;
|
|
|
|
float rangeAttackOfTarget = ActionWeapon(targetWeapon).getCombatRange(isRangedCombat);
|
|
|
|
float rangeAttackOfTarget = ActionWeapon(targetWeapon).getCombatRange(targetUsesRanged);
|
|
|
|
|
|
|
|
|
|
|
|
if (mMovement.mPosition[0] || mMovement.mPosition[1])
|
|
|
|
if (mMovement.mPosition[0] || mMovement.mPosition[1])
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -524,16 +524,17 @@ namespace MWMechanics
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Below behavior for backing up during ranged combat differs from vanilla.
|
|
|
|
// Backing up behaviour
|
|
|
|
// Vanilla is observed as backing up only as far as fCombatDistance or
|
|
|
|
// Actor backs up slightly further away than opponent's weapon range
|
|
|
|
// opponent's weapon range, or not backing up if opponent is also using a ranged weapon
|
|
|
|
// (in vanilla - only as far as oponent's weapon range),
|
|
|
|
|
|
|
|
// or not at all if opponent is using a ranged weapon
|
|
|
|
if (isDistantCombat)
|
|
|
|
if (isDistantCombat)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// actor should not back up into water
|
|
|
|
// actor should not back up into water
|
|
|
|
if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.5f))
|
|
|
|
if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.5f))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (!isRangedCombat && distToTarget <= rangeAttackOfTarget*1.5) // Don't back up if the target is wielding ranged weapon
|
|
|
|
if (!targetUsesRanged && distToTarget <= rangeAttackOfTarget*1.5) // Don't back up if the target is wielding ranged weapon
|
|
|
|
mMovement.mPosition[1] = -1;
|
|
|
|
mMovement.mPosition[1] = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|