1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-31 23:45:32 +00:00

Combat AI: take in account enemy weapon resistance

This commit is contained in:
Andrei Kortunov 2017-06-16 13:33:42 +04:00
parent 62b24eb078
commit a2be73295b

View file

@ -135,6 +135,9 @@ namespace MWMechanics
if (weapon->mData.mType >= ESM::Weapon::MarksmanBow)
{
rating = (weapon->mData.mChop[0] + weapon->mData.mChop[1]) / 2.f;
if (weapon->mData.mType >= ESM::Weapon::MarksmanThrown)
MWMechanics::resistNormalWeapon(enemy, actor, item, rating);
}
else
{
@ -145,6 +148,8 @@ namespace MWMechanics
rating += weapon->mData.mChop[i];
}
rating /= 6.f;
MWMechanics::resistNormalWeapon(enemy, actor, item, rating);
}
if (item.getClass().hasItemHealth(item))
@ -182,6 +187,10 @@ namespace MWMechanics
if (skill != -1)
rating *= actor.getClass().getSkill(actor, skill) / 100.f;
// There is no need to apply bonus if weapon rating == 0
if (rating == 0.f)
return 0.f;
return rating + bonus;
}