fix: Fixes AR/Durability/Tool Uses for Pre-UOR and LBR (#2113)
This commit is contained in:
parent
d407847fc4
commit
51367df0d2
6 changed files with 173 additions and 82 deletions
|
|
@ -313,26 +313,35 @@ namespace Server.Items
|
|||
|
||||
if (_protectionLevel != ArmorProtectionLevel.Regular)
|
||||
{
|
||||
ar += 10 + 5 * (int)_protectionLevel;
|
||||
if (Core.UOR)
|
||||
{
|
||||
ar += 10;
|
||||
}
|
||||
|
||||
ar += 5 * (int)_protectionLevel;
|
||||
}
|
||||
|
||||
ar += _resource switch
|
||||
// Colored armor does not give a bonus until UOR+
|
||||
if (Core.UOR)
|
||||
{
|
||||
CraftResource.DullCopper => 2,
|
||||
CraftResource.ShadowIron => 4,
|
||||
CraftResource.Copper => 6,
|
||||
CraftResource.Bronze => 8,
|
||||
CraftResource.Gold => 10,
|
||||
CraftResource.Agapite => 12,
|
||||
CraftResource.Verite => 14,
|
||||
CraftResource.Valorite => 16,
|
||||
CraftResource.SpinedLeather => 10,
|
||||
CraftResource.HornedLeather => 13,
|
||||
CraftResource.BarbedLeather => 16,
|
||||
_ => 0
|
||||
};
|
||||
ar += _resource switch
|
||||
{
|
||||
CraftResource.DullCopper => 2,
|
||||
CraftResource.ShadowIron => 4,
|
||||
CraftResource.Copper => 6,
|
||||
CraftResource.Bronze => 8,
|
||||
CraftResource.Gold => 10,
|
||||
CraftResource.Agapite => 12,
|
||||
CraftResource.Verite => 14,
|
||||
CraftResource.Valorite => 16,
|
||||
CraftResource.SpinedLeather => 10,
|
||||
CraftResource.HornedLeather => 13,
|
||||
CraftResource.BarbedLeather => 16,
|
||||
_ => 0
|
||||
};
|
||||
}
|
||||
|
||||
ar += -8 + 8 * (int)_quality;
|
||||
ar += 8 * (int)(_quality - 1);
|
||||
return ScaleArmorByDurability(ar);
|
||||
}
|
||||
}
|
||||
|
|
@ -546,7 +555,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public int OnCraft(
|
||||
public virtual int OnCraft(
|
||||
int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue
|
||||
)
|
||||
|
|
@ -578,8 +587,9 @@ namespace Server.Items
|
|||
{
|
||||
DistributeBonuses(
|
||||
tool is BaseRunicTool ? 6 :
|
||||
// Not sure since when, but right now 15 points are added, not 14.
|
||||
Core.SE ? 15 : 14
|
||||
); // Not sure since when, but right now 15 points are added, not 14.
|
||||
);
|
||||
}
|
||||
|
||||
if (Core.ML && this is not BaseShield)
|
||||
|
|
@ -591,20 +601,30 @@ namespace Server.Items
|
|||
switch (Utility.Random(5))
|
||||
{
|
||||
case 0:
|
||||
PhysicalBonus++;
|
||||
break;
|
||||
{
|
||||
PhysicalBonus++;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
FireBonus++;
|
||||
break;
|
||||
{
|
||||
FireBonus++;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
ColdBonus++;
|
||||
break;
|
||||
{
|
||||
ColdBonus++;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
EnergyBonus++;
|
||||
break;
|
||||
{
|
||||
EnergyBonus++;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
PoisonBonus++;
|
||||
break;
|
||||
{
|
||||
PoisonBonus++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -832,20 +852,30 @@ namespace Server.Items
|
|||
switch (Utility.Random(5))
|
||||
{
|
||||
case 0:
|
||||
++PhysicalBonus;
|
||||
break;
|
||||
{
|
||||
++PhysicalBonus;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
++FireBonus;
|
||||
break;
|
||||
{
|
||||
++FireBonus;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
++ColdBonus;
|
||||
break;
|
||||
{
|
||||
++ColdBonus;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
++PoisonBonus;
|
||||
break;
|
||||
{
|
||||
++PoisonBonus;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
++EnergyBonus;
|
||||
break;
|
||||
{
|
||||
++EnergyBonus;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -857,49 +887,61 @@ namespace Server.Items
|
|||
|
||||
public int GetProtOffset()
|
||||
{
|
||||
return _protectionLevel switch
|
||||
if (Core.T2A)
|
||||
{
|
||||
ArmorProtectionLevel.Guarding => 1,
|
||||
ArmorProtectionLevel.Hardening => 2,
|
||||
ArmorProtectionLevel.Fortification => 3,
|
||||
ArmorProtectionLevel.Invulnerability => 4,
|
||||
_ => 0
|
||||
};
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public int GetDurabilityBonus()
|
||||
{
|
||||
var bonus = _quality == ArmorQuality.Exceptional ? 20 : 0;
|
||||
|
||||
bonus += _durability switch
|
||||
if (Core.UOR)
|
||||
{
|
||||
ArmorDurabilityLevel.Durable => 20,
|
||||
ArmorDurabilityLevel.Substantial => 50,
|
||||
ArmorDurabilityLevel.Massive => 70,
|
||||
ArmorDurabilityLevel.Fortified => 100,
|
||||
ArmorDurabilityLevel.Indestructible => 120,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
bonus += ArmorAttributes.DurabilityBonus;
|
||||
|
||||
var resInfo = CraftResources.GetInfo(_resource);
|
||||
CraftAttributeInfo attrInfo = null;
|
||||
|
||||
if (resInfo != null)
|
||||
var bonus = _durability switch
|
||||
{
|
||||
attrInfo = resInfo.AttributeInfo;
|
||||
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 (attrInfo != null)
|
||||
if (_quality == ArmorQuality.Exceptional)
|
||||
{
|
||||
bonus += attrInfo.ArmorDurability;
|
||||
return bonus + 20;
|
||||
}
|
||||
|
||||
return bonus;
|
||||
}
|
||||
|
||||
return bonus;
|
||||
return (int)_durability * 5 + ((int)_quality - 1) * 10;
|
||||
}
|
||||
|
||||
public static void ValidateMobile(Mobile m)
|
||||
|
|
@ -1596,7 +1638,7 @@ namespace Server.Items
|
|||
ArmorDurabilityLevel.Substantial => "substantial",
|
||||
ArmorDurabilityLevel.Massive => "massive",
|
||||
ArmorDurabilityLevel.Fortified => "fortified",
|
||||
ArmorDurabilityLevel.Indestructible => "indestructable",
|
||||
ArmorDurabilityLevel.Indestructible => "indestructible",
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ public abstract partial class BaseInstrument : Item, ICraftable, ISlayer
|
|||
_usesRemaining = Utility.RandomMinMax(InitMinUses, InitMaxUses);
|
||||
}
|
||||
|
||||
public virtual int InitMinUses => 350;
|
||||
public virtual int InitMaxUses => 450;
|
||||
public virtual int InitMinUses => Core.UOR ? 350 : 100;
|
||||
public virtual int InitMaxUses => Core.UOR ? 450 : 150;
|
||||
|
||||
public virtual TimeSpan ChargeReplenishRate => TimeSpan.FromMinutes(5.0);
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ public abstract partial class BaseInstrument : Item, ICraftable, ISlayer
|
|||
}
|
||||
}
|
||||
|
||||
public int OnCraft(
|
||||
public virtual int OnCraft(
|
||||
int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue
|
||||
)
|
||||
|
|
@ -128,6 +128,19 @@ public abstract partial class BaseInstrument : Item, ICraftable, ISlayer
|
|||
Crafter = from?.RawName;
|
||||
}
|
||||
|
||||
// Publish 16 change
|
||||
if (Core.LBR)
|
||||
{
|
||||
if (Quality == InstrumentQuality.Exceptional)
|
||||
{
|
||||
UsesRemaining += 100;
|
||||
}
|
||||
}
|
||||
else if (Quality != InstrumentQuality.Regular)
|
||||
{
|
||||
UsesRemaining += (int)(UsesRemaining * ((int)Quality - 1) * 0.1);
|
||||
}
|
||||
|
||||
return quality;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public abstract partial class BaseTool : Item, IUsesRemaining, ICraftable
|
|||
|
||||
private bool ShowUsesRemaining { get; set; } = true;
|
||||
|
||||
public int OnCraft(
|
||||
public virtual int OnCraft(
|
||||
int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue
|
||||
)
|
||||
|
|
@ -68,6 +68,18 @@ public abstract partial class BaseTool : Item, IUsesRemaining, ICraftable
|
|||
Crafter = from?.RawName;
|
||||
}
|
||||
|
||||
if (Core.UOR)
|
||||
{
|
||||
if (Quality == ToolQuality.Exceptional)
|
||||
{
|
||||
UsesRemaining = 100;
|
||||
}
|
||||
}
|
||||
else if (Quality != ToolQuality.Regular)
|
||||
{
|
||||
UsesRemaining += (int)(UsesRemaining * ((int)Quality - 1) * 0.2);
|
||||
}
|
||||
|
||||
return quality;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
@ -35,5 +37,27 @@ namespace Server.Items
|
|||
public override int InitMaxHits => 60;
|
||||
|
||||
public override WeaponAnimation DefAnimation => WeaponAnimation.Slash1H;
|
||||
|
||||
public override int OnCraft(
|
||||
int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue
|
||||
)
|
||||
{
|
||||
var result = base.OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue);
|
||||
|
||||
if (Core.UOR)
|
||||
{
|
||||
if (Quality == WeaponQuality.Exceptional)
|
||||
{
|
||||
UsesRemaining += 50;
|
||||
}
|
||||
}
|
||||
else if (Quality != WeaponQuality.Regular)
|
||||
{
|
||||
UsesRemaining += (int)(UsesRemaining * ((int)Quality - 1) * 0.2);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -662,7 +662,7 @@ public abstract partial class BaseWeapon
|
|||
[SerializableFieldDefault(23)]
|
||||
private CraftResource ResourceDefaultValue() => CraftResource.Iron;
|
||||
|
||||
public int OnCraft(
|
||||
public virtual int OnCraft(
|
||||
int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue
|
||||
)
|
||||
|
|
|
|||
|
|
@ -547,33 +547,33 @@ namespace Server
|
|||
return Construct<BaseArmor>(_oldArmorOrShieldTypes);
|
||||
}
|
||||
|
||||
private static readonly Type[][] _mlArmorOrHatOrShieldOrJeweleyTypes =
|
||||
private static readonly Type[][] _mlArmorOrHatOrShieldOrJewelryTypes =
|
||||
[MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes];
|
||||
private static readonly Type[][] _seArmorOrHatOrShieldOrJeweleyTypes =
|
||||
private static readonly Type[][] _seArmorOrHatOrShieldOrJewelryTypes =
|
||||
[SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes];
|
||||
private static readonly Type[][] _aosArmorOrHatOrShieldOrJeweleyTypes =
|
||||
private static readonly Type[][] _aosArmorOrHatOrShieldOrJewelryTypes =
|
||||
[ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes];
|
||||
private static readonly Type[][] _oldArmorOrHatOrShieldOrJeweleyTypes =
|
||||
private static readonly Type[][] _oldArmorOrHatOrShieldOrJewelryTypes =
|
||||
[ArmorTypes, HatTypes, ShieldTypes, JewelryTypes];
|
||||
|
||||
public static Item RandomArmorOrShieldOrJewelry(bool inTokuno = false, bool isMondain = false)
|
||||
{
|
||||
if (Core.ML && isMondain)
|
||||
{
|
||||
return Construct(_mlArmorOrHatOrShieldOrJeweleyTypes);
|
||||
return Construct(_mlArmorOrHatOrShieldOrJewelryTypes);
|
||||
}
|
||||
|
||||
if (Core.SE && inTokuno)
|
||||
{
|
||||
return Construct(_seArmorOrHatOrShieldOrJeweleyTypes);
|
||||
return Construct(_seArmorOrHatOrShieldOrJewelryTypes);
|
||||
}
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
return Construct(_aosArmorOrHatOrShieldOrJeweleyTypes);
|
||||
return Construct(_aosArmorOrHatOrShieldOrJewelryTypes);
|
||||
}
|
||||
|
||||
return Construct(_oldArmorOrHatOrShieldOrJeweleyTypes);
|
||||
return Construct(_oldArmorOrHatOrShieldOrJewelryTypes);
|
||||
}
|
||||
|
||||
private static readonly Type[][] _mlWeaponOrRangedOrArmorOrHatOrShieldTypes =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue