]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - hack/hack.mhitu.c
1 /* $NetBSD: hack.mhitu.c,v 1.4 1997/10/19 16:58:22 christos Exp $ */
4 * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
9 __RCSID("$NetBSD: hack.mhitu.c,v 1.4 1997/10/19 16:58:22 christos Exp $");
16 * mhitu: monster hits you
17 * returns 1 if monster dies (e.g. 'y', 'F'), 0 otherwise
23 struct permonst
*mdat
= mtmp
->data
;
28 /* If swallowed, can only be affected by hissers and by u.ustuck */
30 if (mtmp
!= u
.ustuck
) {
31 if (mdat
->mlet
== 'c' && !rn2(13)) {
32 pline("Outside, you hear %s's hissing!",
34 pline("%s gets turned to stone!",
36 pline("And the same fate befalls you.");
38 /* "notreached": not return(1); */
42 switch (mdat
->mlet
) { /* now mtmp == u.ustuck */
44 youswld(mtmp
, (u
.uac
> 0) ? u
.uac
+ 4 : 4,
48 youswld(mtmp
, rnd(6), 7, "The lurker above");
51 youswld(mtmp
, d(2, 4), 12, "The purple worm");
54 /* This is not impossible! */
55 pline("The mysterious monster totally digests you.");
62 if (mdat
->mlet
== 'c' && Stoned
)
65 /* make eels visible the moment they hit/miss us */
66 if (mdat
->mlet
== ';' && mtmp
->minvis
&& cansee(mtmp
->mx
, mtmp
->my
)) {
70 if (!strchr("1&DuxynNF", mdat
->mlet
))
71 tmp
= hitu(mtmp
, d(mdat
->damn
, mdat
->damd
));
74 if (strchr(UNDEAD
, mdat
->mlet
) && midnight())
75 tmp
+= hitu(mtmp
, d(mdat
->damn
, mdat
->damd
));
77 ctmp
= tmp
&& !mtmp
->mcan
&&
78 (!uarm
|| objects
[uarm
->otyp
].a_can
< rnd(3) || !rn2(50));
82 return (1); /* he disappeared */
85 if (!mtmp
->cham
&& !mtmp
->mcan
&& !rn2(13)) {
86 (void) makemon(PM_DEMON
, u
.ux
, u
.uy
);
88 (void) hitu(mtmp
, d(2, 6));
89 (void) hitu(mtmp
, d(2, 6));
90 (void) hitu(mtmp
, rnd(3));
91 (void) hitu(mtmp
, rnd(3));
92 (void) hitu(mtmp
, rn1(4, 2));
97 justswld(mtmp
, "The trapper");
101 justswld(mtmp
, "The lurker above");
105 if (!u
.ustuck
&& !rn2(10)) {
106 pline("%s swings itself around you!",
109 } else if (u
.ustuck
== mtmp
&&
110 levl
[mtmp
->mx
][mtmp
->my
].typ
== POOL
) {
111 pline("%s drowns you ...", Monnam(mtmp
));
117 if (ctmp
&& rn2(2)) {
118 if (Poison_resistance
)
119 pline("The sting doesn't seem to affect you.");
121 pline("You feel weaker!");
127 (void) hitu(mtmp
, rnd(6));
131 pline("You hear %s's hissing!", monnam(mtmp
));
132 if (ctmp
|| !rn2(20) || (flags
.moonphase
== NEW_MOON
133 && !carrying(DEAD_LIZARD
))) {
135 /* pline("You get turned to stone!"); */
136 /* done_in_by(mtmp); */
141 if (rn2(6) || mtmp
->mcan
) {
142 (void) hitu(mtmp
, d(3, 10));
143 (void) hitu(mtmp
, rnd(8));
144 (void) hitu(mtmp
, rnd(8));
147 kludge("%s breathes fire!", "The dragon");
148 buzz(-1, mtmp
->mx
, mtmp
->my
, u
.ux
- mtmp
->mx
, u
.uy
- mtmp
->my
);
151 (void) hitu(mtmp
, d(2, (flags
.moonphase
== FULL_MOON
) ? 3 : 4));
154 (void) hitu(mtmp
, d(3, 6));
159 kludge("%s explodes!", "The freezing sphere");
161 pline("You don't seem affected by it.");
164 if (17 - (u
.ulevel
/ 2) > rnd(20)) {
165 pline("You get blasted!");
168 pline("You duck the blast...");
171 losehp_m(d(dn
, 6), mtmp
);
176 if (ctmp
&& multi
>= 0 && !rn2(3)) {
177 kludge("You are frozen by %ss juices", "the cube'");
182 if (ctmp
&& multi
>= 0 && !rn2(5)) {
184 kludge("You are put to sleep by %ss bite!",
189 tmp
= hitu(mtmp
, rnd(3));
190 tmp
&= hitu(mtmp
, rnd(3));
192 (void) hitu(mtmp
, rnd(4));
193 (void) hitu(mtmp
, rnd(4));
197 if ((hitu(mtmp
, rnd(4)) || !rn2(3)) && ctmp
) {
198 poisoned("bee's sting", mdat
->mname
);
206 if (mtmp
->mcan
&& !Blind
) {
207 pline("%s tries to seduce you, but you seem not interested.",
208 Amonnam(mtmp
, "plain"));
211 } else if (steal(mtmp
)) {
217 if (!uwep
&& !uarm
&& !uarmh
&& !uarms
&& !uarmg
) {
218 pline("%s hits! (I hope you don't mind)",
223 if (u
.uhp
> u
.uhpmax
)
229 (void) hitu(mtmp
, d(2, 6));
230 (void) hitu(mtmp
, d(2, 6));
234 tmp
= hitu(mtmp
, rnd(6));
235 if (hitu(mtmp
, rnd(6)) && tmp
&& /* hits with both paws */
236 !u
.ustuck
&& rn2(2)) {
238 kludge("%s has grabbed you!", "The owlbear");
240 } else if (u
.ustuck
== mtmp
) {
242 pline("You are being crushed.");
247 justswld(mtmp
, "The purple worm");
249 (void) hitu(mtmp
, d(2, 4));
252 (void) hitu(mtmp
, rnd(2));
253 (void) hitu(mtmp
, rnd(2));
256 if (tmp
&& uarmh
&& !uarmh
->rustfree
&&
257 (int) uarmh
->spe
>= -1) {
258 pline("Your helmet rusts!");
260 } else if (ctmp
&& uarm
&& !uarm
->rustfree
&& /* Mike Newton */
261 uarm
->otyp
< STUDDED_LEATHER_ARMOR
&&
262 (int) uarm
->spe
>= -1) {
263 pline("Your armor rusts!");
268 if (ctmp
&& !rn2(8)) {
269 poisoned("snake's bite", mdat
->mname
);
273 if (tmp
&& !rn2(8)) {
274 poisoned("scorpion's sting", mdat
->mname
);
276 (void) hitu(mtmp
, rnd(8));
277 (void) hitu(mtmp
, rnd(8));
280 (void) hitu(mtmp
, rnd(6));
281 (void) hitu(mtmp
, rnd(6));
291 (void) hitu(mtmp
, d(3, 4));
292 (void) hitu(mtmp
, d(3, 4));
295 if (ctmp
&& !u
.ustuck
)
315 (void) hitu(mtmp
, rnd(5));
316 (void) hitu(mtmp
, rnd(5));
317 (void) hitu(mtmp
, rnd(5));
321 long side
= rn2(2) ? RIGHT_SIDE
: LEFT_SIDE
;
322 pline("%s pricks in your %s leg!",
323 Monnam(mtmp
), (side
== RIGHT_SIDE
) ? "right" : "left");
324 set_wounded_legs(side
, rnd(50));
333 pline("You are blinded by a blast of light!");
339 (void) hitu(mtmp
, rnd(6));
358 if (mtmp
->mhide
&& mtmp
->mundetected
) {
359 mtmp
->mundetected
= 0;
362 if ((obj
= o_at(mtmp
->mx
, mtmp
->my
)) != NULL
)
363 pline("%s was hidden under %s!",
364 Xmonnam(mtmp
), doname(obj
));
368 /* give people with Ac = -10 at least some vulnerability */
370 dam
+= tmp
; /* decrease damage */
375 tmp
+= mtmp
->data
->mlevel
;
378 if ((Invis
&& mtmp
->data
->mlet
!= 'I') || !mtmp
->mcansee
)
382 if (tmp
<= rnd(20)) {
386 pline("%s misses.", Monnam(mtmp
));
392 pline("%s hits!", Monnam(mtmp
));