forked from mirror/openmw-tes3mp
Combat AI: take in account enemy weapon resistance
This commit is contained in:
parent
62b24eb078
commit
a2be73295b
1 changed files with 9 additions and 0 deletions
|
@ -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…
Reference in a new issue