1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 18:29:55 +00:00

Rate weapons as useless if the actor's skill is 0

This commit is contained in:
Evil Eye 2023-10-24 21:29:37 +02:00
parent f724b05c57
commit 6cd5734fb3
2 changed files with 12 additions and 7 deletions

View file

@ -83,6 +83,7 @@
Bug #7611: Beast races' idle animations slide after turning or jumping in place Bug #7611: Beast races' idle animations slide after turning or jumping in place
Bug #7630: Charm can be cast on creatures Bug #7630: Charm can be cast on creatures
Bug #7631: Cannot trade with/talk to Creeper or Mudcrab Merchant when they're fleeing Bug #7631: Cannot trade with/talk to Creeper or Mudcrab Merchant when they're fleeing
Bug #7639: NPCs don't use hand-to-hand if their other melee skills were damaged during combat
Feature #3537: Shader-based water ripples Feature #3537: Shader-based water ripples
Feature #5492: Let rain and snow collide with statics Feature #5492: Let rain and snow collide with statics
Feature #6149: Dehardcode Lua API_REVISION Feature #6149: Dehardcode Lua API_REVISION

View file

@ -118,13 +118,17 @@ namespace MWMechanics
} }
int value = 50.f; int value = 50.f;
if (actor.getClass().isNpc()) ESM::RefId skill = item.getClass().getEquipmentSkill(item);
{ if (!skill.empty())
ESM::RefId skill = item.getClass().getEquipmentSkill(item); value = actor.getClass().getSkill(actor, skill);
if (!skill.empty()) // Prefer hand-to-hand if our skill is 0 (presumably due to magic)
value = actor.getClass().getSkill(actor, skill); if (value <= 0.f)
} return 0.f;
else // Note that a creature with a dagger and 0 Stealth will forgo the weapon despite using Combat for hit chance.
// The same creature will use a sword provided its Combat stat isn't 0. We're using the "skill" value here to
// decide whether to use the weapon at all, but adjusting the final rating based on actual hit chance - i.e. the
// Combat stat.
if (!actor.getClass().isNpc())
{ {
MWWorld::LiveCellRef<ESM::Creature>* ref = actor.get<ESM::Creature>(); MWWorld::LiveCellRef<ESM::Creature>* ref = actor.get<ESM::Creature>();
value = ref->mBase->mData.mCombat; value = ref->mBase->mData.mCombat;