Questo articolo tratta delle meccaniche di incantamento adoperate dal gioco per la selezione degli incantesimi nel tavolo per incantesimi.
Meccaniche di base
Ogni qual volta il giocatore inserisce un oggetto nel tavolo per incantesimi che sia idoneo ad essere incantato tramite il suddetto strumento, dei livelli d'esperienza vengono generati casualmente secondo la formula riportata sotto. Un livello d'esperienza dipende dal numero degli scaffali posizionati attorno al tavolo (limitato a 15) e in quale dei tre slot si trova l'incantesimo a cui il livello d'esperienza appartiene.
livello d'esperienza di base disponibile (base) = (1..8 + piano(b/2) + 0..b)
dove b è il numero di librerie vicine (limitate a 15) e x..y genera un numero intero casuale distribuito uniformemente fra x e y, inclusi nella selezione casuale anche questi due valori. Il numero risultato da questa formula è successivamente modificato con le formule che seguono:
livello d'esperienza nello slot in alto = max(base/3, 1)
livello d'esperienza nello slot in mezzo = (base×2)/3 + 1
livello d'esperienza nello slot in basso = max(base, b×2)
dove max(x, y) sceglie il valore più alto fra x e y.
Il tutto è riassunto nelle tabelle che seguono.
Numero di librerie | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Livello minimo (nello slot in alto) | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 2 | 2 |
Livello massimo (nello slot in basso) | 8 | 9 | 11 | 12 | 14 | 15 | 17 | 18 | 20 | 21 | 23 | 24 | 26 | 27 | 29 | 30 |
Numero di librerie | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Livelli possibili nello slot in alto | 1 - 2 | 1 - 3 | 1 - 3 | 1 - 4 | 1 - 4 | 1 - 5 | 1 - 5 | 1 - 6 | 1 - 6 | 1 - 7 | 2 - 7 | 2 - 8 | 2 - 8 | 2 - 9 | 2 - 9 | 2 - 10 |
Livelli possibili nello slot in mezzo | 1 - 6 | 1 - 7 | 2 - 8 | 2 - 9 | 3 - 10 | 3 - 11 | 3 - 12 | 3 - 13 | 4 - 14 | 4 - 15 | 5 - 16 | 5 - 17 | 5 - 18 | 5 - 19 | 6 - 20 | 6 - 21 |
Livelli possibili nello slot in basso | 1 - 8 | 2 - 9 | 4 - 11 | 6 - 12 | 8 - 14 | 10 - 15 | 12 - 17 | 14 - 18 | 16 - 20 | 18 - 21 | 20 - 23 | 22 - 24 | 24 - 26 | 26 - 27 | 28 - 29 | 30 - 30 |
Si tenga presente che un requisito di livello d'esperienza più alto in uno slot non necessariamente significa che gli incantesimi di quello slot siano migliori degli incantesimi degli altri slot.
Nella modalità creativa non è necessario possedere esperienza per incantare con il tavolo per incantesimi.
Disposizione delle librerie
Le librerie nelle vicinanze alzeranno i livelli d'esperienza richiesti; senza alcuna libreria, nessun requisito di livello sarà mai superiore a 8.
Per avere effetto, una libreria deve essere piazzata esattamente 2 blocchi lateralmente distanti dal tavolo per incantesimi e sullo stesso piano o un blocco più in alto, e gli spazi tra il tavolo e le librerie devono rimanere vuoti (perfino una torcia, uno strato di neve o una tappeto impediranno l'effetto). Il tutto è riassunto nei diagrammi che seguono (gli spazi bianchi rappresentano aria e Template:BlockSprite significa "indifferente").
Dall'alto: così |
|
o |
| ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Dal lato: così |
|
o |
|
Si tenga presente che le particelle dei glifi che compaiono dalle librerie seguono schemi differenti e possono apparire anche se le suddette librerie non stanno interagendo con il tavolo.
Esistono molte possibili combinazioni in grado di generare la massima resa. Un semplice metodo è quello di circondare il tavolo per incantesimi con 15 librerie disposte sullo stesso piano del tavolo con uno spazio vuoto fra tavolo e librerie.
Un'alternativa sarebbe quella di costruire un angolo di librerie alto due blocchi che circondino il tavolo per due facciate e che partano dal suo stesso piano. Questa disposizione comprende una quantità di 16 librerie, ovvero una in più del necessario, che, se rimossa, non causerà alcuna perdita di effetto.
Scegliere i livelli d'esperienza richiesti
Gli incantesimi offerti dal tavolo per incantesimi dipendono dai livelli di esperienza richiesti, i quali a loro volta dipendono dal numero di librerie funzionanti. Un semplice metodo per modificare gli incantesimi offerti è quello di piazzare un oggetto qualsiasi (ad esempio una torcia) tra le librerie e il tavolo. In questo modo è possibile alterare gli incantesimi offerti a proprio piacimento senza dover ricorrere a distruggere le librerie.
In riferimento all'immagine, la tabella seguente elenca il numero di librerie funzionanti in base a dove e a quante torce sono state piazzate nei pressi del tavolo.
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Librerie funzionanti |
---|---|---|---|---|
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 0 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 1 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 2 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 3 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 4 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 5 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 6 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 7 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 8 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 9 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 10 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 11 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 12 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 13 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 14 |
Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | Template:BlockSprite | 15 |
How enchantments are chosen
"Enchantment level" is the required experience level (the green number on the bottom-right). "Enchantment power" is the strength of the particular enchantment. For example, "Sharpness IV" has a power of 4. The enchantment algorithm uses a three-step process.
Step one – Applying modifiers to the enchantment level
The first thing that Minecraft does is apply two modifiers to the base enchantment level. Each modifier is restricted to a certain range, with numbers close to the middle of the range more common than those near the ends.
The first modifier is based on the item's "enchantability," which depends on the material and the type of the item (see the table below). Minecraft picks a number between 0 and half the enchantability, then adds that number plus one to the enchantment level. Bows, books, and fishing rods have an enchantability of 1 for this purpose. This random value follows a triangular distribution (like rolling a pair of dice and adding) so results close to a quarter of the enchantability are much more likely than results at the extremes.
The modified enchantment level is calculated with the following formula:
- L = B + R1 + R2 + 1
Where:
- R1 and R2 are two individual randomly generated integers:
- R1 = randomInteger(0, E / 4)
- R2 = randomInteger(0, E / 4)
- B is the base enchantment level.
- E is the enchantability of the item.
Division is rounded down.
Material | Armor enchantability | Sword/Tool enchantability |
---|---|---|
Wood | N/A | 15 |
Leather | 15 | N/A |
Stone | N/A | 5 |
Iron | 9 | 14 |
Chain | 12 | N/A |
Diamond | 10 | 10 |
Gold | 25 | 22 |
Book | 1 | 1 |
Next, Minecraft picks a value between 0.85 and 1.15, again with a triangular distribution. The modified enchantment level is multiplied by this value (so it could increase or decrease by up to 15%) and then rounded to the nearest integer.
Step 1 pseudocode
// Returns a uniformly distributed random integer between 0 and n - 1, inclusive function randomInt(n); // Returns a uniformly distributed random real (fractional) number between 0 (inclusive) and 1 (exclusive) function randomFloat(); // Returns the real number n rounded to the nearest integer. function round(n); // Generate a random number between 1 and 1+(enchantability/2), with a triangular distribution int rand_enchantability = 1 + randomInt(enchantability / 4 + 1) + randomInt(enchantability / 4 + 1); // Choose the enchantment level int k = chosen_enchantment_level + rand_enchantability; // A random bonus, between .85 and 1.15 float rand_bonus_percent = 1 + (randomFloat() + randomFloat() - 1) * 0.15; // Finally, we calculate the level int final_level = round(k * rand_bonus_percent); if ( final_level < 1 ) final_level = 1
Source:
Step two – Find possible enchantments
A sword with several enchantments. Now, based on the modified level, Minecraft makes a list of all enchantment types that can be applied to the target item along with the power that each enchantment will have.
The power of each enchantment type is determined by the level and the values in the enchantments levels table. For each power value of an enchantment type, there is a minimum and maximum modified level that can produce the enchantment at that power. If the modified enchantment level is within the range, then the enchantment will be assigned that power. If the modified level is within two overlapping ranges for the same enchantment type, the higher power value is used.
Treasure
Some enchantments are "treasure" enchantments (shown in the table below), meaning they can never be created by an enchantment table, and can only be discovered in certain situations: when generating chest loot (equipment and books), when fishing, when generating enchanted book trades, and when an enchanted book is dropped by a raiding illager[Bedrock Edition only].
Step three – Select a set of enchantments from the list
Now that it has a list of the possible enchantments for the item, Minecraft must pick some of them that will actually be applied. Each enchantment has a statistical "weight". Enchantments with higher weights have a higher chance of being selected.
In detail, Minecraft uses the following weighted random selection algorithm:
- Calculate the total weight of all enchantments in the list (T).
- Pick a random integer in the half range [0; T) as a number w.
- Iterate through each enchantment in the list, subtracting its weight from w. If w is now negative, select the current enchantment.
This algorithm produces the same results as listing each enchantment the number of times given by its weight, then choosing a random entry from the combined list.
So, for each enchantment in the list, the probability of it being selected is:
- P = wT
Where:
- w is the enchantment's weight.
- T is the total weight of all enchantments in the list.
Type of enchantment | Enchantment | Weight | Creatable by an enchantment table |
---|---|---|---|
Armor | Protection | 10 | Yes |
Feather Falling | 5 | Yes | |
Fire Protection | 5 | Yes | |
Projectile Protection | 5 | Yes | |
Aqua Affinity | 2 | Yes | |
Blast Protection | 2 | Yes | |
Respiration | 2 | Yes | |
Depth Strider | 2 | Yes | |
Frost Walker | 2 | No | |
Thorns | 1 | Yes | |
Curse of Binding | 1 | No | |
Sword | Sharpness | 10 | Yes |
Bane of Arthropods | 5 | Yes | |
Knockback | 5 | Yes | |
Smite | 5 | Yes | |
Fire Aspect | 2 | Yes | |
Looting | 2 | Yes | |
Sweeping Edge | 2 | Yes | |
Pickaxe
Shovel Axe Shears |
Efficiency | 10 | Yes |
Fortune | 2 | Yes | |
Silk Touch | 1 | Yes | |
Bow | Power | 10 | Yes |
Flame | 2 | Yes | |
Punch | 2 | Yes | |
Infinity | 1 | Yes | |
Fishing rod | Luck of the Sea | 2 | Yes |
Lure | 2 | Yes | |
Trident | Loyalty | 5 | Yes |
Impaling | 2 | Yes | |
Riptide | 2 | Yes | |
Channeling | 1 | Yes | |
Crossbow | Quick Charge | 10 | Yes |
Multishot | 3 | Yes | |
Piercing | 30 | Yes | |
All applicable | Unbreaking | 5 | Yes |
Mending | 2 | No | |
Curse of Vanishing | 1 | No |
The player always gets at least one enchantment on an item, and there is a chance of receiving more. Additional enchantments are chosen by this algorithm:
- With probability (modified level + 1) / 50, keep going. Otherwise, stop picking bonus enchantments.
- Remove from the list of possible enchantments anything that conflicts with previously-chosen enchantments.
- Pick one enchantment from the remaining possible enchantments (based on the weights, as before) and apply it to the item.
- Divide the modified level in half, rounded down (this does not affect the possible enchantments themselves, because they were all pre-calculated in Step Two).
- Repeat from the beginning.
When enchanting books using an enchantment table, if multiple enchantments were generated then one selected at random will be removed from the final list. This does not apply to other sources of enchanted books that use enchantment mechanics, such as fishing or chests in generated structures.
Conflicting enchantments
Some enchantments conflict with other enchantments and thus both can't be enchanted into the same item, effectively taking down the possibility for one to get an overpowered weapon.
The rules for enchantment conflicts are:
- Every enchantment conflicts with itself. (The player can't get a tool with two copies of the Efficiency enchantment.)
- All damage enchantments (Sharpness, Smite, and Bane of Arthropods) conflict with each other.
- Silk Touch and Fortune conflict with each other.
- Depth Strider and Frost Walker conflict with each other.
- Mending and Infinity conflict with each other.
- Loyalty and Riptide conflict with each other.
- Channeling and Riptide conflict with each other.
- Multishot and Piercing conflict with each other.
Conflicting enchantments may appear on an item with specially-crafted /give
commands. The behavior of such items should not be relied upon, but in general:
- An item with multiple copies of the same enchantment will use the level of the first copy of that enchantment in the list.
- For armor with conflicting protection enchantments, all enchantments will take effect individually.
- For weapons with conflicting damage enchantments, all enchantments will take effect individually.
- For tools with both Silk Touch and Fortune, Silk Touch takes priority over Fortune on blocks affected by both enchantments. Fortune will still apply to blocks such as crops that are not affected by Silk Touch.
- For bows with both Mending and Infinity, both enchantments work individually.
- For tridents with both Loyalty and Riptide, Riptide will still function normally but the trident can no longer be thrown. Trident still can be thrown using dispenser.
- For crossbows with both Multishot and Piercing, both enchantments work individually.