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