From e66be02e2e2f4a6ebd8fb883e58402aa0bc17cdf Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Fri, 31 Aug 2018 02:06:29 +0300 Subject: [PATCH] Account for enemy armor rating in weapon rating --- apps/openmw/mwmechanics/weaponpriority.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/weaponpriority.cpp b/apps/openmw/mwmechanics/weaponpriority.cpp index 6b9616359..6861a1b77 100644 --- a/apps/openmw/mwmechanics/weaponpriority.cpp +++ b/apps/openmw/mwmechanics/weaponpriority.cpp @@ -97,8 +97,11 @@ namespace MWMechanics } } - if (weapon->mData.mType <= ESM::Weapon::MarksmanThrown) - rating *= weapon->mData.mSpeed; + if (enemy.getClass().isNpc()) + { + static const float fCombatArmorMinMult = gmst.find("fCombatArmorMinMult")->mValue.getFloat(); + rating *= std::max(fCombatArmorMinMult, rating / (rating + enemy.getClass().getArmorRating(enemy))); + } int value = 50.f; if (actor.getClass().isNpc()) @@ -115,6 +118,9 @@ namespace MWMechanics rating *= getHitChance(actor, enemy, value) / 100.f; + if (weapon->mData.mType <= ESM::Weapon::MarksmanThrown) + rating *= weapon->mData.mSpeed; + return rating * rangedMult; }