v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "40d:Item quality"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
Line 87: Line 87:
 
|}
 
|}
  
The above table is based on the formula discovered by [[User:Bartavelle]]:
+
The above table is based on the formula discovered by
 +
<!-- [[User:Bartavelle]]
 +
Hey, man, don't take credit for my work, especially when you get it wrong.  -->
 +
[[User:0x517A5D|0x517A5D]]:
  
 
First, a skill level is computed, apparently directly related to the dabbling...legendary indicators. No skill or dabbling is 0, legendary is 15. It's capped at 20.
 
First, a skill level is computed, apparently directly related to the dabbling...legendary indicators. No skill or dabbling is 0, legendary is 15. It's capped at 20.
Line 93: Line 96:
 
Item quality is set to 0.
 
Item quality is set to 0.
  
Then dice are rolled. If a roll fails, no further rolls are made.
+
Then dice are rolled. Each roll is independent; all rolls are made even if a previous roll fails.
  
 
* If d5 < skill level, quality is bumped.
 
* If d5 < skill level, quality is bumped.
Line 99: Line 102:
 
* If d15 < skill level, quality is bumped.
 
* If d15 < skill level, quality is bumped.
 
* If d20 < skill level, quality is bumped.
 
* If d20 < skill level, quality is bumped.
* If d25 < skill level and d3 == 1, quality is set to 5.
+
* If d25 < skill level and d3 == 1, quality is bumped.
 +
This gives the 6 quality levels (0 to 5).
 +
<!--
 +
Here is 0x517A5D's disassembly and analysis, up-to-date as of version .40d9:
  
This gives the 6 quality levels (0 to 5).
+
; ---------------------------------------------------------------------------
 +
 
 +
loc_6FCB92:
 +
                push    eax
 +
                call    get_dorf_level_in_a_skill
 +
                mov    ebx, eax
 +
 
 +
loc_6FCB9A:
 +
                cmp    ebx, 20
 +
                mov    [edi+7Ah], bx  ; Save the creator's true skill level.
 +
                                        ; EDI points to the item being created.
 +
 
 +
                jle    short loc_6FCBA8
 +
                mov    ebx, 20        ; EBX is a value in the range of [0..20],
 +
                                        ; and is the (capped) skill level of the
 +
                                        ; creator, possibly adjusted for material
 +
                                        ; preferences, I didn't check.
 +
 
 +
; We roll a d5 and compare the result with the creator's skill level.
 +
; (Technically, we compare d5 - 1 against skill_level - 1.)
 +
 
 +
loc_6FCBA8:                            ; field 78h is quality.
 +
                xor    eax, eax
 +
 
 +
                mov    [edi+78h], ax  ; Init item quality to 0
 +
 
 +
                call    mt_engine      ; Get a random number (returned in EAX).
 +
 
 +
                mov    ecx, eax        ; This mess is a division by 5,
 +
                mov    eax, 3          ; retaining the modulus.
 +
                mul    ecx            ; It's done this way in the hope
 +
                mov    eax, ecx        ; that three multiplies is less
 +
                sub    eax, edx        ; expensive than a single divide.
 +
                shr    eax, 1          ; This technique is called
 +
                add    eax, edx        ; "multiplying by the reciprocal."
 +
                shr    eax, 1Eh
 +
                imul    eax, 80000001h
 +
                add    ecx, eax
 +
                mov    eax, 4FFFFFFFh
 +
                mul    ecx
 +
                shr    edx, 1Bh        ; now EDX is in the range [0..4]
 +
                                        ; i.e. d5 - 1
 +
 
 +
                cmp    edx, ebx        ; Compare the "die roll" against the
 +
                                        ; 0-based skill level (still in EBX).
 +
                jge    short loc_6FCBE1
 +
                add    [edi+78h], bp  ; If the random number was less than
 +
                                        ; the skill level,
 +
                                        ; add 1 to the quality level.
 +
                                        ; (BP is known to be 1, and
 +
                                        ; item quality is known to be 0.)
 +
 
 +
; Now we roll a d10 and compare.  It's important to note that the roll
 +
; of the d10 is independent, not conditional, of the roll of the d5.
 +
 
 +
loc_6FCBE1:                            ; Random number
 +
                call    mt_engine
 +
                mov    ecx, eax        ; Modulus
 +
                mov    eax, 3
 +
                mul    ecx
 +
                mov    eax, ecx
 +
                sub    eax, edx
 +
                shr    eax, 1
 +
                add    eax, edx
 +
                shr    eax, 1Eh
 +
                imul    eax, 80000001h
 +
                add    ecx, eax
 +
                mov    eax, 4FFFFFFFh
 +
                mul    ecx
 +
                shr    edx, 1Ah        ; now EDX is in the range [0..9]
 +
                                        ; i.e. d10 - 1
 +
                cmp    edx, ebx        ; Compare
 +
                jge    short loc_6FCC14
 +
                add    [edi+78h], bp  ; If d10 < skill, bump quality.
 +
 
 +
loc_6FCC14:                            ; Same thing for a d15.
 +
                call    mt_engine
 +
                mov    ecx, eax
 +
                mov    eax, 3
 +
                mul    ecx
 +
                mov    eax, ecx
 +
                sub    eax, edx
 +
                shr    eax, 1
 +
                add    eax, edx
 +
                shr    eax, 1Eh
 +
                imul    eax, 80000001h
 +
                add    ecx, eax
 +
                mov    eax, 0EFFFFFF3h
 +
                mul    ecx
 +
                shr    edx, 1Bh
 +
                cmp    edx, ebx
 +
                jge    short loc_6FCC47
 +
                add    [edi+78h], bp  ; If d15 < skill, bump quality.
 +
 
 +
loc_6FCC47:                            ; Same thing for a d20.
 +
                call    mt_engine
 +
                mov    ecx, eax
 +
                mov    eax, 3
 +
                mul    ecx
 +
                mov    eax, ecx
 +
                sub    eax, edx
 +
                shr    eax, 1
 +
                add    eax, edx
 +
                shr    eax, 1Eh
 +
                imul    eax, 80000001h
 +
                add    ecx, eax
 +
                mov    eax, 3FFFFFE3h
 +
                mul    ecx
 +
                sub    ecx, edx
 +
                shr    ecx, 1
 +
                add    ecx, edx
 +
                shr    ecx, 1Ah
 +
                cmp    ecx, ebx
 +
                jge    short loc_6FCC80
 +
                add    [edi+78h], bp  ; If d20 < skill. bump quality.
 +
 
 +
loc_6FCC80:                            ; Now we roll a d25
 +
                call    mt_engine
 +
                mov    ecx, eax
 +
                mov    eax, 3
 +
                mul    ecx
 +
                mov    eax, ecx
 +
                sub    eax, edx
 +
                shr    eax, 1
 +
                add    eax, edx
 +
                shr    eax, 1Eh
 +
                imul    eax, 80000001h
 +
                add    ecx, eax
 +
                mov    eax, 0C7FFFFFDh
 +
                mul    ecx
 +
                shr    edx, 1Ah
 +
                cmp    edx, ebx        ; Compare against skill,
 +
                jge    short loc_6FCCE2
 +
                call    mt_engine      ; AND roll a d3
 +
                mov    ecx, eax
 +
                mov    eax, 3
 +
                mul    ecx
 +
                mov    eax, ecx
 +
                sub    eax, edx
 +
                shr    eax, 1
 +
                add    eax, edx
 +
                shr    eax, 1Eh
 +
                imul    eax, 80000001h
 +
                add    ecx, eax
 +
                mov    eax, 0BFFFFFFFh
 +
                mul    ecx
 +
                shr    edx, 1Dh
 +
                test    edx, edx        ; The d3 result must be 1.
 +
                                        ; (Technically, d3-1 is tested against 0.)
 +
                jnz    short loc_6FCCE2
 +
                add    [edi+78h], bp  ; If d25 < skill AND d3 = 1, bump
 +
 
 +
loc_6FCCE2:
 +
                cmp    word ptr [edi+78h], 5
 +
                jnz    loc_6FCE28
 +
                lea    ecx, [esp+40h+var_2C]
 +
                call    ds:??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ
 +
                lea    ecx, [esp-14h+arg_24]
 +
                push    ecx
 +
                mov    ecx, esi
 +
                mov    [esp-10h+arg_4C], 0
 +
                call    get_dorf_name
 +
                add    esp, 4
 +
                push    offset aHasCreatedAMasterpiece ; " has created a masterpiece!"
 +
                lea    ecx, [esp-10h+arg_24]
 +
                call    ds:??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z
 +
                cmp    [esp-18h+arg_40], 10h
 +
                mov    ecx, [esp-18h+arg_2C]
 +
                jnb    short loc_6FCD2C
 +
                lea    ecx, [esp-18h+arg_2C]
 +
-->
  
 
According to inspections of the memory values, it seems that artifacts have a quality of 5.
 
According to inspections of the memory values, it seems that artifacts have a quality of 5.

Revision as of 16:35, 15 March 2009

All items in the game have a base value, which is multiplied by what material the item is made of and by the item's quality. Decorations (such as bone, gems, and studding) further increase the value.

Item quality can have an effect on an item's properties, especially armor and weapons.

Quality grades

All crafted items (furniture, armor, bolts, etc.) – but not intermediate materials (bars, blocks, etc. except cloth, which does have quality levels) – are bracketed by characters that show the quality of their craftsdwarfship. Dyeing also has a quality level, as does Decorating/Encrusting (with gems, leathers, cloth, etc). Prepared foods have quality levels. Alcohol has a hidden quality rating that controls the amount of happiness a dwarf gets from drinking it. It is not yet known whether the damage or destruction of masterful alcohol can cause tantrums.

Designation Description Value
Modifier
 Damage / To-Hit /
Armor Modifier
 Item Name —     ×1  ×1.0 
-Item Name- Well-crafted ×2  ×1.2 
+Item Name+ Finely-crafted ×3  ×1.4 
*Item Name* Superior quality ×4  ×1.6 
≡Item Name≡ Exceptional ×5  ×1.8 
☼Item Name☼ Masterful ×12  ×2.0 
Unique name Artifact ×120  ×2.0 

When a masterful quality item is created, the game will announce, "<dwarf> has created a masterpiece!" The destruction or theft of such a masterpiece will cause the dwarf that created it an unhappy thought. Trading a masterpiece item to merchants is always safe. Masterpiece meals can be eaten safely, although allowing the food to rot will provoke the same response as theft or destruction. Using masterpiece bolts will not cause a tantrum, even if the bolts break. However, if a kobold or wild animal steals a used masterpiece bolt which was lying around, then the maker's mood will decrease. If a bolt misses its target and falls into the chasm or is melted by "the impertinent magma", this also counts as defacement.

The magnitude of the unhappy thought is equal to 1000 divided by the number of masterworks the dwarf has created[Verify]. So a engraver with hundreds of masterwork images on the walls of the fortress will be merely irked by the destruction of a one, while a a dwarf who has only made a single masterwork item would become deeply upset.

Since legendary dwarves are most likely to be the ones creating masterpieces, keeping these creations safe should be high priority; tantruming legendary dwarves can be very difficult to subdue.

Artifact items have a unique name instead of bracketing symbols and are worth 120x base value. Artifacts, like masterpiece items, will cause a significant mood drop in the creator when destroyed or stolen. According to inspections of the memory values, it seems that artifacts have the same quality value as masterpiece items, with presumably the same armor/weapon modifiers (×2.0)[Verify].

Skill and quality levels

Tradesdwarves of different skill levels will produce items of differing quality. "Dabbling" dwarves never (without applicable preference) produce anything above a basic quality item, legendary dwarves usually produce Exceptional items, and the best legendary dwarves produce Masterful items approximately 27% of the time.

Preferences for particular materials and objects make a considerable difference. Although the exact adjustment is unknown, preliminary testing indicates that they can boost effective skill (not quality) by one to three levels (if the craftdwarf likes the item type, subtype and material).

Chance for No quality Well-crafted Finely-crafted Superior quality Exceptional Masterful Average Value Multiplier Jump in Average Value
Dabbling 100% 1.0
Novice 80% 18% 1.9% 0.13% 0.007% 0.00009% 1.2226 0.2226
No label 60% 32% 6.9% 1.0% 0.1% 0.003% 1.4924 0.2698
Competent 40% 42% 14% 3.1% 0.5% 0.02% 1.8114 0.319
Skilled 20% 48% 24% 6.8% 1.6% 0.09% 2.2428 0.4314
Proficient 50% 33% 12% 4.0% 0.28% 2.7036 0.4608
Talented 40% 36% 17% 6.6% 0.58% 2.9596 0.256
Adept 30% 37% 21% 10% 1.1% 3.182 0.2224
Expert 20% 37% 26% 15% 1.8% 3.516 0.334
Professional 10% 36% 30% 21% 2.9% 3.878 0.362
Accomplished 33% 33% 29% 4.4% 4.288 0.41
Great 27% 33% 34% 5.9% 4.538 0.25
Master 20% 32% 40% 7.7% 4.804 0.266
High Master 13% 31% 46% 9.8% 5.106 0.302
Grand Master 6.7% 28% 53% 12% 5.411 0.305
Legendary 25% 60% 15% 5.8 0.389
Legendary+1 20% 63% 17% 5.995 0.195
Legendary+2 15% 66% 19% 6.199 0.204
Legendary+3 10% 68% 22% 6.412 0.213
Legendary+4 5% 71% 24% 6.635 0.223
Legendary+5 73% 27% 6.89 0.232

The above table is based on the formula discovered by 0x517A5D:

First, a skill level is computed, apparently directly related to the dabbling...legendary indicators. No skill or dabbling is 0, legendary is 15. It's capped at 20.

Item quality is set to 0.

Then dice are rolled. Each roll is independent; all rolls are made even if a previous roll fails.

  • If d5 < skill level, quality is bumped.
  • If d10 < skill level, quality is bumped.
  • If d15 < skill level, quality is bumped.
  • If d20 < skill level, quality is bumped.
  • If d25 < skill level and d3 == 1, quality is bumped.

This gives the 6 quality levels (0 to 5).

According to inspections of the memory values, it seems that artifacts have a quality of 5.

Effect of quality on weapon skill v0.23.130.23a

To quote Toady:

The quality of any weapon, including crossbows used as launchers, affects the skill of the shooter. I think this even leads to obscene things like master crossbows + master bolts causing recruits to shoot like legends. In general, if the quality Q is from 0 to 5, the skill is modified according to

Skillnew = Skilloriginal × (1.0 + 0.2 × Q) + Q

This is pretty extreme and will probably be reduced for all weapons.

while equipped with a single masterpiece weapon, dwarves have skill increase to Accomplished, not Legendary. Still, the bonus is way too high. See this chart for the exact levels:

Note: This chart is out of date/wrong due to the facts that the integer that represents a specific skill level is not known, how the formula rounds is not known, and the fact that higher legendaries exist is known.

Result for Well-crafted Finely-crafted Superior quality Exceptional Masterful
Dabbling No label Skilled Talented Expert Accomplished
Novice Competent Proficient Expert Accomplished Master
No label Skilled Adept Professional Master Grand Master
Competent Talented Expert Great High Master Legendary
Skilled Adept Accomplished Master Legendary Legendary
Proficient Expert Great Grand Master Legendary Legendary
Talented Professional Master Legendary Legendary Legendary
Adept Accomplished Grand Master Legendary Legendary Legendary
Expert Master Legendary Legendary Legendary Legendary
Professional High Master Legendary Legendary Legendary Legendary
Accomplished Grand Master Legendary Legendary Legendary Legendary
Great and better Legendary Legendary Legendary Legendary Legendary

If this is true, then it would be possible to:

  1. Train a couple dozen skilled miners
  2. Give them exceptional picks
  3. Draft them and give them decent armor
  4. Kill a goblin siege with a couple dozen legendary speardwarves (picks = 70% damage spears) as long as there are no enemy champions to destroy your armour/shield/wrestling inept speardwarves