User:Furey/NetHack Combat Internals (3.6.7)

From NetHackWiki
Jump to navigation Jump to search

This article is for NetHack 3.6.7.

Several articles such as Double damage, Damage type, and Attack type will benefit from this.

Damage type

Start with mattacku. This dispatches on attack type to about ten different damage functions. Each damage function switches on the damage types that it cares about. A few damage types are in multiple functions notably AD_STON, and they have different effects for different attack types.

For passive damage (AT_NONE), start with uhitm which calls passive. passive has its own codepath for cancellation and magic cancellation. Again AD_STON has significantly different behavior for AT_NONE vs other attack types.

Monster on monster combat arrives at mhitm among other functions. Completely different code path from mhitu. Lots of major differences and innumerable minor differences.

Source File Functions Notes
include/monattk.h in NetHack 3.6.7, line 31 - defines the AD_* values
src/monst.c in NetHack 3.6.7, line 1 - defines monsters and their attacks
src/mhitu.c in NetHack 3.6.7, line 914 hitmu monster (m) hits hero (u)
src/mhitu.c in NetHack 3.6.7, line 1778 gulpmu monster engulfs at hero
src/mhitu.c in NetHack 3.6.7, line 2036 explmu monster explodes at hero
src/mhitu.c in NetHack 3.6.7, line 2141 gazemu monster gazes at hero
src/mthrowu.c in NetHack 3.6.7, line 954 spitmu monster spits at hero
src/mthrowu.c in NetHack 3.6.7, line 997 breamu monster breathes at hero
src/mthrowu.c in NetHack 3.6.7, line 885 thrwmu monster throws at hero
src/mcastu.c in NetHack 3.6.7, line 179 castmu monster spellcasts at hero
src/mcastu.c in NetHack 3.6.7, line 839 buzzmu monster sends buzz (z) (beam or ray) at hero
src/zap.c in NetHack 3.6.7, line 3763 zhitu buzz hits the hero
src/steal.c in NetHack 3.6.7, line 529 stealamulet monster steals amulet or other item from hero
src/mondata.c in NetHack 3.6.7, line 1 - auxiliary functions
src/mhitm.c in NetHack 3.6.7, line 855 mdamagem monster damages monster

thrwmu