1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Combat AI: normalize hit chance in the weapon priority calculation

This commit is contained in:
Andrei Kortunov 2019-03-09 22:20:43 +04:00
parent 5f0c8a4783
commit 2a08b85998

View File

@ -127,7 +127,9 @@ namespace MWMechanics
value = ref->mBase->mData.mCombat;
}
rating *= getHitChance(actor, enemy, value) / 100.f;
// Take hit chance in account, but do not allow rating become negative.
float chance = getHitChance(actor, enemy, value) / 100.f;
rating *= std::min(1.f, std::max(0.01f, chance));
if (weapon->mData.mType < ESM::Weapon::Arrow)
rating *= weapon->mData.mSpeed;