hack.fight.c revision 1.10 1 1.10 dholland /* $NetBSD: hack.fight.c,v 1.10 2009/06/07 20:13:18 dholland 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.10 dholland __RCSID("$NetBSD: hack.fight.c,v 1.10 2009/06/07 20:13:18 dholland 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.9 dholland hitmm(struct monst *magr, struct monst *mdef)
78 1.4 christos {
79 1.5 jsm const struct permonst *pa = magr->data, *pd = mdef->data;
80 1.8 dholland int didhit;
81 1.4 christos schar tmp;
82 1.4 christos boolean vis;
83 1.8 dholland
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.8 dholland didhit = (tmp > rnd(20));
95 1.8 dholland if (didhit)
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.10 dholland (void) snprintf(buf, sizeof(buf), "%s %s", Monnam(magr),
105 1.8 dholland didhit ? "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.8 dholland if (didhit) {
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.8 dholland didhit = 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.8 dholland didhit = 2;
139 1.1 cgd }
140 1.1 cgd }
141 1.8 dholland return (didhit);
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.9 dholland mondied(struct monst *mdef)
147 1.4 christos {
148 1.5 jsm const struct permonst *pd = mdef->data;
149 1.4 christos if (letter(pd->mlet) && rn2(3)) {
150 1.4 christos (void) mkobj_at(pd->mlet, mdef->mx, mdef->my);
151 1.4 christos if (cansee(mdef->mx, mdef->my)) {
152 1.4 christos unpmon(mdef);
153 1.4 christos atl(mdef->mx, mdef->my, fobj->olet);
154 1.1 cgd }
155 1.4 christos stackobj(fobj);
156 1.4 christos }
157 1.4 christos mondead(mdef);
158 1.1 cgd }
159 1.1 cgd
160 1.1 cgd /* drop a rock and remove monster */
161 1.4 christos void
162 1.9 dholland monstone(struct monst *mdef)
163 1.4 christos {
164 1.4 christos if (strchr(mlarge, mdef->data->mlet))
165 1.1 cgd mksobj_at(ENORMOUS_ROCK, mdef->mx, mdef->my);
166 1.1 cgd else
167 1.1 cgd mksobj_at(ROCK, mdef->mx, mdef->my);
168 1.4 christos if (cansee(mdef->mx, mdef->my)) {
169 1.1 cgd unpmon(mdef);
170 1.4 christos atl(mdef->mx, mdef->my, fobj->olet);
171 1.1 cgd }
172 1.1 cgd mondead(mdef);
173 1.1 cgd }
174 1.1 cgd
175 1.4 christos
176 1.4 christos int
177 1.9 dholland fightm(struct monst *mtmp)
178 1.4 christos {
179 1.4 christos struct monst *mon;
180 1.4 christos for (mon = fmon; mon; mon = mon->nmon)
181 1.4 christos if (mon != mtmp) {
182 1.4 christos if (DIST(mon->mx, mon->my, mtmp->mx, mtmp->my) < 3)
183 1.4 christos if (rn2(4))
184 1.4 christos return (hitmm(mtmp, mon));
185 1.4 christos }
186 1.4 christos return (-1);
187 1.1 cgd }
188 1.1 cgd
189 1.1 cgd /* u is hit by sth, but not a monster */
190 1.4 christos int
191 1.9 dholland thitu(int tlev, int dam, const char *name)
192 1.1 cgd {
193 1.4 christos char buf[BUFSZ];
194 1.10 dholland
195 1.10 dholland setan(name, buf, sizeof(buf));
196 1.4 christos if (u.uac + tlev <= rnd(20)) {
197 1.4 christos if (Blind)
198 1.4 christos pline("It misses.");
199 1.4 christos else
200 1.4 christos pline("You are almost hit by %s!", buf);
201 1.4 christos return (0);
202 1.1 cgd } else {
203 1.4 christos if (Blind)
204 1.4 christos pline("You are hit!");
205 1.4 christos else
206 1.4 christos pline("You are hit by %s!", buf);
207 1.4 christos losehp(dam, name);
208 1.4 christos return (1);
209 1.1 cgd }
210 1.1 cgd }
211 1.1 cgd
212 1.4 christos char mlarge[] = "bCDdegIlmnoPSsTUwY',&";
213 1.1 cgd
214 1.9 dholland /* return TRUE if mon still alive */
215 1.1 cgd boolean
216 1.9 dholland hmon(struct monst *mon, struct obj *obj, int thrown)
217 1.1 cgd {
218 1.4 christos int tmp;
219 1.4 christos boolean hittxt = FALSE;
220 1.1 cgd
221 1.4 christos if (!obj) {
222 1.1 cgd tmp = rnd(2); /* attack with bare hands */
223 1.4 christos if (mon->data->mlet == 'c' && !uarmg) {
224 1.1 cgd pline("You hit the cockatrice with your bare hands.");
225 1.1 cgd pline("You turn to stone ...");
226 1.1 cgd done_in_by(mon);
227 1.1 cgd }
228 1.4 christos } else if (obj->olet == WEAPON_SYM || obj->otyp == PICK_AXE) {
229 1.4 christos if (obj == uwep && (obj->otyp > SPEAR || obj->otyp < BOOMERANG))
230 1.4 christos tmp = rnd(2);
231 1.4 christos else {
232 1.4 christos if (strchr(mlarge, mon->data->mlet)) {
233 1.4 christos tmp = rnd(objects[obj->otyp].wldam);
234 1.4 christos if (obj->otyp == TWO_HANDED_SWORD)
235 1.4 christos tmp += d(2, 6);
236 1.4 christos else if (obj->otyp == FLAIL)
237 1.4 christos tmp += rnd(4);
238 1.4 christos } else {
239 1.4 christos tmp = rnd(objects[obj->otyp].wsdam);
240 1.4 christos }
241 1.4 christos tmp += obj->spe;
242 1.4 christos if (!thrown && obj == uwep && obj->otyp == BOOMERANG
243 1.4 christos && !rn2(3)) {
244 1.4 christos pline("As you hit %s, the boomerang breaks into splinters.",
245 1.4 christos monnam(mon));
246 1.4 christos freeinv(obj);
247 1.4 christos setworn((struct obj *) 0, obj->owornmask);
248 1.4 christos obfree(obj, (struct obj *) 0);
249 1.7 jnemeth obj = NULL;
250 1.4 christos tmp++;
251 1.4 christos }
252 1.1 cgd }
253 1.7 jnemeth if (mon->data->mlet == 'O' && obj != NULL &&
254 1.7 jnemeth obj->otyp == TWO_HANDED_SWORD &&
255 1.4 christos !strcmp(ONAME(obj), "Orcrist"))
256 1.4 christos tmp += rnd(10);
257 1.4 christos } else
258 1.4 christos switch (obj->otyp) {
259 1.1 cgd case HEAVY_IRON_BALL:
260 1.4 christos tmp = rnd(25);
261 1.4 christos break;
262 1.1 cgd case EXPENSIVE_CAMERA:
263 1.4 christos pline("You succeed in destroying your camera. Congratulations!");
264 1.1 cgd freeinv(obj);
265 1.4 christos if (obj->owornmask)
266 1.1 cgd setworn((struct obj *) 0, obj->owornmask);
267 1.1 cgd obfree(obj, (struct obj *) 0);
268 1.4 christos return (TRUE);
269 1.1 cgd case DEAD_COCKATRICE:
270 1.1 cgd pline("You hit %s with the cockatrice corpse.",
271 1.4 christos monnam(mon));
272 1.4 christos if (mon->data->mlet == 'c') {
273 1.1 cgd tmp = 1;
274 1.1 cgd hittxt = TRUE;
275 1.1 cgd break;
276 1.1 cgd }
277 1.1 cgd pline("%s is turned to stone!", Monnam(mon));
278 1.1 cgd killed(mon);
279 1.4 christos return (FALSE);
280 1.4 christos case CLOVE_OF_GARLIC: /* no effect against demons */
281 1.4 christos if (strchr(UNDEAD, mon->data->mlet))
282 1.1 cgd mon->mflee = 1;
283 1.1 cgd tmp = 1;
284 1.1 cgd break;
285 1.1 cgd default:
286 1.1 cgd /* non-weapons can damage because of their weight */
287 1.1 cgd /* (but not too much) */
288 1.4 christos tmp = obj->owt / 10;
289 1.4 christos if (tmp < 1)
290 1.4 christos tmp = 1;
291 1.4 christos else
292 1.4 christos tmp = rnd(tmp);
293 1.4 christos if (tmp > 6)
294 1.4 christos tmp = 6;
295 1.1 cgd }
296 1.1 cgd
297 1.1 cgd /****** NOTE: perhaps obj is undefined!! (if !thrown && BOOMERANG) */
298 1.1 cgd
299 1.1 cgd tmp += u.udaminc + dbon();
300 1.4 christos if (u.uswallow) {
301 1.4 christos if ((tmp -= u.uswldtim) <= 0) {
302 1.1 cgd pline("Your arms are no longer able to hit.");
303 1.4 christos return (TRUE);
304 1.1 cgd }
305 1.1 cgd }
306 1.4 christos if (tmp < 1)
307 1.4 christos tmp = 1;
308 1.1 cgd mon->mhp -= tmp;
309 1.4 christos if (mon->mhp < 1) {
310 1.1 cgd killed(mon);
311 1.4 christos return (FALSE);
312 1.1 cgd }
313 1.4 christos if (mon->mtame && (!mon->mflee || mon->mfleetim)) {
314 1.4 christos mon->mflee = 1; /* Rick Richardson */
315 1.4 christos mon->mfleetim += 10 * rnd(tmp);
316 1.1 cgd }
317 1.4 christos if (!hittxt) {
318 1.7 jnemeth if (thrown) {
319 1.1 cgd /* this assumes that we cannot throw plural things */
320 1.7 jnemeth if (obj == NULL)
321 1.7 jnemeth panic("thrown non-object");
322 1.4 christos hit(xname(obj) /* or: objects[obj->otyp].oc_name */ ,
323 1.4 christos mon, exclam(tmp));
324 1.7 jnemeth } else if (Blind)
325 1.1 cgd pline("You hit it.");
326 1.1 cgd else
327 1.1 cgd pline("You hit %s%s", monnam(mon), exclam(tmp));
328 1.1 cgd }
329 1.4 christos if (u.umconf && !thrown) {
330 1.4 christos if (!Blind) {
331 1.1 cgd pline("Your hands stop glowing blue.");
332 1.4 christos if (!mon->mfroz && !mon->msleep)
333 1.4 christos pline("%s appears confused.", Monnam(mon));
334 1.1 cgd }
335 1.1 cgd mon->mconf = 1;
336 1.1 cgd u.umconf = 0;
337 1.1 cgd }
338 1.4 christos return (TRUE); /* mon still alive */
339 1.1 cgd }
340 1.1 cgd
341 1.1 cgd /* try to attack; return FALSE if monster evaded */
342 1.1 cgd /* u.dx and u.dy must be set */
343 1.4 christos int
344 1.9 dholland attack(struct monst *mtmp)
345 1.1 cgd {
346 1.4 christos schar tmp;
347 1.4 christos boolean malive = TRUE;
348 1.5 jsm const struct permonst *mdat;
349 1.1 cgd mdat = mtmp->data;
350 1.1 cgd
351 1.4 christos u_wipe_engr(3); /* andrew@orca: prevent unlimited pick-axe
352 1.4 christos * attacks */
353 1.1 cgd
354 1.4 christos if (mdat->mlet == 'L' && !mtmp->mfroz && !mtmp->msleep &&
355 1.4 christos !mtmp->mconf && mtmp->mcansee && !rn2(7) &&
356 1.4 christos (m_move(mtmp, 0) == 2 /* he died */ || /* he moved: */
357 1.4 christos mtmp->mx != u.ux + u.dx || mtmp->my != u.uy + u.dy))
358 1.4 christos return (FALSE);
359 1.4 christos
360 1.4 christos if (mtmp->mimic) {
361 1.4 christos if (!u.ustuck && !mtmp->mflee)
362 1.4 christos u.ustuck = mtmp;
363 1.4 christos switch (levl[u.ux + u.dx][u.uy + u.dy].scrsym) {
364 1.1 cgd case '+':
365 1.1 cgd pline("The door actually was a Mimic.");
366 1.1 cgd break;
367 1.1 cgd case '$':
368 1.1 cgd pline("The chest was a Mimic!");
369 1.1 cgd break;
370 1.1 cgd default:
371 1.1 cgd pline("Wait! That's a Mimic!");
372 1.1 cgd }
373 1.1 cgd wakeup(mtmp); /* clears mtmp->mimic */
374 1.4 christos return (TRUE);
375 1.1 cgd }
376 1.1 cgd wakeup(mtmp);
377 1.1 cgd
378 1.4 christos if (mtmp->mhide && mtmp->mundetected) {
379 1.4 christos struct obj *obj;
380 1.1 cgd
381 1.1 cgd mtmp->mundetected = 0;
382 1.4 christos if ((obj = o_at(mtmp->mx, mtmp->my)) && !Blind)
383 1.1 cgd pline("Wait! There's a %s hiding under %s!",
384 1.4 christos mdat->mname, doname(obj));
385 1.4 christos return (TRUE);
386 1.1 cgd }
387 1.1 cgd tmp = u.uluck + u.ulevel + mdat->ac + abon();
388 1.4 christos if (uwep) {
389 1.4 christos if (uwep->olet == WEAPON_SYM || uwep->otyp == PICK_AXE)
390 1.1 cgd tmp += uwep->spe;
391 1.4 christos if (uwep->otyp == TWO_HANDED_SWORD)
392 1.4 christos tmp -= 1;
393 1.4 christos else if (uwep->otyp == DAGGER)
394 1.4 christos tmp += 2;
395 1.4 christos else if (uwep->otyp == CRYSKNIFE)
396 1.4 christos tmp += 3;
397 1.4 christos else if (uwep->otyp == SPEAR &&
398 1.4 christos strchr("XDne", mdat->mlet))
399 1.4 christos tmp += 2;
400 1.1 cgd }
401 1.4 christos if (mtmp->msleep) {
402 1.1 cgd mtmp->msleep = 0;
403 1.1 cgd tmp += 2;
404 1.1 cgd }
405 1.4 christos if (mtmp->mfroz) {
406 1.1 cgd tmp += 4;
407 1.4 christos if (!rn2(10))
408 1.4 christos mtmp->mfroz = 0;
409 1.1 cgd }
410 1.4 christos if (mtmp->mflee)
411 1.4 christos tmp += 2;
412 1.4 christos if (u.utrap)
413 1.4 christos tmp -= 3;
414 1.1 cgd
415 1.1 cgd /* with a lot of luggage, your agility diminishes */
416 1.4 christos tmp -= (inv_weight() + 40) / 20;
417 1.1 cgd
418 1.4 christos if (tmp <= rnd(20) && !u.uswallow) {
419 1.4 christos if (Blind)
420 1.4 christos pline("You miss it.");
421 1.4 christos else
422 1.4 christos pline("You miss %s.", monnam(mtmp));
423 1.1 cgd } else {
424 1.1 cgd /* we hit the monster; be careful: it might die! */
425 1.1 cgd
426 1.4 christos if ((malive = hmon(mtmp, uwep, 0)) == TRUE) {
427 1.4 christos /* monster still alive */
428 1.4 christos if (!rn2(25) && mtmp->mhp < mtmp->mhpmax / 2) {
429 1.1 cgd mtmp->mflee = 1;
430 1.4 christos if (!rn2(3))
431 1.4 christos mtmp->mfleetim = rnd(100);
432 1.4 christos if (u.ustuck == mtmp && !u.uswallow)
433 1.1 cgd u.ustuck = 0;
434 1.1 cgd }
435 1.1 cgd #ifndef NOWORM
436 1.4 christos if (mtmp->wormno)
437 1.4 christos cutworm(mtmp, u.ux + u.dx, u.uy + u.dy,
438 1.1 cgd uwep ? uwep->otyp : 0);
439 1.4 christos #endif /* NOWORM */
440 1.1 cgd }
441 1.4 christos if (mdat->mlet == 'a') {
442 1.4 christos if (rn2(2)) {
443 1.1 cgd pline("You are splashed by the blob's acid!");
444 1.1 cgd losehp_m(rnd(6), mtmp);
445 1.4 christos if (!rn2(30))
446 1.4 christos corrode_armor();
447 1.1 cgd }
448 1.4 christos if (!rn2(6))
449 1.4 christos corrode_weapon();
450 1.1 cgd }
451 1.1 cgd }
452 1.4 christos if (malive && mdat->mlet == 'E' && canseemon(mtmp)
453 1.4 christos && !mtmp->mcan && rn2(3)) {
454 1.4 christos if (mtmp->mcansee) {
455 1.4 christos pline("You are frozen by the floating eye's gaze!");
456 1.4 christos nomul((u.ulevel > 6 || rn2(4)) ? rn1(20, -21) : -200);
457 1.4 christos } else {
458 1.4 christos pline("The blinded floating eye cannot defend itself.");
459 1.4 christos if (!rn2(500))
460 1.4 christos if ((int) u.uluck > LUCKMIN)
461 1.4 christos u.uluck--;
462 1.4 christos }
463 1.1 cgd }
464 1.4 christos return (TRUE);
465 1.1 cgd }
466