From 382b68a081e449dd8f229f438e3947ac0a5c91c3 Mon Sep 17 00:00:00 2001 From: Capostrophic <21265616+Capostrophic@users.noreply.github.com> Date: Wed, 1 Aug 2018 19:27:19 +0300 Subject: [PATCH] Combat AI: take the actual hit chance in account when rating weapon --- apps/openmw/mwmechanics/weaponpriority.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/weaponpriority.cpp b/apps/openmw/mwmechanics/weaponpriority.cpp index 5a0bd9c15..f3d00c606 100644 --- a/apps/openmw/mwmechanics/weaponpriority.cpp +++ b/apps/openmw/mwmechanics/weaponpriority.cpp @@ -103,7 +103,10 @@ namespace MWMechanics int skill = item.getClass().getEquipmentSkill(item); if (skill != -1) - rating *= actor.getClass().getSkill(actor, skill) / 100.f; + { + MWMechanics::SkillValue& value = actor.getClass().getSkill(actor, skill); + rating *= MWMechanics::getHitChance(actor, enemy, value) / 100.f; + } // There is no need to apply bonus if weapon rating == 0 if (rating == 0.f)