Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohicatv authored and kamronbatman committed Feb 6, 2025
1 parent 200e6dd commit 255f3a4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 137 deletions.
71 changes: 19 additions & 52 deletions Projects/UOContent/Items/Armor/BaseArmor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -887,73 +887,40 @@ public CraftAttributeInfo GetResourceAttrs() =>

public int GetProtOffset()
{
if (Core.UOR)
return _protectionLevel switch
{
return _protectionLevel switch
{
ArmorProtectionLevel.Defense => 2,
ArmorProtectionLevel.Guarding => 4,
ArmorProtectionLevel.Hardening => 6,
ArmorProtectionLevel.Fortification => 8,
ArmorProtectionLevel.Invulnerability => 10,
_ => 0
};
}
else
{
return _protectionLevel switch
{
ArmorProtectionLevel.Defense => 5,
ArmorProtectionLevel.Guarding => 10,
ArmorProtectionLevel.Hardening => 15,
ArmorProtectionLevel.Fortification => 20,
ArmorProtectionLevel.Invulnerability => 25,
_ => 0
};
}
ArmorProtectionLevel.Guarding => 1,
ArmorProtectionLevel.Hardening => 2,
ArmorProtectionLevel.Fortification => 3,
ArmorProtectionLevel.Invulnerability => 4,
_ => 0
};
}

public int GetDurabilityBonus()
{
var bonus = _quality == ArmorQuality.Exceptional ? 20 : 0;

if (Core.UOR)
if (!Core.UOR)
{
return _durability switch
{
ArmorDurabilityLevel.Durable => 20,
ArmorDurabilityLevel.Substantial => 50,
ArmorDurabilityLevel.Massive => 70,
ArmorDurabilityLevel.Fortified => 100,
ArmorDurabilityLevel.Indestructible => 120,
_ => 0
};
return (int)_durability * 5 + ((int)_quality - 1) * 10;
}
else

var bonus = _durability switch
{
return _durability switch
{
ArmorDurabilityLevel.Durable => 5,
ArmorDurabilityLevel.Substantial => 10,
ArmorDurabilityLevel.Massive => 15,
ArmorDurabilityLevel.Fortified => 20,
ArmorDurabilityLevel.Indestructible => 25,
_ => 0
};
}
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 _quality == ArmorQuality.Exceptional ? bonus + 20 : bonus;
}

public static void ValidateMobile(Mobile m)
Expand Down
124 changes: 39 additions & 85 deletions Projects/UOContent/Items/Weapons/BaseWeapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -941,52 +941,28 @@ public override void OnAfterDuped(Item newItem)

public int GetDurabilityBonus()
{
var bonus = _quality == WeaponQuality.Exceptional ? 20 : 0;

if (Core.UOR)
if (!Core.UOR)
{
bonus += _durabilityLevel switch
{
WeaponDurabilityLevel.Durable => 20,
WeaponDurabilityLevel.Substantial => 50,
WeaponDurabilityLevel.Massive => 70,
WeaponDurabilityLevel.Fortified => 100,
WeaponDurabilityLevel.Indestructible => 120,
_ => 0
};
return (int)_durabilityLevel * 5 + ((int)_quality - 1) * 10;
}
else

var bonus = _durabilityLevel switch
{
bonus += _durabilityLevel switch
{
WeaponDurabilityLevel.Durable => 5,
WeaponDurabilityLevel.Substantial => 10,
WeaponDurabilityLevel.Massive => 15,
WeaponDurabilityLevel.Fortified => 20,
WeaponDurabilityLevel.Indestructible => 25,
_ => 0
};
}
WeaponDurabilityLevel.Durable => 20,
WeaponDurabilityLevel.Substantial => 50,
WeaponDurabilityLevel.Massive => 70,
WeaponDurabilityLevel.Fortified => 100,
WeaponDurabilityLevel.Indestructible => 120,
_ => 0
};

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 @@ -1258,10 +1234,9 @@ public virtual bool CheckHit(Mobile attacker, Mobile defender)

double ourValue, theirValue;

var bonus = GetHitChanceBonus();

if (Core.AOS)
{
var bonus = GetHitChanceBonus();
if (atkValue <= -20.0)
{
atkValue = -19.9;
Expand Down Expand Up @@ -1360,16 +1335,14 @@ public virtual bool CheckHit(Mobile attacker, Mobile defender)
}

theirValue = (defValue + 20.0) * (100 + bonus);

bonus = 0;
}
else
{
ourValue = Math.Max(0.1, atkValue + 50.0);
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);

if (Core.AOS && chance < 0.02)
{
Expand Down Expand Up @@ -2489,29 +2462,25 @@ public virtual double GetBaseDamage(Mobile attacker)
return damage;
}

if (Core.UOR)
/* Apply damage level offset
* : Regular : 0
* : Ruin : 1
* : Might : 3
* : Force : 5
* : Power : 7
* : Vanq : 9
*/
if (_damageLevel != WeaponDamageLevel.Regular)
{
damage += _damageLevel switch
// Toward the end of T2A, calculations were changed
if (!Core.T2A)
{
WeaponDamageLevel.Ruin => 1,
WeaponDamageLevel.Might => 3,
WeaponDamageLevel.Force => 5,
WeaponDamageLevel.Power => 7,
WeaponDamageLevel.Vanq => 9,
_ => 0
};
}
else
{
damage += _damageLevel switch
damage += (int)_damageLevel;
}
else
{
WeaponDamageLevel.Ruin => 5,
WeaponDamageLevel.Might => 10,
WeaponDamageLevel.Force => 15,
WeaponDamageLevel.Power => 20,
WeaponDamageLevel.Vanq => 25,
_ => 0
};
damage += (int)_damageLevel - 1;
}
}

return damage;
Expand All @@ -2531,30 +2500,15 @@ public virtual double GetBonus(double value, double scalar, double threshold, do

public virtual int GetHitChanceBonus()
{
if (Core.UOR)
{
return _accuracyLevel switch
{
WeaponAccuracyLevel.Accurate => 2,
WeaponAccuracyLevel.Surpassingly => 4,
WeaponAccuracyLevel.Eminently => 6,
WeaponAccuracyLevel.Exceedingly => 8,
WeaponAccuracyLevel.Supremely => 10,
_ => 0
};
}
else
return _accuracyLevel switch
{
return _accuracyLevel switch
{
WeaponAccuracyLevel.Accurate => 5,
WeaponAccuracyLevel.Surpassingly => 10,
WeaponAccuracyLevel.Eminently => 15,
WeaponAccuracyLevel.Exceedingly => 20,
WeaponAccuracyLevel.Supremely => 25,
_ => 0
};
}
WeaponAccuracyLevel.Accurate => 2,
WeaponAccuracyLevel.Surpassingly => 4,
WeaponAccuracyLevel.Eminently => 6,
WeaponAccuracyLevel.Exceedingly => 8,
WeaponAccuracyLevel.Supremely => 10,
_ => 0
};
}

// Note: AOS quality/damage bonuses removed since they are incorporated into the crafting already
Expand Down

0 comments on commit 255f3a4

Please sign in to comment.