1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-12 21:39:26 +00:00

Merge pull request #2235 from akortunov/aifix

[0.45 regression] Fix AI regressions
This commit is contained in:
Bret Curtis 2019-03-10 11:48:48 +01:00
parent 1f3813a230
commit e29e3248fc
2 changed files with 4 additions and 2 deletions

View File

@ -171,7 +171,7 @@ namespace MWMechanics
float rating = rateEffects(enchantment->mEffects, actor, enemy);
rating *= 2; // prefer rechargable magic items over spells
rating *= 1.25f; // prefer rechargable magic items over spells
return rating;
}

View File

@ -125,7 +125,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;