Gem crafting

Gem crafting is a mechanic in Xenoblade Chronicles. By taking the ether crystals collected from enemies and placing them into an ether furnace, they can be transformed into gems. Gems can be crafted by talking to Gem Man in the of  or, after completing the  The Gem Man's Invention, from the menu at any point. It is a complex and random process, but several strategies make it an effective way of gaining strong gems.

Gem crafting is not available in Future Connected; ether crystal deposits yield refined gems that are ready to use, and enemies do not drop crystals.

Overview
Gem crafting can be broken into three phases: setup, crafting, and collection.


 * Setup - First, the player must choose what crystals to craft with, and which party members will be doing the crafting. The crystals chosen must all be of the same rank, though they need not share any qualities. Between two and eight crystals (inclusive) may be used. As crystals are added, their matching qualities are added together, and if the sum of any quality reaches 100% or more than no more can be added. Cylinders may also be used; there is no difference between crystals and cylinders, other than cylinders typically having only one quality. Two party members are also selected, one to be shooter and the other to be engineer.
 * Crafting - The actual crafting occurs in "turns", with the number of turns based on the between the selected party members. Each turn, the engineer selects one of three flames for the ether furnace, which the shooter applies to the contents. A strong flame raises a single quality by a lot, a medium flame raises all qualities a small amount, and a gentle flame adds to the cylinder gauge instead of affecting the qualities. There is a small chance each turn of triggering a "fever", which adds several extra turns of the current flame.
 * Collection - Once crafting is completed, every quality of 100% or better is turned into a gem. Qualities that did not reach 100% can be recouped as cylinders, up to the number of times the cylinder gauge was filled.

Crafting turns
The number of turns spent crafting is based on the affinity between the shooter and engineer, and ranges from 3-5 at lowest affinity to 10-15 at highest. The exact math is: Once the minimum number of turns is reached, there is a 20% chance of getting another turn, until the maximum is reached. As a result, the minimum and maximum are more common than any number in between.
 * minimum:  (minimum goes up by 1 every 750 affinity)
 * maximum:  (maximum goes up by 1 every 500 affinity)

Because of how the turn range is calculated, it can be used to determine the affinity between two party members more accurately than the level icon alone.

Fever
At the end of each turn, there is a 1% chance of entering a "fever" state. Fever is an additional 3-10 turns using the same flame, with a 30% chance of getting each turn after the first 3. With Shulk's Fever Pitch linked to both characters and Shulk's Fever Plus shooter ability, it is possible to raise the chance of fever to 4%. Fever cannot trigger on the last turn, or if Riki is the shooter.

Furnace flames
On each turn, a random flame is selected by the engineer. Each engineer has a different rate of choosing each flame. These values are described in-game by vague and inconsistent terms.
 * Strong - A single quality (at random) is raised by 3% - 11% (at random).
 * Medium - All qualities are raised by 1% - 6% (at random for each).
 * Gentle - The cylinder gauge is raised by 40% - 70% (at random). Excess adds 1 to the gauge count and rolls over to the next filling.

Shooter abilities
The shooter chosen has a unique ability, many of which alter the flow of crafting significantly.

Party support
After each turn except for the first, there is a chance for a non-participating party member to provide support. This chance is equal to the affinity between the bystander and the engineer divided by 10,000, meaning it ranges from 0% at lowest affinity to 50% at highest. When this occurs, 1-3 qualities are selected at random and boosted by 10% - 21% at random. A single quality may be selected multiple times, so it is possible (though unlikely) for party support to boost a quality by 63%. Aside from the affinity check, the identity of the bystander does not matter. Each bystander can only support once per craft, and only one can support per turn.

There is a limit to how late in the process party support can occur. First, a value is created from the affinity of the two participants, equal to  (meaning it is between 100 and 300). On each turn, this value is reduced by a random value between 20 and 30, and once it reaches zero, the opportunity for party support ends after this turn. Practically, this means that party support might get cut off at the end of a high-affinity craft that goes longer than 11 turns; in most other cases, it will probably be available the whole time. If the shooter is Riki, the reduction is doubled, so the opportunity is halved.

Results
After all turns are taken, the final value of each quality is checked.
 * Qualities that did not reach 100% can be reclaimed as cylinders, which costs 1 cylinder gauge for each. Any qualities that remain after running out of cylinder gauge are lost.
 * Qualities that reach 100% are converted into gems of the same rank and quality. The strength of the gem is based on how high the value is; a gem created from a 195% result will be close to the maximum for that rank, while a 105% result will be near the minimum.
 * Qualities that reach 200% ("heat") become a rank higher than the crystals used. Again, a higher value will result in a stronger gem.
 * Qualities that reach 300% ("mega heat") both become a rank higher and produce two gems rather than just one. Both gems will have the maximum value for their rank.

Strategy
Crafting strong gems is a three-step process.
 * 1) Separate crystals out into cylinders of individual qualities. This is a matter of simply filling the cylinder gauge, in order to break apart crystals into individual-quality cylinders and keep them all.
 * 2) Strengthen cylinders as close to 100% as possible without going over. This step is optional and risky, and requires a pair suited to increasing qualities slowly and carefully.
 * 3) Combine strong cylinders to get a quality far above 100% before starting, to make it easier to reach 200% and 300%. Having only a single quality in the furnace makes a strong flame very powerful.

Definitive Edition changes
The Definitive Edition makes significant changes to gem crafting, strongly altering how best to approach it.
 * Dunban's streak starts at 2%, rather than 1%. This is a minor buff that does not much fix Dunban's problem of being more dependent on luck than the other characters, and so has minimal effect.
 * When Riki takes his two turns, they now count as a single turn rather than two turns. This is a huge change that suggests the original behaviour was unintentional, as now Riki effectively gets double the turns than other characters, making him much more useful past a certain affinity point.
 * Gems produced are now entirely random in strength within their rank. This is a puzzling change that removes a huge amount of consistency from results; just barely squeaking out 205% has the same random chance of getting a good gem as does reaching 295%, meaning there is no longer any benefit to raising strength if the heat thresholds are not met.