> For the complete documentation index, see [llms.txt](https://linparlab.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://linparlab.gitbook.io/docs/reference/repair-cost.md). Agents can also search and read this documentation through its [MCP server](https://linparlab.gitbook.io/docs/~gitbook/mcp).

# Repair Cost Formula

Let base be durability-per-material, missing be damage and maximum be the item's maximum durability.

```
bounded level = clamp(level, 1, level-cap)
weight = exact override for bounded level, or base weight + per-level × bounded level
factor = 1 + sum of unique enchantment weights
effective factor = factor × (1 − highest applicable discount)
points per ingredient = clamp(floor(base ÷ effective factor), 1, maximum)
full cost = ceil(missing ÷ points per ingredient)
percentage target = ceil(missing × percentage ÷ 100)
percentage cost = ceil(percentage target ÷ points per ingredient)
restored = min(missing, ingredients charged × points per ingredient)
```

A fixed ingredient budget charges up to that budget or full cost, whichever is smaller. A percentage is rounded up to whole ingredients. The discount indicator appears when the discount increases the whole points restored per ingredient.

For 48 missing durability, base 12 and no enchantments or discount, 25% restores 12 points for one ingredient and full repair costs four. With factor 1.2, each ingredient restores 10 points and full repair costs five. A 10% discount changes the effective factor to 1.08 and the yield to 11. Full repair still costs five due to rounding.

See [enchantments.yml](https://linparlab.gitbook.io/docs/configuration/enchantments.md) and [config.yml](https://linparlab.gitbook.io/docs/configuration/config.md).
