Source:NetHack 3.2.0/mondata.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to mondata.h from the source code of NetHack 3.2.0. To link to a particular line, write [[NetHack 3.2.0/mondata.h#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see 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.    /*	SCCS Id: @(#)mondata.h	3.2	95/07/29	*/
2.    /* Copyright (c) 1989 Mike Threepoint				  */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef MONDATA_H
6.    #define MONDATA_H
7.    
8.    #ifndef ALIGN_H
9.    #include "align.h"
10.   #endif
11.   
12.   #define verysmall(ptr)		((ptr)->msize < MZ_SMALL)
13.   #define bigmonst(ptr)		((ptr)->msize >= MZ_LARGE)
14.   
15.   #define pm_resistance(ptr,typ)	(((ptr)->mresists & (typ)) != 0)
16.   
17.   #define resists_fire(mon)	(((mon)->mintrinsics & MR_FIRE) != 0)
18.   #define resists_cold(mon)	(((mon)->mintrinsics & MR_COLD) != 0)
19.   #define resists_sleep(mon)	(((mon)->mintrinsics & MR_SLEEP) != 0)
20.   #define resists_disint(mon)	(((mon)->mintrinsics & MR_DISINT) != 0)
21.   #define resists_elec(mon)	(((mon)->mintrinsics & MR_ELEC) != 0)
22.   #define resists_poison(mon)	(((mon)->mintrinsics & MR_POISON) != 0)
23.   #define resists_acid(mon)	(((mon)->mintrinsics & MR_ACID) != 0)
24.   #define resists_ston(mon)	(((mon)->mintrinsics & MR_STONE) != 0)
25.   
26.   #define is_flyer(ptr)		(((ptr)->mflags1 & M1_FLY) != 0L)
27.   #define is_floater(ptr)		((ptr)->mlet == S_EYE)
28.   #define is_clinger(ptr)		(((ptr)->mflags1 & M1_CLING) != 0L)
29.   #define is_swimmer(ptr)		(((ptr)->mflags1 & M1_SWIM) != 0L)
30.   #define breathless(ptr)		(((ptr)->mflags1 & M1_BREATHLESS) != 0L)
31.   #define amphibious(ptr)		(((ptr)->mflags1 & (M1_AMPHIBIOUS | M1_BREATHLESS)) != 0L)
32.   #define passes_walls(ptr)	(((ptr)->mflags1 & M1_WALLWALK) != 0L)
33.   #define amorphous(ptr)		(((ptr)->mflags1 & M1_AMORPHOUS) != 0L)
34.   #define noncorporeal(ptr)	((ptr)->mlet == S_GHOST)
35.   #define tunnels(ptr)		(((ptr)->mflags1 & M1_TUNNEL) != 0L)
36.   #define needspick(ptr)		(((ptr)->mflags1 & M1_NEEDPICK) != 0L)
37.   #define hides_under(ptr)	(((ptr)->mflags1 & M1_CONCEAL) != 0L)
38.   #define is_hider(ptr)		(((ptr)->mflags1 & M1_HIDE) != 0L)
39.   #define haseyes(ptr)		(((ptr)->mflags1 & M1_NOEYES) == 0L)
40.   #define nohands(ptr)		(((ptr)->mflags1 & M1_NOHANDS) != 0L)
41.   #define nolimbs(ptr)		(((ptr)->mflags1 & M1_NOLIMBS) == M1_NOLIMBS)
42.   #define has_head(ptr)		(((ptr)->mflags1 & M1_NOHEAD) == 0L)
43.   #define is_whirly(ptr)		((ptr)->mlet == S_VORTEX || \
44.   				 (ptr) == &mons[PM_AIR_ELEMENTAL])
45.   #define unsolid(ptr)		(((ptr)->mflags1 & M1_UNSOLID) != 0L)
46.   #define mindless(ptr)		(((ptr)->mflags1 & M1_MINDLESS) != 0L)
47.   #define humanoid(ptr)		(((ptr)->mflags1 & M1_HUMANOID) != 0L)
48.   #define is_animal(ptr)		(((ptr)->mflags1 & M1_ANIMAL) != 0L)
49.   #define slithy(ptr)		(((ptr)->mflags1 & M1_SLITHY) != 0L)
50.   #define is_meaty(ptr)		(!amorphous(ptr) && \
51.   				 (ptr)->mlet != S_BLOB && \
52.   				 (ptr)->mlet != S_JELLY && \
53.   				 (ptr)->mlet != S_FUNGUS)
54.   #define is_wooden(ptr)		((ptr) == &mons[PM_WOOD_GOLEM])
55.   #define thick_skinned(ptr)	(((ptr)->mflags1 & M1_THICK_HIDE) != 0L)
56.   #define lays_eggs(ptr)		(((ptr)->mflags1 & M1_OVIPAROUS) != 0L)
57.   #define regenerates(ptr)	(((ptr)->mflags1 & M1_REGEN) != 0L)
58.   #define perceives(ptr)		(((ptr)->mflags1 & M1_SEE_INVIS) != 0L)
59.   #define can_teleport(ptr)	(((ptr)->mflags1 & M1_TPORT) != 0L)
60.   #define control_teleport(ptr)	(((ptr)->mflags1 & M1_TPORT_CNTRL) != 0L)
61.   #define telepathic(ptr)		((ptr) == &mons[PM_FLOATING_EYE] || \
62.   				 (ptr) == &mons[PM_MIND_FLAYER])
63.   #define is_armed(ptr)		attacktype(ptr, AT_WEAP)
64.   #define acidic(ptr)		(((ptr)->mflags1 & M1_ACID) != 0L)
65.   #define poisonous(ptr)		(((ptr)->mflags1 & M1_POIS) != 0L)
66.   #define carnivorous(ptr)	(((ptr)->mflags1 & M1_CARNIVORE) != 0L)
67.   #define herbivorous(ptr)	(((ptr)->mflags1 & M1_HERBIVORE) != 0L)
68.   #define metallivorous(ptr)	(((ptr)->mflags1 & M1_METALLIVORE) != 0L)
69.   #define polyok(ptr)		(((ptr)->mflags2 & M2_NOPOLY) == 0L)
70.   #define is_undead(ptr)		(((ptr)->mflags2 & M2_UNDEAD) != 0L)
71.   #define is_were(ptr)		(((ptr)->mflags2 & M2_WERE) != 0L)
72.   #define is_elf(ptr)		(((ptr)->mflags2 & M2_ELF) != 0L)
73.   #define is_dwarf(ptr)		(((ptr)->mflags2 & M2_DWARF) != 0L)
74.   #define is_giant(ptr)		(((ptr)->mflags2 & M2_GIANT) != 0L)
75.   #define is_golem(ptr)		((ptr)->mlet == S_GOLEM)
76.   #define is_domestic(ptr)	(((ptr)->mflags2 & M2_DOMESTIC) != 0L)
77.   #define is_orc(ptr)		(((ptr)->mflags2 & M2_ORC) != 0L)
78.   #define is_human(ptr)		(((ptr)->mflags2 & M2_HUMAN) != 0L)
79.   #define is_demon(ptr)		(((ptr)->mflags2 & M2_DEMON) != 0L)
80.   #define is_mercenary(ptr)	(((ptr)->mflags2 & M2_MERC) != 0L)
81.   #define is_male(ptr)		(((ptr)->mflags2 & M2_MALE) != 0L)
82.   #define is_female(ptr)		(((ptr)->mflags2 & M2_FEMALE) != 0L)
83.   #define is_neuter(ptr)		(((ptr)->mflags2 & M2_NEUTER) != 0L)
84.   #define is_wanderer(ptr)	(((ptr)->mflags2 & M2_WANDER) != 0L)
85.   #define always_hostile(ptr)	(((ptr)->mflags2 & M2_HOSTILE) != 0L)
86.   #define always_peaceful(ptr)	(((ptr)->mflags2 & M2_PEACEFUL) != 0L)
87.   #define extra_nasty(ptr)	(((ptr)->mflags2 & M2_NASTY) != 0L)
88.   #define strongmonst(ptr)	(((ptr)->mflags2 & M2_STRONG) != 0L)
89.   #define can_breathe(ptr)	attacktype(ptr, AT_BREA)
90.   #define cantwield(ptr)		(nohands(ptr) || verysmall(ptr))
91.   #define cantweararm(ptr)	(breakarm(ptr) || sliparm(ptr))
92.   #define throws_rocks(ptr)	(((ptr)->mflags2 & M2_ROCKTHROW) != 0L)
93.   #define type_is_pname(ptr)	(((ptr)->mflags2 & M2_PNAME) != 0L)
94.   #define is_lord(ptr)		(((ptr)->mflags2 & M2_LORD) != 0L)
95.   #define is_prince(ptr)		(((ptr)->mflags2 & M2_PRINCE) != 0L)
96.   #define is_ndemon(ptr)		(is_demon(ptr) && \
97.   				 (((ptr)->mflags2 & (M2_LORD|M2_PRINCE)) == 0L))
98.   #define is_dlord(ptr)		(is_demon(ptr) && is_lord(ptr))
99.   #define is_dprince(ptr)		(is_demon(ptr) && is_prince(ptr))
100.  #define is_minion(ptr)		((ptr)->mflags2 & M2_MINION)
101.  #define is_lminion(ptr)		(is_minion(ptr) && \
102.  				 (ptr)->maligntyp >= A_COALIGNED)
103.  #define likes_gold(ptr)		(((ptr)->mflags2 & M2_GREEDY) != 0L)
104.  #define likes_gems(ptr)		(((ptr)->mflags2 & M2_JEWELS) != 0L)
105.  #define likes_objs(ptr)		(((ptr)->mflags2 & M2_COLLECT) != 0L || \
106.  				 is_armed(ptr))
107.  #define likes_magic(ptr)	(((ptr)->mflags2 & M2_MAGIC) != 0L)
108.  #define is_longworm(ptr)	(((ptr) == &mons[PM_BABY_LONG_WORM]) || \
109.  				 ((ptr) == &mons[PM_LONG_WORM]) || \
110.  				 ((ptr) == &mons[PM_LONG_WORM_TAIL]))
111.  #define is_covetous(ptr)	((ptr->mflags3 & M3_COVETOUS))
112.  #define is_mplayer(ptr)		(((ptr) >= &mons[PM_ARCHEOLOGIST]) && \
113.  				 ((ptr) <= &mons[PM_WIZARD]))
114.  #define is_rider(ptr)		((ptr) == &mons[PM_DEATH] || \
115.  				 (ptr) == &mons[PM_FAMINE] || \
116.  				 (ptr) == &mons[PM_PESTILENCE])
117.  #define is_placeholder(ptr)     ((ptr) == &mons[PM_ORC] || \
118.  				 (ptr) == &mons[PM_GIANT] || \
119.  				 (ptr) == &mons[PM_HUMAN])
120.  /* this returns the light's range, or 0 if none; if we add more light emitting
121.     monsters, we'll likely have to add a new light range field to mons[] */
122.  #define emits_light(ptr)	(((ptr)->mlet == S_LIGHT || \
123.  				  (ptr) == &mons[PM_FIRE_VORTEX]) ? 1 : \
124.  				 ((ptr) == &mons[PM_FIRE_ELEMENTAL]) ? 1 : 0)
125.  /*	[note: the light ranges above were reduced to 1 for performance...] */
126.  #define likes_lava(ptr)		(ptr == &mons[PM_FIRE_ELEMENTAL] || \
127.  				 ptr == &mons[PM_SALAMANDER])
128.  #define pm_invisible(ptr) ((ptr)->mlet == S_STALKER || \
129.  			   (ptr) == &mons[PM_BLACK_LIGHT])
130.  
131.  /* could probably add more */
132.  #define likes_fire(ptr)		((ptr) == &mons[PM_FIRE_VORTEX] || \
133.  				 likes_lava(ptr))
134.  
135.  #define nonliving(ptr)		(is_golem(ptr) || is_undead(ptr))
136.  
137.  #endif /* MONDATA_H */