Merge branch 'brokenknuckles' into 'master'

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

Closes #7639

See merge request OpenMW/openmw!3520
macos_ci_fix
Alexei Kotov 1 year ago
commit 2488ecebc5

@ -83,6 +83,7 @@
Bug #7611: Beast races' idle animations slide after turning or jumping in place
Bug #7630: Charm can be cast on creatures
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 #5492: Let rain and snow collide with statics
Feature #6149: Dehardcode Lua API_REVISION

@ -118,13 +118,17 @@ namespace MWMechanics
}
int value = 50.f;
if (actor.getClass().isNpc())
{
ESM::RefId skill = item.getClass().getEquipmentSkill(item);
if (!skill.empty())
value = actor.getClass().getSkill(actor, skill);
}
else
ESM::RefId skill = item.getClass().getEquipmentSkill(item);
if (!skill.empty())
value = actor.getClass().getSkill(actor, skill);
// Prefer hand-to-hand if our skill is 0 (presumably due to magic)
if (value <= 0.f)
return 0.f;
// 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>();
value = ref->mBase->mData.mCombat;

Loading…
Cancel
Save