Difference between revisions of "Double damage"

From NetHackWiki
Jump to navigation Jump to search
(Complete update for 3.6.0 functions for all references and explanations)
Line 4: Line 4:
 
* The weapon's base damage.
 
* The weapon's base damage.
 
* The [[enchantment#Weapons|enchantment]] damage bonus.  
 
* The [[enchantment#Weapons|enchantment]] damage bonus.  
* The [[Rogue]]'s d(XL) back stab damage.
+
* The [[Rogue]]'s d(XL) [[backstab]] damage.
 
* The negative penalty for [[erosion]].
 
* The negative penalty for [[erosion]].
  
Line 33: Line 33:
 
The damage calculation in NetHack is quite complex, but when concerned only with melee weapons, it is simple enough to describe.
 
The damage calculation in NetHack is quite complex, but when concerned only with melee weapons, it is simple enough to describe.
  
hmon_hitmon in uhitm.c is called once for each melee hit on a monster, whether the hit is barehanded, with a weapon, with a weapon tool, or with something else (silver wand, cream pie, or cockatrice corpse for instance). If twoweaponing, it is called once for each of the two weapons or weapon-tools in use.{{refsrc|Uhitm.c|481|comment=hitum calls known_hitum}}{{refsrc|Uhitm.c|438|comment=first call to hmon}}{{refsrc|Uhitm.c|442|comment=second call to hmon for second weapon}}{{refsrc|Uhitm.c|498|comment=hmon calls hmon_hitmon}}
+
hmon_hitmon in uhitm.c is called once for each melee hit on a monster, whether the hit is barehanded, with a weapon, with a weapon tool, or with something else (silver wand, cream pie, or cockatrice corpse for instance). If twoweaponing, it is called once for each of the two weapons or weapon-tools in use.{{refsrc|uhitm.c|504|nethack=3.6.0|comment=hitum calls known_hitum}}{{refsrc|uhitm.c|464|version=3.6.0|comment=first call to hmon}}{{refsrc|uhitm.c|512|nethack=3.6.0|comment=second call to known_hitum for second weapon}}{{refsrc|uhitm.c|531|nethack=3.6.0|comment=hmon calls hmon_hitmon}}
  
 
Reading hmon_hitmon and its sub-functions gives us the order in which bonuses are applied, and thus tells us which of these bonuses will be affected by double damage.
 
Reading hmon_hitmon and its sub-functions gives us the order in which bonuses are applied, and thus tells us which of these bonuses will be affected by double damage.
  
Inside hmon_hitmon, the weapon/item in question is stored in the variable obj. The damage is stored in tmp, and this variable is modified as the function progresses, adding layer upon layer of NetHack combat functionality. hmon_hitman calls dmgval in weapon.c to get the base damage, enchantment bonus, and situation bonuses for the weapon.{{refsrc|Uhitm.c|601}}. dmgval adds bonuses for using blessed weapons against undead, axes against wooden monsters, and silver against silver hating monsters, but tests to see if the weapon will do double damage and divides these values by two in that case (so the bonuses are not doubled).{{refsrc|Weapon.c|285|comment=bonuses calculated and fiddled with}}. dmgval also subtracts damage due to erosion.<ref>[[Weapon.c#line310|erosion subtracted]].</ref>
+
Inside hmon_hitmon, the weapon/item in question is stored in the variable obj. The damage is stored in tmp, and this variable is modified as the function progresses, adding layer upon layer of NetHack combat functionality. hmon_hitman calls dmgval in weapon.c to get the base damage, enchantment bonus, and situation bonuses for the weapon.{{refsrc|uhitm.c|643|nethack=3.6.0}}. dmgval adds bonuses for using blessed weapons against undead, axes against wooden monsters, and silver against silver hating monsters, but tests to see if the weapon will do double damage and divides these values by two in that case (so the bonuses are not doubled).{{refsrc|weapon.c|332|nethack=3.6.0|comment=bonuses calculated and fiddled with}}. dmgval also subtracts damage due to erosion.{{refsrc|weapon.c|346|nethack=3.6.0}}
  
hmon_hitmon then considers backstab damage.{{refsrc|Uhitm.c|606|comment=back stab damage section}}.  
+
hmon_hitmon then considers backstab damage.{{refsrc|uhitm.c|648|nethack=3.6.0|comment=back stab damage section}}.  
  
Double damage and other special artifact effects (like Magicbane's specials and the Tsurugi's special, which could itself by double damage) are added in by artifact_hit in artifact.c.{{refsrc|Uhitm.c|642|comment=hmon_hitmon calls artifact_hit}}.
+
Double damage and other special artifact effects (like Magicbane's specials and the Tsurugi's special, which could itself by double damage) are added in by artifact_hit in artifact.c.{{refsrc|uhitm.c|685|nethack=3.6.0|comment=hmon_hitmon calls artifact_hit}}.
  
Finally, hmon_hitmon adds on intrinsic damage bonuses and damage bonuses from rings of increase damage{{refsrc|Uhitm.c|891|comment=damage bonus added}}; followed by the bonus for skill in the weapon's class {{refsrc|Uhitm.c|904|comment=weapon skill bonus}}; and lastly, poison damage is potentially added {{refsrc|Uhitm.c|928|comment=poison damage}}. Bare-hands or martial arts skill only grant their damage bonus if the d2 or d4 base damage is at least two -- effectively you are at unskilled 50% or 25% of the time.<ref>{{sourcecode|uhitm.c|438}} and {{sourcecode|uhitm.c|904}}</ref>
+
Finally, hmon_hitmon adds on intrinsic damage bonuses and damage bonuses from rings of increase damage{{refsrc|uhitm.c|962|nethack=3.6.0|comment=damage bonus added}}; followed by the bonus for skill in the weapon's class {{refsrc|uhitm.c|976|nethack=3.6.0|comment=weapon skill bonus}}; and lastly, poison damage is potentially added {{refsrc|uhitm.c|1003|comment=poison damage}}. Bare-hands or martial arts skill only grant their damage bonus if the d2 or d4 base damage is at least two -- effectively you are at unskilled 50% or 25% of the time.{{refsrc|uhitm.c|464|nethack=3.6.0|comment=bare-handed start}}{{refsrc|uhitm.c|976|nethack=3.6.0|comment=weapon_dam_bonus call}}{{refsrc|weapon.c|1395|nethack=3.6.0|comment=bare-handed calculation}}
  
(tmp, the damage, is subtracted from the monster's hp, mon->mhp on line 989{{refsrc|Uhitm.c|989|comment=tmp subtracted from mon->mhp}}.)
+
(tmp, the damage, is subtracted from the monster's hp, mon->mhp on line 1064{{refsrc|uhitm.c|1064|comment=tmp subtracted from mon->mhp}}.)
  
 
==See also==
 
==See also==
Line 54: Line 54:
  
 
[[Category:Weapons]]
 
[[Category:Weapons]]
{{nethack-343}}
+
{{nethack-360}}

Revision as of 00:07, 7 January 2016

Double damage is a property of some weapons that doubles their damage.

Components of damage doubled

Components of damage not doubled

Weapons that have the double damage property

Even at +0, these weapons are twice as powerful as their base damage alone would suggest, but even greater benefits are to be had from enchanting them: a scroll of enchant weapon used on an artifact weapon with double damage is more effective than the same scroll used on a weapon without double damage (for Grayswandir that's twice as effective, since the doubled damage applies to all monsters.) This also works in reverse; if you ever come across a negatively enchanted -3 Grayswandir you might not want to use it, because it will deal 2*1d8 - 6 for an average of 3 damage (but will still do nicely against silver-haters).

Calculation

A user has suggested this page be merged with "damage"

The damage calculation in NetHack is quite complex, but when concerned only with melee weapons, it is simple enough to describe.

hmon_hitmon in uhitm.c is called once for each melee hit on a monster, whether the hit is barehanded, with a weapon, with a weapon tool, or with something else (silver wand, cream pie, or cockatrice corpse for instance). If twoweaponing, it is called once for each of the two weapons or weapon-tools in use.[1][2][3][4]

Reading hmon_hitmon and its sub-functions gives us the order in which bonuses are applied, and thus tells us which of these bonuses will be affected by double damage.

Inside hmon_hitmon, the weapon/item in question is stored in the variable obj. The damage is stored in tmp, and this variable is modified as the function progresses, adding layer upon layer of NetHack combat functionality. hmon_hitman calls dmgval in weapon.c to get the base damage, enchantment bonus, and situation bonuses for the weapon.[5]. dmgval adds bonuses for using blessed weapons against undead, axes against wooden monsters, and silver against silver hating monsters, but tests to see if the weapon will do double damage and divides these values by two in that case (so the bonuses are not doubled).[6]. dmgval also subtracts damage due to erosion.[7]

hmon_hitmon then considers backstab damage.[8].

Double damage and other special artifact effects (like Magicbane's specials and the Tsurugi's special, which could itself by double damage) are added in by artifact_hit in artifact.c.[9].

Finally, hmon_hitmon adds on intrinsic damage bonuses and damage bonuses from rings of increase damage[10]; followed by the bonus for skill in the weapon's class [11]; and lastly, poison damage is potentially added [12]. Bare-hands or martial arts skill only grant their damage bonus if the d2 or d4 base damage is at least two -- effectively you are at unskilled 50% or 25% of the time.[13][14][15]

(tmp, the damage, is subtracted from the monster's hp, mon->mhp on line 1064[16].)

See also

See http://www.steelypips.org/nethack/343/weap-343.txt, the weapons spoiler by Kevin Hugo at steelypips for a run down on NetHack's entire damage calculation process.

References

  1. uhitm.c in NetHack 3.6.0, line 504: hitum calls known_hitum
  2. uhitm.c in 3.6.0, line 464: first call to hmon
  3. uhitm.c in NetHack 3.6.0, line 512: second call to known_hitum for second weapon
  4. uhitm.c in NetHack 3.6.0, line 531: hmon calls hmon_hitmon
  5. uhitm.c in NetHack 3.6.0, line 643
  6. weapon.c in NetHack 3.6.0, line 332: bonuses calculated and fiddled with
  7. weapon.c in NetHack 3.6.0, line 346
  8. uhitm.c in NetHack 3.6.0, line 648: back stab damage section
  9. uhitm.c in NetHack 3.6.0, line 685: hmon_hitmon calls artifact_hit
  10. uhitm.c in NetHack 3.6.0, line 962: damage bonus added
  11. uhitm.c in NetHack 3.6.0, line 976: weapon skill bonus
  12. uhitm.c in NetHack 3.4.3, line 1003: poison damage
  13. uhitm.c in NetHack 3.6.0, line 464: bare-handed start
  14. uhitm.c in NetHack 3.6.0, line 976: weapon_dam_bonus call
  15. weapon.c in NetHack 3.6.0, line 1395: bare-handed calculation
  16. uhitm.c in NetHack 3.4.3, line 1064: tmp subtracted from mon->mhp

This page may need to be updated for the current version of NetHack.

It may contain text specific to NetHack 3.6.0. Information on this page may be out of date.

Editors: After reviewing this page and making necessary edits, please change the {{nethack-360}} tag to the current version's tag or {{noversion}} as appropriate.