Skip to content

Commit

Permalink
Merge pull request #2235 from akortunov/aifix
Browse files Browse the repository at this point in the history
[0.45 regression] Fix AI regressions
  • Loading branch information
psi29a committed Mar 10, 2019
1 parent 1f3813a commit e29e324
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/openmw/mwmechanics/spellpriority.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 3 additions & 1 deletion apps/openmw/mwmechanics/weaponpriority.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e29e324

Please sign in to comment.