mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 18:06:43 +00:00
Combat AI: normalize hit chance in the weapon priority calculation
This commit is contained in:
parent
5f0c8a4783
commit
2a08b85998
1 changed files with 3 additions and 1 deletions
|
@ -127,7 +127,9 @@ namespace MWMechanics
|
||||||
value = ref->mBase->mData.mCombat;
|
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)
|
if (weapon->mData.mType < ESM::Weapon::Arrow)
|
||||||
rating *= weapon->mData.mSpeed;
|
rating *= weapon->mData.mSpeed;
|
||||||
|
|
Loading…
Reference in a new issue