From 772511d1e8b17500cc89cbd9ed419be5bf35b51d Mon Sep 17 00:00:00 2001 From: Bohica <53943479+Bohicatv@users.noreply.github.com> Date: Thu, 6 Feb 2025 01:27:40 -0800 Subject: [PATCH] fix: Reverts GetProtOffset, Adds PreT2A Weapon Damage & PreUOR Armor Durability (#2114) --- Projects/UOContent/Items/Armor/BaseArmor.cs | 73 +++++++------------ .../UOContent/Items/Weapons/BaseWeapon.cs | 35 +++++---- 2 files changed, 43 insertions(+), 65 deletions(-) diff --git a/Projects/UOContent/Items/Armor/BaseArmor.cs b/Projects/UOContent/Items/Armor/BaseArmor.cs index b1e7139a3..a6955bf0f 100644 --- a/Projects/UOContent/Items/Armor/BaseArmor.cs +++ b/Projects/UOContent/Items/Armor/BaseArmor.cs @@ -887,61 +887,40 @@ namespace Server.Items public int GetProtOffset() { - if (Core.T2A) + return _protectionLevel switch { - return _protectionLevel switch - { - ArmorProtectionLevel.Defense => 5, - ArmorProtectionLevel.Guarding => 10, - ArmorProtectionLevel.Hardening => 15, - ArmorProtectionLevel.Fortification => 20, - ArmorProtectionLevel.Invulnerability => 25, - _ => 0 // regular - }; - } - else - { - return _protectionLevel switch - { - ArmorProtectionLevel.Defense => 2, - ArmorProtectionLevel.Guarding => 4, - ArmorProtectionLevel.Hardening => 6, - ArmorProtectionLevel.Fortification => 8, - ArmorProtectionLevel.Invulnerability => 10, - _ => 0 // regular - }; - } + ArmorProtectionLevel.Guarding => 1, + ArmorProtectionLevel.Hardening => 2, + ArmorProtectionLevel.Fortification => 3, + ArmorProtectionLevel.Invulnerability => 4, + _ => 0 + }; } public int GetDurabilityBonus() { - if (Core.UOR) + if (!Core.UOR) { - var bonus = _durability switch - { - ArmorDurabilityLevel.Durable => 20, - ArmorDurabilityLevel.Substantial => 50, - ArmorDurabilityLevel.Massive => 70, - ArmorDurabilityLevel.Fortified => 100, - ArmorDurabilityLevel.Indestructible => 120, - _ => 0 - }; - - if (Core.AOS) - { - var resInfo = CraftResources.GetInfo(_resource); - bonus += ArmorAttributes.DurabilityBonus + (resInfo?.AttributeInfo?.ArmorDurability ?? 0); - } - - if (_quality == ArmorQuality.Exceptional) - { - return bonus + 20; - } - - return bonus; + return (int)_durability * 5 + ((int)_quality - 1) * 10; } - return (int)_durability * 5 + ((int)_quality - 1) * 10; + var bonus = _durability switch + { + ArmorDurabilityLevel.Durable => 20, + ArmorDurabilityLevel.Substantial => 50, + ArmorDurabilityLevel.Massive => 70, + ArmorDurabilityLevel.Fortified => 100, + ArmorDurabilityLevel.Indestructible => 120, + _ => 0 + }; + + if (Core.AOS) + { + var resInfo = CraftResources.GetInfo(_resource); + bonus += ArmorAttributes.DurabilityBonus + (resInfo?.AttributeInfo?.ArmorDurability ?? 0); + } + + return _quality == ArmorQuality.Exceptional ? bonus + 20 : bonus; } public static void ValidateMobile(Mobile m) diff --git a/Projects/UOContent/Items/Weapons/BaseWeapon.cs b/Projects/UOContent/Items/Weapons/BaseWeapon.cs index 7a1a3c073..3bc381b5a 100644 --- a/Projects/UOContent/Items/Weapons/BaseWeapon.cs +++ b/Projects/UOContent/Items/Weapons/BaseWeapon.cs @@ -941,9 +941,12 @@ public abstract partial class BaseWeapon public int GetDurabilityBonus() { - var bonus = _quality == WeaponQuality.Exceptional ? 20 : 0; + if (!Core.UOR) + { + return (int)_durabilityLevel * 5 + ((int)_quality - 1) * 10; + } - bonus += _durabilityLevel switch + var bonus = _durabilityLevel switch { WeaponDurabilityLevel.Durable => 20, WeaponDurabilityLevel.Substantial => 50, @@ -955,23 +958,11 @@ public abstract partial class BaseWeapon if (Core.AOS) { - bonus += WeaponAttributes.DurabilityBonus; - var resInfo = CraftResources.GetInfo(_resource); - CraftAttributeInfo attrInfo = null; - - if (resInfo != null) - { - attrInfo = resInfo.AttributeInfo; - } - - if (attrInfo != null) - { - bonus += attrInfo.WeaponDurability; - } + bonus += WeaponAttributes.DurabilityBonus + (resInfo?.AttributeInfo?.WeaponDurability ?? 0); } - return bonus; + return _quality == WeaponQuality.Exceptional ? bonus + 20 : bonus; } public int GetLowerStatReq() @@ -1354,7 +1345,7 @@ public abstract partial class BaseWeapon theirValue = Math.Max(0.1, defValue + 50.0); } - var chance = ourValue / (theirValue * 2.0) * 1.0 + (double)bonus / 100; + var chance = ourValue / (theirValue * 2.0) * 1.0 + (double)bonus / 100;; if (Core.AOS && chance < 0.02) { @@ -2484,7 +2475,15 @@ public abstract partial class BaseWeapon */ if (_damageLevel != WeaponDamageLevel.Regular) { - damage += 2 * (int)_damageLevel - 1; + // Toward the end of T2A, calculations were changed + if (!Core.T2A) + { + damage += (int)_damageLevel; + } + else + { + damage += 2 * (int)_damageLevel - 1; + } } return damage;