hack.fight.c revision 1.6 1 1.6 jsm /* $NetBSD: hack.fight.c,v 1.6 2003/04/02 18:36:36 jsm Exp $ */
2 1.4 christos
3 1.2 mycroft /*
4 1.6 jsm * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
5 1.6 jsm * Amsterdam
6 1.6 jsm * All rights reserved.
7 1.6 jsm *
8 1.6 jsm * Redistribution and use in source and binary forms, with or without
9 1.6 jsm * modification, are permitted provided that the following conditions are
10 1.6 jsm * met:
11 1.6 jsm *
12 1.6 jsm * - Redistributions of source code must retain the above copyright notice,
13 1.6 jsm * this list of conditions and the following disclaimer.
14 1.6 jsm *
15 1.6 jsm * - Redistributions in binary form must reproduce the above copyright
16 1.6 jsm * notice, this list of conditions and the following disclaimer in the
17 1.6 jsm * documentation and/or other materials provided with the distribution.
18 1.6 jsm *
19 1.6 jsm * - Neither the name of the Stichting Centrum voor Wiskunde en
20 1.6 jsm * Informatica, nor the names of its contributors may be used to endorse or
21 1.6 jsm * promote products derived from this software without specific prior
22 1.6 jsm * written permission.
23 1.6 jsm *
24 1.6 jsm * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
25 1.6 jsm * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 1.6 jsm * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
27 1.6 jsm * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
28 1.6 jsm * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 1.6 jsm * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 1.6 jsm * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31 1.6 jsm * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 1.6 jsm * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 1.6 jsm * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 1.6 jsm * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 1.6 jsm */
36 1.6 jsm
37 1.6 jsm /*
38 1.6 jsm * Copyright (c) 1982 Jay Fenlason <hack (at) gnu.org>
39 1.6 jsm * All rights reserved.
40 1.6 jsm *
41 1.6 jsm * Redistribution and use in source and binary forms, with or without
42 1.6 jsm * modification, are permitted provided that the following conditions
43 1.6 jsm * are met:
44 1.6 jsm * 1. Redistributions of source code must retain the above copyright
45 1.6 jsm * notice, this list of conditions and the following disclaimer.
46 1.6 jsm * 2. Redistributions in binary form must reproduce the above copyright
47 1.6 jsm * notice, this list of conditions and the following disclaimer in the
48 1.6 jsm * documentation and/or other materials provided with the distribution.
49 1.6 jsm * 3. The name of the author may not be used to endorse or promote products
50 1.6 jsm * derived from this software without specific prior written permission.
51 1.6 jsm *
52 1.6 jsm * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
53 1.6 jsm * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
54 1.6 jsm * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
55 1.6 jsm * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
56 1.6 jsm * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
57 1.6 jsm * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
58 1.6 jsm * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
59 1.6 jsm * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
60 1.6 jsm * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
61 1.6 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.6 jsm __RCSID("$NetBSD: hack.fight.c,v 1.6 2003/04/02 18:36:36 jsm Exp $");
67 1.4 christos #endif /* not lint */
68 1.1 cgd
69 1.4 christos #include "hack.h"
70 1.4 christos #include "extern.h"
71 1.1 cgd
72 1.4 christos static boolean far_noise;
73 1.4 christos static long noisetime;
74 1.1 cgd
75 1.1 cgd /* hitmm returns 0 (miss), 1 (hit), or 2 (kill) */
76 1.4 christos int
77 1.4 christos hitmm(magr, mdef)
78 1.4 christos struct monst *magr, *mdef;
79 1.4 christos {
80 1.5 jsm const struct permonst *pa = magr->data, *pd = mdef->data;
81 1.4 christos int hit;
82 1.4 christos schar tmp;
83 1.4 christos boolean vis;
84 1.4 christos if (strchr("Eauy", pa->mlet))
85 1.4 christos return (0);
86 1.4 christos if (magr->mfroz)
87 1.4 christos return (0); /* riv05!a3 */
88 1.1 cgd tmp = pd->ac + pa->mlevel;
89 1.4 christos if (mdef->mconf || mdef->mfroz || mdef->msleep) {
90 1.1 cgd tmp += 4;
91 1.4 christos if (mdef->msleep)
92 1.4 christos mdef->msleep = 0;
93 1.1 cgd }
94 1.1 cgd hit = (tmp > rnd(20));
95 1.4 christos if (hit)
96 1.4 christos mdef->msleep = 0;
97 1.4 christos vis = (cansee(magr->mx, magr->my) && cansee(mdef->mx, mdef->my));
98 1.4 christos if (vis) {
99 1.4 christos char buf[BUFSZ];
100 1.4 christos if (mdef->mimic)
101 1.4 christos seemimic(mdef);
102 1.4 christos if (magr->mimic)
103 1.4 christos seemimic(magr);
104 1.4 christos (void) sprintf(buf, "%s %s", Monnam(magr),
105 1.4 christos hit ? "hits" : "misses");
106 1.1 cgd pline("%s %s.", buf, monnam(mdef));
107 1.1 cgd } else {
108 1.4 christos boolean far = (dist(magr->mx, magr->my) > 15);
109 1.4 christos if (far != far_noise || moves - noisetime > 10) {
110 1.1 cgd far_noise = far;
111 1.1 cgd noisetime = moves;
112 1.1 cgd pline("You hear some noises%s.",
113 1.4 christos far ? " in the distance" : "");
114 1.1 cgd }
115 1.1 cgd }
116 1.4 christos if (hit) {
117 1.4 christos if (magr->data->mlet == 'c' && !magr->cham) {
118 1.1 cgd magr->mhpmax += 3;
119 1.4 christos if (vis)
120 1.4 christos pline("%s is turned to stone!", Monnam(mdef));
121 1.4 christos else if (mdef->mtame)
122 1.4 christos pline("You have a peculiarly sad feeling for a moment, then it passes.");
123 1.1 cgd monstone(mdef);
124 1.1 cgd hit = 2;
125 1.4 christos } else if ((mdef->mhp -= d(pa->damn, pa->damd)) < 1) {
126 1.4 christos magr->mhpmax += 1 + rn2(pd->mlevel + 1);
127 1.4 christos if (magr->mtame && magr->mhpmax > 8 * pa->mlevel) {
128 1.4 christos if (pa == &li_dog)
129 1.4 christos magr->data = pa = &dog;
130 1.4 christos else if (pa == &dog)
131 1.4 christos magr->data = pa = &la_dog;
132 1.1 cgd }
133 1.4 christos if (vis)
134 1.4 christos pline("%s is killed!", Monnam(mdef));
135 1.4 christos else if (mdef->mtame)
136 1.4 christos pline("You have a sad feeling for a moment, then it passes.");
137 1.1 cgd mondied(mdef);
138 1.1 cgd hit = 2;
139 1.1 cgd }
140 1.1 cgd }
141 1.4 christos return (hit);
142 1.1 cgd }
143 1.1 cgd
144 1.1 cgd /* drop (perhaps) a cadaver and remove monster */
145 1.4 christos void
146 1.4 christos mondied(mdef)
147 1.4 christos struct monst *mdef;
148 1.4 christos {
149 1.5 jsm const struct permonst *pd = mdef->data;
150 1.4 christos if (letter(pd->mlet) && rn2(3)) {
151 1.4 christos (void) mkobj_at(pd->mlet, mdef->mx, mdef->my);
152 1.4 christos if (cansee(mdef->mx, mdef->my)) {
153 1.4 christos unpmon(mdef);
154 1.4 christos atl(mdef->mx, mdef->my, fobj->olet);
155 1.1 cgd }
156 1.4 christos stackobj(fobj);
157 1.4 christos }
158 1.4 christos mondead(mdef);
159 1.1 cgd }
160 1.1 cgd
161 1.1 cgd /* drop a rock and remove monster */
162 1.4 christos void
163 1.4 christos monstone(mdef)
164 1.4 christos struct monst *mdef;
165 1.4 christos {
166 1.4 christos if (strchr(mlarge, mdef->data->mlet))
167 1.1 cgd mksobj_at(ENORMOUS_ROCK, mdef->mx, mdef->my);
168 1.1 cgd else
169 1.1 cgd mksobj_at(ROCK, mdef->mx, mdef->my);
170 1.4 christos if (cansee(mdef->mx, mdef->my)) {
171 1.1 cgd unpmon(mdef);
172 1.4 christos atl(mdef->mx, mdef->my, fobj->olet);
173 1.1 cgd }
174 1.1 cgd mondead(mdef);
175 1.1 cgd }
176 1.1 cgd
177 1.4 christos
178 1.4 christos int
179 1.4 christos fightm(mtmp)
180 1.4 christos struct monst *mtmp;
181 1.4 christos {
182 1.4 christos struct monst *mon;
183 1.4 christos for (mon = fmon; mon; mon = mon->nmon)
184 1.4 christos if (mon != mtmp) {
185 1.4 christos if (DIST(mon->mx, mon->my, mtmp->mx, mtmp->my) < 3)
186 1.4 christos if (rn2(4))
187 1.4 christos return (hitmm(mtmp, mon));
188 1.4 christos }
189 1.4 christos return (-1);
190 1.1 cgd }
191 1.1 cgd
192 1.1 cgd /* u is hit by sth, but not a monster */
193 1.4 christos int
194 1.4 christos thitu(tlev, dam, name)
195 1.4 christos int tlev, dam;
196 1.5 jsm const char *name;
197 1.1 cgd {
198 1.4 christos char buf[BUFSZ];
199 1.4 christos setan(name, buf);
200 1.4 christos if (u.uac + tlev <= rnd(20)) {
201 1.4 christos if (Blind)
202 1.4 christos pline("It misses.");
203 1.4 christos else
204 1.4 christos pline("You are almost hit by %s!", buf);
205 1.4 christos return (0);
206 1.1 cgd } else {
207 1.4 christos if (Blind)
208 1.4 christos pline("You are hit!");
209 1.4 christos else
210 1.4 christos pline("You are hit by %s!", buf);
211 1.4 christos losehp(dam, name);
212 1.4 christos return (1);
213 1.1 cgd }
214 1.1 cgd }
215 1.1 cgd
216 1.4 christos char mlarge[] = "bCDdegIlmnoPSsTUwY',&";
217 1.1 cgd
218 1.1 cgd boolean
219 1.4 christos hmon(mon, obj, thrown) /* return TRUE if mon still alive */
220 1.4 christos struct monst *mon;
221 1.4 christos struct obj *obj;
222 1.4 christos int thrown;
223 1.1 cgd {
224 1.4 christos int tmp;
225 1.4 christos boolean hittxt = FALSE;
226 1.1 cgd
227 1.4 christos if (!obj) {
228 1.1 cgd tmp = rnd(2); /* attack with bare hands */
229 1.4 christos if (mon->data->mlet == 'c' && !uarmg) {
230 1.1 cgd pline("You hit the cockatrice with your bare hands.");
231 1.1 cgd pline("You turn to stone ...");
232 1.1 cgd done_in_by(mon);
233 1.1 cgd }
234 1.4 christos } else if (obj->olet == WEAPON_SYM || obj->otyp == PICK_AXE) {
235 1.4 christos if (obj == uwep && (obj->otyp > SPEAR || obj->otyp < BOOMERANG))
236 1.4 christos tmp = rnd(2);
237 1.4 christos else {
238 1.4 christos if (strchr(mlarge, mon->data->mlet)) {
239 1.4 christos tmp = rnd(objects[obj->otyp].wldam);
240 1.4 christos if (obj->otyp == TWO_HANDED_SWORD)
241 1.4 christos tmp += d(2, 6);
242 1.4 christos else if (obj->otyp == FLAIL)
243 1.4 christos tmp += rnd(4);
244 1.4 christos } else {
245 1.4 christos tmp = rnd(objects[obj->otyp].wsdam);
246 1.4 christos }
247 1.4 christos tmp += obj->spe;
248 1.4 christos if (!thrown && obj == uwep && obj->otyp == BOOMERANG
249 1.4 christos && !rn2(3)) {
250 1.4 christos pline("As you hit %s, the boomerang breaks into splinters.",
251 1.4 christos monnam(mon));
252 1.4 christos freeinv(obj);
253 1.4 christos setworn((struct obj *) 0, obj->owornmask);
254 1.4 christos obfree(obj, (struct obj *) 0);
255 1.4 christos tmp++;
256 1.4 christos }
257 1.1 cgd }
258 1.4 christos if (mon->data->mlet == 'O' && obj->otyp == TWO_HANDED_SWORD &&
259 1.4 christos !strcmp(ONAME(obj), "Orcrist"))
260 1.4 christos tmp += rnd(10);
261 1.4 christos } else
262 1.4 christos switch (obj->otyp) {
263 1.1 cgd case HEAVY_IRON_BALL:
264 1.4 christos tmp = rnd(25);
265 1.4 christos break;
266 1.1 cgd case EXPENSIVE_CAMERA:
267 1.4 christos pline("You succeed in destroying your camera. Congratulations!");
268 1.1 cgd freeinv(obj);
269 1.4 christos if (obj->owornmask)
270 1.1 cgd setworn((struct obj *) 0, obj->owornmask);
271 1.1 cgd obfree(obj, (struct obj *) 0);
272 1.4 christos return (TRUE);
273 1.1 cgd case DEAD_COCKATRICE:
274 1.1 cgd pline("You hit %s with the cockatrice corpse.",
275 1.4 christos monnam(mon));
276 1.4 christos if (mon->data->mlet == 'c') {
277 1.1 cgd tmp = 1;
278 1.1 cgd hittxt = TRUE;
279 1.1 cgd break;
280 1.1 cgd }
281 1.1 cgd pline("%s is turned to stone!", Monnam(mon));
282 1.1 cgd killed(mon);
283 1.4 christos return (FALSE);
284 1.4 christos case CLOVE_OF_GARLIC: /* no effect against demons */
285 1.4 christos if (strchr(UNDEAD, mon->data->mlet))
286 1.1 cgd mon->mflee = 1;
287 1.1 cgd tmp = 1;
288 1.1 cgd break;
289 1.1 cgd default:
290 1.1 cgd /* non-weapons can damage because of their weight */
291 1.1 cgd /* (but not too much) */
292 1.4 christos tmp = obj->owt / 10;
293 1.4 christos if (tmp < 1)
294 1.4 christos tmp = 1;
295 1.4 christos else
296 1.4 christos tmp = rnd(tmp);
297 1.4 christos if (tmp > 6)
298 1.4 christos tmp = 6;
299 1.1 cgd }
300 1.1 cgd
301 1.1 cgd /****** NOTE: perhaps obj is undefined!! (if !thrown && BOOMERANG) */
302 1.1 cgd
303 1.1 cgd tmp += u.udaminc + dbon();
304 1.4 christos if (u.uswallow) {
305 1.4 christos if ((tmp -= u.uswldtim) <= 0) {
306 1.1 cgd pline("Your arms are no longer able to hit.");
307 1.4 christos return (TRUE);
308 1.1 cgd }
309 1.1 cgd }
310 1.4 christos if (tmp < 1)
311 1.4 christos tmp = 1;
312 1.1 cgd mon->mhp -= tmp;
313 1.4 christos if (mon->mhp < 1) {
314 1.1 cgd killed(mon);
315 1.4 christos return (FALSE);
316 1.1 cgd }
317 1.4 christos if (mon->mtame && (!mon->mflee || mon->mfleetim)) {
318 1.4 christos mon->mflee = 1; /* Rick Richardson */
319 1.4 christos mon->mfleetim += 10 * rnd(tmp);
320 1.1 cgd }
321 1.4 christos if (!hittxt) {
322 1.4 christos if (thrown)
323 1.1 cgd /* this assumes that we cannot throw plural things */
324 1.4 christos hit(xname(obj) /* or: objects[obj->otyp].oc_name */ ,
325 1.4 christos mon, exclam(tmp));
326 1.4 christos else if (Blind)
327 1.1 cgd pline("You hit it.");
328 1.1 cgd else
329 1.1 cgd pline("You hit %s%s", monnam(mon), exclam(tmp));
330 1.1 cgd }
331 1.4 christos if (u.umconf && !thrown) {
332 1.4 christos if (!Blind) {
333 1.1 cgd pline("Your hands stop glowing blue.");
334 1.4 christos if (!mon->mfroz && !mon->msleep)
335 1.4 christos pline("%s appears confused.", Monnam(mon));
336 1.1 cgd }
337 1.1 cgd mon->mconf = 1;
338 1.1 cgd u.umconf = 0;
339 1.1 cgd }
340 1.4 christos return (TRUE); /* mon still alive */
341 1.1 cgd }
342 1.1 cgd
343 1.1 cgd /* try to attack; return FALSE if monster evaded */
344 1.1 cgd /* u.dx and u.dy must be set */
345 1.4 christos int
346 1.1 cgd attack(mtmp)
347 1.4 christos struct monst *mtmp;
348 1.1 cgd {
349 1.4 christos schar tmp;
350 1.4 christos boolean malive = TRUE;
351 1.5 jsm const struct permonst *mdat;
352 1.1 cgd mdat = mtmp->data;
353 1.1 cgd
354 1.4 christos u_wipe_engr(3); /* andrew@orca: prevent unlimited pick-axe
355 1.4 christos * attacks */
356 1.1 cgd
357 1.4 christos if (mdat->mlet == 'L' && !mtmp->mfroz && !mtmp->msleep &&
358 1.4 christos !mtmp->mconf && mtmp->mcansee && !rn2(7) &&
359 1.4 christos (m_move(mtmp, 0) == 2 /* he died */ || /* he moved: */
360 1.4 christos mtmp->mx != u.ux + u.dx || mtmp->my != u.uy + u.dy))
361 1.4 christos return (FALSE);
362 1.4 christos
363 1.4 christos if (mtmp->mimic) {
364 1.4 christos if (!u.ustuck && !mtmp->mflee)
365 1.4 christos u.ustuck = mtmp;
366 1.4 christos switch (levl[u.ux + u.dx][u.uy + u.dy].scrsym) {
367 1.1 cgd case '+':
368 1.1 cgd pline("The door actually was a Mimic.");
369 1.1 cgd break;
370 1.1 cgd case '$':
371 1.1 cgd pline("The chest was a Mimic!");
372 1.1 cgd break;
373 1.1 cgd default:
374 1.1 cgd pline("Wait! That's a Mimic!");
375 1.1 cgd }
376 1.1 cgd wakeup(mtmp); /* clears mtmp->mimic */
377 1.4 christos return (TRUE);
378 1.1 cgd }
379 1.1 cgd wakeup(mtmp);
380 1.1 cgd
381 1.4 christos if (mtmp->mhide && mtmp->mundetected) {
382 1.4 christos struct obj *obj;
383 1.1 cgd
384 1.1 cgd mtmp->mundetected = 0;
385 1.4 christos if ((obj = o_at(mtmp->mx, mtmp->my)) && !Blind)
386 1.1 cgd pline("Wait! There's a %s hiding under %s!",
387 1.4 christos mdat->mname, doname(obj));
388 1.4 christos return (TRUE);
389 1.1 cgd }
390 1.1 cgd tmp = u.uluck + u.ulevel + mdat->ac + abon();
391 1.4 christos if (uwep) {
392 1.4 christos if (uwep->olet == WEAPON_SYM || uwep->otyp == PICK_AXE)
393 1.1 cgd tmp += uwep->spe;
394 1.4 christos if (uwep->otyp == TWO_HANDED_SWORD)
395 1.4 christos tmp -= 1;
396 1.4 christos else if (uwep->otyp == DAGGER)
397 1.4 christos tmp += 2;
398 1.4 christos else if (uwep->otyp == CRYSKNIFE)
399 1.4 christos tmp += 3;
400 1.4 christos else if (uwep->otyp == SPEAR &&
401 1.4 christos strchr("XDne", mdat->mlet))
402 1.4 christos tmp += 2;
403 1.1 cgd }
404 1.4 christos if (mtmp->msleep) {
405 1.1 cgd mtmp->msleep = 0;
406 1.1 cgd tmp += 2;
407 1.1 cgd }
408 1.4 christos if (mtmp->mfroz) {
409 1.1 cgd tmp += 4;
410 1.4 christos if (!rn2(10))
411 1.4 christos mtmp->mfroz = 0;
412 1.1 cgd }
413 1.4 christos if (mtmp->mflee)
414 1.4 christos tmp += 2;
415 1.4 christos if (u.utrap)
416 1.4 christos tmp -= 3;
417 1.1 cgd
418 1.1 cgd /* with a lot of luggage, your agility diminishes */
419 1.4 christos tmp -= (inv_weight() + 40) / 20;
420 1.1 cgd
421 1.4 christos if (tmp <= rnd(20) && !u.uswallow) {
422 1.4 christos if (Blind)
423 1.4 christos pline("You miss it.");
424 1.4 christos else
425 1.4 christos pline("You miss %s.", monnam(mtmp));
426 1.1 cgd } else {
427 1.1 cgd /* we hit the monster; be careful: it might die! */
428 1.1 cgd
429 1.4 christos if ((malive = hmon(mtmp, uwep, 0)) == TRUE) {
430 1.4 christos /* monster still alive */
431 1.4 christos if (!rn2(25) && mtmp->mhp < mtmp->mhpmax / 2) {
432 1.1 cgd mtmp->mflee = 1;
433 1.4 christos if (!rn2(3))
434 1.4 christos mtmp->mfleetim = rnd(100);
435 1.4 christos if (u.ustuck == mtmp && !u.uswallow)
436 1.1 cgd u.ustuck = 0;
437 1.1 cgd }
438 1.1 cgd #ifndef NOWORM
439 1.4 christos if (mtmp->wormno)
440 1.4 christos cutworm(mtmp, u.ux + u.dx, u.uy + u.dy,
441 1.1 cgd uwep ? uwep->otyp : 0);
442 1.4 christos #endif /* NOWORM */
443 1.1 cgd }
444 1.4 christos if (mdat->mlet == 'a') {
445 1.4 christos if (rn2(2)) {
446 1.1 cgd pline("You are splashed by the blob's acid!");
447 1.1 cgd losehp_m(rnd(6), mtmp);
448 1.4 christos if (!rn2(30))
449 1.4 christos corrode_armor();
450 1.1 cgd }
451 1.4 christos if (!rn2(6))
452 1.4 christos corrode_weapon();
453 1.1 cgd }
454 1.1 cgd }
455 1.4 christos if (malive && mdat->mlet == 'E' && canseemon(mtmp)
456 1.4 christos && !mtmp->mcan && rn2(3)) {
457 1.4 christos if (mtmp->mcansee) {
458 1.4 christos pline("You are frozen by the floating eye's gaze!");
459 1.4 christos nomul((u.ulevel > 6 || rn2(4)) ? rn1(20, -21) : -200);
460 1.4 christos } else {
461 1.4 christos pline("The blinded floating eye cannot defend itself.");
462 1.4 christos if (!rn2(500))
463 1.4 christos if ((int) u.uluck > LUCKMIN)
464 1.4 christos u.uluck--;
465 1.4 christos }
466 1.1 cgd }
467 1.4 christos return (TRUE);
468 1.1 cgd }
469