Spearcrafting Bug

Recommended Posts

The way the formula that calculates the final condition for a spear with an additional weapon attached to it is causing unintended behavior. Spears with attachments never receive full condition upon crafting even if both weapons used in the crafting are in full condition. The highest amount of durability received is usually about half of the maximum even when both weapons used to craft it are in maximum condition themselves. The culprit are the following lines inside recipecode.lua:

The problem is that the base crafted spear has a lower maximum condition than all of the spears with attachments, the same being also true for many of the blades used, yet the formula uses direct additions and subtractions instead of ratios. The ideal solution would be instead to take the proportion of the condition of the spear in relation to it's max condition [conditionMax = items:get(i):getCondition() / items:get(i):getConditionMax()], then do the same for the blade [conditionMax = conditionMax - math.abs( items:get(i):getCondition() / items:get(i):getConditionMax() - 1 )] and use the result to multiply for the maximum condition of the final spear [conditionMax = result:getConditionMax() * conditionMax] in order not to have inconsistencies while converting between different maximum conditions.

Edited by Ridick
typo

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account