Merge pull request #2538 from Capostrophic/animation

Use random attack strength if there's no wind up animation (bug #5059)
This commit is contained in:
Andrei Kortunov 2019-10-02 08:23:13 +04:00 committed by GitHub
commit 2b2f63c919
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -1629,7 +1629,9 @@ bool CharacterController::updateWeaponState(CharacterState& idle)
if(mUpperBodyState == UpperCharState_MinAttackToMaxAttack && !isKnockedDown())
{
float attackStrength = complete;
if (!mPtr.getClass().isNpc())
float minAttackTime = mAnimation->getTextKeyTime(mCurrentWeapon+": "+mAttackType+" "+"min attack");
float maxAttackTime = mAnimation->getTextKeyTime(mCurrentWeapon+": "+mAttackType+" "+"max attack");
if (minAttackTime == maxAttackTime)
{
// most creatures don't actually have an attack wind-up animation, so use a uniform random value
// (even some creatures that can use weapons don't have a wind-up animation either, e.g. Rieklings)
@ -1735,7 +1737,7 @@ bool CharacterController::updateWeaponState(CharacterState& idle)
{
// If actor is already stopped preparing attack, do not play the "min attack -> max attack" part.
// Happens if the player did not hold the attack button.
// Note: if the "min attack"->"max attack" is a stub, "play" it anyway. Attack strength will be 1.
// Note: if the "min attack"->"max attack" is a stub, "play" it anyway. Attack strength will be random.
float minAttackTime = mAnimation->getTextKeyTime(mCurrentWeapon+": "+mAttackType+" "+"min attack");
float maxAttackTime = mAnimation->getTextKeyTime(mCurrentWeapon+": "+mAttackType+" "+"max attack");
if (mAttackingOrSpell || minAttackTime == maxAttackTime)