1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-23 20:39:57 +00:00

Merge pull request #1878 from Capostrophic/hitchance

Use the correct skill for creature AI weapon hit chance rating
This commit is contained in:
Bret Curtis 2018-08-21 08:12:06 +02:00 committed by GitHub
commit b748bb11ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,11 +108,19 @@ namespace MWMechanics
}
}
int skill = item.getClass().getEquipmentSkill(item);
if (skill != -1)
if (actor.getClass().isNpc())
{
int value = actor.getClass().getSkill(actor, skill);
rating *= MWMechanics::getHitChance(actor, enemy, value) / 100.f;
int skill = item.getClass().getEquipmentSkill(item);
if (skill != -1)
{
int value = actor.getClass().getSkill(actor, skill);
rating *= MWMechanics::getHitChance(actor, enemy, value) / 100.f;
}
}
else
{
MWWorld::LiveCellRef<ESM::Creature> *ref = actor.get<ESM::Creature>();
rating *= MWMechanics::getHitChance(actor, enemy, ref->mBase->mData.mCombat) / 100.f;
}
return rating * rangedMult;