Crafting

Introduction
With crafting you can increase the stats of equipment. Every piece of equipment can be crafted only once. When starting a craft you can optionally choose to increase the quality and/or stat slots of an item which results in better items, but at a higher cost.

Cost
Crafting costs mainly gold and optionally wootz if you want to increase the quality. Stat slots multiply the gold cost.

The formula for gold cost is: 5000 * sqrt(slots) * slots * (1 + level / 1000) * (1 + newQualityMultiplier - oldQualityMultiplier). Even if you keep the same amount of slots as the item already has, you still have to pay this gold cost to craft the item.

Every quality that you go up will cost you 1 wootz of that quality. So upgrading an item from scrap to relic will cost you 1 of each wootz.

Actions
Higher quality and slots will increase the amount of actions you can perform on the item. More actions is better as that increases how much stats the item gains.

The formula for actions is: sqrt(level / 2) * ( qualityMultiplier + sqrt(slots) )

Quality
Quality does not only increase the amount of actions you can perform, but also determines the success rate. It's not guaranteed to increase every stat every action.

Slots
If you add a slot to an item it will add one of the missing stats. The new stat will start at half of the other stats, so it is not recommended to craft anything epic or lower, as the total stats will most likely not be better than old items.

Level
While crafting you will gain experience in the crafting skill. Each level will give you +0.01% boost to stat gain. You will see this used in the base formula below.

Stat Gain
On every action there is a roll for each stat to see if stats are added (see Quality above). If successful there will be another roll to determine how high the added stats are from a range determined by the crafting boosts (Relics, House, Village, Kingdom). This is done for each stat (including Damage and Defense) on the item separately, so you can have different values added to each stat.

To calculate the min and max roll we'll first need to know our base formula and consistency:

base : 2 * (1 + craftingBoost)

consistency : 1000 / (1000 + consistencyBoost * 1000)

capacity: 2 * capacity

Now we can use those outcomes to determine the rolls:

minimum roll : base * (1 - consistency) * (1 + craftingLvl / 1000) * (1 + villageBoost) * (1 + kingdomBoost) (* 1.1 if VIP is active)

maximum roll : (base + capacity) * (1 + craftingLvl / 1000) * (1 + villageBoost) * (1 + kingdomBoost) (* 1.1 if VIP is active)

The actually gained stat is randomly chosen between these two values. The average can be calculated by adding up minimum and maximum and dividing by two.

The luck roll is done after this.