Minecraft Wiki
Advertisement

Tento článek popisuje princip očarování - Enchanting.

Základní princip

Kdykoliv vložíš vhodný předmět na kouzelnický stůl, jsou náhodně vygenerovány dostupné úrovně očarování ve všech slotech a to za použití vzorce uvedeného níže. Úroveň očarování je závislá na počtu sousedících knihoven (omezení na 15) a na slotu, ve kterém je generována:

Základní dostupná úroveň očarování (základ) = (1..8 + patro(b/2) + 0..b),

kde b je počet sousedících knihoven (maximum je 15) a x..y generuje náhodné celé diskrétní číslo mezi x a y včetně. To je pozměněno v závislosti na pozici slotu:

Úroveň očarování v horním slotu = max (základ/3, 1) (Poznámka - "max (a, b)", tj. větší z množiny (a,b))
Úroveň očarování ve středním slotu = (základ × 2) / 3 + 1
Úroveň očarování ve spodním slotu = max (základ, b × 2)

Před verzí 1.3 byla dostupná úroveň očarování (1..5 + patro(b/2) + 0..b) vynásobená "slot faktorem" 13, 23, nebo 1 pro horní, střední a spodní slot. Nejnižší dostupná úroveň se rovnala polovině použitých knihoven.

Před verzí 1.1 byl výraz patro(b/2) z rovnice uvedené výše vyjádřen jako 0..patro(b/2). Výsledek byl tedy generován náhodněji a hledání úrovní očarování bylo časově velmi náročné. Před verzí 1.1 byla nejnižší dostupná úroveň rovna 1 bez ohledu na počtu použitých knihoven.

Knihovny 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Min. úroveň (v horním slotu) 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
Max. úroveň (ve středním slotu) 8 9 11 12 14 15 17 18 20 21 23 24 26 27 29 30

V Creative módu nejsou pro očarování potřebné ani úrovně ani zkušenosti.

Umístění knihovny

V blízkosti knihovny vyšší dostupná úroven očarování. Jak je uvedeno ve snapshotu 1.3 12w22a, žádná očarování dražší osmi zkušenostních úrovní nejsou dostupná, pokud poblíž kouzelnického stolu neumístíš knihovny tak, aby se nedotýkaly kouzelnického stolu. Pro správné fungování musí být knihovna umístěna 2 bloky stranou kouzelnického stolu a ve stejné výšce, nebo o jeden blok nad ním. Prostor mezi stolem a knihovnou musí být vyplněn vzduchem (dokonce i louč, nebo sněhová pokrývka zablokuje účinek). Prostor "mezi" je naznačen na následujícím obrázku (bílá místa jsou vzduch a na blocích označených nezáleží:

Příklad ze shora:
nebo
a z boku:
nebo

V současnosti je pro dosažení maximální úrovně očarování potřeba jen 15 knihoven a je mnoho možností, jak je rozmístit a dosahnout tohoto limitu. Jednoduchý způsob spočívá v obklopení kouzelnického stolu 1 blok vysokým čtvercem složeného z knihoven a vynecháním volného místa mezi stolem a čtvercem:


Jinou možností, která je nyní dostupná, je "knihovnický koutek", kde jsou knihovny umístěny ve dvou řadách, tzn. 2 bloky na výšku, jak je naznačeno na následujícím obrázku. Toto rozmístění umožňuje umístit 16 knihoven, tzn. o jednu víc, než je potřeba.


Omezit maximální dostupnou úroveň očarování lze jednoduše. Pokud chceš snížit úroveň očarování, umísti na knihovny pochodně tak, abys blokoval jejich účinek vůči kouzelnickému stolu. Pokud potřebuješ, můžeš tak docílit celistvého "kruhu" knihoven kolem stolu a zároveň dosáhnout nejnižší úrovně očarování. Odebráním pochodní obnovíš maximální úroveň očarování.

Důležité je nezapomenout zajistit zcela volný prostor mezi stolem a knihovnami. Předměty jako sníh mohou vyrušit účinky "všech" knihoven a učiní je zbytečnými až do jeho odklizení. Bezpečným způsobem je úplné uklizení pracoviště, pokud nevyžaduješ získání nižší úrovně očarování.

Jak jsou vybírána očarování

"Úroveň očarování" je cena za očarování, kde jsou platidlem úrovně zkušenosti (zelené číslo vespod). "Energie očarování" je síla konkrétního očarování. Například "Účinnost IV" má sílu 4. Algoritmus očarování má tři fáze.

1. fáze - Uplatnění modifikátoru pro úroveň očarování

Minecraft nejdříve uplatní dva modifikátory pro základ úrovně očarování. Každý modifikátor je určený jen pro konkrétní rozsah s častějším výskytem okolo středu tohoto rozsahu, než na jeho okrajích.

První modifikátor je založen na "očarovatelnosti" předmětu, která závisí na materiálu a typu předmětu (viz tabulka níže).

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, (actually 1/4 rounded down and multiplied by 2) then adds that number plus one to the enchantment level. Bows and books 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 half the enchantability are much more likely than results at the extremes.

modified enchantment level = enchantment level + Random(0, enchantability / 4 * 2) + 1
(Rounding Down after each step)
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

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 down 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();


// Generate a random number between 1 and 1+(enchantability/2), with a triangular distribution
enchantability_2 = enchantability / 2;
int rand_enchantability = 1 + randomInt(enchantability_2 / 2 + 1) + randomInt(enchantability_2 / 2 + 1);

// Choose the enchantment level
int k = chosen_enchantment_level + rand_enchantability;

// A random bonus, between .85 and 1.15
float rand_bonus_percent = (randomFloat() + randomFloat() - 1) * 0.15;

// Finally, we calculate the level
int final_level = (int)(k * (1 + rand_bonus_percent) + 0.5);

Source:[1]

Step Two - Find possible enchantments

Powersword

A sword with several enchantments. (In versions 1.3+, Sharpness V is unattainable on diamond swords unless using the anvil introduced in 1.4.)

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. The Enchantview mod will help you see what enchantments you will get.

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.

You always get at least one enchantment. The first enchantment is picked from a list of statistical "weights" - the enchantment with the higher weight has a higher chance of being selected.

P(enchantment) = (enchantment weight) / ( ∑i=1number of possible enchantments〖enchantment weighti 〗)
Armor Enchantments Weight
Protection 10
Fire Protection 5
Feather Fall 5
Blast Protection 2
Projectile Protection 5
Respiration 2
Aqua Affinity 2
Sword Enchantments Weight
Sharpness 10
Smite 5
Bane of Arthropods 5
Knockback 5
Fire Aspect 2
Looting 2
Tool Enchantments Weight
Efficiency 10
Silk Touch 1
Unbreaking 5
Fortune 2
Bow Enchantments Weight
Power 10
Punch 2
Flame 2
Infinity 1

After the first enchantment is selected, there is a chance of receiving more, except for books, which only every get one enchantment, Additional enchantments are chosen by this algorithm:

  1. 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.)
  2. With probability (modified level + 1) / 50, keep going. Otherwise, stop picking bonus enchantments.
  3. Remove from the list of possible enchantments anything that conflicts with previously-chosen enchantments.
  4. Pick one enchantment from the remaining possible enchantments (based on the weights, as before) and apply it to the item.
  5. Repeat from step 1.

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. (So you can't get a tool with two copies of the Efficiency enchantment.)
  • All protection enchantments conflict with each other, so an item can only have one at a time. (In the code, Feather Fall is implemented as a protection enchantment, but it doesn't conflict with the others.)
  • All damage enchantments (Sharpness, Smite, and Bane of Arthropods) conflict with each other.
  • Silk Touch and Fortune also conflict with each other. (The Silk Touch enchantment has no effect on a pickaxe that also has Fortune, such as could be obtained in a 1.9 pre-release or with an inventory editor, since a Silk Touch pickaxe cannot mine resources such as diamonds or coal—only their ore blocks.)


Image005

A chart showing all possible enchantments on diamond tools..

Enchantment Simulator

A website for testing and simulating enchantments can be found here.

Enchantment Probability Charts

A bunch of charts on the probabilities of different enchantments on 1.3 here. There is a separate set for enchanting prior to 12w22a here.

Video

Enchantment Mechanics/video


References

  1. Minecraft 1.3.2 source code
Advertisement