diff --git a/CHANGELOG.md b/CHANGELOG.md index d5acfd089..2646bcbbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -114,6 +114,7 @@ Feature #5000: Compressed BSA format support Feature #5010: Native graphics herbalism support Feature #5031: Make GetWeaponType function return different values for tools + Feature #5033: Magic armor mitigation for creatures Task #4686: Upgrade media decoder to a more current FFmpeg API Task #4695: Optimize Distant Terrain memory consumption Task #4721: Add NMake support to the Windows prebuild script diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 9ea103a36..4c50634e0 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -401,10 +401,10 @@ namespace MWClass stats.setHitRecovery(true); // Is this supposed to always occur? } - damage = std::max(1.f, damage); - if(ishealth) { + damage *= damage / (damage + getArmorRating(ptr)); + damage = std::max(1.f, damage); if (!attacker.isEmpty()) { damage = scaleDamage(damage, attacker, ptr); @@ -597,7 +597,7 @@ namespace MWClass float Creature::getArmorRating (const MWWorld::Ptr& ptr) const { - // Note this is currently unused. Creatures do not use armor mitigation. + // Equipment armor rating is deliberately ignored. return getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Shield).getMagnitude(); } diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index 2dedd863f..f37354cba 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -571,8 +571,8 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor) // Autoequip clothing, armor and weapons. // Equipping lights is handled in Actors::updateEquippedLight based on environment light. - // Note: creatures do not use the armor mitigation and can equip only shields - // Use a custom logic for them - select shield based on its health instead of armor rating (since it useless for creatures) + // Note: creatures ignore equipment armor rating and only equip shields + // Use custom logic for them - select shield based on its health instead of armor rating autoEquipWeapon(actor, slots_); autoEquipArmor(actor, slots_);