Below is the full text to include/monst.h from NetHack 3.4.3. To link to a particular line, write [[monst.h#line123]], for example.
1. /* SCCS Id: @(#)monst.h 3.4 1999/01/04 */ 2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4.
The NetHack General Public License applies to screenshots, source code and other content from NetHack. |
5. #ifndef MONST_H 6. #define MONST_H 7. 8. /* The weapon_check flag is used two ways: 9. * 1) When calling mon_wield_item, is 2-6 depending on what is desired. 10. * 2) Between calls to mon_wield_item, is 0 or 1 depending on whether or not 11. * the weapon is known by the monster to be cursed (so it shouldn't bother 12. * trying for another weapon). 13. * I originally planned to also use 0 if the monster already had its best 14. * weapon, to avoid the overhead of a call to mon_wield_item, but it turns out 15. * that there are enough situations which might make a monster change its 16. * weapon that this is impractical. --KAA 17. */ 18. # define NO_WEAPON_WANTED 0 19. # define NEED_WEAPON 1 20. # define NEED_RANGED_WEAPON 2 21. # define NEED_HTH_WEAPON 3 22. # define NEED_PICK_AXE 4 23. # define NEED_AXE 5 24. # define NEED_PICK_OR_AXE 6 25. 26. /* The following flags are used for the second argument to display_minventory 27. * in invent.c: 28. * 29. * MINV_NOLET If set, don't display inventory letters on monster's inventory. 30. * MINV_ALL If set, display all items in monster's inventory, otherwise 31. * just display wielded weapons and worn items. 32. */ 33. #define MINV_NOLET 0x01 34. #define MINV_ALL 0x02 35. 36. #ifndef ALIGN_H 37. #include "align.h" 38. #endif 39. 40. struct monst { 41. struct monst *nmon; 42. struct permonst *data; 43. unsigned m_id; 44. short mnum; /* permanent monster index number */ 45. short movement; /* movement points (derived from permonst definition and added effects */ 46. uchar m_lev; /* adjusted difficulty level of monster */ 47. aligntyp malign; /* alignment of this monster, relative to the 48. player (positive = good to kill) */ 49. xchar mx, my; 50. xchar mux, muy; /* where the monster thinks you are */ 51. #define MTSZ 4 52. coord mtrack[MTSZ]; /* monster track */ 53. int mhp, mhpmax; 54. unsigned mappearance; /* for undetected mimics and the wiz */ 55. uchar m_ap_type; /* what mappearance is describing: */ 56. #define M_AP_NOTHING 0 /* mappearance is unused -- monster appears 57. as itself */ 58. #define M_AP_FURNITURE 1 /* stairs, a door, an altar, etc. */ 59. #define M_AP_OBJECT 2 /* an object */ 60. #define M_AP_MONSTER 3 /* a monster */ 61. 62. schar mtame; /* level of tameness, implies peaceful */ 63. unsigned short mintrinsics; /* low 8 correspond to mresists */ 64. int mspec_used; /* monster's special ability attack timeout */ 65. 66. Bitfield(female,1); /* is female */ 67. Bitfield(minvis,1); /* currently invisible */ 68. Bitfield(invis_blkd,1); /* invisibility blocked */ 69. Bitfield(perminvis,1); /* intrinsic minvis value */ 70. Bitfield(cham,3); /* shape-changer */ 71. /* note: lychanthropes are handled elsewhere */ 72. #define CHAM_ORDINARY 0 /* not a shapechanger */ 73. #define CHAM_CHAMELEON 1 /* animal */ 74. #define CHAM_DOPPELGANGER 2 /* demi-human */ 75. #define CHAM_SANDESTIN 3 /* demon */ 76. #define CHAM_MAX_INDX CHAM_SANDESTIN 77. Bitfield(mundetected,1); /* not seen in present hiding place */ 78. /* implies one of M1_CONCEAL or M1_HIDE, 79. * but not mimic (that is, snake, spider, 80. * trapper, piercer, eel) 81. */ 82. 83. Bitfield(mcan,1); /* has been cancelled */ 84. Bitfield(mburied,1); /* has been buried */ 85. Bitfield(mspeed,2); /* current speed */ 86. Bitfield(permspeed,2); /* intrinsic mspeed value */ 87. Bitfield(mrevived,1); /* has been revived from the dead */ 88. Bitfield(mavenge,1); /* did something to deserve retaliation */ 89. 90. Bitfield(mflee,1); /* fleeing */ 91. Bitfield(mfleetim,7); /* timeout for mflee */ 92. 93. Bitfield(mcansee,1); /* cansee 1, temp.blinded 0, blind 0 */ 94. Bitfield(mblinded,7); /* cansee 0, temp.blinded n, blind 0 */ 95. 96. Bitfield(mcanmove,1); /* paralysis, similar to mblinded */ 97. Bitfield(mfrozen,7); 98. 99. Bitfield(msleeping,1); /* asleep until woken */ 100. Bitfield(mstun,1); /* stunned (off balance) */ 101. Bitfield(mconf,1); /* confused */ 102. Bitfield(mpeaceful,1); /* does not attack unprovoked */ 103. Bitfield(mtrapped,1); /* trapped in a pit, web or bear trap */ 104. Bitfield(mleashed,1); /* monster is on a leash */ 105. Bitfield(isshk,1); /* is shopkeeper */ 106. Bitfield(isminion,1); /* is a minion */ 107. 108. Bitfield(isgd,1); /* is guard */ 109. Bitfield(ispriest,1); /* is a priest */ 110. Bitfield(iswiz,1); /* is the Wizard of Yendor */ 111. Bitfield(wormno,5); /* at most 31 worms on any level */ 112. #define MAX_NUM_WORMS 32 /* should be 2^(wormno bitfield size) */ 113. 114. long mstrategy; /* for monsters with mflag3: current strategy */ 115. #define STRAT_ARRIVE 0x40000000L /* just arrived on current level */ 116. #define STRAT_WAITFORU 0x20000000L 117. #define STRAT_CLOSE 0x10000000L 118. #define STRAT_WAITMASK 0x30000000L 119. #define STRAT_HEAL 0x08000000L 120. #define STRAT_GROUND 0x04000000L 121. #define STRAT_MONSTR 0x02000000L 122. #define STRAT_PLAYER 0x01000000L 123. #define STRAT_NONE 0x00000000L 124. #define STRAT_STRATMASK 0x0f000000L 125. #define STRAT_XMASK 0x00ff0000L 126. #define STRAT_YMASK 0x0000ff00L 127. #define STRAT_GOAL 0x000000ffL 128. #define STRAT_GOALX(s) ((xchar)((s & STRAT_XMASK) >> 16)) 129. #define STRAT_GOALY(s) ((xchar)((s & STRAT_YMASK) >> 8)) 130. 131. long mtrapseen; /* bitmap of traps we've been trapped in */ 132. long mlstmv; /* for catching up with lost time */ 133. #ifndef GOLDOBJ 134. long mgold; 135. #endif 136. struct obj *minvent; 137. 138. struct obj *mw; 139. long misc_worn_check; 140. xchar weapon_check; 141. 142. uchar mnamelth; /* length of name (following mxlth) */ 143. short mxlth; /* length of following data */ 144. /* in order to prevent alignment problems mextra should 145. be (or follow) a long int */ 146. int meating; /* monster is eating timeout */ 147. long mextra[1]; /* monster dependent info */ 148. }; 149. 150. /* 151. * Note that mextra[] may correspond to any of a number of structures, which 152. * are indicated by some of the other fields. 153. * isgd -> struct egd 154. * ispriest -> struct epri 155. * isshk -> struct eshk 156. * isminion -> struct emin 157. * (struct epri for roaming priests and angels, which is 158. * compatible with emin for polymorph purposes) 159. * mtame -> struct edog 160. * (struct epri for guardian angels, which do not eat 161. * or do other doggy things) 162. * Since at most one structure can be indicated in this manner, it is not 163. * possible to tame any creatures using the other structures (the only 164. * exception being the guardian angels which are tame on creation). 165. */ 166. 167. #define newmonst(xl) (struct monst *)alloc((unsigned)(xl) + sizeof(struct monst)) 168. #define dealloc_monst(mon) free((genericptr_t)(mon)) 169. 170. /* these are in mspeed */ 171. #define MSLOW 1 /* slow monster */ 172. #define MFAST 2 /* speeded monster */ 173. 174. #define NAME(mtmp) (((char *)(mtmp)->mextra) + (mtmp)->mxlth) 175. 176. #define MON_WEP(mon) ((mon)->mw) 177. #define MON_NOWEP(mon) ((mon)->mw = (struct obj *)0) 178. 179. #define DEADMONSTER(mon) ((mon)->mhp < 1) 180. 181. #endif /* MONST_H */