mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Disable combat movements for creatures without weapons
This commit is contained in:
parent
7820ea5806
commit
067c2bc2ec
@ -204,7 +204,10 @@ namespace MWMechanics
|
||||
{
|
||||
//Melee: stop running and attack
|
||||
mMovement.mPosition[1] = 0;
|
||||
chooseBestAttack(weapon, mMovement);
|
||||
|
||||
// When attacking with a weapon, choose between slash, thrust or chop
|
||||
if (actor.getClass().hasInventoryStore(actor))
|
||||
chooseBestAttack(weapon, mMovement);
|
||||
|
||||
if(mMovement.mPosition[0] || mMovement.mPosition[1])
|
||||
{
|
||||
@ -365,7 +368,7 @@ void chooseBestAttack(const ESM::Weapon* weapon, MWMechanics::Movement &movement
|
||||
{
|
||||
if (weapon == NULL)
|
||||
{
|
||||
//hand-to-hand and creatures' attacks deal equal damage for each type
|
||||
//hand-to-hand deal equal damage for each type
|
||||
float roll = static_cast<float>(rand())/RAND_MAX;
|
||||
if(roll <= 0.333f) //side punch
|
||||
{
|
||||
|
@ -478,7 +478,14 @@ bool CharacterController::updateCreatureState()
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->breakInvisibility(mPtr);
|
||||
|
||||
determineAttackType();
|
||||
// These are unique animations and not linked to movement type. Just pick one randomly.
|
||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 3; // [0, 2]
|
||||
if (roll == 0)
|
||||
mCurrentWeapon = "attack1";
|
||||
else if (roll == 1)
|
||||
mCurrentWeapon = "attack2";
|
||||
else
|
||||
mCurrentWeapon = "attack3";
|
||||
|
||||
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
||||
MWRender::Animation::Group_All, true,
|
||||
@ -1308,15 +1315,6 @@ void CharacterController::determineAttackType()
|
||||
else
|
||||
mAttackType = "chop";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (move[0] && !move[1]) //sideway
|
||||
mCurrentWeapon = "attack2";
|
||||
else if (move[1]) //forward
|
||||
mCurrentWeapon = "attack3";
|
||||
else
|
||||
mCurrentWeapon = "attack1";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user