Source:NetHack 3.4.3/include/youprop.h

From NetHackWiki
Jump to: navigation, search

Below is the full text to include/youprop.h from NetHack 3.4.3. To link to a particular line, write [[youprop.h#line123]], for example.

  1. /*	SCCS Id: @(#)youprop.h	3.4	1999/07/02	*/
  2. /* Copyright (c) 1989 Mike Threepoint				  */
  3. /* NetHack may be freely redistributed.  See license for details. */

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. #ifndef YOUPROP_H
  2. #define YOUPROP_H
  3.  
  4. #include "prop.h"
  5. #include "permonst.h"
  6. #include "mondata.h"
  7. #include "pm.h"
  8.  
  9.  
  10. /* KMH, intrinsics patch.
  11. * Reorganized and rewritten for >32-bit properties.
  12. * HXxx refers to intrinsic bitfields while in human form.
  13. * EXxx refers to extrinsic bitfields from worn objects.
  14. * BXxx refers to the cause of the property being blocked.
  15. * Xxx refers to any source, including polymorph forms.
  16. */
  17.  
  18.  
  19. #define maybe_polyd(if_so,if_not)	(Upolyd ? (if_so) : (if_not))
  20.  
  21.  
  22. /*** Resistances to troubles ***/
  23. /* With intrinsics and extrinsics */
  24. #define HFire_resistance	u.uprops[FIRE_RES].intrinsic
  25. #define EFire_resistance	u.uprops[FIRE_RES].extrinsic
  26. #define Fire_resistance		(HFire_resistance || EFire_resistance || \
  27. 				 resists_fire(&youmonst))
  28.  
  29. #define HCold_resistance	u.uprops[COLD_RES].intrinsic
  30. #define ECold_resistance	u.uprops[COLD_RES].extrinsic
  31. #define Cold_resistance		(HCold_resistance || ECold_resistance || \
  32. 				 resists_cold(&youmonst))
  33.  
  34. #define HSleep_resistance	u.uprops[SLEEP_RES].intrinsic
  35. #define ESleep_resistance	u.uprops[SLEEP_RES].extrinsic
  36. #define Sleep_resistance	(HSleep_resistance || ESleep_resistance || \
  37. 				 resists_sleep(&youmonst))
  38.  
  39. #define HDisint_resistance	u.uprops[DISINT_RES].intrinsic
  40. #define EDisint_resistance	u.uprops[DISINT_RES].extrinsic
  41. #define Disint_resistance	(HDisint_resistance || EDisint_resistance || \
  42. 				 resists_disint(&youmonst))
  43.  
  44. #define HShock_resistance	u.uprops[SHOCK_RES].intrinsic
  45. #define EShock_resistance	u.uprops[SHOCK_RES].extrinsic
  46. #define Shock_resistance	(HShock_resistance || EShock_resistance || \
  47. 				 resists_elec(&youmonst))
  48.  
  49. #define HPoison_resistance	u.uprops[POISON_RES].intrinsic
  50. #define EPoison_resistance	u.uprops[POISON_RES].extrinsic
  51. #define Poison_resistance	(HPoison_resistance || EPoison_resistance || \
  52. 				 resists_poison(&youmonst))
  53.  
  54. #define HDrain_resistance	u.uprops[DRAIN_RES].intrinsic
  55. #define EDrain_resistance	u.uprops[DRAIN_RES].extrinsic
  56. #define Drain_resistance	(HDrain_resistance || EDrain_resistance || \
  57. 				 resists_drli(&youmonst))
  58.  
  59. /* Intrinsics only */
  60. #define HSick_resistance	u.uprops[SICK_RES].intrinsic
  61. #define Sick_resistance		(HSick_resistance || \
  62. 				 youmonst.data->mlet == S_FUNGUS || \
  63. 				 youmonst.data == &mons[PM_GHOUL] || \
  64. 				 defends(AD_DISE,uwep))
  65. #define Invulnerable		u.uprops[INVULNERABLE].intrinsic    /* [Tom] */
  66.  
  67. /* Extrinsics only */
  68. #define EAntimagic		u.uprops[ANTIMAGIC].extrinsic
  69. #define Antimagic		(EAntimagic || \
  70. 				 (Upolyd && resists_magm(&youmonst)))
  71.  
  72. #define EAcid_resistance	u.uprops[ACID_RES].extrinsic
  73. #define Acid_resistance		(EAcid_resistance || resists_acid(&youmonst))
  74.  
  75. #define EStone_resistance	u.uprops[STONE_RES].extrinsic
  76. #define Stone_resistance	(EStone_resistance || resists_ston(&youmonst))
  77.  
  78.  
  79. /*** Troubles ***/
  80. /* Pseudo-property */
  81. #define Punished		(uball)
  82.  
  83. /* Those implemented solely as timeouts (we use just intrinsic) */
  84. #define HStun			u.uprops[STUNNED].intrinsic
  85. #define Stunned			(HStun || u.umonnum == PM_STALKER || \
  86. 				 youmonst.data->mlet == S_BAT)
  87. 		/* Note: birds will also be stunned */
  88.  
  89. #define HConfusion		u.uprops[CONFUSION].intrinsic
  90. #define Confusion		HConfusion
  91.  
  92. #define Blinded			u.uprops[BLINDED].intrinsic
  93. #define Blindfolded		(ublindf && ublindf->otyp != LENSES)
  94. 		/* ...means blind because of a cover */
  95. #define Blind	((Blinded || Blindfolded || !haseyes(youmonst.data)) && \
  96. 		 !(ublindf && ublindf->oartifact == ART_EYES_OF_THE_OVERWORLD))
  97. 		/* ...the Eyes operate even when you really are blind
  98. 		    or don't have any eyes */
  99.  
  100. #define Sick			u.uprops[SICK].intrinsic
  101. #define Stoned			u.uprops[STONED].intrinsic
  102. #define Strangled		u.uprops[STRANGLED].intrinsic
  103. #define Vomiting		u.uprops[VOMITING].intrinsic
  104. #define Glib			u.uprops[GLIB].intrinsic
  105. #define Slimed			u.uprops[SLIMED].intrinsic	/* [Tom] */
  106.  
  107. /* Hallucination is solely a timeout; its resistance is extrinsic */
  108. #define HHallucination		u.uprops[HALLUC].intrinsic
  109. #define EHalluc_resistance	u.uprops[HALLUC_RES].extrinsic
  110. #define Halluc_resistance	(EHalluc_resistance || \
  111. 				 (Upolyd && dmgtype(youmonst.data, AD_HALU)))
  112. #define Hallucination		(HHallucination && !Halluc_resistance)
  113.  
  114. /* Timeout, plus a worn mask */
  115. #define HFumbling		u.uprops[FUMBLING].intrinsic
  116. #define EFumbling		u.uprops[FUMBLING].extrinsic
  117. #define Fumbling		(HFumbling || EFumbling)
  118.  
  119. #define HWounded_legs		u.uprops[WOUNDED_LEGS].intrinsic
  120. #define EWounded_legs		u.uprops[WOUNDED_LEGS].extrinsic
  121. #define Wounded_legs		(HWounded_legs || EWounded_legs)
  122.  
  123. #define HSleeping		u.uprops[SLEEPING].intrinsic
  124. #define ESleeping		u.uprops[SLEEPING].extrinsic
  125. #define Sleeping		(HSleeping || ESleeping)
  126.  
  127. #define HHunger			u.uprops[HUNGER].intrinsic
  128. #define EHunger			u.uprops[HUNGER].extrinsic
  129. #define Hunger			(HHunger || EHunger)
  130.  
  131.  
  132. /*** Vision and senses ***/
  133. #define HSee_invisible		u.uprops[SEE_INVIS].intrinsic
  134. #define ESee_invisible		u.uprops[SEE_INVIS].extrinsic
  135. #define See_invisible		(HSee_invisible || ESee_invisible || \
  136. 				 perceives(youmonst.data))
  137.  
  138. #define HTelepat		u.uprops[TELEPAT].intrinsic
  139. #define ETelepat		u.uprops[TELEPAT].extrinsic
  140. #define Blind_telepat		(HTelepat || ETelepat || \
  141. 				 telepathic(youmonst.data))
  142. #define Unblind_telepat		(ETelepat)
  143.  
  144. #define HWarning		u.uprops[WARNING].intrinsic
  145. #define EWarning		u.uprops[WARNING].extrinsic
  146. #define Warning			(HWarning || EWarning)
  147.  
  148. /* Warning for a specific type of monster */
  149. #define HWarn_of_mon		u.uprops[WARN_OF_MON].intrinsic
  150. #define EWarn_of_mon		u.uprops[WARN_OF_MON].extrinsic
  151. #define Warn_of_mon		(HWarn_of_mon || EWarn_of_mon)
  152.  
  153. #define HUndead_warning		u.uprops[WARN_UNDEAD].intrinsic
  154. #define Undead_warning		(HUndead_warning)
  155.  
  156. #define HSearching		u.uprops[SEARCHING].intrinsic
  157. #define ESearching		u.uprops[SEARCHING].extrinsic
  158. #define Searching		(HSearching || ESearching)
  159.  
  160. #define HClairvoyant		u.uprops[CLAIRVOYANT].intrinsic
  161. #define EClairvoyant		u.uprops[CLAIRVOYANT].extrinsic
  162. #define BClairvoyant		u.uprops[CLAIRVOYANT].blocked
  163. #define Clairvoyant		((HClairvoyant || EClairvoyant) &&\
  164. 				 !BClairvoyant)
  165.  
  166. #define HInfravision		u.uprops[INFRAVISION].intrinsic
  167. #define EInfravision		u.uprops[INFRAVISION].extrinsic
  168. #define Infravision		(HInfravision || EInfravision || \
  169. 				  infravision(youmonst.data))
  170.  
  171. #define HDetect_monsters	u.uprops[DETECT_MONSTERS].intrinsic
  172. #define EDetect_monsters	u.uprops[DETECT_MONSTERS].extrinsic
  173. #define Detect_monsters		(HDetect_monsters || EDetect_monsters)
  174.  
  175.  
  176. /*** Appearance and behavior ***/
  177. #define Adornment		u.uprops[ADORNED].extrinsic
  178.  
  179. #define HInvis			u.uprops[INVIS].intrinsic
  180. #define EInvis			u.uprops[INVIS].extrinsic
  181. #define BInvis			u.uprops[INVIS].blocked
  182. #define Invis			((HInvis || EInvis || \
  183. 				 pm_invisible(youmonst.data)) && !BInvis)
  184. #define Invisible		(Invis && !See_invisible)
  185. 		/* Note: invisibility also hides inventory and steed */
  186.  
  187. #define EDisplaced		u.uprops[DISPLACED].extrinsic
  188. #define Displaced		EDisplaced
  189.  
  190. #define HStealth		u.uprops[STEALTH].intrinsic
  191. #define EStealth		u.uprops[STEALTH].extrinsic
  192. #define BStealth		u.uprops[STEALTH].blocked
  193. #define Stealth			((HStealth || EStealth) && !BStealth)
  194.  
  195. #define HAggravate_monster	u.uprops[AGGRAVATE_MONSTER].intrinsic
  196. #define EAggravate_monster	u.uprops[AGGRAVATE_MONSTER].extrinsic
  197. #define Aggravate_monster	(HAggravate_monster || EAggravate_monster)
  198.  
  199. #define HConflict		u.uprops[CONFLICT].intrinsic
  200. #define EConflict		u.uprops[CONFLICT].extrinsic
  201. #define Conflict		(HConflict || EConflict)
  202.  
  203.  
  204. /*** Transportation ***/
  205. #define HJumping		u.uprops[JUMPING].intrinsic
  206. #define EJumping		u.uprops[JUMPING].extrinsic
  207. #define Jumping			(HJumping || EJumping)
  208.  
  209. #define HTeleportation		u.uprops[TELEPORT].intrinsic
  210. #define ETeleportation		u.uprops[TELEPORT].extrinsic
  211. #define Teleportation		(HTeleportation || ETeleportation || \
  212. 				 can_teleport(youmonst.data))
  213.  
  214. #define HTeleport_control	u.uprops[TELEPORT_CONTROL].intrinsic
  215. #define ETeleport_control	u.uprops[TELEPORT_CONTROL].extrinsic
  216. #define Teleport_control	(HTeleport_control || ETeleport_control || \
  217. 				 control_teleport(youmonst.data))
  218.  
  219. #define HLevitation		u.uprops[LEVITATION].intrinsic
  220. #define ELevitation		u.uprops[LEVITATION].extrinsic
  221. #define Levitation		(HLevitation || ELevitation || \
  222. 				 is_floater(youmonst.data))
  223. 	/* Can't touch surface, can't go under water; overrides all others */
  224. #define Lev_at_will		(((HLevitation & I_SPECIAL) != 0L || \
  225. 				 (ELevitation & W_ARTI) != 0L) && \
  226. 				 (HLevitation & ~(I_SPECIAL|TIMEOUT)) == 0L && \
  227. 				 (ELevitation & ~W_ARTI) == 0L && \
  228. 				 !is_floater(youmonst.data))
  229.  
  230. #define EFlying			u.uprops[FLYING].extrinsic
  231. #ifdef STEED
  232. # define Flying			(EFlying || is_flyer(youmonst.data) || \
  233. 				 (u.usteed && is_flyer(u.usteed->data)))
  234. #else
  235. # define Flying			(EFlying || is_flyer(youmonst.data))
  236. #endif
  237. 	/* May touch surface; does not override any others */
  238.  
  239. #define Wwalking		(u.uprops[WWALKING].extrinsic && \
  240. 				 !Is_waterlevel(&u.uz))
  241. 	/* Don't get wet, can't go under water; overrides others except levitation */
  242. 	/* Wwalking is meaningless on water level */
  243.  
  244. #define HSwimming		u.uprops[SWIMMING].intrinsic
  245. #define ESwimming		u.uprops[SWIMMING].extrinsic	/* [Tom] */
  246. #ifdef STEED
  247. # define Swimming		(HSwimming || ESwimming || \
  248. 				 is_swimmer(youmonst.data) || \
  249. 				 (u.usteed && is_swimmer(u.usteed->data)))
  250. #else
  251. # define Swimming		(HSwimming || ESwimming || \
  252. 				 is_swimmer(youmonst.data))
  253. #endif
  254. 	/* Get wet, don't go under water unless if amphibious */
  255.  
  256. #define HMagical_breathing	u.uprops[MAGICAL_BREATHING].intrinsic
  257. #define EMagical_breathing	u.uprops[MAGICAL_BREATHING].extrinsic
  258. #define Amphibious		(HMagical_breathing || EMagical_breathing || \
  259. 				 amphibious(youmonst.data))
  260. 	/* Get wet, may go under surface */
  261.  
  262. #define Breathless		(HMagical_breathing || EMagical_breathing || \
  263. 				 breathless(youmonst.data))
  264.  
  265. #define Underwater		(u.uinwater)
  266. /* Note that Underwater and u.uinwater are both used in code.
  267. The latter form is for later implementation of other in-water
  268. states, like swimming, wading, etc. */
  269.  
  270. #define HPasses_walls		u.uprops[PASSES_WALLS].intrinsic
  271. #define EPasses_walls		u.uprops[PASSES_WALLS].extrinsic
  272. #define Passes_walls		(HPasses_walls || EPasses_walls || \
  273. 				 passes_walls(youmonst.data))
  274.  
  275.  
  276. /*** Physical attributes ***/
  277. #define HSlow_digestion		u.uprops[SLOW_DIGESTION].intrinsic
  278. #define ESlow_digestion		u.uprops[SLOW_DIGESTION].extrinsic
  279. #define Slow_digestion		(HSlow_digestion || ESlow_digestion)  /* KMH */
  280.  
  281. #define HHalf_spell_damage	u.uprops[HALF_SPDAM].intrinsic
  282. #define EHalf_spell_damage	u.uprops[HALF_SPDAM].extrinsic
  283. #define Half_spell_damage	(HHalf_spell_damage || EHalf_spell_damage)
  284.  
  285. #define HHalf_physical_damage	u.uprops[HALF_PHDAM].intrinsic
  286. #define EHalf_physical_damage	u.uprops[HALF_PHDAM].extrinsic
  287. #define Half_physical_damage	(HHalf_physical_damage || EHalf_physical_damage)
  288.  
  289. #define HRegeneration		u.uprops[REGENERATION].intrinsic
  290. #define ERegeneration		u.uprops[REGENERATION].extrinsic
  291. #define Regeneration		(HRegeneration || ERegeneration || \
  292. 				 regenerates(youmonst.data))
  293.  
  294. #define HEnergy_regeneration	u.uprops[ENERGY_REGENERATION].intrinsic
  295. #define EEnergy_regeneration	u.uprops[ENERGY_REGENERATION].extrinsic
  296. #define Energy_regeneration	(HEnergy_regeneration || EEnergy_regeneration)
  297.  
  298. #define HProtection		u.uprops[PROTECTION].intrinsic
  299. #define EProtection		u.uprops[PROTECTION].extrinsic
  300. #define Protection		(HProtection || EProtection)
  301.  
  302. #define HProtection_from_shape_changers \
  303. 				u.uprops[PROT_FROM_SHAPE_CHANGERS].intrinsic
  304. #define EProtection_from_shape_changers \
  305. 				u.uprops[PROT_FROM_SHAPE_CHANGERS].extrinsic
  306. #define Protection_from_shape_changers \
  307. 				(HProtection_from_shape_changers || \
  308. 				 EProtection_from_shape_changers)
  309.  
  310. #define HPolymorph		u.uprops[POLYMORPH].intrinsic
  311. #define EPolymorph		u.uprops[POLYMORPH].extrinsic
  312. #define Polymorph		(HPolymorph || EPolymorph)
  313.  
  314. #define HPolymorph_control	u.uprops[POLYMORPH_CONTROL].intrinsic
  315. #define EPolymorph_control	u.uprops[POLYMORPH_CONTROL].extrinsic
  316. #define Polymorph_control	(HPolymorph_control || EPolymorph_control)
  317.  
  318. #define HUnchanging		u.uprops[UNCHANGING].intrinsic
  319. #define EUnchanging		u.uprops[UNCHANGING].extrinsic
  320. #define Unchanging		(HUnchanging || EUnchanging)	/* KMH */
  321.  
  322. #define HFast			u.uprops[FAST].intrinsic
  323. #define EFast			u.uprops[FAST].extrinsic
  324. #define Fast			(HFast || EFast)
  325. #define Very_fast		((HFast & ~INTRINSIC) || EFast)
  326.  
  327. #define EReflecting		u.uprops[REFLECTING].extrinsic
  328. #define Reflecting		(EReflecting || \
  329. 				 (youmonst.data == &mons[PM_SILVER_DRAGON]))
  330.  
  331. #define Free_action		u.uprops[FREE_ACTION].extrinsic /* [Tom] */
  332.  
  333. #define Fixed_abil		u.uprops[FIXED_ABIL].extrinsic	/* KMH */
  334.  
  335. #define Lifesaved		u.uprops[LIFESAVED].extrinsic
  336.  
  337.  
  338. #endif /* YOUPROP_H */