Resist failed normal weapon hits (bug #7284)

revert-6246b479
Alexei Dobrohotov 10 months ago
parent d9027f7eef
commit 411c71062c

@ -54,6 +54,7 @@
Bug #7172: Current music playlist continues playing indefinitely if next playlist is empty
Bug #7229: Error marker loading failure is not handled
Bug #7243: Supporting loading external files from VFS from esm files
Bug #7284: "Your weapon has no effect." message doesn't always show when the player character attempts to attack
Bug #7298: Water ripples from projectiles sometimes are not spawned
Bug #7307: Alchemy "Magic Effect" search string does not match on tool tip for effects related to attributes
Bug #7322: Shadows don't cover groundcover depending on the view angle and perspective with compute scene bounds = primitives

@ -614,15 +614,16 @@ namespace MWClass
if (ptr == MWMechanics::getPlayer())
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
float damage = 0.0f;
if (!success)
{
othercls.onHit(victim, 0.0f, false, weapon, ptr, osg::Vec3f(), false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
othercls.onHit(victim, damage, false, weapon, ptr, osg::Vec3f(), false);
MWMechanics::reduceWeaponCondition(damage, false, weapon, ptr);
MWMechanics::resistNormalWeapon(victim, ptr, weapon, damage);
return;
}
bool healthdmg;
float damage = 0.0f;
if (!weapon.isEmpty())
{
const unsigned char* attack = nullptr;

@ -180,7 +180,7 @@ namespace MWMechanics
void resistNormalWeapon(
const MWWorld::Ptr& actor, const MWWorld::Ptr& attacker, const MWWorld::Ptr& weapon, float& damage)
{
if (damage == 0 || weapon.isEmpty() || !isNormalWeapon(weapon))
if (weapon.isEmpty() || !isNormalWeapon(weapon))
return;
const MWMechanics::MagicEffects& effects = actor.getClass().getCreatureStats(actor).getMagicEffects();
@ -189,7 +189,7 @@ namespace MWMechanics
damage *= 1.f - std::min(1.f, resistance - weakness);
if (damage == 0 && attacker == getPlayer())
if (resistance - weakness >= 1.f && attacker == getPlayer())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResistsWeapons}");
}

Loading…
Cancel
Save