mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-15 23:36:56 -04:00
Combat AI: take in account enemy weapon resistance
This commit is contained in:
parent
62b24eb078
commit
a2be73295b
@ -135,6 +135,9 @@ namespace MWMechanics
|
|||||||
if (weapon->mData.mType >= ESM::Weapon::MarksmanBow)
|
if (weapon->mData.mType >= ESM::Weapon::MarksmanBow)
|
||||||
{
|
{
|
||||||
rating = (weapon->mData.mChop[0] + weapon->mData.mChop[1]) / 2.f;
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -145,6 +148,8 @@ namespace MWMechanics
|
|||||||
rating += weapon->mData.mChop[i];
|
rating += weapon->mData.mChop[i];
|
||||||
}
|
}
|
||||||
rating /= 6.f;
|
rating /= 6.f;
|
||||||
|
|
||||||
|
MWMechanics::resistNormalWeapon(enemy, actor, item, rating);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getClass().hasItemHealth(item))
|
if (item.getClass().hasItemHealth(item))
|
||||||
@ -182,6 +187,10 @@ namespace MWMechanics
|
|||||||
if (skill != -1)
|
if (skill != -1)
|
||||||
rating *= actor.getClass().getSkill(actor, skill) / 100.f;
|
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;
|
return rating + bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user