Source:SLASH'EM 0.0.7E7F2/attk.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to attk.h from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[Source:SLASH'EM 0.0.7E7F2/attk.h#line123]], for example.

Source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1.    /* attk.h */
2.    /* NetHack may be freely redistributed.  See license for details. */
3.    /* Copyright 1988, M. Stephenson */
4.    
5.    #ifndef ATTK_H
6.    #define ATTK_H
7.    
8.    typedef struct Attk {
9.    	struct monst *amon;		/* Attacking monster */
10.   	struct obj *wobj;		/* The wielded object, launcher, or wand */
11.   	struct obj *tobj;		/* The thrown, kicked, or zapped object */
12.   	struct monst *dmon;		/* Defending monster */
13.   	xchar	atype;			/* The attack type (AT_ below) */
14.   	xchar	admg;			/* The damage type (AD_ below) */
15.   	xchar	skill;			/* Skill used (if any) */
16.   	schar	aalign;			/* Attacking monster's alignment */
17.   	schar	dalign;			/* Defending monster's alignment */
18.   	xchar	ax, ay;			/* Location of attacker */
19.   	schar	dx, dy, dz;		/* Direction of the attack */
20.   	xchar	tx, ty;			/* Location of tobj */
21.   	xchar	range;			/* How much further tobj can go */
22.   	xchar	dist;			/* Distance from amon to dmon */
23.   	long	tglyph;			/* Glyph to use for tobj */
24.   	xchar	tohit;			/* Calculated to-hit value */
25.   	xchar	dieroll;		/* The die roll used for the attack */
26.   	xchar	damage;			/* Calculated amount of damage */
27.   	Bitfield(ayou,1);		/* You are the attacker */
28.   	Bitfield(avis,1);		/* Player can see amon */
29.   	Bitfield(dyou,1);		/* You are the defender */
30.   	Bitfield(dvis,1);		/* Player can see dmon */
31.   	Bitfield(defensive,1);	/* This is the defensive response of another */
32.   							/* attack by dmon against amon */
33.   	Bitfield(poison,1);		/* Poison was used */
34.   	Bitfield(poiskilled,1);
35.   	Bitfield(poismgs,1);
36.   	Bitfield(vampmsg,1);
37.   	Bitfield(resists,1);	/* Defender resists */
38.   	Bitfield(passes,1);		/* Attack passes harmlessly through dmon */
39.   	Bitfield(dkilled,1);	/* Defender is killed */
40.   	Bitfield(wlearn,1);		/* Character learns identity of wobj */
41.   	Bitfield(hitmsg,1);
42.   	Bitfield(skbonus,1);
43.   } *Attk;
44.   
45.   extern void attk_by_you(Attk);
46.   extern void attk_by_mon(Attk, struct monst *);
47.   extern void attk_by_god(Attk, SCHAR_P);
48.   extern void attk_by_trap(Attk, XCHAR_P);
49.   extern void attk_with_obj(Attk, struct obj *);
50.   extern void attk_with_mon(Attk, XCHAR_P);
51.   extern void attk_throw(Attk, struct obj *);
52.   extern void attk_upon(Attk, struct monst *);
53.   extern char *attk_aname(Attk);
54.   extern char *attk_wname(Attk);
55.   extern char *attk_tname(Attk);
56.   extern char *attk_dname(Attk);
57.   
58.   /*	Add new attack types below - ordering affects experience (exper.c).
59.    *	Attacks > AT_BUTT are worth extra experience.
60.    */
61.   #define AT_NONE		0		/* passive monster (ex. acid blob) */
62.   #define AT_CLAW		1		/* claw (punch, hit, etc.) */
63.   #define AT_BITE		2		/* bite */
64.   #define AT_KICK		3		/* kick */
65.   #define AT_BUTT		4		/* head butt (ex. a unicorn) */
66.   #define AT_TUCH		5		/* touches */
67.   #define AT_STNG		6		/* sting */
68.   #define AT_HUGS		7		/* crushing bearhug */
69.   #define AT_SPIT		10		/* spits substance - ranged */
70.   #define AT_ENGL		11		/* engulf (swallow or by a cloud) */
71.   #define AT_BREA		12		/* breath - ranged */
72.   #define AT_EXPL		13		/* explodes - proximity */
73.   #define AT_BOOM     14      /* explodes upon hit */
74.   #define AT_GAZE     15      /* gaze - ranged */
75.   #define AT_TENT     16      /* tentacles */
76.   
77.   #define AT_WEAP		64		/* Hand-to-hand weapon (monster or character) */
78.   #define AT_THRO		65		/* Thrown object */
79.   #define AT_SPEL		66		/* Magic spell (monster or character) */
80.   #define AT_WAND		67		/* Wand or camera (monster or character) */
81.   #define AT_MEGA		68		/* Mega spell/wand */
82.   #define AT_TRAP		69		/* Trap (amon is null) */
83.   #define AT_GODS		70		/* God (amon is null) */
84.   
85.   /*#define AT_MAGC	66 */		/* uses magic spell(s) */
86.   
87.   
88.   /*	Add new damage types below.
89.    *
90.    *	Note that 1-10 correspond to the types of attack used in buzz().
91.    *	Please don't disturb the order unless you rewrite the buzz() code.
92.    */
93.   #define AD_PHYS		0		/* ordinary physical */
94.   #define AD_MAGM		1		/* magic missiles */
95.   #define AD_FIRE		2		/* fire damage */
96.   #define AD_COLD		3		/* frost damage */
97.   #define AD_SLEE		4		/* sleep ray */
98.   #define AD_DISN		5		/* disintegration (death ray) */
99.   #define AD_ELEC		6		/* shock damage */
100.  #define AD_DRST		7		/* drains str (poison) */
101.  #define AD_ACID		8		/* acid damage */
102.  #define AD_LITE		9		/* light ray */
103.  #define AD_SPC2		10		/* for extension of buzz() */
104.  #define AD_BLND		11		/* blinds (glowing eye) */
105.  #define AD_STUN		12		/* stuns */
106.  #define AD_SLOW		13		/* slows */
107.  #define AD_PLYS		14		/* paralyses */
108.  #define AD_DRLI		15		/* drains life levels (Vampire) */
109.  #define AD_DREN		16		/* drains magic energy */
110.  #define AD_LEGS		17		/* damages legs (xan) */
111.  #define AD_STON		18		/* petrifies (Medusa, Cockatrice) */
112.  #define AD_STCK		19		/* sticks to you (Mimic) */
113.  #define AD_SGLD		20		/* steals gold (Leppie) */
114.  #define AD_SITM		21		/* steals item (Nymphs) */
115.  #define AD_SEDU		22		/* seduces & steals multiple items */
116.  #define AD_TLPT		23		/* teleports you (Quantum Mech.) */
117.  #define AD_RUST		24		/* rusts armour (Rust Monster)*/
118.  #define AD_CONF		25		/* confuses (Umber Hulk) */
119.  #define AD_DGST		26		/* digests opponent (trapper, etc.) */
120.  #define AD_HEAL		27		/* heals opponent's wounds (nurse) */
121.  #define AD_WRAP		28		/* special "stick" for eels */
122.  #define AD_WERE		29		/* confers lycanthropy */
123.  #define AD_DRDX		30		/* drains dexterity (Quasit) */
124.  #define AD_DRCO		31		/* drains constitution */
125.  #define AD_DRIN		32		/* drains intelligence (mind flayer) */
126.  #define AD_DISE		33		/* confers diseases */
127.  #define AD_DCAY		34		/* decays organics (Brown pudding) */
128.  #define AD_SSEX		35		/* Succubus seduction (extended) */
129.  					/* If no SEDUCE then same as AD_SEDU */
130.  #define AD_HALU		36		/* causes hallucination */
131.  #define AD_DETH		37		/* for Death only */
132.  #define AD_PEST		38		/* for Pestilence only */
133.  #define AD_FAMN		39		/* for Famine only */
134.  #define AD_SLIM		40		/* turns you into green slime */
135.  
136.  #define AD_CLRC		240		/* random clerical spell */
137.  #define AD_SPEL		241		/* random magic spell */
138.  #define AD_RBRE		242		/* random breath weapon */
139.  
140.  #define AD_SAMU		252		/* hits, may steal Amulet (Wizard) */
141.  #define AD_CURS		253		/* random curse (ex. gremlin) */
142.  
143.  
144.  /*
145.   *  Monster to monster attacks.  When a monster attacks another (mattackm),
146.   *  any or all of the following can be returned.  See mattackm() for more
147.   *  details.
148.   */
149.  #define MM_MISS		0x0	/* aggressor missed */
150.  #define MM_HIT		0x1	/* aggressor hit defender */
151.  #define MM_DEF_DIED	0x2	/* defender died */
152.  #define MM_AGR_DIED	0x4	/* aggressor died */
153.  
154.  #endif /* ATTK_H */