Item Quality Formula Update
The process for evaluating the quality of a compound item now uses a weighted average of the item's crafting quality and the average of the ingredients' quality, instead of multiplying them
This commit is contained in:
parent
0ae4a388f5
commit
feb24cfd6b
3 changed files with 33 additions and 29 deletions
|
|
@ -23,24 +23,6 @@ public static class Extensions
|
|||
return baseType.GetInterfaces().Any(interfaceType.Equals);
|
||||
}
|
||||
|
||||
private static readonly Dictionary<CraftedItemInstance, float> Quality = new Dictionary<CraftedItemInstance, float>();
|
||||
public static float CompoundQuality(this CraftedItemInstance item)
|
||||
{
|
||||
if (Quality.ContainsKey(item)) return Quality[item];
|
||||
|
||||
var quality = item.Quality;
|
||||
|
||||
var craftedIngredients = item.Ingredients.Where(i => i is CraftedItemInstance).ToArray();
|
||||
if (craftedIngredients.Length > 0)
|
||||
{
|
||||
quality *= craftedIngredients.Cast<CraftedItemInstance>().Average(CompoundQuality);
|
||||
}
|
||||
|
||||
Quality[item] = quality;
|
||||
|
||||
return Quality[item];
|
||||
}
|
||||
|
||||
public static void Send<T>(this NetPeer peer, T message, DeliveryMethod method = DeliveryMethod.ReliableOrdered) where T : Message
|
||||
{
|
||||
peer.Send(MessagePackSerializer.Serialize(message as Message), method);
|
||||
|
|
|
|||
Loading…
Reference in a new issue