Home | History | Annotate | Line # | Download | only in hack
hack.trap.c revision 1.5
      1  1.5     veego /*	$NetBSD: hack.trap.c,v 1.5 1998/08/30 09:19:37 veego Exp $	*/
      2  1.4  christos 
      3  1.2   mycroft /*
      4  1.2   mycroft  * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
      5  1.2   mycroft  */
      6  1.2   mycroft 
      7  1.4  christos #include <sys/cdefs.h>
      8  1.2   mycroft #ifndef lint
      9  1.5     veego __RCSID("$NetBSD: hack.trap.c,v 1.5 1998/08/30 09:19:37 veego Exp $");
     10  1.4  christos #endif				/* not lint */
     11  1.1       cgd 
     12  1.4  christos #include <stdlib.h>
     13  1.4  christos #include "hack.h"
     14  1.4  christos #include "extern.h"
     15  1.4  christos #include "def.mkroom.h"
     16  1.1       cgd 
     17  1.4  christos char            vowels[] = "aeiou";
     18  1.1       cgd 
     19  1.4  christos char           *traps[] = {
     20  1.1       cgd 	" bear trap",
     21  1.1       cgd 	"n arrow trap",
     22  1.1       cgd 	" dart trap",
     23  1.1       cgd 	" trapdoor",
     24  1.1       cgd 	" teleportation trap",
     25  1.1       cgd 	" pit",
     26  1.1       cgd 	" sleeping gas trap",
     27  1.1       cgd 	" piercer",
     28  1.1       cgd 	" mimic"
     29  1.1       cgd };
     30  1.1       cgd 
     31  1.4  christos struct trap    *
     32  1.4  christos maketrap(x, y, typ)
     33  1.4  christos 	int x, y, typ;
     34  1.1       cgd {
     35  1.4  christos 	struct trap    *ttmp;
     36  1.1       cgd 
     37  1.1       cgd 	ttmp = newtrap();
     38  1.1       cgd 	ttmp->ttyp = typ;
     39  1.1       cgd 	ttmp->tseen = 0;
     40  1.1       cgd 	ttmp->once = 0;
     41  1.1       cgd 	ttmp->tx = x;
     42  1.1       cgd 	ttmp->ty = y;
     43  1.1       cgd 	ttmp->ntrap = ftrap;
     44  1.1       cgd 	ftrap = ttmp;
     45  1.4  christos 	return (ttmp);
     46  1.1       cgd }
     47  1.1       cgd 
     48  1.4  christos void
     49  1.4  christos dotrap(trap)
     50  1.4  christos 	struct trap    *trap;
     51  1.4  christos {
     52  1.4  christos 	int             ttype = trap->ttyp;
     53  1.1       cgd 
     54  1.1       cgd 	nomul(0);
     55  1.4  christos 	if (trap->tseen && !rn2(5) && ttype != PIT)
     56  1.1       cgd 		pline("You escape a%s.", traps[ttype]);
     57  1.1       cgd 	else {
     58  1.1       cgd 		trap->tseen = 1;
     59  1.4  christos 		switch (ttype) {
     60  1.1       cgd 		case SLP_GAS_TRAP:
     61  1.1       cgd 			pline("A cloud of gas puts you to sleep!");
     62  1.1       cgd 			nomul(-rnd(25));
     63  1.1       cgd 			break;
     64  1.1       cgd 		case BEAR_TRAP:
     65  1.4  christos 			if (Levitation) {
     66  1.1       cgd 				pline("You float over a bear trap.");
     67  1.1       cgd 				break;
     68  1.1       cgd 			}
     69  1.1       cgd 			u.utrap = 4 + rn2(4);
     70  1.1       cgd 			u.utraptype = TT_BEARTRAP;
     71  1.1       cgd 			pline("A bear trap closes on your foot!");
     72  1.1       cgd 			break;
     73  1.1       cgd 		case PIERC:
     74  1.1       cgd 			deltrap(trap);
     75  1.4  christos 			if (makemon(PM_PIERCER, u.ux, u.uy)) {
     76  1.4  christos 				pline("A piercer suddenly drops from the ceiling!");
     77  1.4  christos 				if (uarmh)
     78  1.4  christos 					pline("Its blow glances off your helmet.");
     79  1.4  christos 				else
     80  1.4  christos 					(void) thitu(3, d(4, 6), "falling piercer");
     81  1.1       cgd 			}
     82  1.1       cgd 			break;
     83  1.1       cgd 		case ARROW_TRAP:
     84  1.1       cgd 			pline("An arrow shoots out at you!");
     85  1.4  christos 			if (!thitu(8, rnd(6), "arrow")) {
     86  1.1       cgd 				mksobj_at(ARROW, u.ux, u.uy);
     87  1.1       cgd 				fobj->quan = 1;
     88  1.1       cgd 			}
     89  1.1       cgd 			break;
     90  1.1       cgd 		case TRAPDOOR:
     91  1.4  christos 			if (!xdnstair) {
     92  1.4  christos 				pline("A trap door in the ceiling opens and a rock falls on your head!");
     93  1.4  christos 				if (uarmh)
     94  1.4  christos 					pline("Fortunately, you are wearing a helmet!");
     95  1.4  christos 				losehp(uarmh ? 2 : d(2, 10), "falling rock");
     96  1.4  christos 				mksobj_at(ROCK, u.ux, u.uy);
     97  1.4  christos 				fobj->quan = 1;
     98  1.4  christos 				stackobj(fobj);
     99  1.4  christos 				if (Invisible)
    100  1.4  christos 					newsym(u.ux, u.uy);
    101  1.1       cgd 			} else {
    102  1.4  christos 				int             newlevel = dlevel + 1;
    103  1.4  christos 				while (!rn2(4) && newlevel < 29)
    104  1.1       cgd 					newlevel++;
    105  1.1       cgd 				pline("A trap door opens up under you!");
    106  1.4  christos 				if (Levitation || u.ustuck) {
    107  1.4  christos 					pline("For some reason you don't fall in.");
    108  1.1       cgd 					break;
    109  1.1       cgd 				}
    110  1.1       cgd 				goto_level(newlevel, FALSE);
    111  1.1       cgd 			}
    112  1.1       cgd 			break;
    113  1.1       cgd 		case DART_TRAP:
    114  1.1       cgd 			pline("A little dart shoots out at you!");
    115  1.4  christos 			if (thitu(7, rnd(3), "little dart")) {
    116  1.4  christos 				if (!rn2(6))
    117  1.4  christos 					poisoned("dart", "poison dart");
    118  1.1       cgd 			} else {
    119  1.1       cgd 				mksobj_at(DART, u.ux, u.uy);
    120  1.1       cgd 				fobj->quan = 1;
    121  1.1       cgd 			}
    122  1.1       cgd 			break;
    123  1.1       cgd 		case TELEP_TRAP:
    124  1.4  christos 			if (trap->once) {
    125  1.1       cgd 				deltrap(trap);
    126  1.4  christos 				newsym(u.ux, u.uy);
    127  1.1       cgd 				vtele();
    128  1.1       cgd 			} else {
    129  1.4  christos 				newsym(u.ux, u.uy);
    130  1.1       cgd 				tele();
    131  1.1       cgd 			}
    132  1.1       cgd 			break;
    133  1.1       cgd 		case PIT:
    134  1.4  christos 			if (Levitation) {
    135  1.1       cgd 				pline("A pit opens up under you!");
    136  1.1       cgd 				pline("You don't fall in!");
    137  1.1       cgd 				break;
    138  1.1       cgd 			}
    139  1.1       cgd 			pline("You fall into a pit!");
    140  1.4  christos 			u.utrap = rn1(6, 2);
    141  1.1       cgd 			u.utraptype = TT_PIT;
    142  1.4  christos 			losehp(rnd(6), "fall into a pit");
    143  1.1       cgd 			selftouch("Falling, you");
    144  1.1       cgd 			break;
    145  1.1       cgd 		default:
    146  1.1       cgd 			impossible("You hit a trap of type %u", trap->ttyp);
    147  1.1       cgd 		}
    148  1.1       cgd 	}
    149  1.1       cgd }
    150  1.1       cgd 
    151  1.4  christos int
    152  1.4  christos mintrap(mtmp)
    153  1.4  christos 	struct monst   *mtmp;
    154  1.4  christos {
    155  1.4  christos 	struct trap    *trap = t_at(mtmp->mx, mtmp->my);
    156  1.4  christos 	int             wasintrap = mtmp->mtrapped;
    157  1.1       cgd 
    158  1.4  christos 	if (!trap) {
    159  1.1       cgd 		mtmp->mtrapped = 0;	/* perhaps teleported? */
    160  1.4  christos 	} else if (wasintrap) {
    161  1.4  christos 		if (!rn2(40))
    162  1.4  christos 			mtmp->mtrapped = 0;
    163  1.1       cgd 	} else {
    164  1.4  christos 		int             tt = trap->ttyp;
    165  1.4  christos 		int             in_sight = cansee(mtmp->mx, mtmp->my);
    166  1.4  christos 
    167  1.4  christos 		if (mtmp->mtrapseen & (1 << tt)) {
    168  1.4  christos 			/* he has been in such a trap - perhaps he escapes */
    169  1.4  christos 			if (rn2(4))
    170  1.4  christos 				return (0);
    171  1.4  christos 		}
    172  1.4  christos 		mtmp->mtrapseen |= (1 << tt);
    173  1.4  christos 		switch (tt) {
    174  1.1       cgd 		case BEAR_TRAP:
    175  1.4  christos 			if (strchr(mlarge, mtmp->data->mlet)) {
    176  1.4  christos 				if (in_sight)
    177  1.4  christos 					pline("%s is caught in a bear trap!",
    178  1.4  christos 					      Monnam(mtmp));
    179  1.4  christos 				else if (mtmp->data->mlet == 'o')
    180  1.4  christos 					pline("You hear the roaring of an angry bear!");
    181  1.1       cgd 				mtmp->mtrapped = 1;
    182  1.1       cgd 			}
    183  1.1       cgd 			break;
    184  1.1       cgd 		case PIT:
    185  1.1       cgd 			/* there should be a mtmp/data -> floating */
    186  1.4  christos 			if (!strchr("EywBfk'& ", mtmp->data->mlet)) {	/* ab */
    187  1.1       cgd 				mtmp->mtrapped = 1;
    188  1.4  christos 				if (in_sight)
    189  1.4  christos 					pline("%s falls in a pit!", Monnam(mtmp));
    190  1.1       cgd 			}
    191  1.1       cgd 			break;
    192  1.1       cgd 		case SLP_GAS_TRAP:
    193  1.4  christos 			if (!mtmp->msleep && !mtmp->mfroz) {
    194  1.1       cgd 				mtmp->msleep = 1;
    195  1.4  christos 				if (in_sight)
    196  1.4  christos 					pline("%s suddenly falls asleep!",
    197  1.4  christos 					      Monnam(mtmp));
    198  1.1       cgd 			}
    199  1.1       cgd 			break;
    200  1.1       cgd 		case TELEP_TRAP:
    201  1.1       cgd 			rloc(mtmp);
    202  1.4  christos 			if (in_sight && !cansee(mtmp->mx, mtmp->my))
    203  1.1       cgd 				pline("%s suddenly disappears!",
    204  1.4  christos 				      Monnam(mtmp));
    205  1.1       cgd 			break;
    206  1.1       cgd 		case ARROW_TRAP:
    207  1.4  christos 			if (in_sight) {
    208  1.1       cgd 				pline("%s is hit by an arrow!",
    209  1.4  christos 				      Monnam(mtmp));
    210  1.1       cgd 			}
    211  1.1       cgd 			mtmp->mhp -= 3;
    212  1.1       cgd 			break;
    213  1.1       cgd 		case DART_TRAP:
    214  1.4  christos 			if (in_sight) {
    215  1.1       cgd 				pline("%s is hit by a dart!",
    216  1.4  christos 				      Monnam(mtmp));
    217  1.1       cgd 			}
    218  1.1       cgd 			mtmp->mhp -= 2;
    219  1.1       cgd 			/* not mondied here !! */
    220  1.1       cgd 			break;
    221  1.1       cgd 		case TRAPDOOR:
    222  1.4  christos 			if (!xdnstair) {
    223  1.1       cgd 				mtmp->mhp -= 10;
    224  1.4  christos 				if (in_sight)
    225  1.4  christos 					pline("A trap door in the ceiling opens and a rock hits %s!", monnam(mtmp));
    226  1.1       cgd 				break;
    227  1.1       cgd 			}
    228  1.4  christos 			if (mtmp->data->mlet != 'w') {
    229  1.1       cgd 				fall_down(mtmp);
    230  1.4  christos 				if (in_sight)
    231  1.4  christos 					pline("Suddenly, %s disappears out of sight.", monnam(mtmp));
    232  1.4  christos 				return (2);	/* no longer on this level */
    233  1.1       cgd 			}
    234  1.1       cgd 			break;
    235  1.1       cgd 		case PIERC:
    236  1.1       cgd 			break;
    237  1.1       cgd 		default:
    238  1.1       cgd 			impossible("Some monster encountered a strange trap.");
    239  1.4  christos 		}
    240  1.1       cgd 	}
    241  1.4  christos 	return (mtmp->mtrapped);
    242  1.1       cgd }
    243  1.1       cgd 
    244  1.4  christos void
    245  1.4  christos selftouch(arg)
    246  1.4  christos 	char           *arg;
    247  1.4  christos {
    248  1.4  christos 	if (uwep && uwep->otyp == DEAD_COCKATRICE) {
    249  1.1       cgd 		pline("%s touch the dead cockatrice.", arg);
    250  1.1       cgd 		pline("You turn to stone.");
    251  1.1       cgd 		killer = objects[uwep->otyp].oc_name;
    252  1.1       cgd 		done("died");
    253  1.1       cgd 	}
    254  1.1       cgd }
    255  1.1       cgd 
    256  1.4  christos void
    257  1.4  christos float_up()
    258  1.4  christos {
    259  1.4  christos 	if (u.utrap) {
    260  1.4  christos 		if (u.utraptype == TT_PIT) {
    261  1.1       cgd 			u.utrap = 0;
    262  1.1       cgd 			pline("You float up, out of the pit!");
    263  1.1       cgd 		} else {
    264  1.1       cgd 			pline("You float up, only your leg is still stuck.");
    265  1.1       cgd 		}
    266  1.1       cgd 	} else
    267  1.1       cgd 		pline("You start to float in the air!");
    268  1.1       cgd }
    269  1.1       cgd 
    270  1.4  christos void
    271  1.4  christos float_down()
    272  1.4  christos {
    273  1.4  christos 	struct trap    *trap;
    274  1.1       cgd 	pline("You float gently to the ground.");
    275  1.4  christos 	if ((trap = t_at(u.ux, u.uy)) != NULL)
    276  1.4  christos 		switch (trap->ttyp) {
    277  1.1       cgd 		case PIERC:
    278  1.1       cgd 			break;
    279  1.1       cgd 		case TRAPDOOR:
    280  1.4  christos 			if (!xdnstair || u.ustuck)
    281  1.4  christos 				break;
    282  1.1       cgd 			/* fall into next case */
    283  1.1       cgd 		default:
    284  1.1       cgd 			dotrap(trap);
    285  1.4  christos 		}
    286  1.1       cgd 	pickup(1);
    287  1.1       cgd }
    288  1.1       cgd 
    289  1.4  christos void
    290  1.4  christos vtele()
    291  1.4  christos {
    292  1.4  christos 	struct mkroom  *croom;
    293  1.4  christos 	for (croom = &rooms[0]; croom->hx >= 0; croom++)
    294  1.4  christos 		if (croom->rtype == VAULT) {
    295  1.4  christos 			int x, y;
    296  1.4  christos 
    297  1.4  christos 			x = rn2(2) ? croom->lx : croom->hx;
    298  1.4  christos 			y = rn2(2) ? croom->ly : croom->hy;
    299  1.4  christos 			if (teleok(x, y)) {
    300  1.4  christos 				teleds(x, y);
    301  1.4  christos 				return;
    302  1.4  christos 			}
    303  1.1       cgd 		}
    304  1.1       cgd 	tele();
    305  1.1       cgd }
    306  1.1       cgd 
    307  1.4  christos void
    308  1.4  christos tele()
    309  1.4  christos {
    310  1.4  christos 	coord           cc;
    311  1.4  christos 	int             nux, nuy;
    312  1.1       cgd 
    313  1.4  christos 	if (Teleport_control) {
    314  1.1       cgd 		pline("To what position do you want to be teleported?");
    315  1.4  christos 		cc = getpos(1, "the desired position");	/* 1: force valid */
    316  1.4  christos 		/*
    317  1.4  christos 		 * possible extensions: introduce a small error if magic
    318  1.4  christos 		 * power is low; allow transfer to solid rock
    319  1.4  christos 		 */
    320  1.4  christos 		if (teleok(cc.x, cc.y)) {
    321  1.1       cgd 			teleds(cc.x, cc.y);
    322  1.1       cgd 			return;
    323  1.1       cgd 		}
    324  1.1       cgd 		pline("Sorry ...");
    325  1.1       cgd 	}
    326  1.1       cgd 	do {
    327  1.4  christos 		nux = rnd(COLNO - 1);
    328  1.1       cgd 		nuy = rn2(ROWNO);
    329  1.4  christos 	} while (!teleok(nux, nuy));
    330  1.1       cgd 	teleds(nux, nuy);
    331  1.1       cgd }
    332  1.1       cgd 
    333  1.4  christos void
    334  1.1       cgd teleds(nux, nuy)
    335  1.4  christos 	int             nux, nuy;
    336  1.1       cgd {
    337  1.4  christos 	if (Punished)
    338  1.4  christos 		unplacebc();
    339  1.1       cgd 	unsee();
    340  1.1       cgd 	u.utrap = 0;
    341  1.1       cgd 	u.ustuck = 0;
    342  1.1       cgd 	u.ux = nux;
    343  1.1       cgd 	u.uy = nuy;
    344  1.1       cgd 	setsee();
    345  1.4  christos 	if (Punished)
    346  1.4  christos 		placebc(1);
    347  1.4  christos 	if (u.uswallow) {
    348  1.1       cgd 		u.uswldtim = u.uswallow = 0;
    349  1.1       cgd 		docrt();
    350  1.1       cgd 	}
    351  1.1       cgd 	nomul(0);
    352  1.4  christos 	if (levl[nux][nuy].typ == POOL && !Levitation)
    353  1.1       cgd 		drown();
    354  1.1       cgd 	(void) inshop();
    355  1.1       cgd 	pickup(1);
    356  1.4  christos 	if (!Blind)
    357  1.4  christos 		read_engr_at(u.ux, u.uy);
    358  1.1       cgd }
    359  1.1       cgd 
    360  1.4  christos int
    361  1.4  christos teleok(x, y)
    362  1.4  christos 	int             x, y;
    363  1.4  christos {				/* might throw him into a POOL */
    364  1.4  christos 	return (isok(x, y) && !IS_ROCK(levl[x][y].typ) && !m_at(x, y) &&
    365  1.4  christos 		!sobj_at(ENORMOUS_ROCK, x, y) && !t_at(x, y)
    366  1.4  christos 		);
    367  1.1       cgd 	/* Note: gold is permitted (because of vaults) */
    368  1.1       cgd }
    369  1.1       cgd 
    370  1.4  christos int
    371  1.4  christos dotele()
    372  1.4  christos {
    373  1.4  christos 	if (
    374  1.1       cgd #ifdef WIZARD
    375  1.4  christos 	    !wizard &&
    376  1.4  christos #endif	/* WIZARD */
    377  1.4  christos 	    (!Teleportation || u.ulevel < 6 ||
    378  1.4  christos 	     (pl_character[0] != 'W' && u.ulevel < 10))) {
    379  1.1       cgd 		pline("You are not able to teleport at will.");
    380  1.4  christos 		return (0);
    381  1.1       cgd 	}
    382  1.4  christos 	if (u.uhunger <= 100 || u.ustr < 6) {
    383  1.1       cgd 		pline("You miss the strength for a teleport spell.");
    384  1.4  christos 		return (1);
    385  1.1       cgd 	}
    386  1.1       cgd 	tele();
    387  1.1       cgd 	morehungry(100);
    388  1.4  christos 	return (1);
    389  1.1       cgd }
    390  1.1       cgd 
    391  1.4  christos void
    392  1.4  christos placebc(attach)
    393  1.4  christos 	int             attach;
    394  1.4  christos {
    395  1.4  christos 	if (!uchain || !uball) {
    396  1.1       cgd 		impossible("Where are your chain and ball??");
    397  1.1       cgd 		return;
    398  1.1       cgd 	}
    399  1.1       cgd 	uball->ox = uchain->ox = u.ux;
    400  1.1       cgd 	uball->oy = uchain->oy = u.uy;
    401  1.4  christos 	if (attach) {
    402  1.1       cgd 		uchain->nobj = fobj;
    403  1.1       cgd 		fobj = uchain;
    404  1.4  christos 		if (!carried(uball)) {
    405  1.1       cgd 			uball->nobj = fobj;
    406  1.1       cgd 			fobj = uball;
    407  1.1       cgd 		}
    408  1.1       cgd 	}
    409  1.1       cgd }
    410  1.1       cgd 
    411  1.4  christos void
    412  1.4  christos unplacebc()
    413  1.4  christos {
    414  1.4  christos 	if (!carried(uball)) {
    415  1.1       cgd 		freeobj(uball);
    416  1.1       cgd 		unpobj(uball);
    417  1.1       cgd 	}
    418  1.1       cgd 	freeobj(uchain);
    419  1.1       cgd 	unpobj(uchain);
    420  1.1       cgd }
    421  1.1       cgd 
    422  1.4  christos void
    423  1.4  christos level_tele()
    424  1.4  christos {
    425  1.4  christos 	int             newlevel;
    426  1.4  christos 	if (Teleport_control) {
    427  1.4  christos 		char            buf[BUFSZ];
    428  1.4  christos 
    429  1.4  christos 		do {
    430  1.4  christos 			pline("To what level do you want to teleport? [type a number] ");
    431  1.4  christos 			getlin(buf);
    432  1.4  christos 		} while (!digit(buf[0]) && (buf[0] != '-' || !digit(buf[1])));
    433  1.4  christos 		newlevel = atoi(buf);
    434  1.1       cgd 	} else {
    435  1.4  christos 		newlevel = 5 + rn2(20);	/* 5 - 24 */
    436  1.5     veego 		if (dlevel == newlevel) {
    437  1.4  christos 			if (!xdnstair)
    438  1.4  christos 				newlevel--;
    439  1.4  christos 			else
    440  1.4  christos 				newlevel++;
    441  1.5     veego 		}
    442  1.4  christos 	}
    443  1.4  christos 	if (newlevel >= 30) {
    444  1.4  christos 		if (newlevel > MAXLEVEL)
    445  1.4  christos 			newlevel = MAXLEVEL;
    446  1.4  christos 		pline("You arrive at the center of the earth ...");
    447  1.4  christos 		pline("Unfortunately it is here that hell is located.");
    448  1.4  christos 		if (Fire_resistance) {
    449  1.4  christos 			pline("But the fire doesn't seem to harm you.");
    450  1.4  christos 		} else {
    451  1.4  christos 			pline("You burn to a crisp.");
    452  1.4  christos 			dlevel = maxdlevel = newlevel;
    453  1.4  christos 			killer = "visit to the hell";
    454  1.4  christos 			done("burned");
    455  1.4  christos 		}
    456  1.4  christos 	}
    457  1.4  christos 	if (newlevel < 0) {
    458  1.4  christos 		newlevel = 0;
    459  1.4  christos 		pline("You are now high above the clouds ...");
    460  1.4  christos 		if (Levitation) {
    461  1.4  christos 			pline("You float gently down to earth.");
    462  1.4  christos 			done("escaped");
    463  1.4  christos 		}
    464  1.4  christos 		pline("Unfortunately, you don't know how to fly.");
    465  1.4  christos 		pline("You fall down a few thousand feet and break your neck.");
    466  1.4  christos 		dlevel = 0;
    467  1.4  christos 		killer = "fall";
    468  1.4  christos 		done("died");
    469  1.1       cgd 	}
    470  1.4  christos 	goto_level(newlevel, FALSE);	/* calls done("escaped") if
    471  1.4  christos 					 * newlevel==0 */
    472  1.1       cgd }
    473  1.1       cgd 
    474  1.4  christos void
    475  1.1       cgd drown()
    476  1.1       cgd {
    477  1.1       cgd 	pline("You fall into a pool!");
    478  1.1       cgd 	pline("You can't swim!");
    479  1.4  christos 	if (rn2(3) < u.uluck + 2) {
    480  1.1       cgd 		/* most scrolls become unreadable */
    481  1.4  christos 		struct obj     *obj;
    482  1.1       cgd 
    483  1.4  christos 		for (obj = invent; obj; obj = obj->nobj)
    484  1.4  christos 			if (obj->olet == SCROLL_SYM && rn2(12) > u.uluck)
    485  1.1       cgd 				obj->otyp = SCR_BLANK_PAPER;
    486  1.1       cgd 		/* we should perhaps merge these scrolls ? */
    487  1.1       cgd 
    488  1.1       cgd 		pline("You attempt a teleport spell.");	/* utcsri!carroll */
    489  1.1       cgd 		(void) dotele();
    490  1.4  christos 		if (levl[u.ux][u.uy].typ != POOL)
    491  1.4  christos 			return;
    492  1.1       cgd 	}
    493  1.1       cgd 	pline("You drown ...");
    494  1.1       cgd 	killer = "pool of water";
    495  1.1       cgd 	done("drowned");
    496  1.1       cgd }
    497