Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Reverts GetProtOffset, Adds PreT2A Weapon Damage & PreUOR Armor Durability #2114

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 24 additions & 45 deletions Projects/UOContent/Items/Armor/BaseArmor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -887,61 +887,40 @@ public CraftAttributeInfo GetResourceAttrs() =>

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);
}
return (int)_durability * 5 + ((int)_quality - 1) * 10;
}

if (_quality == ArmorQuality.Exceptional)
{
return bonus + 20;
}
var bonus = _durability switch
{
ArmorDurabilityLevel.Durable => 20,
ArmorDurabilityLevel.Substantial => 50,
ArmorDurabilityLevel.Massive => 70,
ArmorDurabilityLevel.Fortified => 100,
ArmorDurabilityLevel.Indestructible => 120,
_ => 0
};

return bonus;
if (Core.AOS)
{
var resInfo = CraftResources.GetInfo(_resource);
bonus += ArmorAttributes.DurabilityBonus + (resInfo?.AttributeInfo?.ArmorDurability ?? 0);
}

return (int)_durability * 5 + ((int)_quality - 1) * 10;
return _quality == ArmorQuality.Exceptional ? bonus + 20 : bonus;
}

public static void ValidateMobile(Mobile m)
Expand Down
35 changes: 17 additions & 18 deletions Projects/UOContent/Items/Weapons/BaseWeapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -941,9 +941,12 @@ public override void OnAfterDuped(Item newItem)

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,
Expand All @@ -955,23 +958,11 @@ public int GetDurabilityBonus()

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()
Expand Down Expand Up @@ -1354,7 +1345,7 @@ public virtual bool CheckHit(Mobile attacker, Mobile defender)
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)
{
Expand Down Expand Up @@ -2484,7 +2475,15 @@ public virtual double GetBaseDamage(Mobile attacker)
*/
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;
Expand Down
Loading