Repair (equipment)

You can repair damaged equipment by visiting a vendor, and paying a fee that depends on the amount of damage the equipment has suffered (this fee may vary depending on the vendor).

When repairing any piece of equipment, there is always some chance to permanently damage it. Currently, this probability does not depend on the vendor, and is given by P(permanent damage) = 1 - (current durability / current maximum durability)

Additionally, the amount of permanent damage taken when repairing is given by max( 1, sqrt( x ) ) where x is the amount of permanent damage already taken by the item.

Proof that it does not matter when you repair
By looking at the above formula, an interesting question is: when is it optimal to repair so as to maximize an item's duration? It turns out that it does not matter when you repair, as is shown below (using some latex-like notations for maths), and under some necessary assumptions also presented below.

Before going into the maths, a simple English formulation of the result would be the following:

''Repairing often does not change the average lifespan of your items. It tends to make their effective lifespan vary more than if you repair less frequently: if you're lucky, your item will last longer, otherwise it will last less, both having equal chance of happening.''

The required assumptions for this to be true are: If you have made any experiment supporting (or denying) any of these two assumptions, please tell me about them!
 * the amount of temporary damage you get when hitting a mob must not depend on the current amount of temporary damage.
 * the formula above is computed exactly (or at least, to a sufficient precision). If rounding occurs, then the result is not obvious (and the "best" strategy now depends on the current maximum durability of the item). In particular, a specific way of rounding could result in a zero probability of getting permanent damage when repairing an item with a single point of temporary damage and a maximum durability higher than 100 (see the discussion page for details).

If you have made experiments to verify this, please tell me about it!

Denote by d the current maximum durability of the item, and by x the amount of damage taken before you decide to repair it. We are interested in how long it will take before the item gets permanent damage.

Each time you repair, the probability of suffering permanent damage is x/d, and the probability of not suffering permanent damage is thus 1 - x/d. Since each repair event is independent, the probability of getting permanent damage exactly on the n-th repair is equal to P(permanent damage on n-th repair) = (1 - x/d)^(n-1) * x/d The expected number of repairs before taking your first permanent damage is thus: E[number of repairs before taking first permanent damage] = sum_{n = 1}^infinity n * P(permanent damage on n-th repair) = sum_{n = 1}^infinity n * (1 - x/d)^(n-1) * x/d To compute this sum, consider any y in ]0,1[ and the desired sum sum_{n = 1}^infinity n * y^(n-1). It can also be written (skipping some maths technical details to move the derivative from inside the sum to outside the sum): sum_{n = 1}^infinity n * y^(n-1) = sum_{n = 1}^infinity d(y^n)/dy = d/dy ( sum_{n = 1}^infinity y^n ) = d/dy ( 1 / (1 -y) - 1 ) = 1 / (1 - y)^2 Plugging this result into the precent equation, we obtain E[number of repairs before taking first permanent damage] = x/d * 1 / (1 - (1 - x/d))^2 = x/d * d^2 / x^2 = d/x But what we are interested in is the expectation of the amount of total temporary damage taken before getting the first permanent damage (i.e. also the amount of time before getting the first permanent damage). This is also equal to the number of repairs multiplied by x, since x is the amount of temporary damage taken before we repair. Thus E[total temporary damage (or time elapsed) before getting first permanent damage] = d/x * x = d which does not depend on x!

About the second part of the result, namely that repairing often introduces more variance in an item's lifespan, it can be shown by computing the variance just like we computed the expectation. I won't go into the details unless someone asks me to, but I obtained a simple formula for the variance: V[number of repairs before taking first permanent damage] = d * (d - x)

I have verified the above mathematical results with a computer simulation. See the talk page for details.