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