Source:NetHack 3.4.0/polyself.c

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

Below is the full text to polyself.c from the source code of NetHack 3.4.0. To link to a particular line, write [[NetHack 3.4.0/polyself.c#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: @(#)polyself.c	3.4	2002/01/15	*/
2.    /*	Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    /*
6.     * Polymorph self routine.
7.     *
8.     * Note:  the light source handling code assumes that both youmonst.m_id
9.     * and youmonst.mx will always remain 0 when it handles the case of the
10.    * player polymorphed into a light-emitting monster.
11.    */
12.   
13.   #include "hack.h"
14.   
15.   #ifdef OVLB
16.   STATIC_DCL void FDECL(polyman, (const char *,const char *));
17.   STATIC_DCL void NDECL(break_armor);
18.   STATIC_DCL void FDECL(drop_weapon,(int));
19.   STATIC_DCL void NDECL(uunstick);
20.   STATIC_DCL int FDECL(armor_to_dragon,(int));
21.   STATIC_DCL void NDECL(newman);
22.   
23.   /* update the youmonst.data structure pointer */
24.   void
25.   set_uasmon()
26.   {
27.   	set_mon_data(&youmonst, &mons[u.umonnum], 0);
28.   }
29.   
30.   /* make a (new) human out of the player */
31.   STATIC_OVL void
32.   polyman(fmt, arg)
33.   const char *fmt, *arg;
34.   {
35.   	boolean sticky = sticks(youmonst.data) && u.ustuck && !u.uswallow,
36.   		was_mimicking_gold = (youmonst.m_ap_type == M_AP_OBJECT
37.   				      && youmonst.mappearance == GOLD_PIECE);
38.   	boolean was_blind = !!Blind;
39.   
40.   	if (Upolyd) {
41.   		u.acurr = u.macurr;	/* restore old attribs */
42.   		u.amax = u.mamax;
43.   		u.umonnum = u.umonster;
44.   		flags.female = u.mfemale;
45.   	}
46.   	set_uasmon();
47.   
48.   	u.mh = u.mhmax = 0;
49.   	u.mtimedone = 0;
50.   	skinback(FALSE);
51.   	u.uundetected = 0;
52.   
53.   	if (sticky) uunstick();
54.   	find_ac();
55.   	if (was_mimicking_gold) {
56.   	    if (multi < 0) unmul("");
57.   	} else {
58.   	    /*
59.   	     * Clear any in-progress imitations -- the case where not a
60.   	     * mimic is handled above.
61.   	     *
62.   	     * Except, this is not complete if the hero ever gets the
63.   	     * chance to imitate anything, then s/he may be mimicing
64.   	     * gold, but not the way its done for eating a mimic.
65.   	     */
66.   	    youmonst.m_ap_type = M_AP_NOTHING;
67.   	}
68.   	newsym(u.ux,u.uy);
69.   
70.   	You(fmt, arg);
71.   	/* check whether player foolishly genocided self while poly'd */
72.   	if ((mvitals[urole.malenum].mvflags & G_GENOD) ||
73.   			(urole.femalenum != NON_PM &&
74.   			(mvitals[urole.femalenum].mvflags & G_GENOD)) ||
75.   			(mvitals[urace.malenum].mvflags & G_GENOD) ||
76.   			(urace.femalenum != NON_PM &&
77.   			(mvitals[urace.femalenum].mvflags & G_GENOD))) {
78.   	    /* intervening activity might have clobbered genocide info */
79.   	    killer = delayed_killer;
80.   	    if (!killer || !strstri(killer, "genocid")) {
81.   		killer_format = KILLED_BY;
82.   		killer = "self-genocide";
83.   	    }
84.   	    done(GENOCIDED);
85.   	}
86.   	if (was_blind && !Blind) {	/* reverting from eyeless */
87.   	    Blinded = 1L;
88.   	    make_blinded(0L, TRUE);	/* remove blindness */
89.   	}
90.   
91.   	if(!Levitation && !u.ustuck &&
92.   	   (is_pool(u.ux,u.uy) || is_lava(u.ux,u.uy)))
93.   		spoteffects(TRUE);
94.   
95.   	see_monsters();
96.   }
97.   
98.   void
99.   change_sex()
100.  {
101.  	/* setting u.umonster for caveman/cavewoman or priest/priestess
102.  	   swap unintentionally makes `Upolyd' appear to be true */
103.  	boolean already_polyd = (boolean) Upolyd;
104.  
105.  	/* Some monsters are always of one sex and their sex can't be changed */
106.  	/* succubi/incubi can change, but are handled below */
107.  	/* !already_polyd check necessary because is_male() and is_female()
108.             are true if the player is a priest/priestess */
109.  	if (!already_polyd || (!is_male(youmonst.data) && !is_female(youmonst.data) && !is_neuter(youmonst.data)))
110.  	    flags.female = !flags.female;
111.  	if (already_polyd)	/* poly'd: also change saved sex */
112.  	    u.mfemale = !u.mfemale;
113.  	max_rank_sz();		/* [this appears to be superfluous] */
114.  	if ((already_polyd ? u.mfemale : flags.female) && urole.name.f)
115.  	    Strcpy(pl_character, urole.name.f);
116.  	else
117.  	    Strcpy(pl_character, urole.name.m);
118.  	u.umonster = ((already_polyd ? u.mfemale : flags.female) && urole.femalenum != NON_PM) ?
119.  			urole.femalenum : urole.malenum;
120.  	if (!already_polyd) {
121.  	    u.umonnum = u.umonster;
122.  	} else if (u.umonnum == PM_SUCCUBUS || u.umonnum == PM_INCUBUS) {
123.  	    flags.female = !flags.female;
124.  	    /* change monster type to match new sex */
125.  	    u.umonnum = (u.umonnum == PM_SUCCUBUS) ? PM_INCUBUS : PM_SUCCUBUS;
126.  	    set_uasmon();
127.  	}
128.  }
129.  
130.  STATIC_OVL void
131.  newman()
132.  {
133.  	int tmp, oldlvl;
134.  
135.  	tmp = u.uhpmax;
136.  	oldlvl = u.ulevel;
137.  	u.ulevel = u.ulevel + rn1(5, -2);
138.  	if (u.ulevel > 127 || u.ulevel < 1) { /* level went below 0? */
139.  	    u.ulevel = oldlvl; /* restore old level in case they lifesave */
140.  	    goto dead;
141.  	}
142.  	if (u.ulevel > MAXULEV) u.ulevel = MAXULEV;
143.  	/* If your level goes down, your peak level goes down by
144.  	   the same amount so that you can't simply use blessed
145.  	   full healing to undo the decrease.  But if your level
146.  	   goes up, your peak level does *not* undergo the same
147.  	   adjustment; you might end up losing out on the chance
148.  	   to regain some levels previously lost to other causes. */
149.  	if (u.ulevel < oldlvl) u.ulevelmax -= (oldlvl - u.ulevel);
150.  	if (u.ulevelmax < u.ulevel) u.ulevelmax = u.ulevel;
151.  
152.  	if (!rn2(10)) change_sex();
153.  
154.  	adjabil(oldlvl, (int)u.ulevel);
155.  	reset_rndmonst(NON_PM);	/* new monster generation criteria */
156.  
157.  	/* random experience points for the new experience level */
158.  	u.uexp = rndexp();
159.  
160.  	/* u.uhpmax * u.ulevel / oldlvl: proportionate hit points to new level
161.  	 * -10 and +10: don't apply proportionate HP to 10 of a starting
162.  	 *   character's hit points (since a starting character's hit points
163.  	 *   are not on the same scale with hit points obtained through level
164.  	 *   gain)
165.  	 * 9 - rn2(19): random change of -9 to +9 hit points
166.  	 */
167.  #ifndef LINT
168.  	u.uhpmax = ((u.uhpmax - 10) * (long)u.ulevel / oldlvl + 10) +
169.  		(9 - rn2(19));
170.  #endif
171.  
172.  #ifdef LINT
173.  	u.uhp = u.uhp + tmp;
174.  #else
175.  	u.uhp = u.uhp * (long)u.uhpmax/tmp;
176.  #endif
177.  
178.  	tmp = u.uenmax;
179.  #ifndef LINT
180.  	u.uenmax = u.uenmax * (long)u.ulevel / oldlvl + 9 - rn2(19);
181.  #endif
182.  	if (u.uenmax < 0) u.uenmax = 0;
183.  #ifndef LINT
184.  	u.uen = (tmp ? u.uen * (long)u.uenmax / tmp : u.uenmax);
185.  #endif
186.  
187.  	redist_attr();
188.  	u.uhunger = rn1(500,500);
189.  	if (Sick) make_sick(0L, (char *) 0, FALSE, SICK_ALL);
190.  	Stoned = 0;
191.  	delayed_killer = 0;
192.  	if (u.uhp <= 0 || u.uhpmax <= 0) {
193.  		if (Polymorph_control) {
194.  		    if (u.uhp <= 0) u.uhp = 1;
195.  		    if (u.uhpmax <= 0) u.uhpmax = 1;
196.  		} else {
197.  dead: /* we come directly here if their experience level went to 0 or less */
198.  		    Your("new form doesn't seem healthy enough to survive.");
199.  		    killer_format = KILLED_BY_AN;
200.  		    killer="unsuccessful polymorph";
201.  		    done(DIED);
202.  		    newuhs(FALSE);
203.  		    return; /* lifesaved */
204.  		}
205.  	}
206.  	newuhs(FALSE);
207.  	polyman("feel like a new %s!",
208.  		(flags.female && urace.individual.f) ? urace.individual.f :
209.  		(urace.individual.m) ? urace.individual.m : urace.noun);
210.  	if (Slimed) {
211.  		Your("body transforms, but there is still slime on you.");
212.  		Slimed = 10L;
213.  	}
214.  	flags.botl = 1;
215.  	see_monsters();
216.  	(void) encumber_msg();
217.  }
218.  
219.  void
220.  polyself(forcecontrol)
221.  boolean forcecontrol;     
222.  {
223.  	char buf[BUFSZ];
224.  	int old_light, new_light;
225.  	int mntmp = NON_PM;
226.  	int tries=0;
227.  	boolean draconian = (uarm &&
228.  				uarm->otyp >= GRAY_DRAGON_SCALE_MAIL &&
229.  				uarm->otyp <= YELLOW_DRAGON_SCALES);
230.  	boolean iswere = (u.ulycn >= LOW_PM || is_were(youmonst.data));
231.  	boolean isvamp = (youmonst.data->mlet == S_VAMPIRE || u.umonnum == PM_VAMPIRE_BAT);
232.  
233.          if(!Polymorph_control && !forcecontrol && !draconian && !iswere && !isvamp) {
234.  	    if (rn2(20) > ACURR(A_CON)) {
235.  		You(shudder_for_moment);
236.  		losehp(rnd(30), "system shock", KILLED_BY_AN);
237.  		exercise(A_CON, FALSE);
238.  		return;
239.  	    }
240.  	}
241.  	old_light = Upolyd ? emits_light(youmonst.data) : 0;
242.  
243.  	if (Polymorph_control || forcecontrol) {
244.  		do {
245.  			getlin("Become what kind of monster? [type the name]",
246.  				buf);
247.  			mntmp = name_to_mon(buf);
248.  			if (mntmp < LOW_PM)
249.  				pline("I've never heard of such monsters.");
250.  			/* Note:  humans are illegal as monsters, but an
251.  			 * illegal monster forces newman(), which is what we
252.  			 * want if they specified a human.... */
253.  			else if (!polyok(&mons[mntmp]) && !your_race(&mons[mntmp]))
254.  				You("cannot polymorph into that.");
255.  			else break;
256.  		} while(++tries < 5);
257.  		if (tries==5) pline(thats_enough_tries);
258.  		/* allow skin merging, even when polymorph is controlled */
259.  		if (draconian &&
260.  		    (mntmp == armor_to_dragon(uarm->otyp) || tries == 5))
261.  		    goto do_merge;
262.  	} else if (draconian || iswere || isvamp) {
263.  		/* special changes that don't require polyok() */
264.  		if (draconian) {
265.  		    do_merge:
266.  			mntmp = armor_to_dragon(uarm->otyp);
267.  			if (!(mvitals[mntmp].mvflags & G_GENOD)) {
268.  				/* allow G_EXTINCT */
269.  				You("merge with your scaly armor.");
270.  				uskin = uarm;
271.  				uarm = (struct obj *)0;
272.  				/* save/restore hack */
273.  				uskin->owornmask |= I_SPECIAL;
274.  			}
275.  		} else if (iswere) {
276.  			if (is_were(youmonst.data))
277.  				mntmp = PM_HUMAN; /* Illegal; force newman() */
278.  			else
279.  				mntmp = u.ulycn;
280.  		} else {
281.  			if (youmonst.data->mlet == S_VAMPIRE)
282.  				mntmp = PM_VAMPIRE_BAT;
283.  			else
284.  				mntmp = PM_VAMPIRE;
285.  		}
286.  		/* if polymon fails, "you feel" message has been given
287.  		   so don't follow up with another polymon or newman */
288.  		if (mntmp == PM_HUMAN) newman();	/* werecritter */
289.  		else (void) polymon(mntmp);
290.  		goto made_change;    /* maybe not, but this is right anyway */
291.  	}
292.  
293.  	if (mntmp < LOW_PM) {
294.  		tries = 0;
295.  		do {
296.  			/* randomly pick an "ordinary" monster */
297.  			mntmp = rn1(SPECIAL_PM - LOW_PM, LOW_PM);
298.  		} while((!polyok(&mons[mntmp]) || is_placeholder(&mons[mntmp]))
299.  				&& tries++ < 200);
300.  	}
301.  
302.  	/* The below polyok() fails either if everything is genocided, or if
303.  	 * we deliberately chose something illegal to force newman().
304.  	 */
305.  	if (!polyok(&mons[mntmp]) || !rn2(5))
306.  		newman();
307.  	else if(!polymon(mntmp)) return;
308.  
309.  	if (!uarmg) selftouch("No longer petrify-resistant, you");
310.  
311.   made_change:
312.  	new_light = Upolyd ? emits_light(youmonst.data) : 0;
313.  	if (old_light != new_light) {
314.  	    if (old_light)
315.  		del_light_source(LS_MONSTER, (genericptr_t)&youmonst);
316.  	    if (new_light == 1) ++new_light;  /* otherwise it's undetectable */
317.  	    if (new_light)
318.  		new_light_source(u.ux, u.uy, new_light,
319.  				 LS_MONSTER, (genericptr_t)&youmonst);
320.  	}
321.  }
322.  
323.  /* (try to) make a mntmp monster out of the player */
324.  int
325.  polymon(mntmp)	/* returns 1 if polymorph successful */
326.  int	mntmp;
327.  {
328.  	boolean sticky = sticks(youmonst.data) && u.ustuck && !u.uswallow,
329.  		was_blind = !!Blind, dochange = FALSE;
330.  	int mlvl;
331.  
332.  	if (mvitals[mntmp].mvflags & G_GENOD) {	/* allow G_EXTINCT */
333.  		You_feel("rather %s-ish.",mons[mntmp].mname);
334.  		exercise(A_WIS, TRUE);
335.  		return(0);
336.  	}
337.  
338.  	/* KMH, conduct */
339.  	u.uconduct.polyselfs++;
340.  
341.  	if (!Upolyd) {
342.  		/* Human to monster; save human stats */
343.  		u.macurr = u.acurr;
344.  		u.mamax = u.amax;
345.  		u.mfemale = flags.female;
346.  	} else {
347.  		/* Monster to monster; restore human stats, to be
348.  		 * immediately changed to provide stats for the new monster
349.  		 */
350.  		u.acurr = u.macurr;
351.  		u.amax = u.mamax;
352.  		flags.female = u.mfemale;
353.  	}
354.  
355.  	if (youmonst.m_ap_type == M_AP_OBJECT &&
356.  		youmonst.mappearance == GOLD_PIECE) {
357.  	    /* stop mimicking gold immediately */
358.  	    if (multi < 0) unmul("");
359.  	}
360.  	if (is_male(&mons[mntmp])) {
361.  		if(flags.female) dochange = TRUE;
362.  	} else if (is_female(&mons[mntmp])) {
363.  		if(!flags.female) dochange = TRUE;
364.  	} else if (!is_neuter(&mons[mntmp]) && mntmp != u.ulycn) {
365.  		if(!rn2(10)) dochange = TRUE;
366.  	}
367.  	if (dochange) {
368.  		flags.female = !flags.female;
369.  		You("%s %s%s!",
370.  		    (u.umonnum != mntmp) ? "turn into a" : "feel like a new",
371.  		    (is_male(&mons[mntmp]) || is_female(&mons[mntmp])) ? "" :
372.  			flags.female ? "female " : "male ",
373.  		    mons[mntmp].mname);
374.  	} else {
375.  		if (u.umonnum != mntmp)
376.  			You("turn into %s!", an(mons[mntmp].mname));
377.  		else
378.  			You_feel("like a new %s!", mons[mntmp].mname);
379.  	}
380.  	if (Stoned && poly_when_stoned(&mons[mntmp])) {
381.  		/* poly_when_stoned already checked stone golem genocide */
382.  		You("turn to stone!");
383.  		mntmp = PM_STONE_GOLEM;
384.  		Stoned = 0;
385.  		delayed_killer = 0;
386.  	}
387.  
388.  	u.mtimedone = rn1(500, 500);
389.  	u.umonnum = mntmp;
390.  	set_uasmon();
391.  
392.  	/* New stats for monster, to last only as long as polymorphed.
393.  	 * Currently only strength gets changed.
394.  	 */
395.  	if(strongmonst(&mons[mntmp])) ABASE(A_STR) = AMAX(A_STR) = STR18(100);
396.  
397.  	if (Stone_resistance && Stoned) { /* parnes@eniac.seas.upenn.edu */
398.  		Stoned = 0;
399.  		delayed_killer = 0;
400.  		You("no longer seem to be petrifying.");
401.  	}
402.  	if (Sick_resistance && Sick) {
403.  		make_sick(0L, (char *) 0, FALSE, SICK_ALL);
404.  		You("no longer feel sick.");
405.  	}
406.  	if (Slimed) {
407.  	    if (mntmp == PM_FIRE_VORTEX || mntmp == PM_FIRE_ELEMENTAL || mntmp == PM_SALAMANDER) {
408.  		pline_The("slime burns away!");
409.  		Slimed = 0L;
410.  		flags.botl = 1;
411.  	    } else if (mntmp == PM_GREEN_SLIME) {
412.  		/* do it silently */
413.  		Slimed = 0L;
414.  		flags.botl = 1;
415.  	    }
416.  	}
417.  	if (nohands(youmonst.data)) Glib = 0;
418.  
419.  	/*
420.  	mlvl = adj_lev(&mons[mntmp]);
421.  	 * We can't do the above, since there's no such thing as an
422.  	 * "experience level of you as a monster" for a polymorphed character.
423.  	 */
424.  	mlvl = (int)mons[mntmp].mlevel;
425.  	if (youmonst.data->mlet == S_DRAGON && mntmp >= PM_GRAY_DRAGON) {
426.  		u.mhmax = In_endgame(&u.uz) ? (8*mlvl) : (4*mlvl + d(mlvl,4));
427.  	} else if (is_golem(youmonst.data)) {
428.  		u.mhmax = golemhp(mntmp);
429.  	} else {
430.  		if (!mlvl) u.mhmax = rnd(4);
431.  		else u.mhmax = d(mlvl, 8);
432.  		if (is_home_elemental(&mons[mntmp])) u.mhmax *= 3;
433.  	}
434.  	u.mh = u.mhmax;
435.  
436.  	if (u.ulevel < mlvl) {
437.  	/* Low level characters can't become high level monsters for long */
438.  #ifdef DUMB
439.  		/* DRS/NS 2.2.6 messes up -- Peter Kendell */
440.  		int mtd = u.mtimedone, ulv = u.ulevel;
441.  
442.  		u.mtimedone = mtd * ulv / mlvl;
443.  #else
444.  		u.mtimedone = u.mtimedone * u.ulevel / mlvl;
445.  #endif
446.  	}
447.  
448.  	if (uskin && mntmp != armor_to_dragon(uskin->otyp))
449.  		skinback(FALSE);
450.  	break_armor();
451.  	drop_weapon(1);
452.  	if (hides_under(youmonst.data))
453.  		u.uundetected = OBJ_AT(u.ux, u.uy);
454.  	else if (youmonst.data->mlet == S_EEL)
455.  		u.uundetected = is_pool(u.ux, u.uy);
456.  	else
457.  		u.uundetected = 0;
458.  
459.  	if (was_blind && !Blind) {	/* previous form was eyeless */
460.  	    Blinded = 1L;
461.  	    make_blinded(0L, TRUE);	/* remove blindness */
462.  	}
463.  	newsym(u.ux,u.uy);		/* Change symbol */
464.  
465.  	if (!sticky && !u.uswallow && u.ustuck && sticks(youmonst.data)) u.ustuck = 0;
466.  	else if (sticky && !sticks(youmonst.data)) uunstick();
467.  #ifdef STEED
468.  	if (u.usteed) {
469.  	    if (touch_petrifies(u.usteed->data) &&
470.  	    		!Stone_resistance && rnl(3)) {
471.  	    	char buf[BUFSZ];
472.  
473.  	    	pline("No longer petrifying-resistant, you touch %s.",
474.  	    			mon_nam(u.usteed));
475.  	    	Sprintf(buf, "riding %s", an(u.usteed->data->mname));
476.  	    	instapetrify(buf);
477.   	    }
478.  	    if (!can_ride(u.usteed)) dismount_steed(DISMOUNT_POLY);
479.  	}
480.  #endif
481.  
482.  	if (flags.verbose) {
483.  	    static const char use_thec[] = "Use the command #%s to %s.";
484.  	    static const char monsterc[] = "monster";
485.  	    if (can_breathe(youmonst.data))
486.  		pline(use_thec,monsterc,"use your breath weapon");
487.  	    if (attacktype(youmonst.data, AT_SPIT))
488.  		pline(use_thec,monsterc,"spit venom");
489.  	    if (youmonst.data->mlet == S_NYMPH)
490.  		pline(use_thec,monsterc,"remove an iron ball");
491.  	    if (attacktype(youmonst.data, AT_GAZE))
492.  		pline(use_thec,monsterc,"gaze at monsters");
493.  	    if (is_hider(youmonst.data))
494.  		pline(use_thec,monsterc,"hide");
495.  	    if (is_were(youmonst.data))
496.  		pline(use_thec,monsterc,"summon help");
497.  	    if (webmaker(youmonst.data))
498.  		pline(use_thec,monsterc,"spin a web");
499.  	    if (u.umonnum == PM_GREMLIN)
500.  		pline(use_thec,monsterc,"multiply in a fountain");
501.  	    if (is_unicorn(youmonst.data))
502.  		pline(use_thec,monsterc,"use your horn");
503.  	    if (is_mind_flayer(youmonst.data))
504.  		pline(use_thec,monsterc,"emit a mental blast");
505.  	    if (youmonst.data->msound == MS_SHRIEK) /* worthless, actually */
506.  		pline(use_thec,monsterc,"shriek");
507.  	    if (lays_eggs(youmonst.data) && flags.female)
508.  		pline(use_thec,"sit","lay an egg");
509.  	}
510.  	/* you now know what an egg of your type looks like */
511.  	if (lays_eggs(youmonst.data)) {
512.  	    learn_egg_type(u.umonnum);
513.  	    /* make queen bees recognize killer bee eggs */
514.  	    learn_egg_type(egg_type_from_parent(u.umonnum, TRUE));
515.  	}
516.  	find_ac();
517.  	if((!Levitation && !u.ustuck && !Flying &&
518.  	    (is_pool(u.ux,u.uy) || is_lava(u.ux,u.uy))) ||
519.  	   (Underwater && !Swimming))
520.  	    spoteffects(TRUE);
521.  	if (Passes_walls && u.utrap && u.utraptype == TT_INFLOOR) {
522.  	    u.utrap = 0;
523.  	    pline_The("rock seems to no longer trap you.");
524.  	} else if (likes_lava(youmonst.data) && u.utrap && u.utraptype == TT_LAVA) {
525.  	    u.utrap = 0;
526.  	    pline_The("lava now feels soothing.");
527.  	}
528.  	if (amorphous(youmonst.data) || is_whirly(youmonst.data) || unsolid(youmonst.data)) {
529.  	    if (Punished) {
530.  		You("slip out of the iron chain.");
531.  		unpunish();
532.  	    }
533.  	}
534.  	if (u.utrap && (u.utraptype == TT_WEB || u.utraptype == TT_BEARTRAP) &&
535.  		(amorphous(youmonst.data) || is_whirly(youmonst.data) || unsolid(youmonst.data) ||
536.  		  (youmonst.data->msize <= MZ_SMALL && u.utraptype == TT_BEARTRAP))) {
537.  	    You("are no longer stuck in the %s.",
538.  		    u.utraptype == TT_WEB ? "web" : "bear trap");
539.  	    /* probably should burn webs too if PM_FIRE_ELEMENTAL */
540.  	    u.utrap = 0;
541.  	}
542.  	if (webmaker(youmonst.data) && u.utrap && u.utraptype == TT_WEB) {
543.  	    You("orient yourself on the web.");
544.  	    u.utrap = 0;
545.  	}
546.  	flags.botl = 1;
547.  	vision_full_recalc = 1;
548.  	see_monsters();
549.  	exercise(A_CON, FALSE);
550.  	exercise(A_WIS, TRUE);
551.  	(void) encumber_msg();
552.  	return(1);
553.  }
554.  
555.  STATIC_OVL void
556.  break_armor()
557.  {
558.      register struct obj *otmp;
559.  
560.      if (breakarm(youmonst.data)) {
561.  	if ((otmp = uarm) != 0) {
562.  		if (donning(otmp)) cancel_don();
563.  		You("break out of your armor!");
564.  		exercise(A_STR, FALSE);
565.  		(void) Armor_gone();
566.  		useup(otmp);
567.  	}
568.  	if ((otmp = uarmc) != 0) {
569.  	    if(otmp->oartifact) {
570.  		Your("%s falls off!", cloak_simple_name(otmp));
571.  		(void) Cloak_off();
572.  		dropx(otmp);
573.  	    } else {
574.  		Your("%s tears apart!", cloak_simple_name(otmp));
575.  		(void) Cloak_off();
576.  		useup(otmp);
577.  	    }
578.  	}
579.  #ifdef TOURIST
580.  	if (uarmu) {
581.  		Your("shirt rips to shreds!");
582.  		useup(uarmu);
583.  	}
584.  #endif
585.      } else if (sliparm(youmonst.data)) {
586.  	if ((otmp = uarm) != 0) {
587.  		if (donning(otmp)) cancel_don();
588.  		Your("armor falls around you!");
589.  		(void) Armor_gone();
590.  		dropx(otmp);
591.  	}
592.  	if ((otmp = uarmc) != 0) {
593.  		if (is_whirly(youmonst.data))
594.  			Your("%s falls, unsupported!", cloak_simple_name(otmp));
595.  		else You("shrink out of your %s!", cloak_simple_name(otmp));
596.  		(void) Cloak_off();
597.  		dropx(otmp);
598.  	}
599.  #ifdef TOURIST
600.  	if ((otmp = uarmu) != 0) {
601.  		if (is_whirly(youmonst.data))
602.  			You("seep right through your shirt!");
603.  		else You("become much too small for your shirt!");
604.  		setworn((struct obj *)0, otmp->owornmask & W_ARMU);
605.  		dropx(otmp);
606.  	}
607.  #endif
608.      }
609.      if (nohands(youmonst.data) || verysmall(youmonst.data)) {
610.  	if ((otmp = uarmg) != 0) {
611.  	    if (donning(otmp)) cancel_don();
612.  	    /* Drop weapon along with gloves */
613.  	    You("drop your gloves%s!", uwep ? " and weapon" : "");
614.  	    drop_weapon(0);
615.  	    (void) Gloves_off();
616.  	    dropx(otmp);
617.  	}
618.  	if ((otmp = uarms) != 0) {
619.  	    You("can no longer hold your shield!");
620.  	    (void) Shield_off();
621.  	    dropx(otmp);
622.  	}
623.  	if ((otmp = uarmh) != 0) {
624.  	    if (donning(otmp)) cancel_don();
625.  	    Your("helmet falls to the %s!", surface(u.ux, u.uy));
626.  	    (void) Helmet_off();
627.  	    dropx(otmp);
628.  	}
629.      }
630.      if (nohands(youmonst.data) || verysmall(youmonst.data) ||
631.  		slithy(youmonst.data) || youmonst.data->mlet == S_CENTAUR) {
632.  	if ((otmp = uarmf) != 0) {
633.  	    if (donning(otmp)) cancel_don();
634.  	    if (is_whirly(youmonst.data))
635.  		Your("boots fall away!");
636.  	    else Your("boots %s off your feet!",
637.  			verysmall(youmonst.data) ? "slide" : "are pushed");
638.  	    (void) Boots_off();
639.  	    dropx(otmp);
640.  	}
641.      }
642.  }
643.  
644.  STATIC_OVL void
645.  drop_weapon(alone)
646.  int alone;
647.  {
648.      struct obj *otmp;
649.      struct obj *otmp2;
650.  
651.      if ((otmp = uwep) != 0) {
652.  	/* !alone check below is currently superfluous but in the
653.  	 * future it might not be so if there are monsters which cannot
654.  	 * wear gloves but can wield weapons
655.  	 */
656.  	if (!alone || cantwield(youmonst.data)) {
657.  	    struct obj *wep = uwep;
658.  
659.  	    if (alone) You("find you must drop your weapon%s!",
660.  			   	u.twoweap ? "s" : "");
661.  	    otmp2 = u.twoweap ? uswapwep : 0;
662.  	    uwepgone();
663.  	    if (!wep->cursed || wep->otyp != LOADSTONE)
664.  		dropx(otmp);
665.  	    if (otmp2 != 0) {
666.  		uswapwepgone();
667.  		if (!otmp2->cursed || otmp2->otyp != LOADSTONE)
668.  		    dropx(otmp2);
669.  	    }
670.  	    untwoweapon();
671.  	}
672.      }
673.  }
674.  
675.  void
676.  rehumanize()
677.  {
678.  	/* You can't revert back while unchanging */
679.  	if (Unchanging && (u.mh < 1)) {
680.  		killer_format = NO_KILLER_PREFIX;
681.  		killer = "killed while stuck in creature form";
682.  		done(DIED);
683.  	}
684.  
685.  	if (emits_light(youmonst.data))
686.  	    del_light_source(LS_MONSTER, (genericptr_t)&youmonst);
687.  	polyman("return to %s form!", urace.adj);
688.  
689.  	if (u.uhp < 1) {
690.  	    char kbuf[256];
691.  
692.  	    Sprintf(kbuf, "reverting to unhealthy %s form", urace.adj);
693.  	    killer_format = KILLED_BY;
694.  	    killer = kbuf;
695.  	    done(DIED);
696.  	}
697.  	if (!uarmg) selftouch("No longer petrify-resistant, you");
698.  	nomul(0);
699.  
700.  	flags.botl = 1;
701.  	vision_full_recalc = 1;
702.  	(void) encumber_msg();
703.  }
704.  
705.  int
706.  dobreathe()
707.  {
708.  	if (Strangled) {
709.  	    You_cant("breathe.  Sorry.");
710.  	    return(0);
711.  	}
712.  	if (u.uen < 15) {
713.  	    You("don't have enough energy to breathe!");
714.  	    return(0);
715.  	}
716.  	u.uen -= 15;
717.  	flags.botl = 1;
718.  
719.  	if (!getdir((char *)0)) return(0);
720.  	else {
721.  	    register struct attack *mattk;
722.  	    register int i;
723.  
724.  	    for(i = 0; i < NATTK; i++) {
725.  		mattk = &(youmonst.data->mattk[i]);
726.  		if(mattk->aatyp == AT_BREA) break;
727.  	    }
728.  	    buzz((int) (20 + mattk->adtyp-1), (int)mattk->damn,
729.  		u.ux, u.uy, u.dx, u.dy);
730.  	}
731.  	return(1);
732.  }
733.  
734.  int
735.  dospit()
736.  {
737.  	struct obj *otmp;
738.  
739.  	if (!getdir((char *)0)) return(0);
740.  	otmp = mksobj(u.umonnum==PM_COBRA ? BLINDING_VENOM : ACID_VENOM,
741.  			TRUE, FALSE);
742.  	otmp->spe = 1; /* to indicate it's yours */
743.  	throwit(otmp, 0L, FALSE);
744.  	return(1);
745.  }
746.  
747.  int
748.  doremove()
749.  {
750.  	if (!Punished) {
751.  		You("are not chained to anything!");
752.  		return(0);
753.  	}
754.  	unpunish();
755.  	return(1);
756.  }
757.  
758.  int
759.  dospinweb()
760.  {
761.  	register struct trap *ttmp = t_at(u.ux,u.uy);
762.  
763.  	if (Levitation || Is_airlevel(&u.uz)
764.  	    || Underwater || Is_waterlevel(&u.uz)) {
765.  		You("must be on the ground to spin a web.");
766.  		return(0);
767.  	}
768.  	if (u.uswallow) {
769.  		You("release web fluid inside %s.", mon_nam(u.ustuck));
770.  		if (is_animal(u.ustuck->data)) {
771.  			expels(u.ustuck, u.ustuck->data, TRUE);
772.  			return(0);
773.  		}
774.  		if (is_whirly(u.ustuck->data)) {
775.  			int i;
776.  
777.  			for (i = 0; i < NATTK; i++)
778.  				if (u.ustuck->data->mattk[i].aatyp == AT_ENGL)
779.  					break;
780.  			if (i == NATTK)
781.  			       impossible("Swallower has no engulfing attack?");
782.  			else {
783.  				char sweep[30];
784.  
785.  				sweep[0] = '\0';
786.  				switch(u.ustuck->data->mattk[i].adtyp) {
787.  					case AD_FIRE:
788.  						Strcpy(sweep, "ignites and ");
789.  						break;
790.  					case AD_ELEC:
791.  						Strcpy(sweep, "fries and ");
792.  						break;
793.  					case AD_COLD:
794.  						Strcpy(sweep,
795.  						      "freezes, shatters and ");
796.  						break;
797.  				}
798.  				pline_The("web %sis swept away!", sweep);
799.  			}
800.  			return(0);
801.  		}		     /* default: a nasty jelly-like creature */
802.  		pline_The("web dissolves into %s.", mon_nam(u.ustuck));
803.  		return(0);
804.  	}
805.  	if (u.utrap) {
806.  		You("cannot spin webs while stuck in a trap.");
807.  		return(0);
808.  	}
809.  	exercise(A_DEX, TRUE);
810.  	if (ttmp) switch (ttmp->ttyp) {
811.  		case PIT:
812.  		case SPIKED_PIT: You("spin a web, covering up the pit.");
813.  			deltrap(ttmp);
814.  			bury_objs(u.ux, u.uy);
815.  			if (Invisible) newsym(u.ux, u.uy);
816.  			return(1);
817.  		case SQKY_BOARD: pline_The("squeaky board is muffled.");
818.  			deltrap(ttmp);
819.  			if (Invisible) newsym(u.ux, u.uy);
820.  			return(1);
821.  		case TELEP_TRAP:
822.  		case LEVEL_TELEP:
823.  		case MAGIC_PORTAL:
824.  			Your("webbing vanishes!");
825.  			return(0);
826.  		case WEB: You("make the web thicker.");
827.  			return(1);
828.  		case HOLE:
829.  		case TRAPDOOR:
830.  			You("web over the %s.",
831.  			    (ttmp->ttyp == TRAPDOOR) ? "trap door" : "hole");
832.  			deltrap(ttmp);
833.  			if (Invisible) newsym(u.ux, u.uy);
834.  			return 1;
835.  		case ROLLING_BOULDER_TRAP:
836.  			You("spin a web, jamming the trigger.");
837.  			deltrap(ttmp);
838.  			if (Invisible) newsym(u.ux, u.uy);
839.  			return(1);
840.  		case ARROW_TRAP:
841.  		case DART_TRAP:
842.  		case BEAR_TRAP:
843.  		case ROCKTRAP:
844.  		case FIRE_TRAP:
845.  		case LANDMINE:
846.  		case SLP_GAS_TRAP:
847.  		case RUST_TRAP:
848.  		case MAGIC_TRAP:
849.  		case ANTI_MAGIC:
850.  		case POLY_TRAP:
851.  			You("have triggered a trap!");
852.  			dotrap(ttmp, 0);
853.  			return(1);
854.  		default:
855.  			impossible("Webbing over trap type %d?", ttmp->ttyp);
856.  			return(0);
857.  	}
858.  	ttmp = maketrap(u.ux, u.uy, WEB);
859.  	if (ttmp) {
860.  		ttmp->tseen = 1;
861.  		ttmp->madeby_u = 1;
862.  	}
863.  	if (Invisible) newsym(u.ux, u.uy);
864.  	return(1);
865.  }
866.  
867.  int
868.  dosummon()
869.  {
870.  	if (u.uen < 10) {
871.  	    You("lack the energy to send forth a call for help!");
872.  	    return(0);
873.  	}
874.  	u.uen -= 10;
875.  	flags.botl = 1;
876.  
877.  	You("call upon your brethren for help!");
878.  	exercise(A_WIS, TRUE);
879.  	if (!were_summon(youmonst.data,TRUE))
880.  		pline("But none arrive.");
881.  	return(1);
882.  }
883.  
884.  int
885.  dogaze()
886.  {
887.  	register struct monst *mtmp;
888.  	int looked = 0;
889.  	char qbuf[QBUFSZ];
890.  	int i;
891.  	uchar adtyp = 0;
892.  
893.  	for (i = 0; i < NATTK; i++) {
894.  	    if(youmonst.data->mattk[i].aatyp == AT_GAZE) {
895.  		adtyp = youmonst.data->mattk[i].adtyp;
896.  		break;
897.  	    }
898.  	}
899.  	if (adtyp != AD_CONF && adtyp != AD_FIRE) {
900.  	    impossible("gaze attack %d?", adtyp);
901.  	    return 0;
902.  	}
903.  
904.  
905.  	if (Blind) {
906.  	    You_cant("see anything to gaze at.");
907.  	    return 0;
908.  	}
909.  	if (u.uen < 15) {
910.  	    You("lack the energy to use your special gaze!");
911.  	    return(0);
912.  	}
913.  	u.uen -= 15;
914.  	flags.botl = 1;
915.  
916.  	for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
917.  	    if (DEADMONSTER(mtmp)) continue;
918.  	    if (canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my)) {
919.  		looked++;
920.  		if (Invis && !perceives(mtmp->data))
921.  		    pline("%s seems not to notice your gaze.", Monnam(mtmp));
922.  		else if (mtmp->minvis && !See_invisible)
923.  		    You_cant("see where to gaze at %s.", Monnam(mtmp));
924.  		else if (mtmp->m_ap_type == M_AP_FURNITURE
925.  			|| mtmp->m_ap_type == M_AP_OBJECT) {
926.  		    looked--;
927.  		    continue;
928.  		} else if (flags.safe_dog && !Confusion && !Hallucination
929.  		  && mtmp->mtame) {
930.  		    You("avoid gazing at %s.", y_monnam(mtmp));
931.  		} else {
932.  		    if (flags.confirm && mtmp->mpeaceful && !Confusion
933.  							&& !Hallucination) {
934.  			Sprintf(qbuf, "Really %s %s?",
935.  			    (adtyp == AD_CONF) ? "confuse" : "attack",
936.  			    mon_nam(mtmp));
937.  			if (yn(qbuf) != 'y') continue;
938.  			setmangry(mtmp);
939.  		    }
940.  		    if (!mtmp->mcanmove || mtmp->mstun || mtmp->msleeping ||
941.  				    !mtmp->mcansee || !haseyes(mtmp->data)) {
942.  			looked--;
943.  			continue;
944.  		    }
945.  		    /* No reflection check for consistency with when a monster
946.  		     * gazes at *you*--only medusa gaze gets reflected then.
947.  		     */
948.  		    if (adtyp == AD_CONF) {
949.  			if (!mtmp->mconf)
950.  			    Your("gaze confuses %s!", mon_nam(mtmp));
951.  			else
952.  			    pline("%s is getting more and more confused.",
953.  							Monnam(mtmp));
954.  			mtmp->mconf = 1;
955.  		    } else if (adtyp == AD_FIRE) {
956.  			int dmg = d(2,6);
957.  			You("attack %s with a fiery gaze!", mon_nam(mtmp));
958.  			if (resists_fire(mtmp)) {
959.  			    pline_The("fire doesn't burn %s!", mon_nam(mtmp));
960.  			    dmg = 0;
961.  			}
962.  			if((int) u.ulevel > rn2(20))
963.  			    (void) destroy_mitem(mtmp, SCROLL_CLASS, AD_FIRE);
964.  			if((int) u.ulevel > rn2(20))
965.  			    (void) destroy_mitem(mtmp, POTION_CLASS, AD_FIRE);
966.  			if((int) u.ulevel > rn2(25))
967.  			    (void) destroy_mitem(mtmp, SPBOOK_CLASS, AD_FIRE);
968.  			if (dmg && !DEADMONSTER(mtmp)) mtmp->mhp -= dmg;
969.  			if (mtmp->mhp <= 0) killed(mtmp);
970.  		    }
971.  		    /* For consistency with passive() in uhitm.c, this only
972.  		     * affects you if the monster is still alive.
973.  		     */
974.  		    if (!DEADMONSTER(mtmp) &&
975.  			  (mtmp->data==&mons[PM_FLOATING_EYE]) && !mtmp->mcan) {
976.  			if (!Free_action) {
977.  			    You("are frozen by %s gaze!",
978.  					     s_suffix(mon_nam(mtmp)));
979.  			    nomul((u.ulevel > 6 || rn2(4)) ?
980.  				    -d((int)mtmp->m_lev+1,
981.  					    (int)mtmp->data->mattk[0].damd)
982.  				    : -200);
983.  			    return 1;
984.  			} else
985.  			    You("stiffen momentarily under %s gaze.",
986.  				    s_suffix(mon_nam(mtmp)));
987.  		    }
988.  		    /* Technically this one shouldn't affect you at all because
989.  		     * the Medusa gaze is an active monster attack that only
990.  		     * works on the monster's turn, but for it to *not* have an
991.  		     * effect would be too weird.
992.  		     */
993.  		    if (!DEADMONSTER(mtmp) &&
994.  			    (mtmp->data == &mons[PM_MEDUSA]) && !mtmp->mcan) {
995.  			pline(
996.  			 "Gazing at the awake %s is not a very good idea.",
997.  			    l_monnam(mtmp));
998.  			/* as if gazing at a sleeping anything is fruitful... */
999.  			You("turn to stone...");
1000. 			killer_format = KILLED_BY;
1001. 			killer =
1002. 			 "deliberately gazing at Medusa's hideous countenance";
1003. 			done(STONING);
1004. 		    }
1005. 		}
1006. 	    }
1007. 	}
1008. 	if (!looked) You("gaze at no place in particular.");
1009. 	return 1;
1010. }
1011. 
1012. int
1013. dohide()
1014. {
1015. 	boolean ismimic = youmonst.data->mlet == S_MIMIC;
1016. 
1017. 	if (u.uundetected || (ismimic && youmonst.m_ap_type != M_AP_NOTHING)) {
1018. 		You("are already hiding.");
1019. 		return(0);
1020. 	}
1021. 	if (ismimic) {
1022. 		/* should bring up a dialog "what would you like to imitate?" */
1023. 		youmonst.m_ap_type = M_AP_OBJECT;
1024. 		youmonst.mappearance = STRANGE_OBJECT;
1025. 	} else
1026. 		u.uundetected = 1;
1027. 	newsym(u.ux,u.uy);
1028. 	return(1);
1029. }
1030. 
1031. int
1032. domindblast()
1033. {
1034. 	struct monst *mtmp, *nmon;
1035. 
1036. 	if (u.uen < 10) {
1037. 	    You("concentrate but lack the energy to maintain doing so.");
1038. 	    return(0);
1039. 	}
1040. 	u.uen -= 10;
1041. 	flags.botl = 1;
1042. 
1043. 	You("concentrate.");
1044. 	pline("A wave of psychic energy pours out.");
1045. 	for(mtmp=fmon; mtmp; mtmp = nmon) {
1046. 		int u_sen;
1047. 
1048. 		nmon = mtmp->nmon;
1049. 		if (DEADMONSTER(mtmp))
1050. 			continue;
1051. 		if (distu(mtmp->mx, mtmp->my) > BOLT_LIM * BOLT_LIM)
1052. 			continue;
1053. 		if(mtmp->mpeaceful)
1054. 			continue;
1055. 		u_sen = telepathic(mtmp->data) && !mtmp->mcansee;
1056. 		if (u_sen || (telepathic(mtmp->data) && rn2(2)) || !rn2(10)) {
1057. 			You("lock in on %s %s.", s_suffix(mon_nam(mtmp)),
1058. 				u_sen ? "telepathy" :
1059. 				telepathic(mtmp->data) ? "latent telepathy" :
1060. 				"mind");
1061. 			mtmp->mhp -= rnd(15);
1062. 			if (mtmp->mhp <= 0)
1063. 				killed(mtmp);
1064. 		}
1065. 	}
1066. 	return 1;
1067. }
1068. 
1069. STATIC_OVL void
1070. uunstick()
1071. {
1072. 	pline("%s is no longer in your clutches.", Monnam(u.ustuck));
1073. 	u.ustuck = 0;
1074. }
1075. 
1076. void
1077. skinback(silently)
1078. boolean silently;
1079. {
1080. 	if (uskin) {
1081. 		if (!silently) Your("skin returns to its original form.");
1082. 		uarm = uskin;
1083. 		uskin = (struct obj *)0;
1084. 		/* undo save/restore hack */
1085. 		uarm->owornmask &= ~I_SPECIAL;
1086. 	}
1087. }
1088. 
1089. #endif /* OVLB */
1090. #ifdef OVL1
1091. 
1092. const char *
1093. mbodypart(mon, part)
1094. struct monst *mon;
1095. int part;
1096. {
1097. 	static NEARDATA const char
1098. 	*humanoid_parts[] = { "arm", "eye", "face", "finger",
1099. 		"fingertip", "foot", "hand", "handed", "head", "leg",
1100. 		"light headed", "neck", "spine", "toe", "hair",
1101. 		"blood", "lung", "nose", "stomach"},
1102. 	*jelly_parts[] = { "pseudopod", "dark spot", "front",
1103. 		"pseudopod extension", "pseudopod extremity",
1104. 		"pseudopod root", "grasp", "grasped", "cerebral area",
1105. 		"lower pseudopod", "viscous", "middle", "surface",
1106. 		"pseudopod extremity", "ripples", "juices",
1107. 		"surface", "sensor", "stomach" },
1108. 	*animal_parts[] = { "forelimb", "eye", "face", "foreclaw", "claw tip",
1109. 		"rear claw", "foreclaw", "clawed", "head", "rear limb",
1110. 		"light headed", "neck", "spine", "rear claw tip",
1111. 		"fur", "blood", "lung", "nose", "stomach" },
1112. 	*horse_parts[] = { "foreleg", "eye", "face", "forehoof", "hoof tip",
1113. 		"rear hoof", "foreclaw", "hooved", "head", "rear leg",
1114. 		"light headed", "neck", "backbone", "rear hoof tip",
1115. 		"mane", "blood", "lung", "nose", "stomach"},
1116. 	*sphere_parts[] = { "appendage", "optic nerve", "body", "tentacle",
1117. 		"tentacle tip", "lower appendage", "tentacle", "tentacled",
1118. 		"body", "lower tentacle", "rotational", "equator", "body",
1119. 		"lower tentacle tip", "cilia", "life force", "retina",
1120. 		"olfactory nerve", "interior" },
1121. 	*fungus_parts[] = { "mycelium", "visual area", "front", "hypha",
1122. 		"hypha", "root", "strand", "stranded", "cap area",
1123. 		"rhizome", "sporulated", "stalk", "root", "rhizome tip",
1124. 		"spores", "juices", "gill", "gill", "interior" },
1125. 	*vortex_parts[] = { "region", "eye", "front", "minor current",
1126. 		"minor current", "lower current", "swirl", "swirled",
1127. 		"central core", "lower current", "addled", "center",
1128. 		"currents", "edge", "currents", "life force",
1129. 		"center", "leading edge", "interior" },
1130. 	*snake_parts[] = { "vestigial limb", "eye", "face", "large scale",
1131. 		"large scale tip", "rear region", "scale gap", "scale gapped",
1132. 		"head", "rear region", "light headed", "neck", "length",
1133. 		"rear scale", "scales", "blood", "lung", "forked tongue", "stomach" },
1134. 	*fish_parts[] = { "fin", "eye", "premaxillary", "pelvic axillary",
1135. 		"pelvic fin", "anal fin", "pectoral fin", "finned", "head", "peduncle",
1136. 		"played out", "gills", "dorsal fin", "caudal fin",
1137. 		"scales", "blood", "gill", "nostril", "stomach" };
1138. 	/* claw attacks are overloaded in mons[]; most humanoids with
1139. 	   such attacks should still reference hands rather than claws */
1140. 	static const char not_claws[] = {
1141. 		S_HUMAN, S_MUMMY, S_ZOMBIE, S_ANGEL,
1142. 		S_NYMPH, S_LEPRECHAUN, S_QUANTMECH, S_VAMPIRE,
1143. 		S_ORC, S_GIANT,		/* quest nemeses */
1144. 		'\0'		/* string terminator; assert( S_xxx != 0 ); */
1145. 	};
1146. 	struct permonst *mptr = mon->data;
1147. 
1148. 	if (part == HAND || part == HANDED) {	/* some special cases */
1149. 	    if (mptr->mlet == S_DOG || mptr->mlet == S_FELINE ||
1150. 		    mptr->mlet == S_YETI)
1151. 		return part == HAND ? "paw" : "pawed";
1152. 	    if (humanoid(mptr) && attacktype(mptr, AT_CLAW) &&
1153. 		    !index(not_claws, mptr->mlet) &&
1154. 		    mptr != &mons[PM_STONE_GOLEM] &&
1155. 		    mptr != &mons[PM_INCUBUS] && mptr != &mons[PM_SUCCUBUS])
1156. 		return part == HAND ? "claw" : "clawed";
1157. 	}
1158. 	if ((mptr == &mons[PM_MUMAK] || mptr == &mons[PM_MASTODON]) &&
1159. 		part == NOSE)
1160. 	    return "trunk";
1161. 	if (mptr == &mons[PM_SHARK] && part == HAIR)
1162. 	    return "skin";	/* sharks don't have scales */
1163. 	if (mptr == &mons[PM_JELLYFISH] && (part == ARM || part == FINGER ||
1164. 	    part == HAND || part == FOOT || part == TOE))
1165. 	    return "tentacle";
1166. 	if (mptr == &mons[PM_FLOATING_EYE] && part == EYE)
1167. 	    return "cornea";
1168. 	if (humanoid(mptr) &&
1169. 		(part == ARM || part == FINGER || part == FINGERTIP ||
1170. 		    part == HAND || part == HANDED))
1171. 	    return humanoid_parts[part];
1172. 	if (mptr->mlet == S_CENTAUR || mptr->mlet == S_UNICORN ||
1173. 		(mptr == &mons[PM_ROTHE] && part != HAIR))
1174. 	    return horse_parts[part];
1175. 	if (mptr->mlet == S_EEL && mptr != &mons[PM_JELLYFISH])
1176. 	    return fish_parts[part];
1177. 	if (slithy(mptr) || (mptr->mlet == S_DRAGON && part == HAIR))
1178. 	    return snake_parts[part];
1179. 	if (mptr->mlet == S_EYE)
1180. 	    return sphere_parts[part];
1181. 	if (mptr->mlet == S_JELLY || mptr->mlet == S_PUDDING ||
1182. 		mptr->mlet == S_BLOB || mptr == &mons[PM_JELLYFISH])
1183. 	    return jelly_parts[part];
1184. 	if (mptr->mlet == S_VORTEX || mptr->mlet == S_ELEMENTAL)
1185. 	    return vortex_parts[part];
1186. 	if (mptr->mlet == S_FUNGUS)
1187. 	    return fungus_parts[part];
1188. 	if (humanoid(mptr))
1189. 	    return humanoid_parts[part];
1190. 	return animal_parts[part];
1191. }
1192. 
1193. const char *
1194. body_part(part)
1195. int part;
1196. {
1197. 	return mbodypart(&youmonst, part);
1198. }
1199. 
1200. #endif /* OVL1 */
1201. #ifdef OVL0
1202. 
1203. int
1204. poly_gender()
1205. {
1206. /* Returns gender of polymorphed player; 0/1=same meaning as flags.female,
1207.  * 2=none.
1208.  */
1209. 	if (is_neuter(youmonst.data) || !humanoid(youmonst.data)) return 2;
1210. 	return flags.female;
1211. }
1212. 
1213. #endif /* OVL0 */
1214. #ifdef OVLB
1215. 
1216. void
1217. ugolemeffects(damtype, dam)
1218. int damtype, dam;
1219. {
1220. 	int heal = 0;
1221. 	/* We won't bother with "slow"/"haste" since players do not
1222. 	 * have a monster-specific slow/haste so there is no way to
1223. 	 * restore the old velocity once they are back to human.
1224. 	 */
1225. 	if (u.umonnum != PM_FLESH_GOLEM && u.umonnum != PM_IRON_GOLEM)
1226. 		return;
1227. 	switch (damtype) {
1228. 		case AD_ELEC: if (u.umonnum == PM_IRON_GOLEM)
1229. 				heal = dam / 6; /* Approx 1 per die */
1230. 			break;
1231. 		case AD_FIRE: if (u.umonnum == PM_IRON_GOLEM)
1232. 				heal = dam;
1233. 			break;
1234. 	}
1235. 	if (heal && (u.mh < u.mhmax)) {
1236. 		u.mh += heal;
1237. 		if (u.mh > u.mhmax) u.mh = u.mhmax;
1238. 		flags.botl = 1;
1239. 		pline("Strangely, you feel better than before.");
1240. 		exercise(A_STR, TRUE);
1241. 	}
1242. }
1243. 
1244. STATIC_OVL int
1245. armor_to_dragon(atyp)
1246. int atyp;
1247. {
1248. 	switch(atyp) {
1249. 	    case GRAY_DRAGON_SCALE_MAIL:
1250. 	    case GRAY_DRAGON_SCALES:
1251. 		return PM_GRAY_DRAGON;
1252. 	    case SILVER_DRAGON_SCALE_MAIL:
1253. 	    case SILVER_DRAGON_SCALES:
1254. 		return PM_SILVER_DRAGON;
1255. #if 0	/* DEFERRED */
1256. 	    case SHIMMERING_DRAGON_SCALE_MAIL:
1257. 	    case SHIMMERING_DRAGON_SCALES:
1258. 		return PM_SHIMMERING_DRAGON;
1259. #endif
1260. 	    case RED_DRAGON_SCALE_MAIL:
1261. 	    case RED_DRAGON_SCALES:
1262. 		return PM_RED_DRAGON;
1263. 	    case ORANGE_DRAGON_SCALE_MAIL:
1264. 	    case ORANGE_DRAGON_SCALES:
1265. 		return PM_ORANGE_DRAGON;
1266. 	    case WHITE_DRAGON_SCALE_MAIL:
1267. 	    case WHITE_DRAGON_SCALES:
1268. 		return PM_WHITE_DRAGON;
1269. 	    case BLACK_DRAGON_SCALE_MAIL:
1270. 	    case BLACK_DRAGON_SCALES:
1271. 		return PM_BLACK_DRAGON;
1272. 	    case BLUE_DRAGON_SCALE_MAIL:
1273. 	    case BLUE_DRAGON_SCALES:
1274. 		return PM_BLUE_DRAGON;
1275. 	    case GREEN_DRAGON_SCALE_MAIL:
1276. 	    case GREEN_DRAGON_SCALES:
1277. 		return PM_GREEN_DRAGON;
1278. 	    case YELLOW_DRAGON_SCALE_MAIL:
1279. 	    case YELLOW_DRAGON_SCALES:
1280. 		return PM_YELLOW_DRAGON;
1281. 	    default:
1282. 		return -1;
1283. 	}
1284. }
1285. 
1286. #endif /* OVLB */
1287. 
1288. /*polyself.c*/