forked from teamnwah/openmw-tes3coop
Switch hand-to-hand attack types randomly when "always use best attack" is turned on (Fixes #3259)
This commit is contained in:
parent
0a2724f9f2
commit
b332704df7
2 changed files with 24 additions and 7 deletions
|
@ -1281,14 +1281,19 @@ bool CharacterController::updateWeaponState()
|
||||||
mAttackType = "shoot";
|
mAttackType = "shoot";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(isWeapon && mPtr == getPlayer() &&
|
if (isWeapon)
|
||||||
Settings::Manager::getBool("best attack", "Game"))
|
|
||||||
{
|
{
|
||||||
MWWorld::ContainerStoreIterator weapon = mPtr.getClass().getInventoryStore(mPtr).getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
if(mPtr == getPlayer() &&
|
||||||
mAttackType = getBestAttack(weapon->get<ESM::Weapon>()->mBase);
|
Settings::Manager::getBool("best attack", "Game"))
|
||||||
|
{
|
||||||
|
MWWorld::ContainerStoreIterator weapon = mPtr.getClass().getInventoryStore(mPtr).getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||||
|
mAttackType = getBestAttack(weapon->get<ESM::Weapon>()->mBase);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
setAttackTypeBasedOnMovement();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
determineAttackType();
|
setAttackTypeRandomly();
|
||||||
}
|
}
|
||||||
|
|
||||||
mAnimation->play(mCurrentWeapon, priorityWeapon,
|
mAnimation->play(mCurrentWeapon, priorityWeapon,
|
||||||
|
@ -2061,7 +2066,18 @@ void CharacterController::updateMagicEffects()
|
||||||
mAnimation->setLightEffect(light);
|
mAnimation->setLightEffect(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterController::determineAttackType()
|
void CharacterController::setAttackTypeRandomly()
|
||||||
|
{
|
||||||
|
float random = Misc::Rng::rollProbability();
|
||||||
|
if (random >= 2/3.f)
|
||||||
|
mAttackType = "thrust";
|
||||||
|
else if (random >= 1/3.f)
|
||||||
|
mAttackType = "slash";
|
||||||
|
else
|
||||||
|
mAttackType = "chop";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CharacterController::setAttackTypeBasedOnMovement()
|
||||||
{
|
{
|
||||||
float *move = mPtr.getClass().getMovementSettings(mPtr).mPosition;
|
float *move = mPtr.getClass().getMovementSettings(mPtr).mPosition;
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,8 @@ class CharacterController : public MWRender::Animation::TextKeyListener
|
||||||
|
|
||||||
bool mAttackingOrSpell;
|
bool mAttackingOrSpell;
|
||||||
|
|
||||||
void determineAttackType();
|
void setAttackTypeBasedOnMovement();
|
||||||
|
void setAttackTypeRandomly();
|
||||||
|
|
||||||
void refreshCurrentAnims(CharacterState idle, CharacterState movement, JumpingState jump, bool force=false);
|
void refreshCurrentAnims(CharacterState idle, CharacterState movement, JumpingState jump, bool force=false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue