Source:NetHack 3.4.0/youprop.h

From NetHackWiki
Revision as of 14:35, 4 March 2008 by Kernigh bot (talk | contribs) (NetHack 3.4.0/youprop.h moved to Source:NetHack 3.4.0/youprop.h: Robot: moved page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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