1 /* SCCS Id: @(#)mhitm.c 3.4 2003/01/02 */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
9 extern boolean notonhead
;
10 extern const char *breathwep
[]; /* from mthrowu.c */
12 #define POLE_LIM 8 /* How far monsters can use pole-weapons */
16 static NEARDATA boolean vis
, far_noise
;
17 static NEARDATA
long noisetime
;
18 static NEARDATA
struct obj
*otmp
;
20 static const char brief_feeling
[] =
21 "have a %s feeling for a moment, then it passes.";
23 STATIC_DCL
char *mon_nam_too(char *,struct monst
*,struct monst
*);
24 STATIC_DCL
void mrustm(struct monst
*, struct monst
*, struct obj
*);
25 STATIC_DCL
int breamm(struct monst
*, struct monst
*, struct attack
*);
26 STATIC_DCL
int spitmm(struct monst
*, struct monst
*, struct attack
*);
27 STATIC_DCL
int thrwmm(struct monst
*, struct monst
*);
28 STATIC_DCL
int hitmm(struct monst
*,struct monst
*,struct attack
*);
29 STATIC_DCL
int gazemm(struct monst
*,struct monst
*,struct attack
*);
30 STATIC_DCL
int gulpmm(struct monst
*,struct monst
*,struct attack
*);
31 STATIC_DCL
int explmm(struct monst
*,struct monst
*,struct attack
*);
32 STATIC_DCL
int mdamagem(struct monst
*,struct monst
*,struct attack
*);
33 STATIC_DCL
void mswingsm(struct monst
*, struct monst
*, struct obj
*);
34 STATIC_DCL
void noises(struct monst
*,struct attack
*);
35 STATIC_DCL
void missmm(struct monst
*,struct monst
*, int, int, struct attack
*);
36 STATIC_DCL
int passivemm(struct monst
*, struct monst
*, BOOLEAN_P
, int, int);
37 STATIC_DCL
void stoogejoke();
39 STATIC_PTR
void set_lit(int,int,void *);
41 /* Needed for the special case of monsters wielding vorpal blades (rare).
42 * If we use this a lot it should probably be a parameter to mdamagem()
43 * instead of a global variable.
47 static const char *random_joke
[] = {
49 "You'll get what's comming!",
52 "Right in the kisser!",
56 "That's more like it!",
72 "What's the matter with you?",
75 "How about a knuckle sandwich?",
82 "Woop Woop Woop Woop ..."
85 /* returns mon_nam(mon) relative to other_mon; normal name unless they're
86 the same, in which case the reference is to {him|her|it} self */
88 mon_nam_too(outbuf
, mon
, other_mon
)
90 struct monst
*mon
, *other_mon
;
92 strcpy(outbuf
, mon_nam(mon
));
94 switch (pronoun_gender(mon
)) {
95 case 0: strcpy(outbuf
, "himself"); break;
96 case 1: strcpy(outbuf
, "herself"); break;
97 default: strcpy(outbuf
, "itself"); break;
104 register struct monst
*magr
;
105 register struct attack
*mattk
;
107 boolean farq
= (distu(magr
->mx
, magr
->my
) > 15);
109 if(flags
.soundok
&& (farq
!= far_noise
|| moves
-noisetime
> 10)) {
113 (mattk
->aatyp
== AT_EXPL
) ? "an explosion" : "some noises",
114 farq
? " in the distance" : "");
120 missmm(magr
, mdef
, target
, roll
, mattk
)
121 register struct monst
*magr
, *mdef
;
122 struct attack
*mattk
;
125 boolean nearmiss
= (target
== roll
);
127 char buf
[BUFSZ
], mon_name
[BUFSZ
];
129 register struct obj
*blocker
= (struct obj
*)0;
130 long mwflags
= mdef
->misc_worn_check
;
132 /* 3 values for blocker
133 * No blocker: (struct obj *) 0
134 * Piece of armour: object
137 /* This is a hack, since there is no fast equivalent for uarm, uarms, etc.
138 * Technically, we really should check from the inside out...
141 for (blocker
= mdef
->minvent
; blocker
; blocker
= blocker
->nobj
) {
142 if (blocker
->owornmask
& mwflags
) {
143 target
+= ARM_BONUS(blocker
);
144 if (target
> roll
) break;
150 if (!canspotmon(magr
) && !(magr
->data
->msound
== MS_DEEPSTATE
) && !(magr
->egotype_deepstatemember
))
151 map_invisible(magr
->mx
, magr
->my
);
152 if (!canspotmon(mdef
) && !(mdef
->data
->msound
== MS_DEEPSTATE
) && !(mdef
->egotype_deepstatemember
))
153 map_invisible(mdef
->mx
, mdef
->my
);
154 if (mdef
->m_ap_type
) seemimic(mdef
);
155 if (magr
->m_ap_type
) seemimic(magr
);
156 if (flags
.verbose
&& !nearmiss
&& blocker
) {
157 fmt
= "%s %s blocks";
158 sprintf(buf
,fmt
, s_suffix(Monnam(mdef
)),
159 aobjnam(blocker
, (char *)0));
160 pline("%s %s.", buf
, mon_nam_too(mon_name
, magr
, mdef
));
162 fmt
= (could_seduce(magr
,mdef
,mattk
) && !magr
->mcan
) ?
163 "%s pretends to be friendly to" :
164 ((flags
.verbose
&& nearmiss
) ? "%s just misses" :
166 sprintf(buf
, fmt
, Monnam(magr
));
167 pline("%s %s.", buf
, mon_nam_too(mon_name
, mdef
, magr
));
169 } else noises(magr
, mattk
);
173 * fightm() -- fight some other monster
176 * 0 - Monster did nothing.
177 * 1 - If the monster made an attack. The monster might have died.
179 * There is an exception to the above. If mtmp has the hero swallowed,
180 * then we report that the monster did nothing so it will continue to
184 fightm(mtmp
) /* have monsters fight each other */
185 register struct monst
*mtmp
;
187 if (DEADMONSTER(mtmp
)) return 0;
189 register struct monst
*mon
, *nmon
;
190 int result
, has_u_swallowed
;
194 /* perhaps the monster will resist Conflict */
195 if(resist(mtmp
, RING_CLASS
, 0, 0))
197 if(resist(mtmp
, RING_CLASS
, 0, 0))
199 if (!rn2(2)) return(0);
200 /* they're now highly resistant to conflict, because otherwise things would be too easy --Amy */
202 if(u
.ustuck
== mtmp
) {
203 /* perhaps we're holding it... */
207 has_u_swallowed
= (u
.uswallow
&& (mtmp
== u
.ustuck
));
209 for(mon
= fmon
; mon
; mon
= nmon
) {
211 if(nmon
== mtmp
) nmon
= mtmp
->nmon
;
212 /* Be careful to ignore monsters that are already dead, since we
213 * might be calling this before we've cleaned them up. This can
214 * happen if the monster attacked a cockatrice bare-handedly, for
217 if(mon
!= mtmp
&& !DEADMONSTER(mon
)) {
218 if(monnear(mtmp
,mon
->mx
,mon
->my
)) {
219 if(!u
.uswallow
&& (mtmp
== u
.ustuck
)) {
221 pline("%s releases you!", Monnam(mtmp
));
227 /* mtmp can be killed */
231 result
= mattackm(mtmp
,mon
);
233 if (result
& MM_AGR_DIED
) return 1; /* mtmp died */
235 * If mtmp has the hero swallowed, lie and say there
236 * was no attack (this allows mtmp to digest the hero).
238 if (has_u_swallowed
) return 0;
240 /* Allow attacked monsters a chance to hit back. Primarily
241 * to allow monsters that resist conflict to respond.
242 * Amy edit: since monsters can lash out at pets now, the pets should have a considerable chance of
243 * retaliating, regardless of that weird movement value
246 if ( ((result
& MM_HIT
) || (mon
&& mon
->mtame
&& mtmp
&& !mtmp
->mtame
&& !rn2(4))) && !(result
& MM_DEF_DIED
) &&
247 ((rn2(4) && mon
&& mon
->movement
>= NORMAL_SPEED
) || (mon
&& mon
->mtame
&& mtmp
&& !mtmp
->mtame
))
249 mon
->movement
-= NORMAL_SPEED
;
250 if (mon
->movement
< 0) mon
->movement
= 0; /* fail safe */
253 if (!DEADMONSTER(mon
) && !DEADMONSTER(mtmp
)) {
254 (void) mattackm(mon
, mtmp
); /* return attack */
258 return ((result
& MM_HIT
) ? 1 : 0);
266 * mattackm() -- a monster attacks another monster.
268 * This function returns a result bitfield:
270 * --------- aggressor died
271 * / ------- defender died
272 * / / ----- defender was hit
281 * Each successive attack has a lower probability of hitting. Some rely on the
282 * success of previous attacks. ** this doen't seem to be implemented -dl **
284 * In the case of exploding monsters, the monster dies as well.
288 register struct monst
*magr
,*mdef
;
290 int i
, /* loop counter */
291 tmp
, /* amour class difference */
292 strike
, /* hit this attack */
293 attk
, /* attack attempted this time */
294 struck
= 0, /* hit at least once */
295 res
[NATTK
]; /* results of all attacks */
296 int magrlev
, magrhih
; /* for to-hit calculations */
297 struct attack
*mattk
, alt_attk
;
298 struct permonst
*pa
, *pd
;
300 struct permonst
*mdat2
;
302 * Pets don't use "ranged" attacks for fear of hitting their master
308 if (!magr
|| !mdef
) return(MM_MISS
); /* mike@genat */
309 if (DEADMONSTER(mdef
)) { /* catchall by Amy */
312 if (DEADMONSTER(magr
)) { /* shouldn't happen, but who knows? */
315 if (mdef
->handytime
) return(MM_MISS
);
316 /* note by Amy: it's weird if pets can still fight back while eating, so now they can't */
317 if (!magr
->mcanmove
|| magr
->msleeping
|| magr
->meating
) return(MM_MISS
);
318 pa
= magr
->data
; pd
= mdef
->data
;
320 /* Grid bugs cannot attack at an angle. */
321 if ((isgridbug(pa
) || (uwep
&& uwep
->oartifact
== ART_EGRID_BUG
&& magr
->data
->mlet
== S_XAN
) || (uarmf
&& !rn2(10) && itemhasappearance(uarmf
, APP_CHESS_BOOTS
) ) ) && magr
->mx
!= mdef
->mx
&& magr
->my
!= mdef
->my
)
324 range
= (!magr
->mtame
|| rn2(3)) && !monnear(magr
, mdef
->mx
, mdef
->my
);
326 /* Calculate the armour class differential. */
327 tmp
= find_mac(mdef
);
329 boolean didrangedattack
= FALSE
;
330 boolean canweaphit
= TRUE
;
332 boolean norangepassive
= FALSE
; /* don't run passives against phantom attacks, please --Amy */
334 boolean egotypearcane
= magr
->egotype_arcane
;
335 boolean egotypeclerical
= magr
->egotype_clerical
;
336 boolean egotypemastercaster
= magr
->egotype_mastercaster
;
337 boolean egotypethief
= magr
->egotype_thief
;
338 boolean egotypedisenchant
= magr
->egotype_disenchant
;
339 boolean egotyperust
= magr
->egotype_rust
;
340 boolean egotypecorrosion
= magr
->egotype_corrosion
;
341 boolean egotypedecay
= magr
->egotype_decay
;
342 boolean egotypeflamer
= magr
->egotype_flamer
;
343 boolean egotypeblasphemer
= magr
->egotype_blasphemer
;
344 boolean egotypeinverter
= magr
->egotype_inverter
;
345 boolean egotypedebtor
= magr
->egotype_debtor
;
346 boolean egotypedropper
= magr
->egotype_dropper
;
347 boolean egotypewither
= magr
->egotype_wither
;
348 boolean egotypegrab
= magr
->egotype_grab
;
349 boolean egotypefaker
= magr
->egotype_faker
;
350 boolean egotypeslows
= magr
->egotype_slows
;
351 boolean egotypevampire
= magr
->egotype_vampire
;
352 boolean egotypeteleportyou
= magr
->egotype_teleportyou
;
353 boolean egotypewrap
= magr
->egotype_wrap
;
354 boolean egotypedisease
= magr
->egotype_disease
;
355 boolean egotypeslime
= magr
->egotype_slime
;
356 boolean egotypepoisoner
= magr
->egotype_poisoner
;
357 boolean egotypeelementalist
= magr
->egotype_elementalist
;
358 boolean egotypeacidspiller
= magr
->egotype_acidspiller
;
359 boolean egotypeengrave
= magr
->egotype_engrave
;
360 boolean egotypedark
= magr
->egotype_dark
;
361 boolean egotypesounder
= magr
->egotype_sounder
;
362 boolean egotypetimer
= magr
->egotype_timer
;
363 boolean egotypethirster
= magr
->egotype_thirster
;
364 boolean egotypenexus
= magr
->egotype_nexus
;
365 boolean egotypegravitator
= magr
->egotype_gravitator
;
366 boolean egotypeinert
= magr
->egotype_inert
;
367 boolean egotypeantimage
= magr
->egotype_antimage
;
368 boolean egotypeunskillor
= magr
->egotype_unskillor
;
369 boolean egotypevenomizer
= magr
->egotype_venomizer
;
370 boolean egotypedreameater
= magr
->egotype_dreameater
;
371 boolean egotypenastinator
= magr
->egotype_nastinator
;
372 boolean egotypebaddie
= magr
->egotype_baddie
;
373 boolean egotypebadowner
= magr
->egotype_badowner
;
374 boolean egotypebleeder
= magr
->egotype_bleeder
;
375 boolean egotypesludgepuddle
= magr
->egotype_sludgepuddle
;
376 boolean egotypevulnerator
= magr
->egotype_vulnerator
;
377 boolean egotypemarysue
= magr
->egotype_marysue
;
378 boolean egotypeplasmon
= magr
->egotype_plasmon
;
379 boolean egotypelasher
= magr
->egotype_lasher
;
380 boolean egotypebreather
= magr
->egotype_breather
;
381 boolean egotypeluck
= magr
->egotype_luck
;
382 boolean egotypeamnesiac
= magr
->egotype_amnesiac
;
383 boolean egotypeshanker
= magr
->egotype_shanker
;
384 boolean egotypeterrorizer
= magr
->egotype_terrorizer
;
385 boolean egotypeseducer
= magr
->egotype_seducer
;
386 boolean egotypecullen
= magr
->egotype_cullen
;
387 boolean egotypewebber
= magr
->egotype_webber
;
388 boolean egotypetrapmaster
= magr
->egotype_trapmaster
;
389 boolean egotypeitemporter
= magr
->egotype_itemporter
;
390 boolean egotypesinner
= magr
->egotype_sinner
;
391 boolean egotypeschizo
= magr
->egotype_schizo
;
392 boolean egotypealigner
= magr
->egotype_aligner
;
393 boolean egotypefeminizer
= magr
->egotype_feminizer
;
394 boolean egotypedestructor
= magr
->egotype_destructor
;
395 boolean egotypedatadeleter
= magr
->egotype_datadeleter
;
396 boolean egotypelevitator
= magr
->egotype_levitator
;
397 boolean egotypeillusionator
= magr
->egotype_illusionator
;
398 boolean egotypestealer
= magr
->egotype_stealer
;
399 boolean egotypestoner
= magr
->egotype_stoner
;
400 boolean egotypetrembler
= magr
->egotype_trembler
;
401 boolean egotypeworldender
= magr
->egotype_worldender
;
402 boolean egotypedamager
= magr
->egotype_damager
;
403 boolean egotypeantitype
= magr
->egotype_antitype
;
404 boolean egotypestatdamager
= magr
->egotype_statdamager
;
405 boolean egotypedamagedisher
= magr
->egotype_damagedisher
;
406 boolean egotypemaecke
= magr
->egotype_maecke
;
407 boolean egotypesanitizer
= magr
->egotype_sanitizer
;
408 boolean egotypenastycurser
= magr
->egotype_nastycurser
;
409 boolean egotypethiefguildmember
= magr
->egotype_thiefguildmember
;
410 boolean egotyperogue
= magr
->egotype_rogue
;
411 boolean egotypepainlord
= magr
->egotype_painlord
;
412 boolean egotypeempmaster
= magr
->egotype_empmaster
;
413 boolean egotypespellsucker
= magr
->egotype_spellsucker
;
414 boolean egotypeeviltrainer
= magr
->egotype_eviltrainer
;
415 boolean egotypecontaminator
= magr
->egotype_contaminator
;
416 boolean egotypereactor
= magr
->egotype_reactor
;
417 boolean egotyperadiator
= magr
->egotype_radiator
;
418 boolean egotypeminator
= magr
->egotype_minator
;
419 boolean egotypeaggravator
= magr
->egotype_aggravator
;
420 boolean egotypemidiplayer
= magr
->egotype_midiplayer
;
421 boolean egotyperngabuser
= magr
->egotype_rngabuser
;
422 boolean egotypewatersplasher
= magr
->egotype_watersplasher
;
423 boolean egotypecancellator
= magr
->egotype_cancellator
;
424 boolean egotypebanisher
= magr
->egotype_banisher
;
425 boolean egotypeshredder
= magr
->egotype_shredder
;
426 boolean egotypeabductor
= magr
->egotype_abductor
;
427 boolean egotypeincrementor
= magr
->egotype_incrementor
;
428 boolean egotypemirrorimage
= magr
->egotype_mirrorimage
;
429 boolean egotypecurser
= magr
->egotype_curser
;
430 boolean egotypehorner
= magr
->egotype_horner
;
431 boolean egotypepush
= magr
->egotype_push
;
432 boolean egotyperandomizer
= magr
->egotype_randomizer
;
433 boolean egotypeblaster
= magr
->egotype_blaster
;
434 boolean egotypepsychic
= magr
->egotype_psychic
;
435 boolean egotypeabomination
= magr
->egotype_abomination
;
436 boolean egotypeweeper
= magr
->egotype_weeper
;
437 boolean egotypeweaponizer
= magr
->egotype_weaponizer
;
438 boolean egotypeengulfer
= magr
->egotype_engulfer
;
439 boolean egotypecameraclicker
= magr
->egotype_cameraclicker
;
440 boolean egotypealladrainer
= magr
->egotype_alladrainer
;
442 /* To-hit based on the monster's level. Nerf by Amy: high-level monsters shouldn't autohit. */
443 magrlev
= magr
->m_lev
;
445 magrhih
= magrlev
- 19;
446 magrlev
-= rnd(magrhih
);
448 magrhih
= magrlev
- 19;
449 if (magrhih
> 1) magrhih
/= 2;
453 /* pets need to be subjected to penalties or they'll be overpowered :P --Amy */
455 if (magr
->mflee
) tmp
-= 20;
456 if (magr
->mstun
) tmp
-= rnd(20);
457 if (magr
->mconf
) tmp
-= rnd(5);
458 if (magr
->mblinded
&& haseyes(magr
->data
)) tmp
-= rnd(8);
459 if (mdef
->minvis
&& haseyes(magr
->data
) && !perceives(magr
->data
)) tmp
-= 10;
460 if (mdef
->minvisreal
) tmp
-= (haseyes(magr
->data
) ? rnd(30) : rnd(20));
462 if ( (mdef
->data
== &mons
[PM_DISPLACER_BEAST
] || mdef
->data
== &mons
[PM_HYPER_CAVE_BEAR
] || mdef
->data
== &mons
[PM_KURIKKUSHITEKUDASAI__ANATA_NO_OKANE_WANAKU_NATTE_IMASU
] || mdef
->data
== &mons
[PM_REPLACER_BEAST
] || mdef
->data
== &mons
[PM_MISPLACER_BEAST
] || mdef
->data
== &mons
[PM_ELOCATOR
] || mdef
->data
== &mons
[PM_ANCIENT_OF_THE_BURNING_WASTES
] || mdef
->data
== &mons
[PM_SARTAN_TANNIN
] || mdef
->data
== &mons
[PM_POLYMORPH_CODE
] || mdef
->data
== &mons
[PM_SECRET_POLYMORPH_CODE
] || mdef
->data
== &mons
[PM_FIRST_WRAITHWORM
] || mdef
->data
== &mons
[PM_WRAITHWORM
] || mdef
->data
== &mons
[PM_LILAC_FEMMY
] || mdef
->data
== &mons
[PM_SHARAB_KAMEREL
] || mdef
->data
== &mons
[PM_WUXTINA
] || mdef
->data
== &mons
[PM_IVEL_WUXTINA
] || mdef
->data
== &mons
[PM_FLUTTERBUG
] || mdef
->data
== &mons
[PM_LIPSTICK_HC_GIRL
] || mdef
->data
== &mons
[PM_CREEPY_EVIL_GHOST
] || mdef
->data
== &mons
[PM_ORTHOS
] || mdef
->data
== &mons
[PM_SHIMMERING_DRACONIAN
] || mdef
->data
== &mons
[PM_JUMPING_CHAMPION
] || mdef
->data
->mlet
== S_GRUE
|| mdef
->data
== &mons
[PM_QUANTUM_MOLD
] || mdef
->data
== &mons
[PM_QUANTUM_GROWTH
] || mdef
->data
== &mons
[PM_QUANTUM_FUNGUS
] || mdef
->data
== &mons
[PM_QUANTUM_PATCH
] || mdef
->data
== &mons
[PM_QUANTUM_STALK
] || mdef
->data
== &mons
[PM_QUANTUM_MUSHROOM
] || mdef
->data
== &mons
[PM_QUANTUM_SPORE
] || mdef
->data
== &mons
[PM_QUANTUM_COLONY
] || mdef
->data
== &mons
[PM_QUANTUM_FORCE_FUNGUS
] || mdef
->data
== &mons
[PM_QUANTUM_WORT
] || mdef
->data
== &mons
[PM_QUANTUM_FORCE_PATCH
] || mdef
->data
== &mons
[PM_QUANTUM_WARP_FUNGUS
] || mdef
->data
== &mons
[PM_QUANTUM_WARP_PATCH
] || mdef
->egotype_displacer
) && !rn2(2)) tmp
-= 100;
464 if (mdef
->data
== &mons
[PM_XXXXXXXXXXXXXXXXXXXX
]) tmp
-= 100;
466 } /* attacking monster is tame */
468 /* monster attacks should be fully effective against pets so you can't just cheese out everything --Amy
469 * (basically, symmetrical with uhitm.c but only if the attack targets your pet; this isn't FIQslex) */
471 if (!rn2(5) && (level_difficulty() > 20) && magrlev
< 5) magrlev
= 5;
472 if (!rn2(5) && (level_difficulty() > 40) && magrlev
< 10) magrlev
= 10;
473 if (!rn2(5) && (level_difficulty() > 60) && magrlev
< 15) magrlev
= 15;
474 if (!rn2(5) && (level_difficulty() > 80) && magrlev
< 20) magrlev
= 20;
476 if (level_difficulty() > 5 && magrlev
< 5 && !rn2(5)) magrlev
++;
477 if (level_difficulty() > 10 && magrlev
< 5 && !rn2(2)) magrlev
++;
478 if (level_difficulty() > 10 && magrlev
< 10 && !rn2(5)) magrlev
++;
479 if (level_difficulty() > 20 && magrlev
< 10 && !rn2(3)) magrlev
++;
480 if (level_difficulty() > 20 && magrlev
< 15 && !rn2(5)) magrlev
++;
481 if (level_difficulty() > 40 && magrlev
< 15 && !rn2(4)) magrlev
++;
482 if (level_difficulty() > 30 && magrlev
< 20 && !rn2(5)) magrlev
++;
483 if (level_difficulty() > 60 && magrlev
< 20 && !rn2(5)) magrlev
++;
485 if (magr
->egotype_hitter
) tmp
+= 10;
486 if (magr
->egotype_piercer
) tmp
+= 25;
487 if (!(mdef
->mcanmove
)) tmp
+= 4;
488 if (mdef
->mtrapped
) tmp
+= 2;
490 if (magr
->data
== &mons
[PM_IVORY_COAST_STAR
]) tmp
+= 30; /* this monster is aiming abnormally well */
491 if (magr
->data
== &mons
[PM_HAND_OF_GOD
]) tmp
+= 100; /* God personally is guiding this one's blows */
492 if (magr
->data
== &mons
[PM_AKIRA_GIRL
]) tmp
+= 20; /* she needs some boost */
493 if (magr
->data
== &mons
[PM_FIRST_DUNVEGAN
]) tmp
+= 100; /* this monster also almost always hits */
494 if (magr
->data
== &mons
[PM_DNETHACK_ELDER_PRIEST_TM_
]) tmp
+= rnd(100); /* the elder priest uses an aimbot and a wallhack */
496 if (magr
->data
->msound
== MS_FART_LOUD
&& !magr
->butthurt
) tmp
+= rnd(5);
497 if (magr
->data
->msound
== MS_FART_NORMAL
&& !magr
->butthurt
) tmp
+= rnd(7);
498 if (magr
->data
->msound
== MS_FART_QUIET
&& !magr
->butthurt
) tmp
+= rnd(10);
499 if (magr
->data
->msound
== MS_WHORE
&& !magr
->butthurt
) tmp
+= rnd(15);
500 if (magr
->data
->msound
== MS_SHOE
) tmp
+= rnd(10);
501 if (magr
->data
->msound
== MS_STENCH
) tmp
+= rnd(15);
502 if (magr
->data
->msound
== MS_CONVERT
) tmp
+= rnd(5);
503 if (magr
->data
->msound
== MS_HCALIEN
) tmp
+= rnd(10);
504 if (magr
->egotype_farter
) tmp
+= rnd(7);
505 if (magr
->fartbonus
) tmp
+= rnd(magr
->fartbonus
);
506 if (magr
->crapbonus
) tmp
+= rno(magr
->crapbonus
);
507 if (is_table(magr
->mx
, magr
->my
)) tmp
+= 3;
508 if (humanoid(magr
->data
) && is_female(magr
->data
) && attacktype(magr
->data
, AT_KICK
) && FemtrapActiveMadeleine
) tmp
+= rnd(100);
509 if (humanoid(magr
->data
) && is_female(magr
->data
) && FemtrapActiveWendy
) tmp
+= rnd(SuperFemtrapWendy
? 20 : 10);
511 if (!rn2(20)) tmp
+= 20; /* "natural 20" like in D&D --Amy */
513 if(!magr
->cham
&& (is_demon(magr
->data
) || magr
->egotype_gator
) && monnear(magr
, mdef
->mx
, mdef
->my
) && magr
->data
!= &mons
[PM_BALROG
]
514 && magr
->data
!= &mons
[PM_SUCCUBUS
]
515 && magr
->data
!= &mons
[PM_INCUBUS
]
516 && magr
->data
!= &mons
[PM_NEWS_DAEMON
]
517 && magr
->data
!= &mons
[PM_PRINTER_DAEMON
]) {
518 if(!magr
->mcan
&& !rn2(magr
->data
== &mons
[PM_PERCENTI_OPENS_A_GATE_
] ? 5 : magr
->data
== &mons
[PM_CHEATER_LION
] ? 5 : magr
->data
== &mons
[PM_TEA_HUSSY
] ? 5 : magr
->data
== &mons
[PM_PERCENTI_PASSES_TO_YOU_
] ? 5 : 23)) {
520 pline("%s opens a gate!", Monnam(magr
) );
521 if (PlayerHearsSoundEffects
) pline(issoviet
? "Sovetskaya nadeyetsya, chto demony zapolnyayut ves' uroven' i ubit' vas." : "Pitschaeff!");
525 if(!magr
->cham
&& is_were(magr
->data
) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
527 if(!rn2(10) && !magr
->mcan
) {
528 int numseen
, numhelp
;
529 char buf
[BUFSZ
], genericwere
[BUFSZ
];
531 strcpy(genericwere
, "creature");
532 numhelp
= were_summon(magr
->data
, FALSE
, &numseen
, genericwere
, TRUE
);
533 pline("%s summons help!", Monnam(magr
));
536 You_feel("hemmed in.");
537 } else pline("But none comes.");
541 } /* defending monster is tame */
545 if (mdef
->mconf
|| !mdef
->mcanmove
|| mdef
->msleeping
) {
550 if (mdef
->data
== &mons
[PM_DNETHACK_ELDER_PRIEST_TM_
]) {
552 mdef
->egotype_covetous
= 1;
555 /* undetect monsters become un-hidden if they are attacked */
556 if (mdef
->mundetected
) {
557 mdef
->mundetected
= 0;
558 newsym(mdef
->mx
, mdef
->my
);
559 if(canseemon(mdef
) && !sensemon(mdef
)) {
560 if (u
.usleep
) You("dream of %s.",
561 (mdef
->data
->geno
& G_UNIQ
) ?
562 a_monnam(mdef
) : makeplural(m_monnam(mdef
)));
563 else pline("Suddenly, you notice %s.", a_monnam(mdef
));
567 /* Elves hate orcs. */
568 if (is_elf(pa
) && is_orc(pd
)) tmp
++;
571 /* Set up the visibility of action */
572 vis
= (cansee(magr
->mx
,magr
->my
) && cansee(mdef
->mx
,mdef
->my
) && (canspotmon(magr
) || canspotmon(mdef
)));
574 /* Set flag indicating monster has moved this turn. Necessary since a
575 * monster might get an attack out of sequence (i.e. before its move) in
576 * some cases, in which case this still counts as its move for the round
577 * and it shouldn't move again.
579 magr
->mlstmv
= monstermoves
;
581 /* Now perform all attacks for the monster. */
582 for (i
= 0; i
< NATTK
; i
++) {
584 mattk
= getmattk(pa
, i
, res
, &alt_attk
);
585 otmp
= (struct obj
*)0;
587 if (DEADMONSTER(mdef
) || DEADMONSTER(magr
)) { /* ANOTHER catchall by Amy because it keeps malfunctioning! */
591 switch (mattk
->aatyp
) {
595 if (range
&& !linedup(magr
->mx
,magr
->my
,mdef
->mx
,mdef
->my
, FALSE
) ) {
598 norangepassive
= TRUE
;
603 if (range
|| (mattk
->aatyp
== AT_SPIT
&& mdef
->mtame
) || (mdef
->mtame
&& !mon_reflects(mdef
, (char *)0) ) ) {
608 if (mattk
->aatyp
== AT_BREA
) {
610 if (mattk
->adtyp
== AD_FIRE
&& resists_fire(mdef
) && !player_will_pierce_resistance()) {
612 } else if (mattk
->adtyp
== AD_COLD
&& (resists_cold(mdef
) && !player_will_pierce_resistance()) ) {
614 } else if (mattk
->adtyp
== AD_SLEE
&& resists_sleep(mdef
)) {
616 } else if (mattk
->adtyp
== AD_DISN
&& resists_disint(mdef
)) {
618 } else if (mattk
->adtyp
== AD_ELEC
&& (resists_elec(mdef
) && !player_will_pierce_resistance()) ) {
620 } else if (mattk
->adtyp
== AD_DRST
&& (resists_poison(mdef
) && !player_will_pierce_resistance()) ) {
622 } else if (mattk
->adtyp
== AD_ACID
&& (resists_acid(mdef
) && !player_will_pierce_resistance()) ) {
624 } else if ((mattk
->adtyp
< AD_MAGM
|| mattk
->adtyp
> AD_SPC2
) && mattk
->adtyp
!= AD_RBRE
) {
627 else res
[i
] = breamm(magr
, mdef
, mattk
);
629 if (mattk
->adtyp
== AD_ACID
|| mattk
->adtyp
== AD_BLND
|| mattk
->adtyp
== AD_TCKL
|| mattk
->adtyp
== AD_DRLI
|| mattk
->adtyp
== AD_NAST
) {
630 res
[i
] = spitmm(magr
, mdef
, mattk
);
631 } else goto meleeattack
;
634 /* We can't distinguish no action from failed attack
635 * so assume defender doesn't waken unless actually hit.
637 strike
= res
[i
] & MM_HIT
;
645 if (range
&& !linedup(magr
->mx
,magr
->my
,mdef
->mx
,mdef
->my
, FALSE
) ) {
648 norangepassive
= TRUE
;
654 /* [ALI] Monster-on-monster spell casting always fails. This
655 * is partly for balance reasons and partly because the
656 * amount of code required to implement it is prohibitive.
660 if (canseemon(magr
) && couldsee(magr
->mx
, magr
->my
)) {
662 strcpy(buf
, Monnam(magr
));
664 pline("%s points at %s, then curses.", buf
,
667 pline("%s points and curses at something.", buf
);
668 } else if (flags
.soundok
)
669 Norep("You hear a mumbled curse.");
675 /* "ranged" attacks */
676 if ((range
|| (!rn2(4) && mdef
->mtame
) ) && !didrangedattack
) {
678 res
[i
] = thrwmm(magr
, mdef
);
680 strike
= res
[i
] & MM_HIT
;
681 didrangedattack
= TRUE
;
684 /* "hand to hand" attacks */
685 if (magr
->weapon_check
== NEED_WEAPON
|| !MON_WEP(magr
)) {
686 magr
->weapon_check
= NEED_HTH_WEAPON
;
687 if (mon_wield_item(magr
) != 0) {
691 possibly_unwield(magr
, FALSE
);
692 otmp
= MON_WEP(magr
);
696 if (vis
) mswingsm(magr
, mdef
, otmp
);
697 tmp
+= hitval(otmp
, mdef
);
699 if (bimanual(otmp
)) canweaphit
= !canweaphit
;
714 if ((mattk
->aatyp
!= AT_BEAM
) && !(mattk
->aatyp
== AT_WEAP
&& range
) && (!monnear(magr
, mdef
->mx
, mdef
->my
)) ) norangepassive
= TRUE
;
717 /* Nymph that teleported away on first attack? */
718 if ((distmin(magr
->mx
,magr
->my
,mdef
->mx
,mdef
->my
) > 1) && mattk
->aatyp
!= AT_BREA
&& mattk
->aatyp
!= AT_SPIT
&& mattk
->aatyp
!= AT_MAGC
) {
723 /* is the monster lined up? if not, the attack always fails */
724 if ((distmin(magr
->mx
,magr
->my
,mdef
->mx
,mdef
->my
) > 1) && !linedup(magr
->mx
,magr
->my
,mdef
->mx
,mdef
->my
, FALSE
)) {
730 /* Monsters won't attack cockatrices physically if they
731 * have a weapon instead. This instinct doesn't work for
732 * players, or under conflict or confusion.
734 if (!magr
->mconf
&& !Conflict
&& otmp
&&
735 mattk
->aatyp
!= AT_WEAP
&& touch_petrifies(mdef
->data
)) {
739 dieroll
= rnd(20 + i
);
740 if (!rn2(3) && magr
->m_lev
> 0) {
741 magrlev
= magr
->m_lev
;
743 magrhih
= magrlev
- 19;
744 magrlev
-= rnd(magrhih
);
747 magrhih
= magrlev
- 19;
748 if (magrhih
> 1) magrhih
/= 2;
754 if (magr
->data
== &mons
[PM_STOOGE_MOE
] || magr
->data
== &mons
[PM_STOOGE_CURLY
] || magr
->data
== &mons
[PM_STOOGE_LARRY
]) tmp
+= 50;
755 strike
= (tmp
> dieroll
);
757 res
[i
] = hitmm(magr
, mdef
, mattk
);
758 if((mdef
->data
== &mons
[PM_BLACK_PUDDING
] || mdef
->data
== &mons
[PM_GEMINICROTTA
] || mdef
->data
== &mons
[PM_DIVISIBLE_ICE_CREAM_BAR
] || mdef
->data
== &mons
[PM_GREY_PUDDING
] || mdef
->data
== &mons
[PM_STICKY_PUDDING
] || mdef
->data
== &mons
[PM_SHOCK_PUDDING
] || mdef
->data
== &mons
[PM_VOLT_PUDDING
] || mdef
->data
== &mons
[PM_DRUDDING
] || mdef
->data
== &mons
[PM_BLACK_DRUDDING
] || mdef
->data
== &mons
[PM_BLACKSTEEL_PUDDING
] || mdef
->data
== &mons
[PM_BLOOD_PUDDING
] || mdef
->data
== &mons
[PM_MORAL_HAZARD
] || mdef
->data
== &mons
[PM_MORAL_EVENT_HORIZON
] || mdef
->data
== &mons
[PM_BLACK_PIERCER
] || mdef
->data
== &mons
[PM_BROWN_PUDDING
])
759 && otmp
&& objects
[otmp
->otyp
].oc_material
== MT_IRON
760 && mdef
->mhp
> 1 && !mdef
->mcan
&& !rn2(100) ) /* slowing pudding farming to a crawl --Amy */
762 if (clone_mon(mdef
, 0, 0)) {
766 strcpy(buf
, Monnam(mdef
));
767 pline("%s divides as %s hits it!", buf
, mon_nam(magr
));
772 missmm(magr
, mdef
, tmp
, dieroll
, mattk
);
773 /* KMH -- don't accumulate to-hit bonuses */
775 tmp
-= hitval(otmp
, mdef
);
778 case AT_HUGS
: /* automatic if prev two attacks succeed, but also with a low chance otherwise --Amy */
779 strike
= (((i
>= 2 && res
[i
-1] == MM_HIT
&& res
[i
-2] == MM_HIT
) || (!rn2(mdef
->mtame
? 10 : 30) && (dist2(mdef
->mx
, mdef
->my
, magr
->mx
, magr
->my
) <= (BOLT_LIM
* BOLT_LIM
)) ) ) && (tmp
> dieroll
));
781 res
[i
] = hitmm(magr
, mdef
, mattk
);
782 else norangepassive
= TRUE
;
787 strike
= 0; /* will not wake up a sleeper */
789 /* endless gaze spammage against pets was really getting annoying... --Amy
790 * In Soviet Russia, the enemy's troops can stare down at your troops from endlessly far away, and do so
791 * constantly, meaning that your only hope is to equip them all with AK-47's and pray they manage to line
792 * themselves up for a shot. Otherwise, your guys just get wrecked with no chance. */
794 if (!range
|| (clear_path(magr
->mx
, magr
->my
, mdef
->mx
, mdef
->my
) && (!rn2(10) || issoviet
) ) ) {
796 res
[i
] = gazemm(magr
, mdef
, mattk
);
797 } else norangepassive
= TRUE
;
802 if (!magr
->mtame
&& rn2(20)) break; /* we want the things to explode at YOU! Since monsters are immune to quite some attack types anyway, and the exploding lights would just suicide without causing any effect. --Amy */
804 if (!monnear(magr
, mdef
->mx
, mdef
->my
)) break; /* we don't want them to suddenly warp and explode in someone's face --Amy */
806 res
[i
] = explmm(magr
, mdef
, mattk
);
807 if (res
[i
] == MM_MISS
) { /* cancelled--no attack */
811 strike
= 1; /* automatic hit */
815 if (u
.usteed
&& (mdef
== u
.usteed
)) {
820 if (!monnear(magr
, mdef
->mx
, mdef
->my
)) break; /* we don't want them to suddenly warp and engulf someone from far away --Amy */
822 /* Engulfing attacks are directed at the hero if
825 if (u
.uswallow
&& magr
== u
.ustuck
)
828 if (!rn2(3) && magr
->m_lev
> 0) tmp
+= rno(magr
->m_lev
);
830 if ((strike
= (tmp
> (dieroll
= rnd(20+i
)))))
831 res
[i
] = gulpmm(magr
, mdef
, mattk
);
833 missmm(magr
, mdef
, tmp
, dieroll
, mattk
);
837 default: /* no attack */
843 boolean hashit
= FALSE
;
845 if (!norangepassive
&& attk
&& !(res
[i
] & MM_AGR_DIED
)) {
847 res
[i
] = passivemm(magr
, mdef
, strike
, res
[i
] & MM_DEF_DIED
, 0);
848 if (res
[i
] & MM_HIT
) hashit
= TRUE
;
849 if (hashit
&& !(res
[i
] & MM_HIT
)) res
[i
] |= MM_HIT
;
850 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
852 if (!(res
[i
] & MM_AGR_DIED
) && !(res
[i
] & MM_DEF_DIED
)) {
853 res
[i
] = passivemm(magr
, mdef
, strike
, res
[i
] & MM_DEF_DIED
, 1);
854 if (res
[i
] & MM_HIT
) hashit
= TRUE
;
855 if (hashit
&& !(res
[i
] & MM_HIT
)) res
[i
] |= MM_HIT
;
856 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
858 if (!(res
[i
] & MM_AGR_DIED
) && !(res
[i
] & MM_DEF_DIED
)) {
859 res
[i
] = passivemm(magr
, mdef
, strike
, res
[i
] & MM_DEF_DIED
, 2);
860 if (res
[i
] & MM_HIT
) hashit
= TRUE
;
861 if (hashit
&& !(res
[i
] & MM_HIT
)) res
[i
] |= MM_HIT
;
862 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
864 if (!(res
[i
] & MM_AGR_DIED
) && !(res
[i
] & MM_DEF_DIED
)) {
865 res
[i
] = passivemm(magr
, mdef
, strike
, res
[i
] & MM_DEF_DIED
, 3);
866 if (res
[i
] & MM_HIT
) hashit
= TRUE
;
867 if (hashit
&& !(res
[i
] & MM_HIT
)) res
[i
] |= MM_HIT
;
868 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
870 if (!(res
[i
] & MM_AGR_DIED
) && !(res
[i
] & MM_DEF_DIED
)) {
871 res
[i
] = passivemm(magr
, mdef
, strike
, res
[i
] & MM_DEF_DIED
, 4);
872 if (res
[i
] & MM_HIT
) hashit
= TRUE
;
873 if (hashit
&& !(res
[i
] & MM_HIT
)) res
[i
] |= MM_HIT
;
874 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
876 if (!(res
[i
] & MM_AGR_DIED
) && !(res
[i
] & MM_DEF_DIED
)) {
877 res
[i
] = passivemm(magr
, mdef
, strike
, res
[i
] & MM_DEF_DIED
, 5);
878 if (res
[i
] & MM_HIT
) hashit
= TRUE
;
879 if (hashit
&& !(res
[i
] & MM_HIT
)) res
[i
] |= MM_HIT
;
880 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
885 if (hashit
&& !(res
[i
] & MM_HIT
)) res
[i
] |= MM_HIT
;
887 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
890 * Wake up the defender. NOTE: this must follow the check
891 * to see if the defender died. We don't want to modify
892 * unallocated monsters!
897 if (mdef
->masleep
&& !rn2(3)) {
904 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
905 /* return if aggressor can no longer attack */
906 if (!magr
->mcanmove
|| magr
->msleeping
) return res
[i
];
907 if (res
[i
] & MM_HIT
) struck
= 1; /* at least one hit */
910 /* egotypes and other extra attacks, by Amy */
913 if (egotypearcane
) {
915 mdat2
= &mons
[PM_CAST_DUMMY
];
916 a
= &mdat2
->mattk
[3];
920 a
->damd
= (1 + (magr
->m_lev
));
922 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
923 dieroll
= rnd(20 + i
);
924 strike
= (tmp
> dieroll
);
925 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
927 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
928 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
932 if (egotypeclerical
) {
934 mdat2
= &mons
[PM_CAST_DUMMY
];
935 a
= &mdat2
->mattk
[3];
939 a
->damd
= (1 + (magr
->m_lev
));
941 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
942 dieroll
= rnd(20 + i
);
943 strike
= (tmp
> dieroll
);
944 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
946 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
947 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
951 if (egotypemastercaster
) {
953 mdat2
= &mons
[PM_CAST_DUMMY
];
954 a
= &mdat2
->mattk
[3];
958 a
->damd
= (1 + (magr
->m_lev
));
960 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
961 dieroll
= rnd(20 + i
);
962 strike
= (tmp
> dieroll
);
963 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
965 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
966 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
972 mdat2
= &mons
[PM_CAST_DUMMY
];
973 a
= &mdat2
->mattk
[3];
979 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
980 dieroll
= rnd(20 + i
);
981 strike
= (tmp
> dieroll
);
982 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
984 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
985 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
989 if (egotypedisenchant
) {
991 mdat2
= &mons
[PM_CAST_DUMMY
];
992 a
= &mdat2
->mattk
[3];
998 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
999 dieroll
= rnd(20 + i
);
1000 strike
= (tmp
> dieroll
);
1001 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1003 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1004 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1010 mdat2
= &mons
[PM_CAST_DUMMY
];
1011 a
= &mdat2
->mattk
[3];
1017 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1018 dieroll
= rnd(20 + i
);
1019 strike
= (tmp
> dieroll
);
1020 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1022 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1023 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1027 if (egotypecorrosion
) {
1029 mdat2
= &mons
[PM_CAST_DUMMY
];
1030 a
= &mdat2
->mattk
[3];
1036 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1037 dieroll
= rnd(20 + i
);
1038 strike
= (tmp
> dieroll
);
1039 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1041 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1042 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1046 if (egotypedecay
) {
1048 mdat2
= &mons
[PM_CAST_DUMMY
];
1049 a
= &mdat2
->mattk
[3];
1055 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1056 dieroll
= rnd(20 + i
);
1057 strike
= (tmp
> dieroll
);
1058 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1060 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1061 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1065 if (egotypeflamer
) {
1067 mdat2
= &mons
[PM_CAST_DUMMY
];
1068 a
= &mdat2
->mattk
[3];
1074 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1075 dieroll
= rnd(20 + i
);
1076 strike
= (tmp
> dieroll
);
1077 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1079 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1080 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1084 if (egotypeblasphemer
) {
1086 mdat2
= &mons
[PM_CAST_DUMMY
];
1087 a
= &mdat2
->mattk
[3];
1093 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1094 dieroll
= rnd(20 + i
);
1095 strike
= (tmp
> dieroll
);
1096 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1098 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1099 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1103 if (egotypeinverter
) {
1105 mdat2
= &mons
[PM_CAST_DUMMY
];
1106 a
= &mdat2
->mattk
[3];
1110 a
->damd
= (1 + (magr
->m_lev
));
1112 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1113 dieroll
= rnd(20 + i
);
1114 strike
= (tmp
> dieroll
);
1115 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1117 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1118 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1122 if (egotypedebtor
) {
1124 mdat2
= &mons
[PM_CAST_DUMMY
];
1125 a
= &mdat2
->mattk
[3];
1129 a
->damd
= (1 + (magr
->m_lev
));
1131 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1132 dieroll
= rnd(20 + i
);
1133 strike
= (tmp
> dieroll
);
1134 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1136 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1137 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1141 if (egotypedropper
) {
1143 mdat2
= &mons
[PM_CAST_DUMMY
];
1144 a
= &mdat2
->mattk
[3];
1150 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1151 dieroll
= rnd(20 + i
);
1152 strike
= (tmp
> dieroll
);
1153 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1155 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1156 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1160 if (egotypewither
) {
1162 mdat2
= &mons
[PM_CAST_DUMMY
];
1163 a
= &mdat2
->mattk
[3];
1169 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1170 dieroll
= rnd(20 + i
);
1171 strike
= (tmp
> dieroll
);
1172 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1174 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1175 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1181 mdat2
= &mons
[PM_CAST_DUMMY
];
1182 a
= &mdat2
->mattk
[3];
1188 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1189 dieroll
= rnd(20 + i
);
1190 strike
= (tmp
> dieroll
);
1191 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1193 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1194 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1198 if (egotypefaker
) {
1200 mdat2
= &mons
[PM_CAST_DUMMY
];
1201 a
= &mdat2
->mattk
[3];
1207 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1208 dieroll
= rnd(20 + i
);
1209 strike
= (tmp
> dieroll
);
1210 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1212 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1213 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1217 if (egotypeslows
) {
1219 mdat2
= &mons
[PM_CAST_DUMMY
];
1220 a
= &mdat2
->mattk
[3];
1226 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1227 dieroll
= rnd(20 + i
);
1228 strike
= (tmp
> dieroll
);
1229 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1231 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1232 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1236 if (egotypevampire
) {
1238 mdat2
= &mons
[PM_CAST_DUMMY
];
1239 a
= &mdat2
->mattk
[3];
1245 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1246 dieroll
= rnd(20 + i
);
1247 strike
= (tmp
> dieroll
);
1248 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1250 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1251 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1255 if (egotypeteleportyou
) {
1257 mdat2
= &mons
[PM_CAST_DUMMY
];
1258 a
= &mdat2
->mattk
[3];
1264 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1265 dieroll
= rnd(20 + i
);
1266 strike
= (tmp
> dieroll
);
1267 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1269 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1270 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1276 mdat2
= &mons
[PM_CAST_DUMMY
];
1277 a
= &mdat2
->mattk
[3];
1283 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1284 dieroll
= rnd(20 + i
);
1285 strike
= (tmp
> dieroll
);
1286 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1288 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1289 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1293 if (egotypedisease
) {
1295 mdat2
= &mons
[PM_CAST_DUMMY
];
1296 a
= &mdat2
->mattk
[3];
1302 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1303 dieroll
= rnd(20 + i
);
1304 strike
= (tmp
> dieroll
);
1305 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1307 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1308 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1312 if (egotypeslime
) {
1314 mdat2
= &mons
[PM_CAST_DUMMY
];
1315 a
= &mdat2
->mattk
[3];
1321 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1322 dieroll
= rnd(20 + i
);
1323 strike
= (tmp
> dieroll
);
1324 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1326 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1327 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1331 if (egotypepoisoner
) {
1333 mdat2
= &mons
[PM_CAST_DUMMY
];
1334 a
= &mdat2
->mattk
[3];
1340 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1341 dieroll
= rnd(20 + i
);
1342 strike
= (tmp
> dieroll
);
1343 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1345 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1346 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1350 if (egotypeelementalist
) {
1352 mdat2
= &mons
[PM_CAST_DUMMY
];
1353 a
= &mdat2
->mattk
[3];
1359 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1360 dieroll
= rnd(20 + i
);
1361 strike
= (tmp
> dieroll
);
1362 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1364 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1365 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1369 if (egotypeacidspiller
) {
1371 mdat2
= &mons
[PM_CAST_DUMMY
];
1372 a
= &mdat2
->mattk
[3];
1378 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1379 dieroll
= rnd(20 + i
);
1380 strike
= (tmp
> dieroll
);
1381 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1383 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1384 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1388 if (egotypeengrave
) {
1390 mdat2
= &mons
[PM_CAST_DUMMY
];
1391 a
= &mdat2
->mattk
[3];
1397 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1398 dieroll
= rnd(20 + i
);
1399 strike
= (tmp
> dieroll
);
1400 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1402 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1403 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1409 mdat2
= &mons
[PM_CAST_DUMMY
];
1410 a
= &mdat2
->mattk
[3];
1416 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1417 dieroll
= rnd(20 + i
);
1418 strike
= (tmp
> dieroll
);
1419 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1421 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1422 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1426 if (egotypesounder
) {
1428 mdat2
= &mons
[PM_CAST_DUMMY
];
1429 a
= &mdat2
->mattk
[3];
1433 a
->damd
= (1 + (magr
->m_lev
));
1435 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1436 dieroll
= rnd(20 + i
);
1437 strike
= (tmp
> dieroll
);
1438 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1440 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1441 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1445 if (egotypetimer
) {
1447 mdat2
= &mons
[PM_CAST_DUMMY
];
1448 a
= &mdat2
->mattk
[3];
1452 a
->damd
= (1 + (magr
->m_lev
));
1454 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1455 dieroll
= rnd(20 + i
);
1456 strike
= (tmp
> dieroll
);
1457 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1459 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1460 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1464 if (egotypethirster
) {
1466 mdat2
= &mons
[PM_CAST_DUMMY
];
1467 a
= &mdat2
->mattk
[3];
1471 a
->damd
= (1 + (magr
->m_lev
));
1473 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1474 dieroll
= rnd(20 + i
);
1475 strike
= (tmp
> dieroll
);
1476 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1478 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1479 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1483 if (egotypenexus
) {
1485 mdat2
= &mons
[PM_CAST_DUMMY
];
1486 a
= &mdat2
->mattk
[3];
1490 a
->damd
= (1 + (magr
->m_lev
));
1492 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1493 dieroll
= rnd(20 + i
);
1494 strike
= (tmp
> dieroll
);
1495 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1497 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1498 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1502 if (egotypegravitator
) {
1504 mdat2
= &mons
[PM_CAST_DUMMY
];
1505 a
= &mdat2
->mattk
[3];
1509 a
->damd
= (1 + (magr
->m_lev
));
1511 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1512 dieroll
= rnd(20 + i
);
1513 strike
= (tmp
> dieroll
);
1514 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1516 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1517 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1521 if (egotypeinert
) {
1523 mdat2
= &mons
[PM_CAST_DUMMY
];
1524 a
= &mdat2
->mattk
[3];
1528 a
->damd
= (1 + (magr
->m_lev
));
1530 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1531 dieroll
= rnd(20 + i
);
1532 strike
= (tmp
> dieroll
);
1533 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1535 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1536 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1540 if (egotypeantimage
) {
1542 mdat2
= &mons
[PM_CAST_DUMMY
];
1543 a
= &mdat2
->mattk
[3];
1547 a
->damd
= (1 + (magr
->m_lev
));
1549 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1550 dieroll
= rnd(20 + i
);
1551 strike
= (tmp
> dieroll
);
1552 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1554 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1555 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1559 if (egotypeunskillor
) {
1561 mdat2
= &mons
[PM_CAST_DUMMY
];
1562 a
= &mdat2
->mattk
[3];
1566 a
->damd
= (1 + (magr
->m_lev
));
1568 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1569 dieroll
= rnd(20 + i
);
1570 strike
= (tmp
> dieroll
);
1571 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1573 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1574 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1578 if (egotypevenomizer
) {
1580 mdat2
= &mons
[PM_CAST_DUMMY
];
1581 a
= &mdat2
->mattk
[3];
1585 a
->damd
= (1 + (magr
->m_lev
));
1587 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1588 dieroll
= rnd(20 + i
);
1589 strike
= (tmp
> dieroll
);
1590 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1592 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1593 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1597 if (egotypedreameater
) {
1599 mdat2
= &mons
[PM_CAST_DUMMY
];
1600 a
= &mdat2
->mattk
[3];
1604 a
->damd
= (1 + (magr
->m_lev
));
1606 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1607 dieroll
= rnd(20 + i
);
1608 strike
= (tmp
> dieroll
);
1609 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1611 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1612 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1616 if (egotypenastinator
) {
1618 mdat2
= &mons
[PM_CAST_DUMMY
];
1619 a
= &mdat2
->mattk
[3];
1623 a
->damd
= (1 + (magr
->m_lev
));
1625 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1626 dieroll
= rnd(20 + i
);
1627 strike
= (tmp
> dieroll
);
1628 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1630 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1631 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1635 if (egotypebaddie
) {
1637 mdat2
= &mons
[PM_CAST_DUMMY
];
1638 a
= &mdat2
->mattk
[3];
1642 a
->damd
= (1 + (magr
->m_lev
));
1644 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1645 dieroll
= rnd(20 + i
);
1646 strike
= (tmp
> dieroll
);
1647 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1649 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1650 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1654 if (egotypebadowner
) {
1656 mdat2
= &mons
[PM_CAST_DUMMY
];
1657 a
= &mdat2
->mattk
[3];
1661 a
->damd
= (1 + (magr
->m_lev
));
1663 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1664 dieroll
= rnd(20 + i
);
1665 strike
= (tmp
> dieroll
);
1666 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1668 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1669 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1673 if (egotypebleeder
) {
1675 mdat2
= &mons
[PM_CAST_DUMMY
];
1676 a
= &mdat2
->mattk
[3];
1680 a
->damd
= (1 + (magr
->m_lev
));
1682 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1683 dieroll
= rnd(20 + i
);
1684 strike
= (tmp
> dieroll
);
1685 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1687 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1688 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1692 if (egotypesludgepuddle
) {
1694 mdat2
= &mons
[PM_CAST_DUMMY
];
1695 a
= &mdat2
->mattk
[3];
1699 a
->damd
= (1 + (magr
->m_lev
));
1701 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1702 dieroll
= rnd(20 + i
);
1703 strike
= (tmp
> dieroll
);
1704 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1706 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1707 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1711 if (egotypevulnerator
) {
1713 mdat2
= &mons
[PM_CAST_DUMMY
];
1714 a
= &mdat2
->mattk
[3];
1718 a
->damd
= (1 + (magr
->m_lev
));
1720 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1721 dieroll
= rnd(20 + i
);
1722 strike
= (tmp
> dieroll
);
1723 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1725 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1726 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1730 if (egotypemarysue
) {
1732 mdat2
= &mons
[PM_CAST_DUMMY
];
1733 a
= &mdat2
->mattk
[3];
1737 a
->damd
= (1 + (magr
->m_lev
));
1739 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1740 dieroll
= rnd(20 + i
);
1741 strike
= (tmp
> dieroll
);
1742 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1744 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1745 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1749 if (egotypeplasmon
) {
1751 mdat2
= &mons
[PM_CAST_DUMMY
];
1752 a
= &mdat2
->mattk
[3];
1756 a
->damd
= (1 + (magr
->m_lev
));
1758 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1759 dieroll
= rnd(20 + i
);
1760 strike
= (tmp
> dieroll
);
1761 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1763 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1764 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1768 if (egotypelasher
) {
1770 mdat2
= &mons
[PM_CAST_DUMMY
];
1771 a
= &mdat2
->mattk
[3];
1775 a
->damd
= (1 + (magr
->m_lev
));
1777 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1778 dieroll
= rnd(20 + i
);
1779 strike
= (tmp
> dieroll
);
1780 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1782 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1783 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1787 if (egotypebreather
) {
1789 mdat2
= &mons
[PM_CAST_DUMMY
];
1790 a
= &mdat2
->mattk
[3];
1794 a
->damd
= (1 + (magr
->m_lev
));
1796 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1797 dieroll
= rnd(20 + i
);
1798 strike
= (tmp
> dieroll
);
1799 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1801 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1802 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1808 mdat2
= &mons
[PM_CAST_DUMMY
];
1809 a
= &mdat2
->mattk
[3];
1815 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1816 dieroll
= rnd(20 + i
);
1817 strike
= (tmp
> dieroll
);
1818 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1820 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1821 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1825 if (egotypeamnesiac
) {
1827 mdat2
= &mons
[PM_CAST_DUMMY
];
1828 a
= &mdat2
->mattk
[3];
1834 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1835 dieroll
= rnd(20 + i
);
1836 strike
= (tmp
> dieroll
);
1837 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1839 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1840 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1844 if (egotypeshanker
) {
1846 mdat2
= &mons
[PM_CAST_DUMMY
];
1847 a
= &mdat2
->mattk
[3];
1853 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1854 dieroll
= rnd(20 + i
);
1855 strike
= (tmp
> dieroll
);
1856 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1858 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1859 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1863 if (egotypeterrorizer
) {
1865 mdat2
= &mons
[PM_CAST_DUMMY
];
1866 a
= &mdat2
->mattk
[3];
1872 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1873 dieroll
= rnd(20 + i
);
1874 strike
= (tmp
> dieroll
);
1875 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1877 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1878 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1882 if (egotypeseducer
) {
1884 mdat2
= &mons
[PM_CAST_DUMMY
];
1885 a
= &mdat2
->mattk
[3];
1891 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1892 dieroll
= rnd(20 + i
);
1893 strike
= (tmp
> dieroll
);
1894 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1896 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1897 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1901 if (egotypecullen
) {
1903 mdat2
= &mons
[PM_CAST_DUMMY
];
1904 a
= &mdat2
->mattk
[3];
1910 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1911 dieroll
= rnd(20 + i
);
1912 strike
= (tmp
> dieroll
);
1913 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1915 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1916 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1920 if (egotypewebber
) {
1922 mdat2
= &mons
[PM_CAST_DUMMY
];
1923 a
= &mdat2
->mattk
[3];
1929 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1930 dieroll
= rnd(20 + i
);
1931 strike
= (tmp
> dieroll
);
1932 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1934 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1935 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1939 if (egotypetrapmaster
) {
1941 mdat2
= &mons
[PM_CAST_DUMMY
];
1942 a
= &mdat2
->mattk
[3];
1948 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1949 dieroll
= rnd(20 + i
);
1950 strike
= (tmp
> dieroll
);
1951 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1953 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1954 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1958 if (egotypeitemporter
) {
1960 mdat2
= &mons
[PM_CAST_DUMMY
];
1961 a
= &mdat2
->mattk
[3];
1967 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1968 dieroll
= rnd(20 + i
);
1969 strike
= (tmp
> dieroll
);
1970 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1972 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1973 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1977 if (egotypesinner
) {
1979 mdat2
= &mons
[PM_CAST_DUMMY
];
1980 a
= &mdat2
->mattk
[3];
1986 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
1987 dieroll
= rnd(20 + i
);
1988 strike
= (tmp
> dieroll
);
1989 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
1991 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
1992 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
1996 if (egotypeschizo
) {
1998 mdat2
= &mons
[PM_CAST_DUMMY
];
1999 a
= &mdat2
->mattk
[3];
2003 a
->damd
= (1 + (magr
->m_lev
));
2005 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2006 dieroll
= rnd(20 + i
);
2007 strike
= (tmp
> dieroll
);
2008 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2010 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2011 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2015 if (egotypealigner
) {
2017 mdat2
= &mons
[PM_CAST_DUMMY
];
2018 a
= &mdat2
->mattk
[3];
2022 a
->damd
= (1 + (magr
->m_lev
));
2024 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2025 dieroll
= rnd(20 + i
);
2026 strike
= (tmp
> dieroll
);
2027 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2029 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2030 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2034 if (egotypefeminizer
) {
2036 mdat2
= &mons
[PM_CAST_DUMMY
];
2037 a
= &mdat2
->mattk
[3];
2041 a
->damd
= (1 + (magr
->m_lev
));
2043 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2044 dieroll
= rnd(20 + i
);
2045 strike
= (tmp
> dieroll
);
2046 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2048 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2049 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2053 if (egotypedestructor
) {
2055 mdat2
= &mons
[PM_CAST_DUMMY
];
2056 a
= &mdat2
->mattk
[3];
2060 a
->damd
= (1 + (magr
->m_lev
));
2062 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2063 dieroll
= rnd(20 + i
);
2064 strike
= (tmp
> dieroll
);
2065 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2067 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2068 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2072 if (egotypedatadeleter
) {
2074 mdat2
= &mons
[PM_CAST_DUMMY
];
2075 a
= &mdat2
->mattk
[3];
2079 a
->damd
= (1 + (magr
->m_lev
));
2081 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2082 dieroll
= rnd(20 + i
);
2083 strike
= (tmp
> dieroll
);
2084 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2086 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2087 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2091 if (egotypelevitator
) {
2093 mdat2
= &mons
[PM_CAST_DUMMY
];
2094 a
= &mdat2
->mattk
[3];
2098 a
->damd
= (1 + (magr
->m_lev
));
2100 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2101 dieroll
= rnd(20 + i
);
2102 strike
= (tmp
> dieroll
);
2103 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2105 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2106 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2110 if (egotypeillusionator
) {
2112 mdat2
= &mons
[PM_CAST_DUMMY
];
2113 a
= &mdat2
->mattk
[3];
2117 a
->damd
= (1 + (magr
->m_lev
));
2119 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2120 dieroll
= rnd(20 + i
);
2121 strike
= (tmp
> dieroll
);
2122 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2124 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2125 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2129 if (egotypestealer
) {
2131 mdat2
= &mons
[PM_CAST_DUMMY
];
2132 a
= &mdat2
->mattk
[3];
2138 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2139 dieroll
= rnd(20 + i
);
2140 strike
= (tmp
> dieroll
);
2141 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2143 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2144 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2148 if (egotypestoner
) {
2150 mdat2
= &mons
[PM_CAST_DUMMY
];
2151 a
= &mdat2
->mattk
[3];
2157 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2158 dieroll
= rnd(20 + i
);
2159 strike
= (tmp
> dieroll
);
2160 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2162 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2163 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2167 if (egotypetrembler
) {
2169 mdat2
= &mons
[PM_CAST_DUMMY
];
2170 a
= &mdat2
->mattk
[3];
2176 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2177 dieroll
= rnd(20 + i
);
2178 strike
= (tmp
> dieroll
);
2179 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2181 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2182 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2186 if (egotypeworldender
) {
2188 mdat2
= &mons
[PM_CAST_DUMMY
];
2189 a
= &mdat2
->mattk
[3];
2195 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2196 dieroll
= rnd(20 + i
);
2197 strike
= (tmp
> dieroll
);
2198 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2200 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2201 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2205 if (egotypedamager
) {
2207 mdat2
= &mons
[PM_CAST_DUMMY
];
2208 a
= &mdat2
->mattk
[3];
2214 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2215 dieroll
= rnd(20 + i
);
2216 strike
= (tmp
> dieroll
);
2217 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2219 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2220 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2224 if (egotypeantitype
) {
2226 mdat2
= &mons
[PM_CAST_DUMMY
];
2227 a
= &mdat2
->mattk
[3];
2233 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2234 dieroll
= rnd(20 + i
);
2235 strike
= (tmp
> dieroll
);
2236 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2238 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2239 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2243 if (egotypestatdamager
) {
2245 mdat2
= &mons
[PM_CAST_DUMMY
];
2246 a
= &mdat2
->mattk
[3];
2252 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2253 dieroll
= rnd(20 + i
);
2254 strike
= (tmp
> dieroll
);
2255 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2257 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2258 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2262 if (egotypedamagedisher
) {
2264 mdat2
= &mons
[PM_CAST_DUMMY
];
2265 a
= &mdat2
->mattk
[3];
2269 a
->damd
= (1 + (magr
->m_lev
));
2271 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2272 dieroll
= rnd(20 + i
);
2273 strike
= (tmp
> dieroll
);
2274 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2276 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2277 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2281 if (egotypemaecke
) {
2283 mdat2
= &mons
[PM_CAST_DUMMY
];
2284 a
= &mdat2
->mattk
[3];
2288 a
->damd
= (1 + (magr
->m_lev
));
2290 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2291 dieroll
= rnd(20 + i
);
2292 strike
= (tmp
> dieroll
);
2293 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2295 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2296 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2300 if (egotypesanitizer
) {
2302 mdat2
= &mons
[PM_CAST_DUMMY
];
2303 a
= &mdat2
->mattk
[3];
2307 a
->damd
= (1 + (magr
->m_lev
));
2309 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2310 dieroll
= rnd(20 + i
);
2311 strike
= (tmp
> dieroll
);
2312 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2314 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2315 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2319 if (egotypenastycurser
) {
2321 mdat2
= &mons
[PM_CAST_DUMMY
];
2322 a
= &mdat2
->mattk
[3];
2328 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2329 dieroll
= rnd(20 + i
);
2330 strike
= (tmp
> dieroll
);
2331 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2333 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2334 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2338 if (egotypethiefguildmember
) {
2340 mdat2
= &mons
[PM_CAST_DUMMY
];
2341 a
= &mdat2
->mattk
[3];
2345 a
->damd
= (1 + (magr
->m_lev
));
2347 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2348 dieroll
= rnd(20 + i
);
2349 strike
= (tmp
> dieroll
);
2350 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2352 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2353 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2359 mdat2
= &mons
[PM_CAST_DUMMY
];
2360 a
= &mdat2
->mattk
[3];
2366 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2367 dieroll
= rnd(20 + i
);
2368 strike
= (tmp
> dieroll
);
2369 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2371 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2372 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2376 if (egotypepainlord
) {
2378 mdat2
= &mons
[PM_CAST_DUMMY
];
2379 a
= &mdat2
->mattk
[3];
2383 a
->damd
= (1 + (magr
->m_lev
));
2385 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2386 dieroll
= rnd(20 + i
);
2387 strike
= (tmp
> dieroll
);
2388 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2390 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2391 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2395 if (egotypeempmaster
) {
2397 mdat2
= &mons
[PM_CAST_DUMMY
];
2398 a
= &mdat2
->mattk
[3];
2402 a
->damd
= (1 + (magr
->m_lev
));
2404 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2405 dieroll
= rnd(20 + i
);
2406 strike
= (tmp
> dieroll
);
2407 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2409 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2410 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2414 if (egotypespellsucker
) {
2416 mdat2
= &mons
[PM_CAST_DUMMY
];
2417 a
= &mdat2
->mattk
[3];
2421 a
->damd
= (1 + (magr
->m_lev
));
2423 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2424 dieroll
= rnd(20 + i
);
2425 strike
= (tmp
> dieroll
);
2426 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2428 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2429 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2433 if (egotypeeviltrainer
) {
2435 mdat2
= &mons
[PM_CAST_DUMMY
];
2436 a
= &mdat2
->mattk
[3];
2440 a
->damd
= (1 + (magr
->m_lev
));
2442 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2443 dieroll
= rnd(20 + i
);
2444 strike
= (tmp
> dieroll
);
2445 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2447 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2448 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2452 if (egotypecontaminator
) {
2454 mdat2
= &mons
[PM_CAST_DUMMY
];
2455 a
= &mdat2
->mattk
[3];
2459 a
->damd
= (1 + (magr
->m_lev
));
2461 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2462 dieroll
= rnd(20 + i
);
2463 strike
= (tmp
> dieroll
);
2464 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2466 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2467 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2471 if (egotypereactor
) {
2473 mdat2
= &mons
[PM_CAST_DUMMY
];
2474 a
= &mdat2
->mattk
[3];
2478 a
->damd
= (1 + (magr
->m_lev
));
2480 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2481 dieroll
= rnd(20 + i
);
2482 strike
= (tmp
> dieroll
);
2483 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2485 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2486 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2490 if (egotyperadiator
) {
2492 mdat2
= &mons
[PM_CAST_DUMMY
];
2493 a
= &mdat2
->mattk
[3];
2497 a
->damd
= (1 + (magr
->m_lev
));
2499 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2500 dieroll
= rnd(20 + i
);
2501 strike
= (tmp
> dieroll
);
2502 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2504 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2505 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2509 if (egotypeminator
) {
2511 mdat2
= &mons
[PM_CAST_DUMMY
];
2512 a
= &mdat2
->mattk
[3];
2516 a
->damd
= (1 + (magr
->m_lev
));
2518 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2519 dieroll
= rnd(20 + i
);
2520 strike
= (tmp
> dieroll
);
2521 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2523 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2524 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2528 if (egotypeaggravator
) {
2530 mdat2
= &mons
[PM_CAST_DUMMY
];
2531 a
= &mdat2
->mattk
[3];
2535 a
->damd
= (1 + (magr
->m_lev
));
2537 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2538 dieroll
= rnd(20 + i
);
2539 strike
= (tmp
> dieroll
);
2540 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2542 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2543 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2547 if (egotypemidiplayer
) {
2549 mdat2
= &mons
[PM_CAST_DUMMY
];
2550 a
= &mdat2
->mattk
[3];
2554 a
->damd
= (1 + (magr
->m_lev
));
2556 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2557 dieroll
= rnd(20 + i
);
2558 strike
= (tmp
> dieroll
);
2559 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2561 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2562 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2566 if (egotyperngabuser
) {
2568 mdat2
= &mons
[PM_CAST_DUMMY
];
2569 a
= &mdat2
->mattk
[3];
2573 a
->damd
= (1 + (magr
->m_lev
));
2575 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2576 dieroll
= rnd(20 + i
);
2577 strike
= (tmp
> dieroll
);
2578 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2580 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2581 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2585 if (egotypewatersplasher
) {
2587 mdat2
= &mons
[PM_CAST_DUMMY
];
2588 a
= &mdat2
->mattk
[3];
2590 a
->adtyp
= level
.flags
.lethe
? AD_LETH
: AD_WET
;
2594 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2595 dieroll
= rnd(20 + i
);
2596 strike
= (tmp
> dieroll
);
2597 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2599 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2600 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2604 if (egotypecancellator
) {
2606 mdat2
= &mons
[PM_CAST_DUMMY
];
2607 a
= &mdat2
->mattk
[3];
2613 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2614 dieroll
= rnd(20 + i
);
2615 strike
= (tmp
> dieroll
);
2616 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2618 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2619 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2623 if (egotypebanisher
) {
2625 mdat2
= &mons
[PM_CAST_DUMMY
];
2626 a
= &mdat2
->mattk
[3];
2632 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2633 dieroll
= rnd(20 + i
);
2634 strike
= (tmp
> dieroll
);
2635 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2637 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2638 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2642 if (egotypeshredder
) {
2644 mdat2
= &mons
[PM_CAST_DUMMY
];
2645 a
= &mdat2
->mattk
[3];
2651 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2652 dieroll
= rnd(20 + i
);
2653 strike
= (tmp
> dieroll
);
2654 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2656 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2657 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2661 if (egotypeabductor
) {
2663 mdat2
= &mons
[PM_CAST_DUMMY
];
2664 a
= &mdat2
->mattk
[3];
2670 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2671 dieroll
= rnd(20 + i
);
2672 strike
= (tmp
> dieroll
);
2673 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2675 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2676 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2680 if (egotypeincrementor
) {
2682 mdat2
= &mons
[PM_CAST_DUMMY
];
2683 a
= &mdat2
->mattk
[3];
2689 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2690 dieroll
= rnd(20 + i
);
2691 strike
= (tmp
> dieroll
);
2692 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2694 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2695 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2699 if (egotypemirrorimage
) {
2701 mdat2
= &mons
[PM_CAST_DUMMY
];
2702 a
= &mdat2
->mattk
[3];
2708 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2709 dieroll
= rnd(20 + i
);
2710 strike
= (tmp
> dieroll
);
2711 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2713 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2714 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2718 if (egotypecurser
) {
2720 mdat2
= &mons
[PM_CAST_DUMMY
];
2721 a
= &mdat2
->mattk
[3];
2727 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2728 dieroll
= rnd(20 + i
);
2729 strike
= (tmp
> dieroll
);
2730 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2732 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2733 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2737 if (egotypehorner
) {
2739 mdat2
= &mons
[PM_CAST_DUMMY
];
2740 a
= &mdat2
->mattk
[3];
2742 a
->adtyp
= rn2(1000) ? AD_CHRN
: AD_UVUU
;
2744 a
->damd
= (1 + (magr
->m_lev
));
2746 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2747 dieroll
= rnd(20 + i
);
2748 strike
= (tmp
> dieroll
);
2749 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2751 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2752 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2758 mdat2
= &mons
[PM_CAST_DUMMY
];
2759 a
= &mdat2
->mattk
[3];
2765 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2766 dieroll
= rnd(20 + i
);
2767 strike
= (tmp
> dieroll
);
2768 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2770 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2771 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2775 if (egotyperandomizer
) {
2777 mdat2
= &mons
[PM_CAST_DUMMY
];
2778 a
= &mdat2
->mattk
[3];
2782 a
->damd
= (1 + (magr
->m_lev
));
2784 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2785 dieroll
= rnd(20 + i
);
2786 strike
= (tmp
> dieroll
);
2787 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2789 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2790 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2794 if (egotypeblaster
) {
2796 mdat2
= &mons
[PM_CAST_DUMMY
];
2797 a
= &mdat2
->mattk
[3];
2803 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2804 dieroll
= rnd(20 + i
);
2805 strike
= (tmp
> dieroll
);
2806 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2808 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2809 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2813 if (egotypepsychic
) {
2815 mdat2
= &mons
[PM_CAST_DUMMY
];
2816 a
= &mdat2
->mattk
[3];
2820 a
->damd
= (1 + (magr
->m_lev
));
2822 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2823 dieroll
= rnd(20 + i
);
2824 strike
= (tmp
> dieroll
);
2825 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2827 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2828 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2832 if (egotypeabomination
) {
2834 mdat2
= &mons
[PM_CAST_DUMMY
];
2835 a
= &mdat2
->mattk
[3];
2839 a
->damd
= (1 + (magr
->m_lev
));
2841 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2842 dieroll
= rnd(20 + i
);
2843 strike
= (tmp
> dieroll
);
2844 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2846 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2847 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2851 if (egotypeweeper
) {
2853 mdat2
= &mons
[PM_CAST_DUMMY
];
2854 a
= &mdat2
->mattk
[3];
2858 a
->damd
= (1 + (magr
->m_lev
));
2860 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2861 dieroll
= rnd(20 + i
);
2862 strike
= (tmp
> dieroll
);
2863 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2865 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2866 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2870 if (egotypeweaponizer
) {
2872 mdat2
= &mons
[PM_CAST_DUMMY
];
2873 a
= &mdat2
->mattk
[3];
2877 a
->damd
= (1 + (magr
->m_lev
));
2879 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2880 dieroll
= rnd(20 + i
);
2881 strike
= (tmp
> dieroll
);
2882 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2884 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2885 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2889 if (egotypeengulfer
) {
2891 mdat2
= &mons
[PM_CAST_DUMMY
];
2892 a
= &mdat2
->mattk
[3];
2896 a
->damd
= (1 + (magr
->m_lev
));
2898 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2899 dieroll
= rnd(20 + i
);
2900 strike
= (tmp
> dieroll
);
2901 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2903 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2904 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2908 if (evilfriday
&& magr
->data
->mlet
== S_GIANT
) {
2910 mdat2
= &mons
[PM_CAST_DUMMY
];
2911 a
= &mdat2
->mattk
[3];
2915 a
->damd
= 1 + (magr
->m_lev
/ 2);
2917 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2918 dieroll
= rnd(20 + i
);
2919 strike
= (tmp
> dieroll
);
2920 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2922 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2923 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2927 if (evilfriday
&& magr
->data
->mlet
== S_ZOMBIE
) {
2929 mdat2
= &mons
[PM_CAST_DUMMY
];
2930 a
= &mdat2
->mattk
[3];
2936 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2937 dieroll
= rnd(20 + i
);
2938 strike
= (tmp
> dieroll
);
2939 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2941 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2942 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2946 if (evilfriday
&& magr
->data
->mlet
== S_MUMMY
) {
2948 mdat2
= &mons
[PM_CAST_DUMMY
];
2949 a
= &mdat2
->mattk
[3];
2951 a
->adtyp
= rn2(20) ? AD_ICUR
: AD_NACU
;
2955 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2956 dieroll
= rnd(20 + i
);
2957 strike
= (tmp
> dieroll
);
2958 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2960 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2961 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2965 if (evilfriday
&& (is_mplayer(magr
->data
) || is_umplayer(magr
->data
))) {
2966 mdat2
= &mons
[PM_CAST_DUMMY
];
2967 a
= &mdat2
->mattk
[3];
2973 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2974 dieroll
= rnd(20 + i
);
2975 strike
= (tmp
> dieroll
);
2976 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2978 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2979 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
2983 if (evilfriday
&& magr
->data
->mlet
== S_GHOST
) {
2985 mdat2
= &mons
[PM_CAST_DUMMY
];
2986 a
= &mdat2
->mattk
[3];
2992 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
2993 dieroll
= rnd(20 + i
);
2994 strike
= (tmp
> dieroll
);
2995 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
2997 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
2998 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3002 if (uimplant
&& uimplant
->oartifact
== ART_POTATOROK
&& !rn2(10)) {
3004 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
3005 dieroll
= rnd(20 + i
);
3006 strike
= (tmp
> dieroll
);
3009 if (evilfriday
&& magr
->m_lev
> 1) evilragnarok(FALSE
, magr
->m_lev
);
3012 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3013 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3017 if (uwep
&& uwep
->oartifact
== ART_RAFSCHAR_S_SUPERWEAPON
&& !rn2(10)) {
3019 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
3020 dieroll
= rnd(20 + i
);
3021 strike
= (tmp
> dieroll
);
3024 if (evilfriday
&& magr
->m_lev
> 1) evilragnarok(FALSE
, magr
->m_lev
);
3027 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3028 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3032 if (u
.twoweap
&& uswapwep
&& uswapwep
->oartifact
== ART_RAFSCHAR_S_SUPERWEAPON
&& !rn2(10)) {
3034 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
3035 dieroll
= rnd(20 + i
);
3036 strike
= (tmp
> dieroll
);
3039 if (evilfriday
&& magr
->m_lev
> 1) evilragnarok(FALSE
, magr
->m_lev
);
3042 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3043 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3047 if (magr
->data
== &mons
[PM_BOFH
] && isevilvariant
) {
3049 mdat2
= &mons
[PM_CAST_DUMMY
];
3050 a
= &mdat2
->mattk
[3];
3056 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
3057 dieroll
= rnd(20 + i
);
3058 strike
= (tmp
> dieroll
);
3059 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
3061 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3062 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3066 if (magr
->data
== &mons
[PM_ALPHANUMEROGORGON
] && isevilvariant
) {
3068 mdat2
= &mons
[PM_CAST_DUMMY
];
3069 a
= &mdat2
->mattk
[3];
3075 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
3076 dieroll
= rnd(20 + i
);
3077 strike
= (tmp
> dieroll
);
3078 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
3080 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3081 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3085 if (magr
->data
== &mons
[PM_YOUR_GAME_ENDS_NOW
] && isevilvariant
) {
3087 mdat2
= &mons
[PM_CAST_DUMMY
];
3088 a
= &mdat2
->mattk
[3];
3094 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
3095 dieroll
= rnd(20 + i
);
3096 strike
= (tmp
> dieroll
);
3097 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
3099 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3100 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3104 if (magr
->data
== &mons
[PM_MR__CONCLUSIO
] && isevilvariant
) {
3106 mdat2
= &mons
[PM_CAST_DUMMY
];
3107 a
= &mdat2
->mattk
[3];
3113 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
3114 dieroll
= rnd(20 + i
);
3115 strike
= (tmp
> dieroll
);
3116 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
3118 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3119 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3123 if (magr
->data
== &mons
[PM_LEFTOGORGON
] && isevilvariant
) {
3125 mdat2
= &mons
[PM_CAST_DUMMY
];
3126 a
= &mdat2
->mattk
[3];
3132 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
3133 dieroll
= rnd(20 + i
);
3134 strike
= (tmp
> dieroll
);
3135 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
3137 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3138 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3142 if ((magr
->data
== &mons
[PM_DNETHACK_ELDER_PRIEST_TM_
] || (magr
->data
== &mons
[PM_GIANT_ENEMY_CRAB
] && !rn2(20)) || (magr
->data
== &mons
[PM_E_PALE_WRAITH_WITH_A_LIGHTNING_STROKE_
] && !rn2(20)) || magr
->data
== &mons
[PM_SANDRA_S_MINDDRILL_SANDAL
]) && isevilvariant
) {
3144 mdat2
= &mons
[PM_CAST_DUMMY
];
3145 a
= &mdat2
->mattk
[3];
3151 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
3152 dieroll
= rnd(20 + i
);
3153 strike
= (tmp
> dieroll
);
3155 res
[i
] = hitmm(magr
, mdef
, a
);
3157 if (evilfriday
&& magr
->m_lev
> 1) evilragnarok(FALSE
, magr
->m_lev
);
3160 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3161 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3165 if (magr
->data
->msound
== MS_SHRIEK
&& monnear(magr
, mdef
->mx
, mdef
->my
)) {
3166 if (!YouAreDeaf
) pline("%s shrieks.", Monnam(magr
));
3170 if ((magr
->data
->msound
== MS_PHOTO
|| egotypecameraclicker
) && !rn2(50)) {
3172 mdat2
= &mons
[PM_CAST_DUMMY
];
3173 a
= &mdat2
->mattk
[3];
3179 if(monnear(magr
, mdef
->mx
, mdef
->my
)) {
3180 dieroll
= rnd(20 + i
);
3181 strike
= (tmp
> dieroll
);
3182 if (strike
) res
[i
] = hitmm(magr
, mdef
, a
);
3184 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3185 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3189 if ((magr
->data
->msound
== MS_FART_QUIET
|| magr
->data
->msound
== MS_FART_NORMAL
|| magr
->data
->msound
== MS_FART_LOUD
|| magr
->egotype_farter
) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3190 if (magr
->fartbonus
> 9) magr
->fartbonus
= 9; /* fail save */
3191 int monfartchance
= 10 + magr
->butthurt
- magr
->fartbonus
;
3192 if (monfartchance
< 1) monfartchance
= 1; /* yet another fail safe */
3194 if (!rn2(monfartchance
)) {
3196 if (magr
->data
->msound
== MS_FART_QUIET
) pline("%s produces %s farting noises with %s %s butt.", Monnam(magr
), rn2(2) ? "tender" : "soft", mhis(magr
), magr
->female
? "sexy" : "ugly");
3197 else if (magr
->data
->msound
== MS_FART_NORMAL
) pline("%s produces %s farting noises with %s %s butt.", Monnam(magr
), rn2(2) ? "beautiful" : "squeaky", mhis(magr
), magr
->female
? "sexy" : "ugly");
3198 else if (magr
->data
->msound
== MS_FART_LOUD
) pline("%s produces %s farting noises with %s %s butt.", Monnam(magr
), rn2(2) ? "loud" : "disgusting", mhis(magr
), magr
->female
? "sexy" : "ugly");
3199 else pline("%s produces farting noises with %s %s butt.", Monnam(magr
), mhis(magr
), magr
->female
? "sexy" : "ugly");
3201 else if (!YouAreDeaf
) pline("You hear farting noises.");
3205 if (magr
->crapbonus
&& (rn2(100) < magr
->crapbonus
)) {
3207 /* STUPID bug where the game displays the same name twice for some inexplicable reason --Amy */
3208 strcpy(buf
, mon_nam(mdef
));
3210 if (vis
) pline("%s craps in %s's face.", Monnam(magr
), buf
);
3211 else if (!YouAreDeaf
) pline("You hear crapping noises.");
3213 rnd_tmp
= rnd(1 + (level_difficulty() * 3));
3214 if ((rnd_tmp
+= mdef
->mblinded
) > 127) rnd_tmp
= 127;
3215 mdef
->mblinded
= rnd_tmp
;
3222 if ((magr
->data
->msound
== MS_SOUND
|| egotypesounder
) && !rn2(20) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3223 if (vis
) pline("%s lets out an ear-splitting scream!", Monnam(magr
) );
3224 else if (!YouAreDeaf
) pline("You hear a scream.");
3227 if (!rn2(5)) badpeteffect(mdef
);
3230 if ((magr
->data
->msound
== MS_ALLA
|| egotypealladrainer
) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3231 if (vis
) pline("%s's alla is reduced!", Monnam(mdef
));
3235 if ((magr
->data
->msound
== MS_SOCKS
) && mdef
->mcanmove
&& !rn2(10) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3237 /* STUPID bug where the game displays the same name twice for some inexplicable reason --Amy */
3238 strcpy(buf
, mon_nam(mdef
));
3240 if (vis
) pline("%s's beguiling smell affects %s!", Monnam(magr
), buf
);
3242 mdef
->mfrozen
= rn1(3,4);
3243 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
3245 if ((magr
->data
->msound
== MS_PANTS
) && !rn2(10) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3247 /* STUPID bug where the game displays the same name twice for some inexplicable reason --Amy */
3248 strcpy(buf
, Monnam(mdef
));
3250 if (vis
) pline("%s catches a whiff from %s!", buf
, mon_nam(magr
) );
3254 if (magr
->data
->msound
== MS_CUSS
&& !rn2(5) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3256 /* STUPID bug where the game displays the same name twice for some inexplicable reason --Amy */
3257 strcpy(buf
, mon_nam(mdef
));
3261 mdef
->healblock
+= (1 + magr
->m_lev
);
3262 if (vis
) pline("%s calls %s nasty names.", Monnam(magr
), buf
);
3263 } else if (magr
->data
->mlet
== S_ANGEL
|| magr
->mnum
== PM_CHRISTMAS_CHILD
|| magr
->mnum
== PM_HELLS_ANGEL
|| !rn2(5)) {
3264 mdef
->healblock
+= (1 + magr
->m_lev
);
3265 if (vis
) pline("%s is dimmed.", Monnam(mdef
));
3269 if (magr
->data
->msound
== MS_WHORE
&& !rn2(5) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3270 mdef
->healblock
+= (1 + magr
->m_lev
);
3271 if (!rn2(50)) badpeteffect(mdef
);
3272 if (vis
) pline("%s is dimmed.", Monnam(mdef
));
3275 if (magr
->data
->msound
== MS_SUPERMAN
&& !rn2(5) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3276 if (vis
) pline("%s is terrorized by the superman!", Monnam(mdef
));
3277 else You_feel("that something terrible is happening to your companion right now!");
3278 allbadpeteffects(mdef
);
3281 if ((magr
->data
->msound
== MS_CONVERT
|| magr
->egotype_converter
) && !rn2(10) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3282 mdef
->healblock
+= (1 + magr
->m_lev
);
3283 if (vis
) pline("%s seems less faithful.", Monnam(mdef
));
3284 else You_hear("some foreign sermon.");
3286 mdat2
= &mons
[PM_CAST_DUMMY
];
3287 a
= &mdat2
->mattk
[3];
3293 res
[i
] = hitmm(magr
, mdef
, a
);
3294 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3295 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3300 if ((magr
->data
->msound
== MS_HCALIEN
|| magr
->egotype_wouwouer
) && !rn2(15) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3301 if (vis
) pline("%s seems terrorified.", Monnam(mdef
));
3302 else You_hear("a frightening taunt.");
3306 mdat2
= &mons
[PM_CAST_DUMMY
];
3307 a
= &mdat2
->mattk
[3];
3313 res
[i
] = hitmm(magr
, mdef
, a
);
3314 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3315 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3320 if (magr
->data
->msound
== MS_SHOE
&& !rn2(50) && evilfriday
&& monnear(magr
, mdef
->mx
, mdef
->my
)) {
3321 mdat2
= &mons
[PM_CAST_DUMMY
];
3322 a
= &mdat2
->mattk
[3];
3326 a
->damd
= (1 + (magr
->m_lev
));
3328 res
[i
] = hitmm(magr
, mdef
, a
);
3329 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3330 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3333 if (magr
->data
->msound
== MS_BONES
&& !rn2(100) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3334 mdat2
= &mons
[PM_CAST_DUMMY
];
3335 a
= &mdat2
->mattk
[3];
3339 a
->damd
= (1 + (magr
->m_lev
));
3341 res
[i
] = hitmm(magr
, mdef
, a
);
3342 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3343 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3346 if ((magr
->data
->msound
== MS_STENCH
|| magr
->egotype_perfumespreader
) && !rn2(20) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3347 if (vis
) pline("%s inhales the feminine perfume.", Monnam(mdef
));
3351 if ((magr
->data
== &mons
[PM_DHWTY
] || magr
->data
== &mons
[PM_MELUGAST_AO_I_DIMENSION_DRIVER
] || magr
->data
== &mons
[PM_AUTO_AIM_CHEATAH
] || magr
->data
== &mons
[PM_PARTICLE_MAN
] || magr
->data
== &mons
[PM_LAST_DANCER
] || magr
->data
== &mons
[PM_CURTAIN_CALL_LAST_DANCER
] || magr
->data
== &mons
[PM_GRAND_FINALE_LAST_DANCER
] || magr
->data
== &mons
[PM_PROVIDENCE_GAZE
] || magr
->data
== &mons
[PM_CHAOS_SERPENT
] || magr
->data
== &mons
[PM_CHAOTIC_SERPENT
] || magr
->data
== &mons
[PM_ARCHAYEEK_GUNNER
] || magr
->data
== &mons
[PM_SIN_GORILLA
] || magr
->data
== &mons
[PM_ELITE_GUARD
] || magr
->data
== &mons
[PM_ELITE_CROUPIER
] || magr
->data
== &mons
[PM_BLUEBEAM_GOLEM
] || magr
->data
== &mons
[PM_AIRTIGHT_FEMMY
] || magr
->data
== &mons
[PM_DRICERADOPS
] || magr
->data
== &mons
[PM_SVEN
] || magr
->data
== &mons
[PM_GRANDMASTER_SVEN
] || magr
->data
== &mons
[PM_WORLD_PWNZOR
] || magr
->data
== &mons
[PM_DNETHACK_ELDER_PRIEST_TM_
] || magr
->data
== &mons
[PM_SANDRA_S_MINDDRILL_SANDAL
] || magr
->egotype_laserpwnzor
) && monnear(magr
, mdef
->mx
, mdef
->my
)) {
3352 if (!magr
->hominglazer
&& !rn2(20)) {
3353 pline("ATTENTION: Something has started to load an ultra-mega-hyper-dyper laser cannon!");
3354 magr
->hominglazer
= 1;
3355 } else if (magr
->hominglazer
>= 20) {
3356 pline("ZIEIEIEIEIEIEIEIEIEIEIEIEIEIEIEIEIEIEtschhhhhhhhhhhhhhhhhhhhhhhh...");
3357 magr
->hominglazer
= 0;
3359 mdat2
= &mons
[PM_CAST_DUMMY
];
3360 a
= &mdat2
->mattk
[3];
3366 res
[i
] = hitmm(magr
, mdef
, a
);
3367 if (res
[i
] & MM_AGR_DIED
) return res
[i
];
3368 if (res
[i
] & MM_DEF_DIED
) return res
[i
];
3373 } /* special attacks targetting pets */
3375 return(struck
? MM_HIT
: MM_MISS
);
3378 /* monster attempts breath attack against another monster */
3380 breamm(magr
, mdef
, mattk
)
3381 struct monst
*magr
, *mdef
;
3382 struct attack
*mattk
;
3384 /* if new breath types are added, change AD_ACID to max type */
3385 int typ
= mattk
->adtyp
== AD_RBRE
? rnd(AD_SPC2
) : mattk
->adtyp
;
3388 if (DEADMONSTER(magr
)) return 0;
3389 if (DEADMONSTER(mdef
)) return 0;
3391 if (linedup(mdef
->mx
, mdef
->my
, magr
->mx
, magr
->my
, FALSE
)) {
3393 if (flags
.soundok
) {
3394 if (canseemon(magr
))
3395 pline("%s coughs.", Monnam(magr
));
3397 You_hear("a cough.");
3399 } else if (!magr
->mspec_used
&& rn2(3)) {
3400 if (typ
>= AD_MAGM
&& typ
<= AD_SPC2
) {
3401 if (canseemon(magr
))
3402 pline("%s breathes %s!", Monnam(magr
), breathwep
[typ
-1]);
3404 buzz((int)(-20 - (typ
-1)), (rn2(2) ? (int)mattk
->damn
: (int)mattk
->damd
),
3405 magr
->mx
, magr
->my
, sgn(tbx
), sgn(tby
));
3407 /* breath runs out sometimes. */
3409 magr
->mspec_used
= 10+rn2(20);
3410 return (mdef
->mhp
< 1 ? MM_DEF_DIED
: 0) |
3411 (mdef
->mhp
< mhp
? MM_HIT
: 0) |
3412 (magr
->mhp
< 1 ? MM_AGR_DIED
: 0);
3413 } else impossible("Breath weapon %d used", typ
-1);
3419 /* monster attempts spit attack against another monster */
3421 spitmm(magr
, mdef
, mattk
)
3422 struct monst
*magr
, *mdef
;
3423 struct attack
*mattk
;
3425 register struct obj
*obj
;
3428 if (DEADMONSTER(magr
)) return 0;
3429 if (DEADMONSTER(mdef
)) return 0;
3432 if (flags
.soundok
) {
3433 if (canseemon(magr
))
3434 pline("A dry rattle comes from %s throat.",
3435 s_suffix(mon_nam(magr
)));
3437 You_hear("a dry rattle.");
3442 if (linedup(mdef
->mx
, mdef
->my
, magr
->mx
, magr
->my
, FALSE
)) {
3443 switch (mattk
->adtyp
) {
3446 obj
= mksobj(BLINDING_VENOM
, TRUE
, FALSE
, FALSE
);
3449 obj
= mksobj(FAERIE_FLOSS_RHING
, TRUE
, FALSE
, FALSE
);
3452 obj
= mksobj(TAIL_SPIKES
, TRUE
, FALSE
, FALSE
);
3455 obj
= mksobj(SEGFAULT_VENOM
, TRUE
, FALSE
, FALSE
);
3458 pline("bad attack type in spitmm");
3461 obj
= mksobj(ACID_VENOM
, TRUE
, FALSE
, FALSE
);
3464 if (!obj
) return MM_MISS
;
3465 if (!rn2(BOLT_LIM
- distmin(magr
->mx
, magr
->my
, mdef
->mx
, mdef
->my
))) {
3466 if (canseemon(magr
))
3467 pline("%s spits venom!", Monnam(magr
));
3469 m_throw(magr
, magr
->mx
, magr
->my
, sgn(tbx
), sgn(tby
),
3470 distmin(magr
->mx
, magr
->my
, mdef
->mx
, mdef
->my
), obj
);
3472 return (mdef
->mhp
< 1 ? MM_DEF_DIED
: 0) |
3473 (mdef
->mhp
< mhp
? MM_HIT
: 0) |
3474 (magr
->mhp
< 1 ? MM_AGR_DIED
: 0);
3480 /* monster attempts ranged weapon attack against another monster */
3483 struct monst
*magr
, *mdef
;
3485 struct obj
*obj
, *mwep
;
3490 if (DEADMONSTER(magr
)) return 0;
3491 if (DEADMONSTER(mdef
)) return 0;
3493 int polelimit
= POLE_LIM
;
3495 if (magr
->data
== &mons
[PM_MECHTNED
]) return MM_MISS
;
3496 if (magr
->data
== &mons
[PM_IMPALAZON
]) return MM_MISS
;
3497 if (magr
->data
== &mons
[PM_MYSTERY_WOMAN
]) return MM_MISS
;
3499 /* Rearranged beginning so monsters can use polearms not in a line */
3500 if (magr
->weapon_check
== NEED_WEAPON
|| !MON_WEP(magr
)) {
3501 magr
->weapon_check
= NEED_RANGED_WEAPON
;
3502 /* mon_wield_item resets weapon_check as appropriate */
3503 if(mon_wield_item(magr
) != 0) return MM_MISS
;
3507 obj
= select_rwep(magr
,TRUE
); /* can also select polearms even when far away from the player --Amy */
3508 if (!obj
) return MM_MISS
;
3510 if (is_applypole(obj
)) {
3511 int dam
, hitv
, vis
= canseemon(magr
);
3513 if (obj
->otyp
== NOOB_POLLAX
|| obj
->otyp
== GREAT_POLLAX
) polelimit
+= 5;
3514 if (obj
->otyp
== YITH_TENTACLE
) polelimit
+= 2;
3515 if (obj
->otyp
== POLE_LANTERN
) polelimit
+= 10;
3516 if (obj
->otyp
== NASTYPOLE
) polelimit
+= 8;
3517 if (obj
->oartifact
== ART_ETHER_PENETRATOR
) polelimit
+= 5;
3518 if (obj
->oartifact
== ART_FUURKER
) polelimit
+= 6;
3519 if (obj
->otyp
== WOODEN_BAR
) polelimit
+= 7;
3520 if (obj
->oartifact
== ART_OVERLONG_STICK
) polelimit
+= 12;
3522 if (dist2(magr
->mx
, magr
->my
, mdef
->mx
, mdef
->my
) > polelimit
||
3523 !m_cansee(magr
, mdef
->mx
, mdef
->my
))
3524 return MM_MISS
; /* Out of range, or intervening wall */
3528 pline("%s thrusts %s.", Monnam(magr
),
3529 obj_is_pname(obj
) ? the(onm
) : an(onm
));
3532 dam
= dmgval(obj
, mdef
);
3533 hitv
= 3 - distmin(mdef
->mx
, mdef
->my
, magr
->mx
, magr
->my
);
3534 if (hitv
< -4) hitv
= -4;
3535 if (bigmonst(mdef
->data
)) hitv
++;
3536 hitv
+= 8 + obj
->spe
;
3537 if (mdef
->mtame
) hitv
+= magr
->m_lev
;
3538 if (dam
< 1) dam
= 1;
3540 if (find_mac(mdef
) + hitv
<= rnd(20)) {
3541 if (flags
.verbose
&& canseemon(mdef
))
3542 pline("It misses %s.", mon_nam(mdef
));
3544 pline("It misses.");
3547 if (flags
.verbose
&& canseemon(mdef
))
3548 pline("It hits %s%s", a_monnam(mdef
), exclam(dam
));
3551 if (objects
[obj
->otyp
].oc_material
== MT_SILVER
&&
3552 hates_silver(mdef
->data
) && canseemon(mdef
)) {
3554 pline_The("silver sears %s flesh!",
3555 s_suffix(mon_nam(mdef
)));
3557 pline("%s flesh is seared!", s_suffix(Monnam(mdef
)));
3559 if (objects
[obj
->otyp
].oc_material
== MT_VIVA
&& hates_viva(mdef
->data
) && canseemon(mdef
)) {
3560 pline("%s is severely hurt by the radiation!", s_suffix(Monnam(mdef
)));
3562 if (objects
[obj
->otyp
].oc_material
== MT_COPPER
&& hates_copper(mdef
->data
) && canseemon(mdef
)) {
3563 pline("%s decomposes from the contact with copper!", s_suffix(Monnam(mdef
)));
3565 if (objects
[obj
->otyp
].oc_material
== MT_PLATINUM
&& hates_platinum(mdef
->data
) && canseemon(mdef
)) {
3566 pline("%s is smashed!", s_suffix(Monnam(mdef
)));
3568 if (obj
->cursed
&& hates_cursed(mdef
->data
) && canseemon(mdef
)) {
3569 pline("%s is blasted by darkness!", s_suffix(Monnam(mdef
)));
3571 if (objects
[obj
->otyp
].oc_material
== MT_INKA
&& hates_inka(mdef
->data
) && canseemon(mdef
)) {
3572 pline("%s is hurt by the inka string!", s_suffix(Monnam(mdef
)));
3574 if (obj
->otyp
== ODOR_SHOT
&& hates_odor(mdef
->data
) && canseemon(mdef
)) {
3575 pline("%s groans at the odor!", s_suffix(Monnam(mdef
)));
3578 if (mdef
->mhp
< 1) {
3579 if (canseemon(mdef
))
3580 pline("%s is %s!", Monnam(mdef
),
3581 (nonliving(mdef
->data
) || !canspotmon(mdef
))
3582 ? "destroyed" : "killed");
3584 return MM_DEF_DIED
| MM_HIT
;
3593 if (!linedup(mdef
->mx
, mdef
->my
, magr
->mx
, magr
->my
, FALSE
))
3596 skill
= objects
[obj
->otyp
].oc_skill
;
3597 mwep
= MON_WEP(magr
); /* wielded weapon */
3599 if (mwep
&& ammo_and_launcher(obj
, mwep
) && objects
[mwep
->otyp
].oc_range
&&
3600 dist2(magr
->mx
, magr
->my
, mdef
->mx
, mdef
->my
) >
3601 objects
[mwep
->otyp
].oc_range
* objects
[mwep
->otyp
].oc_range
)
3602 return MM_MISS
; /* Out of range */
3604 /* Multishot calculations */
3606 if (( (mwep
&& ammo_and_launcher(obj
, mwep
)) || skill
== P_DAGGER
||
3607 skill
== -P_DART
|| skill
== -P_SHURIKEN
) && !magr
->mconf
) {
3608 /* Assumes lords are skilled, princes are expert */
3609 if (is_prince(magr
->data
)) multishot
+= 2;
3610 else if (is_lord(magr
->data
)) multishot
++;
3612 /* strong, nasty or high-level monsters can also shoot more --Amy */
3613 if (magr
->m_lev
>= 10 && strongmonst(magr
->data
) && !rn2(3)) multishot
++;
3614 if (magr
->m_lev
>= 10 && strongmonst(magr
->data
) && !rn2(9)) multishot
++;
3615 if (magr
->m_lev
>= 10 && strongmonst(magr
->data
) && !rn2(27)) multishot
++;
3617 if (magr
->m_lev
>= 10 && extra_nasty(magr
->data
) && !rn2(2)) multishot
++;
3618 if (magr
->m_lev
>= 10 && extra_nasty(magr
->data
) && !rn2(4)) multishot
++;
3619 if (magr
->m_lev
>= 10 && extra_nasty(magr
->data
) && !rn2(8)) multishot
++;
3621 if (magr
->m_lev
>= 10 && magr
->m_lev
< 20) multishot
+= 1;
3622 if (magr
->m_lev
>= 20 && magr
->m_lev
< 30) multishot
+= rnd(2);
3623 if (magr
->m_lev
>= 30 && magr
->m_lev
< 40) multishot
+= rnd(3);
3624 if (magr
->m_lev
>= 40 && magr
->m_lev
< 50) multishot
+= rnd(4);
3625 if (magr
->m_lev
>= 50 && magr
->m_lev
< 60) multishot
+= rnd(5);
3626 if (magr
->m_lev
>= 60 && magr
->m_lev
< 70) multishot
+= rnd(6);
3627 if (magr
->m_lev
>= 70 && magr
->m_lev
< 80) multishot
+= rnd(7);
3628 if (magr
->m_lev
>= 80 && magr
->m_lev
< 90) multishot
+= rnd(8);
3629 if (magr
->m_lev
>= 90 && magr
->m_lev
< 100) multishot
+= rnd(9);
3630 if (magr
->m_lev
>= 100) multishot
+= rnd(10);
3632 /* Elven Craftsmanship makes for light, quick bows */
3633 if (obj
->otyp
== ELVEN_ARROW
&& !obj
->cursed
)
3635 if (mwep
&& mwep
->otyp
== ELVEN_BOW
&& !mwep
->cursed
) multishot
++;
3637 if (mwep
&& mwep
->otyp
== WILDHILD_BOW
&& obj
->otyp
== ODOR_SHOT
) multishot
++;
3638 if (mwep
&& mwep
->otyp
== COMPOST_BOW
&& obj
->otyp
== FORBIDDEN_ARROW
) multishot
++;
3640 if (mwep
&& mwep
->otyp
== CATAPULT
) multishot
+= rnd(5);
3642 if (mwep
&& mwep
->otyp
== HYDRA_BOW
) multishot
+= 2;
3643 if (mwep
&& mwep
->otyp
== DEMON_CROSSBOW
) multishot
+= 4;
3644 if (mwep
&& mwep
->otyp
== WILDHILD_BOW
) multishot
+= 2;
3646 /* 1/3 of object enchantment */
3647 if (mwep
&& mwep
->spe
> 1)
3648 multishot
+= rounddiv(mwep
->spe
, 3);
3649 /* Some randomness */
3651 multishot
= rnd(multishot
);
3652 if (mwep
&& objects
[mwep
->otyp
].oc_rof
&& is_launcher(mwep
))
3653 multishot
+= objects
[mwep
->otyp
].oc_rof
;
3655 switch (monsndx(magr
->data
)) {
3657 case PM_IBERIAN_SOLDIER
:
3660 case PM_BLUE_ARCHER
:
3665 case PM_GATLING_ARCHER
:
3668 case PM_PELLET_ARCHER
:
3670 case PM_SHOTGUN_HORROR
:
3671 case PM_SHOTGUN_TERROR
:
3672 case PM_KOBOLD_PEPPERMASTER
:
3681 if (obj
->otyp
== ELVEN_ARROW
&& mwep
&& mwep
->otyp
== ELVEN_BOW
) multishot
++;
3684 if (skill
== P_DAGGER
) multishot
++;
3686 case PM_NINJA_GAIDEN
:
3689 if (obj
->otyp
== YA
&& mwep
&& mwep
->otyp
== YUMI
) multishot
++;
3690 if (obj
->otyp
== FAR_EAST_ARROW
&& mwep
&& mwep
->otyp
== YUMI
) multishot
++;
3696 if ((is_elf(magr
->data
) &&
3697 obj
->otyp
== ELVEN_ARROW
&&
3698 mwep
&& mwep
->otyp
== ELVEN_BOW
) ||
3699 (is_orc(magr
->data
) &&
3700 obj
->otyp
== ORCISH_ARROW
&&
3701 mwep
&& mwep
->otyp
== ORCISH_BOW
))
3704 /* monster-versus-monster is less critical than monster-versus-player, so we don't put the reduction for
3705 * weaker monsters here that is present in mthrowu.c --Amy */
3707 if ((long)multishot
> obj
->quan
) multishot
= (int)obj
->quan
;
3708 if (multishot
< 1) multishot
= 1;
3709 /* else multishot = rnd(multishot); */
3712 if (canseemon(magr
)) {
3715 if (multishot
> 1) {
3716 /* "N arrows"; multishot > 1 implies obj->quan > 1, so
3717 xname()'s result will already be pluralized */
3718 sprintf(onmbuf
, "%d %s", multishot
, xname(obj
));
3722 onm
= singular(obj
, xname
);
3723 onm
= obj_is_pname(obj
) ? the(onm
) : an(onm
);
3725 m_shot
.s
= (mwep
&& ammo_and_launcher(obj
,mwep
)) ? TRUE
: FALSE
;
3726 pline("%s %s %s!", Monnam(magr
),
3727 m_shot
.s
? is_bullet(obj
) ? "fires" : "shoots" : "throws",
3729 m_shot
.o
= obj
->otyp
;
3731 m_shot
.o
= STRANGE_OBJECT
; /* don't give multishot feedback */
3735 m_shot
.n
= multishot
;
3736 for (m_shot
.i
= 1; m_shot
.i
<= m_shot
.n
; m_shot
.i
++)
3737 m_throw(magr
, magr
->mx
, magr
->my
, sgn(tbx
), sgn(tby
),
3738 distmin(magr
->mx
, magr
->my
, mdef
->mx
, mdef
->my
), obj
);
3739 m_shot
.n
= m_shot
.i
= 0;
3740 m_shot
.o
= STRANGE_OBJECT
;
3745 return (mdef
->mhp
< 1 ? MM_DEF_DIED
: 0) | (mdef
->mhp
< mhp
? MM_HIT
: 0) |
3746 (magr
->mhp
< 1 ? MM_AGR_DIED
: 0);
3749 /* Returns the result of mdamagem(). */
3751 hitmm(magr
, mdef
, mattk
)
3752 register struct monst
*magr
,*mdef
;
3753 struct attack
*mattk
;
3755 if (DEADMONSTER(magr
)) return 0;
3756 if (DEADMONSTER(mdef
)) return 0;
3760 char buf
[BUFSZ
], mdef_name
[BUFSZ
];
3762 if (!canspotmon(magr
) && !(magr
->data
->msound
== MS_DEEPSTATE
) && !(magr
->egotype_deepstatemember
))
3763 map_invisible(magr
->mx
, magr
->my
);
3764 if (!canspotmon(mdef
) && !(mdef
->data
->msound
== MS_DEEPSTATE
) && !(mdef
->egotype_deepstatemember
))
3765 map_invisible(mdef
->mx
, mdef
->my
);
3766 if(mdef
->m_ap_type
) seemimic(mdef
);
3767 if(magr
->m_ap_type
) seemimic(magr
);
3768 if((compat
= could_seduce(magr
,mdef
,mattk
)) && !magr
->mcan
) {
3769 sprintf(buf
, "%s %s", Monnam(magr
),
3770 mdef
->mcansee
? "smiles at" : "talks to");
3771 pline("%s %s %s.", buf
, mon_nam(mdef
),
3773 "engagingly" : "seductively");
3775 char magr_name
[BUFSZ
];
3777 strcpy(magr_name
, Monnam(magr
));
3778 switch (mattk
->aatyp
) {
3780 sprintf(buf
,"%s bites", magr_name
);
3783 sprintf(buf
,"%s claws", magr_name
);
3786 sprintf(buf
,"%s stings", magr_name
);
3789 sprintf(buf
,"%s butts", magr_name
);
3792 sprintf(buf
,"%s lashes", magr_name
);
3795 sprintf(buf
,"%s tramples over", magr_name
);
3798 sprintf(buf
,"%s scratches", magr_name
);
3801 sprintf(buf
,"%s touches", magr_name
);
3804 sprintf(buf
,"%s blasts", magr_name
);
3807 sprintf(buf
,"%s kicks", magr_name
);
3810 sprintf(buf
,"%s breathes at", magr_name
);
3813 sprintf(buf
,"%s spits at", magr_name
);
3816 sprintf(buf
, "%s tentacles suck",
3817 s_suffix(magr_name
));
3820 if (magr
!= u
.ustuck
) {
3821 sprintf(buf
,"%s squeezes", magr_name
);
3828 sprintf(buf
,"%s hits", magr_name
);
3830 pline("%s %s.", buf
, mon_nam_too(mdef_name
, mdef
, magr
));
3832 } else /* not vis */ noises(magr
, mattk
);
3834 /* stooges infighting but not actually hurting each other, ported from nethack 2.3e by Amy */
3835 if ((magr
->data
== &mons
[PM_STOOGE_LARRY
] || magr
->data
== &mons
[PM_STOOGE_CURLY
] || magr
->data
== &mons
[PM_STOOGE_MOE
]) && (mdef
->data
== &mons
[PM_STOOGE_LARRY
] || mdef
->data
== &mons
[PM_STOOGE_CURLY
] || mdef
->data
== &mons
[PM_STOOGE_MOE
])) {
3837 if (!rn2(6) && !mdef
->mblinded
&& mdef
->mcansee
) {
3838 if(vis
) pline("%s is poked in the %s!", Monnam(mdef
), mbodypart(mdef
, EYE
));
3840 mdef
->mblinded
+= rnd(10);
3841 if (mdef
->mblinded
<= 0) mdef
->mblinded
= 127;
3844 case 0 : pline("%s is shoved!", Monnam(mdef
));
3846 case 1 : pline("%s is kicked!", Monnam(mdef
));
3848 case 2 : pline("%s is slapped!", Monnam(mdef
));
3850 case 3 : pline("%s is slugged!", Monnam(mdef
));
3852 case 4 : pline("%s is punched!", Monnam(mdef
));
3854 case 5 : pline("%s is pinched!", Monnam(mdef
));
3856 case 6 : pline("But %s dodges!", mon_nam(mdef
));
3858 case 7 : pline("But %s ducks!", mon_nam(mdef
));
3860 case 8 : pline("%s gets a black %s!", Monnam(mdef
), mbodypart(mdef
, EYE
));
3862 case 9 : pline("%s gets a bloody %s!", Monnam(mdef
), mbodypart(mdef
, NOSE
));
3864 case 10: pline("%s gets a broken tooth!", Monnam(mdef
));
3866 default: break; /* nothing */
3875 if (mdef
->mtame
&& !rn2(3) && mattk
->aatyp
== AT_KICK
) {
3876 struct obj
*footwear
= which_armor(magr
, W_ARMF
);
3877 if (footwear
&& ishighheeled(footwear
)) {
3878 if (vis
) pline("%s is kicked by female shoes!", Monnam(mdef
));
3880 if (DEADMONSTER(mdef
)) return 2; /* defender died */
3885 if (mdef
->mtame
&& !rn2(3) && mattk
->aatyp
== AT_WEAP
) {
3887 struct obj
*heelshoe
= MON_WEP(magr
);
3888 if (heelshoe
&& (heelshoe
->otyp
== WEDGED_LITTLE_GIRL_SANDAL
|| heelshoe
->otyp
== STURDY_PLATEAU_BOOT_FOR_GIRLS
|| heelshoe
->otyp
== BLOCK_HEELED_SANDAL
|| heelshoe
->otyp
== PROSTITUTE_SHOE
|| heelshoe
->otyp
== BLOCK_HEELED_COMBAT_BOOT
|| heelshoe
->otyp
== HUGGING_BOOT
|| heelshoe
->otyp
== WOODEN_GETA
|| heelshoe
->otyp
== LACQUERED_DANCING_SHOE
|| heelshoe
->otyp
== SEXY_MARY_JANE
|| heelshoe
->otyp
== KITTEN_HEEL_PUMP
|| heelshoe
->otyp
== HIGH_HEELED_SANDAL
|| heelshoe
->otyp
== SEXY_LEATHER_PUMP
|| heelshoe
->otyp
== INKA_BOOT
|| heelshoe
->otyp
== SOFT_LADY_SHOE
|| heelshoe
->otyp
== STEEL_CAPPED_SANDAL
|| heelshoe
->otyp
== DOGSHIT_BOOT
|| heelshoe
->otyp
== SPIKED_BATTLE_BOOT
) ) {
3889 if (vis
) pline("%s is whacked by a high-heeled shoe!", Monnam(mdef
));
3891 if (DEADMONSTER(mdef
)) return 2; /* defender died */
3896 if (DEADMONSTER(mdef
)) return 2; /* defender died */
3898 return(mdamagem(magr
, mdef
, mattk
));
3901 /* Returns the same values as mdamagem(). */
3903 gazemm(magr
, mdef
, mattk
)
3904 register struct monst
*magr
, *mdef
;
3905 struct attack
*mattk
;
3909 if (DEADMONSTER(magr
)) return 0;
3910 if (DEADMONSTER(mdef
)) return 0;
3913 sprintf(buf
,"%s gazes at", Monnam(magr
));
3914 pline("%s %s...", buf
, mon_nam(mdef
));
3917 if (magr
->mcan
|| !magr
->mcansee
|| magr
->minvisreal
||
3918 (magr
->minvis
&& !perceives(mdef
->data
)) ||
3919 !mdef
->mcansee
|| mdef
->msleeping
) {
3920 if(vis
) pline("but nothing happens.");
3923 /* call mon_reflects 2x, first test, then, if visible, print message */
3924 if (magr
->data
== &mons
[PM_MEDUSA
] && mon_reflects(mdef
, (char *)0)) {
3925 if (canseemon(mdef
))
3926 (void) mon_reflects(mdef
,
3927 "The gaze is reflected away by %s %s.");
3928 if (mdef
->mcansee
) {
3929 if (mon_reflects(magr
, (char *)0)) {
3930 if (canseemon(magr
))
3931 (void) mon_reflects(magr
,
3932 "The gaze is reflected away by %s %s.");
3935 if ((mdef
->minvis
&& !perceives(magr
->data
)) || mdef
->minvisreal
) {
3936 if (canseemon(magr
)) {
3937 pline("%s doesn't seem to notice that %s gaze was reflected.",
3938 Monnam(magr
), mhis(magr
));
3942 if (canseemon(magr
))
3943 pline("%s is turned to stone!", Monnam(magr
));
3945 if (magr
->mhp
> 0) return (MM_MISS
);
3946 return (MM_AGR_DIED
);
3950 return(mdamagem(magr
, mdef
, mattk
));
3953 /* Returns the same values as mattackm(). */
3955 gulpmm(magr
, mdef
, mattk
)
3956 register struct monst
*magr
, *mdef
;
3957 register struct attack
*mattk
;
3959 xchar ax
, ay
, dx
, dy
;
3964 if (DEADMONSTER(magr
)) return 0;
3965 if (DEADMONSTER(mdef
)) return 0;
3967 if (mdef
->data
->msize
>= MZ_HUGE
&& magr
->data
->msize
< MZ_HUGE
) return MM_MISS
;
3970 sprintf(buf
,"%s swallows", Monnam(magr
));
3971 pline("%s %s.", buf
, mon_nam(mdef
));
3973 for (obj
= mdef
->minvent
; obj
; obj
= obj
->nobj
)
3974 (void) snuff_lit(obj
);
3977 * All of this maniuplation is needed to keep the display correct.
3978 * There is a flush at the next pline().
3985 * Leave the defender in the monster chain at it's current position,
3986 * but don't leave it on the screen. Move the agressor to the def-
3989 remove_monster(ax
, ay
);
3990 place_monster(magr
, dx
, dy
);
3991 newsym(ax
,ay
); /* erase old position */
3992 newsym(dx
,dy
); /* update new position */
3994 status
= mdamagem(magr
, mdef
, mattk
);
3996 if ((status
& MM_AGR_DIED
) && (status
& MM_DEF_DIED
)) {
3997 ; /* both died -- do nothing */
3999 else if (status
& MM_DEF_DIED
) { /* defender died */
4001 * Note: remove_monster() was called in relmon(), wiping out
4002 * magr from level.monsters[mdef->mx][mdef->my]. We need to
4003 * put it back and display it. -kd
4005 place_monster(magr
, dx
, dy
);
4008 else if (status
& MM_AGR_DIED
) { /* agressor died */
4009 place_monster(mdef
, dx
, dy
);
4012 else { /* both alive, put them back */
4014 pline("%s is regurgitated!", Monnam(mdef
));
4016 place_monster(magr
, ax
, ay
);
4017 place_monster(mdef
, dx
, dy
);
4026 explmm(magr
, mdef
, mattk
)
4027 register struct monst
*magr
, *mdef
;
4028 register struct attack
*mattk
;
4032 if (DEADMONSTER(magr
)) return 0;
4033 if (DEADMONSTER(mdef
)) return 0;
4038 if(cansee(magr
->mx
, magr
->my
))
4039 pline("%s explodes!", Monnam(magr
));
4040 else noises(magr
, mattk
);
4042 remove_monster(magr
->mx
, magr
->my
); /* MAR */
4043 result
= mdamagem(magr
, mdef
, mattk
);
4044 place_monster(magr
,magr
->mx
, magr
->my
); /* MAR */
4046 /* Kill off agressor if it didn't die. */
4047 if (!(result
& MM_AGR_DIED
)) {
4049 if (magr
->mhp
> 0) return result
; /* life saved */
4050 result
|= MM_AGR_DIED
;
4052 /* KMH -- Player gets blame for flame/freezing sphere */
4053 if (magr
->isspell
&& !(result
& MM_DEF_DIED
))
4055 /* give this one even if it was visible, except for spell creatures */
4056 if (magr
->mtame
&& !magr
->isspell
)
4057 You(brief_feeling
, "melancholy");
4063 * See comment at top of mattackm(), for return values.
4066 mdamagem(magr
, mdef
, mattk
)
4067 register struct monst
*magr
, *mdef
;
4068 register struct attack
*mattk
;
4071 if (DEADMONSTER(magr
)) return 0;
4072 if (DEADMONSTER(mdef
)) return 0;
4076 struct permonst
*pa
= magr
->data
, *pd
= mdef
->data
;
4077 int armpro
, num
, tmp
= d((int)mattk
->damn
, (int)mattk
->damd
);
4079 int canhitmon
, objenchant
;
4080 boolean nohit
= FALSE
;
4085 if (touch_petrifies(pd
) && !rn2(4) && !resists_ston(magr
)) {
4086 long protector
= attk_protection((int)mattk
->aatyp
),
4087 wornitems
= magr
->misc_worn_check
;
4089 /* wielded weapon gives same protection as gloves here */
4090 if (otmp
!= 0) wornitems
|= W_ARMG
;
4092 if (protector
== 0L ||
4093 (protector
!= ~0L && (wornitems
& protector
) != protector
)) {
4094 if (poly_when_stoned(pa
)) {
4096 return MM_HIT
; /* no damage during the polymorph */
4098 if (vis
) pline("%s turns to stone!", Monnam(magr
));
4100 if (magr
->mhp
> 0) return 0;
4101 else if (magr
->mtame
&& !vis
)
4102 You(brief_feeling
, "peculiarly sad");
4108 if (need_one(mdef
)) canhitmon
= 1;
4109 if (need_two(mdef
)) canhitmon
= 2;
4110 if (need_three(mdef
)) canhitmon
= 3;
4111 if (need_four(mdef
)) canhitmon
= 4;
4112 if (uarmf
&& uarmf
->oartifact
== ART_KILLCAP
) canhitmon
= 0;
4114 if (mattk
->aatyp
== AT_WEAP
&& otmp
) {
4115 objenchant
= otmp
->spe
;
4116 if (objenchant
< 0) objenchant
= 0;
4117 if (otmp
->oartifact
) {
4118 if (otmp
->spe
< 2) objenchant
+= 1;
4119 else objenchant
= 2;
4121 if (is_lightsaber(otmp
)) objenchant
= 4;
4122 } else objenchant
= 0;
4124 /* a monster that needs a +1 weapon to hit it hits as a +1 weapon... */
4125 if (need_one(magr
)) objenchant
= 1;
4126 if (need_two(magr
)) objenchant
= 2;
4127 if (need_three(magr
)) objenchant
= 3;
4128 if (need_four(magr
)) objenchant
= 4;
4129 /* overridden by specific flags */
4130 if (hit_as_one(magr
)) objenchant
= 1;
4131 if (hit_as_two(magr
)) objenchant
= 2;
4132 if (hit_as_three(magr
)) objenchant
= 3;
4133 if (hit_as_four(magr
)) objenchant
= 4;
4135 if (objenchant
< canhitmon
&& !rn2(3)) nohit
= TRUE
;
4137 /* cancellation factor is the same as when attacking the hero */
4138 armpro
= magic_negation(mdef
);
4139 if (mdef
->data
->mr
>= 49) armpro
++; /* highly magic resistant monsters should have magic cancellation --Amy */
4140 if (mdef
->data
->mr
>= 69) armpro
++;
4141 if (mdef
->data
->mr
>= 99) armpro
++;
4142 cancelled
= magr
->mcan
|| !((rn2(3) >= armpro
) || !rn2(50));
4144 petdamagebonus
= 100;
4146 if (magr
->mtame
&& !mdef
->mtame
&& !PlayerCannotUseSkills
) { /* bonus damage to make pets more viable --Amy */
4147 switch (P_SKILL(P_PETKEEPING
)) {
4149 case P_BASIC
: petdamagebonus
+= 16; break;
4150 case P_SKILLED
: petdamagebonus
+= 32; break;
4151 case P_EXPERT
: petdamagebonus
+= 50; break;
4152 case P_MASTER
: petdamagebonus
+= 75; break;
4153 case P_GRAND_MASTER
: petdamagebonus
+= 100; break;
4154 case P_SUPREME_MASTER
: petdamagebonus
+= 150; break;
4161 if (magr
->mtame
&& !mdef
->mtame
) petdamagebonus
+= (boost_power_value() * 3);
4163 if (magr
->mtame
&& !mdef
->mtame
&& (magr
->data
->mlet
== S_QUADRUPED
) && Race_if(PM_ENGCHIP
)) {
4164 petdamagebonus
+= 25;
4167 if (magr
->mtame
&& !mdef
->mtame
) {
4168 /* and a little help if pet's experience level is very high, to make large cats etc. more useful --Amy */
4169 int overlevelled
= 0;
4170 if (magr
->m_lev
> magr
->data
->mlevel
) overlevelled
= ((magr
->m_lev
- magr
->data
->mlevel
) * 3 / 2);
4171 if (overlevelled
> 0) {
4172 petdamagebonus
+= overlevelled
;
4175 /* it is not a bug that uhitm.c multiplies the level difference by two and this function only gives a
4176 * 50% boost, because your max level is only 30, while pets can reach 49 --Amy */
4180 /* riding skill is now finally useful too, as it boosts steed damage --Amy */
4181 if (u
.usteed
&& magr
== u
.usteed
&& !mdef
->mtame
&& !PlayerCannotUseSkills
) {
4182 switch (P_SKILL(P_RIDING
)) {
4184 case P_BASIC
: petdamagebonus
+= 16; break;
4185 case P_SKILLED
: petdamagebonus
+= 32; break;
4186 case P_EXPERT
: petdamagebonus
+= 50; break;
4187 case P_MASTER
: petdamagebonus
+= 75; break;
4188 case P_GRAND_MASTER
: petdamagebonus
+= 100; break;
4189 case P_SUPREME_MASTER
: petdamagebonus
+= 150; break;
4195 if (u
.usteed
&& magr
== u
.usteed
&& !mdef
->mtame
&& !PlayerCannotUseSkills
&& Race_if(PM_PERVERT
)) {
4196 switch (P_SKILL(P_RIDING
)) {
4198 case P_BASIC
: petdamagebonus
+= 8; break;
4199 case P_SKILLED
: petdamagebonus
+= 16; break;
4200 case P_EXPERT
: petdamagebonus
+= 25; break;
4201 case P_MASTER
: petdamagebonus
+= 37; break;
4202 case P_GRAND_MASTER
: petdamagebonus
+= 50; break;
4203 case P_SUPREME_MASTER
: petdamagebonus
+= 75; break;
4210 if (magr
->egotype_champion
) petdamagebonus
+= 10; /* smaller bonuses than mhitu, intentional --Amy */
4211 if (magr
->egotype_boss
) petdamagebonus
+= 25;
4212 if (magr
->egotype_atomizer
) petdamagebonus
+= 50;
4214 /* tame bosses are simply better --Amy */
4215 if (magr
->mtame
&& !mdef
->mtame
&& (magr
->data
->geno
& G_UNIQ
)) petdamagebonus
+= 25;
4217 if (petdamagebonus
> 100 && magr
->mtame
&& (tmp
> 1 || (tmp
== 1 && petdamagebonus
>= 150) )) {
4219 tmp
*= petdamagebonus
;
4225 if (magr
->egotype_champion
) {
4229 if (magr
->egotype_boss
) {
4233 if (magr
->data
->geno
& G_UNIQ
) {
4237 if (magr
->egotype_atomizer
) {
4244 atttyp
= mattk
->adtyp
;
4247 if (atttyp
== AD_RBRE
) {
4248 while (atttyp
== AD_ENDS
|| atttyp
== AD_RBRE
|| atttyp
== AD_WERE
) {
4249 atttyp
= randattack();
4253 if (atttyp
== AD_DAMA
) {
4254 atttyp
= randomdamageattack();
4257 if (atttyp
== AD_ILLU
) {
4258 atttyp
= randomillusionattack();
4261 if (atttyp
== AD_THIE
) {
4262 atttyp
= randomthievingattack();
4265 if (atttyp
== AD_RNG
) {
4266 while (atttyp
== AD_ENDS
|| atttyp
== AD_RNG
|| atttyp
== AD_WERE
) {
4267 atttyp
= rn2(AD_ENDS
); }
4270 if (atttyp
== AD_PART
) atttyp
= u
.adpartattack
;
4272 if (atttyp
== AD_MIDI
) {
4273 atttyp
= magr
->m_id
;
4274 if (atttyp
< 0) atttyp
*= -1;
4275 while (atttyp
>= AD_ENDS
) atttyp
-= AD_ENDS
;
4276 if (!(atttyp
>= AD_PHYS
&& atttyp
< AD_ENDS
)) atttyp
= AD_PHYS
; /* fail safe --Amy */
4277 if (atttyp
== AD_WERE
) atttyp
= AD_PHYS
;
4284 if (!rnd(25)) { /* since this is an instakill, greatly lower the chance of it connecting --Amy */
4285 if (nohit
) nohit
= FALSE
;
4286 /* eating a Rider or its corpse is fatal */
4287 if (is_rider(mdef
->data
) || is_deadlysin(mdef
->data
) ) {
4289 pline("%s %s!", Monnam(magr
),
4290 mdef
->data
== &mons
[PM_FAMINE
] ?
4291 "belches feebly, shrivels up and dies" :
4292 mdef
->data
== &mons
[PM_PESTILENCE
] ?
4293 "coughs spasmodically and collapses" :
4294 "vomits violently and drops dead");
4296 if (magr
->mhp
> 0) return 0; /* lifesaved */
4297 else if (magr
->mtame
&& !vis
)
4298 You(brief_feeling
, "queasy");
4301 if(flags
.verbose
&& flags
.soundok
) verbalize("Burrrrp!");
4303 /* Use up amulet of life saving */
4304 if (!!(obj
= mlifesaver(mdef
))) m_useup(mdef
, obj
);
4306 /* Is a corpse for nutrition possible? It may kill magr */
4307 if (!corpse_chance(mdef
, magr
, TRUE
) || magr
->mhp
< 1)
4310 /* Pets get nutrition from swallowing monster whole.
4311 * No nutrition from G_NOCORPSE monster, eg, undead.
4312 * DGST monsters don't die from undead corpses
4314 num
= monsndx(mdef
->data
);
4315 if (magr
->mtame
&& !magr
->isminion
&&
4316 !(mvitals
[num
].mvflags
& G_NOCORPSE
)) {
4317 struct obj
*virtualcorpse
= mksobj(CORPSE
, FALSE
, FALSE
, FALSE
);
4320 if (virtualcorpse
) {
4322 virtualcorpse
->corpsenm
= num
;
4323 virtualcorpse
->owt
= weight(virtualcorpse
);
4324 nutrit
= dog_nutrition(magr
, virtualcorpse
);
4325 dealloc_obj(virtualcorpse
);
4329 /* only 50% nutrition, 25% of normal eating time */
4330 if (magr
->meating
> 1) magr
->meating
= (magr
->meating
+3)/4;
4331 if (nutrit
> 1) nutrit
/= 2;
4332 EDOG(magr
)->hungrytime
+= nutrit
;
4337 if (magr
->mcan
) break;
4338 if (canseemon(mdef
))
4339 pline("%s %s for a moment.", Monnam(mdef
), makeplural(stagger(mdef
->data
, "stagger")));
4341 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
4343 if (tmp
< 1) tmp
= 1;
4348 if (magr
->mcan
) break;
4349 if (canseemon(mdef
))
4350 pline("%s %s for a moment.", Monnam(mdef
), makeplural(stagger(mdef
->data
, "stagger")));
4352 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
4354 if (tmp
< 1) tmp
= 1;
4356 if (mdef
->mtame
&& !rn2(4)) {
4357 mon_adjust_speed(mdef
, -1, (struct obj
*)0);
4358 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
4359 if (!rn2(4)) mdef
->inertia
+= (2 + (tmp
* 2));
4363 if (magr
->mcan
) break;
4364 if (canseemon(mdef
))
4365 pline("%s %s for a moment.", Monnam(mdef
), makeplural(stagger(mdef
->data
, "stagger")));
4367 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
4369 if (tmp
< 1) tmp
= 1;
4372 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
4373 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
4374 if (!rn2(3)) badpeteffect(mdef
);
4378 if (magr
->mcan
) break;
4379 if (canseemon(mdef
))
4380 pline("%s %s for a moment.", Monnam(mdef
), makeplural(stagger(mdef
->data
, "stagger")));
4382 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
4384 if (tmp
< 1) tmp
= 1;
4388 if (!rn2(5)) badpeteffect(mdef
);
4396 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
4398 if (tmp
< 1) tmp
= 1;
4400 if (mdef
->mtame
&& !rn2(7)) {
4401 mon_adjust_speed(mdef
, -1, (struct obj
*)0);
4402 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
4403 if (tmp
> 0) mdef
->bleedout
+= rnd(tmp
);
4404 if (!rn2(3)) mdef
->inertia
+= (3 + (tmp
* 3));
4408 if (mdef
->mtame
&& !rn2(3)) {
4410 int untamingchance
= 10;
4412 if (!(PlayerCannotUseSkills
)) {
4413 switch (P_SKILL(P_PETKEEPING
)) {
4414 default: untamingchance
= 10; break;
4415 case P_BASIC
: untamingchance
= 9; break;
4416 case P_SKILLED
: untamingchance
= 8; break;
4417 case P_EXPERT
: untamingchance
= 7; break;
4418 case P_MASTER
: untamingchance
= 6; break;
4419 case P_GRAND_MASTER
: untamingchance
= 5; break;
4420 case P_SUPREME_MASTER
: untamingchance
= 4; break;
4424 /* Certain monsters aren't even made peaceful. */
4425 if (!mdef
->iswiz
&& mdef
->data
!= &mons
[PM_MEDUSA
] &&
4426 !(mdef
->data
->mflags3
& M3_COVETOUS
) && !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && mdef
->data
->mlet
== S_DRAGON
) && !(mdef
->data
->geno
& G_UNIQ
) &&
4427 ((magr
->mtame
&& !rn2(10)) || (mdef
->mtame
&& (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4)) )) {
4428 if (vis
) pline("%s looks calmer.", Monnam(mdef
));
4429 if (mdef
== u
.usteed
&& !mayfalloffsteed())
4430 dismount_steed(DISMOUNT_THROWN
);
4431 if (!mdef
->mfrenzied
&& !rn2(3)) mdef
->mpeaceful
= 1;
4432 else mdef
->mpeaceful
= 0;
4442 if (mattk
->aatyp
== AT_WEAP
&& otmp
) {
4443 if (otmp
->otyp
== CORPSE
&&
4444 touch_petrifies(&mons
[otmp
->corpsenm
]) && nohit
)
4446 } else if(nohit
) break;
4447 if (mattk
->aatyp
== AT_KICK
&& thick_skinned(pd
) && tmp
&& rn2(3)) {
4449 } else if(mattk
->aatyp
== AT_WEAP
) {
4451 if (otmp
->otyp
== CORPSE
&&
4452 touch_petrifies(&mons
[otmp
->corpsenm
]) && !(magr
->mtame
&& nocorpsedecay(&mons
[otmp
->corpsenm
])) )
4455 if (otmp
->otyp
== CORPSE
&&
4456 touch_petrifies(&mons
[otmp
->corpsenm
]) && (magr
->mtame
&& nocorpsedecay(&mons
[otmp
->corpsenm
])) ) {
4457 m_useup(magr
, otmp
);
4458 otmp
= (struct obj
*) 0;
4459 possibly_unwield(magr
, FALSE
);
4463 /* WAC -- Real weapon?
4464 * Could be stuck with a cursed bow/polearm it wielded
4466 if (/* if you strike with a bow... */
4467 is_launcher(otmp
) ||
4468 /* or strike with a missile in your hand... */
4469 (is_missile(otmp
) || is_ammo(otmp
)) ||
4470 /* lightsaber that isn't lit ;) */
4471 (is_lightsaber(otmp
) && !otmp
->lamplit
) ||
4472 /* WAC -- or using a pole at short range... */
4474 /* then do only 1-2 points of damage */
4475 if ( (is_shade(pd
) || (mdef
&& mdef
->egotype_shader
)) && !(uwep
&& uwep
->oartifact
== ART_AP_
) && objects
[otmp
->otyp
].oc_material
!= MT_SILVER
&& objects
[otmp
->otyp
].oc_material
!= MT_ARCANIUM
)
4480 #if 0 /* Monsters don't wield boomerangs */
4481 if(otmp
->otyp
== BOOMERANG
/* && !rnl(3) */) {
4482 pline("As %s hits you, %s breaks into splinters.",
4483 mon_nam(mtmp
), the(xname(otmp
)));
4485 otmp
= (struct obj
*) 0;
4486 possibly_unwield(mtmp
);
4487 if ((!is_shade(pd
) && !(mdef
&& mdef
->egotype_shader
)) || (uwep
&& uwep
->oartifact
== ART_AP_
) )
4491 } else tmp
+= dmgval(otmp
, mdef
);
4493 /* MRKR: Handling damage when hitting with */
4494 /* a burning torch */
4496 if(otmp
->otyp
== TORCH
&& otmp
->lamplit
&& (!resists_fire(mdef
) || player_will_pierce_resistance() ) ) {
4499 static char outbuf
[BUFSZ
];
4500 char *s
= Shk_Your(outbuf
, otmp
);
4502 boolean water
= (mdef
->data
==
4503 &mons
[PM_WATER_ELEMENTAL
]);
4505 pline("%s %s %s%s %s%s.", s
, xname(otmp
),
4506 (water
? "vaporize" : "burn"),
4507 (otmp
->quan
> 1L ? "" : "s"),
4508 (water
? "part of " : ""), mon_nam(mdef
));
4511 burn_faster(otmp
, 1);
4514 if (resists_cold(mdef
)) tmp
+= rnd(3);
4516 if (!rn2(33)) burnarmor(mdef
);
4518 (void)destroy_mitem(mdef
, POTION_CLASS
, AD_FIRE
);
4520 (void)destroy_mitem(mdef
, SCROLL_CLASS
, AD_FIRE
);
4522 (void)destroy_mitem(mdef
, SPBOOK_CLASS
, AD_FIRE
);
4526 /* WAC Weres get seared */
4527 if(otmp
&& objects
[otmp
->otyp
].oc_material
== MT_SILVER
&& (hates_silver(pd
))) {
4529 if (vis
) pline("The silver sears %s!", mon_nam(mdef
));
4531 if(otmp
&& objects
[otmp
->otyp
].oc_material
== MT_COPPER
&& (hates_copper(pd
))) {
4533 if (vis
) pline("The copper decomposes %s!", mon_nam(mdef
));
4535 if(otmp
&& objects
[otmp
->otyp
].oc_material
== MT_MERCURIAL
&& !rn2(10) && !(resists_poison(mdef
))) {
4537 if (vis
) pline("The mercury poisons %s!", mon_nam(mdef
));
4539 if(otmp
&& objects
[otmp
->otyp
].oc_material
== MT_PLATINUM
&& (hates_platinum(pd
))) {
4541 if (vis
) pline("The platinum smashes %s!", mon_nam(mdef
));
4543 if(otmp
&& otmp
->cursed
&& (hates_cursed(pd
))) {
4545 if (otmp
->hvycurse
) tmp
+= 4;
4546 if (otmp
->prmcurse
) tmp
+= 7;
4547 if (otmp
->bbrcurse
) tmp
+= 15;
4548 if (otmp
->evilcurse
) tmp
+= 15;
4549 if (otmp
->morgcurse
) tmp
+= 15;
4550 if (vis
) pline("The unholy aura blasts %s!", mon_nam(mdef
));
4552 if(otmp
&& objects
[otmp
->otyp
].oc_material
== MT_VIVA
&& (hates_viva(pd
))) {
4554 if (vis
) pline("The radiation damages %s!", mon_nam(mdef
));
4556 if(otmp
&& objects
[otmp
->otyp
].oc_material
== MT_INKA
&& (hates_inka(pd
))) {
4558 if (vis
) pline("The inka string damages %s!", mon_nam(mdef
));
4560 if(otmp
&& otmp
->otyp
== ODOR_SHOT
&& (hates_odor(pd
))) {
4562 if (vis
) pline("The odor beguils %s!", mon_nam(mdef
));
4564 /* Stakes do extra dmg agains vamps */
4565 if (otmp
&& (otmp
->otyp
== WOODEN_STAKE
|| otmp
->oartifact
== ART_VAMPIRE_KILLER
) && is_vampire(pd
)) {
4566 if(otmp
->oartifact
== ART_STAKE_OF_VAN_HELSING
) {
4569 strcpy(buf
, Monnam(magr
));
4570 pline("%s plunges the stake into the heart of %s.",
4571 buf
, mon_nam(mdef
));
4572 pline("%s's body vaporizes!", Monnam(mdef
));
4574 mondead(mdef
); /* no corpse */
4575 if (mdef
->mhp
< 0) return (MM_DEF_DIED
|
4576 (grow_up(magr
,mdef
) ? 0 : MM_AGR_DIED
));
4579 strcpy(buf
, Monnam(magr
));
4580 pline("%s drives the stake into %s.",
4581 buf
, mon_nam(mdef
));
4585 }else if (otmp
->oartifact
== ART_VAMPIRE_KILLER
) {
4587 strcpy(buf
, Monnam(magr
));
4588 pline("%s whips %s good!",
4589 buf
, mon_nam(mdef
));
4595 strcpy(buf
, Monnam(magr
));
4596 pline("%s drives the stake into %s.",
4597 buf
, mon_nam(mdef
));
4603 if (otmp
&& otmp
->oartifact
) {
4604 (void)artifact_hit(magr
,mdef
, otmp
, &tmp
, dieroll
);
4606 return (MM_DEF_DIED
|
4607 (grow_up(magr
,mdef
) ? 0 : MM_AGR_DIED
));
4610 mrustm(magr
, mdef
, otmp
);
4612 } else if (magr
->data
== &mons
[PM_PURPLE_WORM
] &&
4613 mdef
->data
== &mons
[PM_SHRIEKER
]) {
4614 /* hack to enhance mm_aggression(); we don't want purple
4615 worm's bite attack to kill a shrieker because then it
4616 won't swallow the corpse; but if the target survives,
4617 the subsequent engulf attack should accomplish that */
4618 if (tmp
>= mdef
->mhp
) tmp
= mdef
->mhp
- 1;
4629 pline("%s is %s!", Monnam(mdef
),
4630 on_fire(mdef
->data
, mattk
));
4631 if (pd
== &mons
[PM_STRAW_GOLEM
] ||
4632 pd
== &mons
[PM_WAX_GOLEM
] ||
4633 pd
== &mons
[PM_PAPER_GOLEM
]) {
4634 if (vis
) pline("%s burns completely!", Monnam(mdef
));
4636 if (mdef
->mhp
> 0) return 0;
4637 else if (mdef
->mtame
&& !vis
)
4638 pline("May %s roast in peace.", mon_nam(mdef
));
4639 return (MM_DEF_DIED
| (grow_up(magr
,mdef
) ?
4642 if (!rn2(33)) tmp
+= destroy_mitem(mdef
, SCROLL_CLASS
, AD_FIRE
);
4643 if (!rn2(33)) tmp
+= destroy_mitem(mdef
, SPBOOK_CLASS
, AD_FIRE
);
4644 if (resists_fire(mdef
) && !player_will_pierce_resistance()) {
4646 pline_The("fire doesn't seem to burn %s!",
4648 shieldeff(mdef
->mx
, mdef
->my
);
4649 golemeffects(mdef
, AD_FIRE
, tmp
);
4652 /* only potions damage resistant players in destroy_item */
4653 if (!rn2(33)) tmp
+= destroy_mitem(mdef
, POTION_CLASS
, AD_FIRE
);
4662 if (vis
) pline("%s is covered in frost!", Monnam(mdef
));
4663 if (resists_cold(mdef
) && !player_will_pierce_resistance()) {
4665 pline_The("frost doesn't seem to chill %s!",
4667 shieldeff(mdef
->mx
, mdef
->my
);
4668 golemeffects(mdef
, AD_COLD
, tmp
);
4671 if (!rn2(33)) tmp
+= destroy_mitem(mdef
, POTION_CLASS
, AD_COLD
);
4680 if (vis
) pline("%s gets zapped!", Monnam(mdef
));
4681 if (!rn2(33)) tmp
+= destroy_mitem(mdef
, WAND_CLASS
, AD_ELEC
);
4682 if (resists_elec(mdef
) && !player_will_pierce_resistance()) {
4683 if (vis
) pline_The("zap doesn't shock %s!", mon_nam(mdef
));
4684 shieldeff(mdef
->mx
, mdef
->my
);
4685 golemeffects(mdef
, AD_ELEC
, tmp
);
4688 /* only rings damage resistant players in destroy_item */
4689 if (!rn2(33)) tmp
+= destroy_mitem(mdef
, RING_CLASS
, AD_ELEC
);
4698 if (resists_acid(mdef
) && !player_will_pierce_resistance()) {
4700 pline("%s is covered in acid, but it seems harmless.",
4704 pline("%s is covered in acid!", Monnam(mdef
));
4705 pline("It burns %s!", mon_nam(mdef
));
4707 if (!rn2(30)) erode_armor(mdef
, TRUE
);
4708 if (!rn2(6)) erode_obj(MON_WEP(mdef
), TRUE
, TRUE
);
4711 if (magr
->mcan
) break;
4712 if (pd
== &mons
[PM_IRON_GOLEM
]) {
4713 if (vis
) pline("%s falls to pieces!", Monnam(mdef
));
4715 if (mdef
->mhp
> 0) return 0;
4716 else if (mdef
->mtame
&& !vis
)
4717 pline("May %s rust in peace.", mon_nam(mdef
));
4718 return (MM_DEF_DIED
| (grow_up(magr
,mdef
) ?
4721 hurtmarmor(mdef
, AD_RUST
);
4722 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
4723 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
4725 if (tmp
< 1) tmp
= 1;
4727 if (pd
== &mons
[PM_IRON_GOLEM
]) tmp
= 0;
4728 if (mdef
->mtame
&& !rn2(5)) {
4729 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
4730 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
4731 if (vis
) pline("%s rusts!", Monnam(mdef
));
4735 if (is_vampire(mdef
->data
)) {
4736 tmp
*= 2; /* vampires take more damage from sunlight --Amy */
4737 if (vis
) pline("%s is irradiated!", Monnam(mdef
));
4740 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
4741 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
4746 if (magr
->mcan
) break;
4747 hurtmarmor(mdef
, AD_CORR
);
4748 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
4749 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
4751 if (tmp
< 1) tmp
= 1;
4754 if (mdef
->mtame
&& !rn2(5)) {
4755 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
4756 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
4757 if (vis
) pline("%s corrodes!", Monnam(mdef
));
4762 if (magr
->mcan
) break;
4763 hurtmarmor(mdef
, AD_FLAM
);
4764 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
4765 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
4767 if (tmp
< 1) tmp
= 1;
4770 if (mdef
->mtame
&& !rn2(5)) {
4771 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
4772 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
4773 if (vis
) pline("%s is engulfed by flames!", Monnam(mdef
));
4777 if (magr
->mcan
) break;
4778 if (pd
== &mons
[PM_WOOD_GOLEM
] ||
4779 pd
== &mons
[PM_LEATHER_GOLEM
]) {
4780 if (vis
) pline("%s falls to pieces!", Monnam(mdef
));
4782 if (mdef
->mhp
> 0) return 0;
4783 else if (mdef
->mtame
&& !vis
)
4784 pline("May %s rot in peace.", mon_nam(mdef
));
4785 return (MM_DEF_DIED
| (grow_up(magr
,mdef
) ?
4788 hurtmarmor(mdef
, AD_DCAY
);
4789 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
4791 if (tmp
< 1) tmp
= 1;
4793 if (pd
== &mons
[PM_WOOD_GOLEM
] || pd
== &mons
[PM_LEATHER_GOLEM
]) tmp
= 0;
4794 if (mdef
->mtame
&& !rn2(5)) {
4795 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
4796 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
4797 if (vis
) pline("%s decays!", Monnam(mdef
));
4802 if (magr
->mcan
) break;
4804 if (mdef
->mtame
&& atttyp
== AD_EDGE
) {
4805 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
4806 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
4809 if (mattk
->aatyp
== AT_GAZE
&& mon_reflects(mdef
, (char *)0)) {
4811 (void) mon_reflects(mdef
, "But it reflects from %s %s!");
4812 if (poly_when_stoned(pa
)) {
4816 if (!resists_ston(magr
) && !rn2(4) ) {
4817 if (vis
) pline("%s turns to stone!", Monnam(magr
));
4819 if (magr
->mhp
> 0) return 0;
4820 else if (magr
->mtame
&& !vis
)
4821 You(brief_feeling
, "peculiarly sad");
4826 /* may die from the acid if it eats a stone-curing corpse */
4827 if (munstone(mdef
, FALSE
)) goto post_stone
;
4828 if (poly_when_stoned(pd
)) {
4833 if (!resists_ston(mdef
) && !rn2(4) ) {
4834 if (vis
) pline("%s turns to stone!", Monnam(mdef
));
4836 post_stone
: if (mdef
->mhp
> 0) return 0;
4837 else if (mdef
->mtame
&& !vis
)
4838 You(brief_feeling
, "peculiarly sad");
4839 return (MM_DEF_DIED
| (grow_up(magr
,mdef
) ?
4841 tmp
= (mattk
->adtyp
== AD_STON
? 0 : mattk
->adtyp
== AD_EDGE
? 0 : 1);
4845 if (mdef
->mtame
&& !rn2(3)) {
4846 mdef
->willbebanished
= TRUE
;
4848 } /* else fall through */
4850 if (!cancelled
&& tmp
< mdef
->mhp
&& !tele_restrict(mdef
)) {
4851 char mdef_Monnam
[BUFSZ
];
4852 /* save the name before monster teleports, otherwise
4853 we'll get "it" in the suddenly disappears message */
4854 if (vis
) strcpy(mdef_Monnam
, Monnam(mdef
));
4855 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
4856 (void) rloc(mdef
, FALSE
);
4857 if (vis
&& !canspotmon(mdef
) && mdef
!= u
.usteed
)
4858 pline("%s suddenly disappears!", mdef_Monnam
);
4864 if (vis
) pline("%s seems oblivious!", Monnam(mdef
));
4866 if (!rn2(3)) badpeteffect(mdef
);
4871 if (!cancelled
&& tmp
< mdef
->mhp
&& !tele_restrict(mdef
)) {
4872 char mdef_Monnam
[BUFSZ
];
4873 /* save the name before monster teleports, otherwise
4874 we'll get "it" in the suddenly disappears message */
4875 if (vis
) strcpy(mdef_Monnam
, Monnam(mdef
));
4876 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
4877 (void) rloc(mdef
, FALSE
);
4878 if (vis
&& !canspotmon(mdef
) && mdef
!= u
.usteed
)
4879 pline("%s suddenly disappears!", mdef_Monnam
);
4883 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
4884 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
4886 if (!rn2(7)) badpeteffect(mdef
);
4890 if (!cancelled
&& tmp
< mdef
->mhp
&& !tele_restrict(mdef
)) {
4891 char mdef_Monnam
[BUFSZ
];
4892 /* save the name before monster teleports, otherwise
4893 we'll get "it" in the suddenly disappears message */
4894 if (vis
) strcpy(mdef_Monnam
, Monnam(mdef
));
4895 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
4896 (void) rloc(mdef
, FALSE
);
4897 if (vis
&& !canspotmon(mdef
) && mdef
!= u
.usteed
)
4898 pline("%s suddenly disappears!", mdef_Monnam
);
4900 if (mdef
->mtame
) badpeteffect(mdef
);
4905 if (cancelled
) break;
4906 if (mattk
->aatyp
== AT_GAZE
&& mon_reflects(mdef
, (char *)0)) {
4908 (void) mon_reflects(mdef
, "But it reflects from %s %s!");
4909 if (sleep_monst(magr
, rnd(10), -1))
4910 if (vis
) pline("%s is put to sleep!", Monnam(magr
));
4915 int parlyzdur
= rnd(magr
->mtame
? 4 : 10);
4916 if (!rn2(4)) parlyzdur
= tmp
;
4918 if (parlyzdur
> 3) {
4919 parlyzdur
= rnd(parlyzdur
);
4920 if (parlyzdur
< 3) parlyzdur
= 2;
4922 if (parlyzdur
> 1) parlyzdur
= rnd(parlyzdur
);
4924 if (parlyzdur
> 127) parlyzdur
= 127;
4926 if (!cancelled
&& !(magr
->mtame
&& (rn2(100) <= mdef
->data
->mr
)) && !mdef
->msleeping
&& (!rn2(5) || !(magr
->mtame
)) &&
4927 sleep_monst(mdef
, parlyzdur
, -1)) {
4929 strcpy(buf
, Monnam(mdef
));
4930 pline("%s is put to sleep by %s.", buf
, mon_nam(magr
));
4932 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
4938 /* WAC DEATH (gaze) */
4941 /* No death, but still cause damage */
4944 if (vis
&& mattk
->aatyp
== AT_GAZE
)
4945 pline("%s gazes intently!", Monnam(magr
));
4946 if (mattk
->aatyp
== AT_GAZE
&& mon_reflects(mdef
, (char *)0)) {
4947 /* WAC reflected gaze
4948 * Oooh boy...that was a bad move :B
4952 shieldeff(mdef
->mx
, mdef
->my
);
4953 (void) mon_reflects(mdef
, "But it reflects from %s %s!");
4955 if (resists_magm(magr
)) {
4956 if (vis
) pline("%s shudders momentarily...", Monnam(magr
));
4959 if (vis
) pline("%s dies!", Monnam(magr
));
4961 if (magr
->mhp
> 0) return 0; /* lifesaved */
4962 else if (magr
->mtame
&& !vis
)
4963 You(brief_feeling
, "peculiarly sad");
4965 } else if (is_undead(mdef
->data
) || mdef
->egotype_undead
) {
4966 /* Still does normal damage */
4967 if (vis
) pline("Something didn't work...");
4969 } else if (resists_magm(mdef
)) {
4970 if (vis
) pline("%s shudders momentarily...", Monnam(mdef
));
4977 if(!cancelled
&& mdef
->mcanmove
&& (!rn2(4) || !(magr
->mtame
)) && !(dmgtype(mdef
->data
, AD_PLYS
))) {
4979 int parlyzdur
= rnd(magr
->mtame
? 4 : 10);
4980 if (!rn2(4)) parlyzdur
= tmp
;
4982 if (parlyzdur
> 3) {
4983 parlyzdur
= rnd(parlyzdur
);
4984 if (parlyzdur
< 3) parlyzdur
= 3;
4986 if (parlyzdur
> 1) parlyzdur
= rnd(parlyzdur
);
4988 if (parlyzdur
> 127) parlyzdur
= 127;
4991 strcpy(buf
, Monnam(mdef
));
4992 pline("%s is frozen by %s.", buf
, mon_nam(magr
));
4995 mdef
->mfrozen
= parlyzdur
;
4996 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5000 if(!cancelled
&& mdef
->mcanmove
&& (!rn2(8) || !(magr
->mtame
)) && !(dmgtype(mdef
->data
, AD_PLYS
))) {
5002 int parlyzdur
= rnd(magr
->mtame
? 3 : 10);
5003 if (!rn2(5)) parlyzdur
= tmp
;
5005 if (parlyzdur
> 2) {
5006 parlyzdur
= rnd(parlyzdur
);
5007 if (parlyzdur
< 2) parlyzdur
= 2;
5009 if (parlyzdur
> 1) parlyzdur
= rnd(parlyzdur
);
5011 if (parlyzdur
> 127) parlyzdur
= 127;
5014 strcpy(buf
, Monnam(magr
));
5015 pline("%s mercilessly tickles %s.", buf
, mon_nam(mdef
));
5018 mdef
->mfrozen
= parlyzdur
;
5019 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5024 if(!cancelled
&& vis
&& mdef
->mspeed
!= MSLOW
&& !(magr
->mtame
&& (rn2(100) <= mdef
->data
->mr
)) ) {
5025 unsigned int oldspeed
= mdef
->mspeed
;
5027 mon_adjust_speed(mdef
, -1, (struct obj
*)0);
5028 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5029 if (mdef
->mspeed
!= oldspeed
&& vis
)
5030 pline("%s slows down.", Monnam(mdef
));
5035 if(!cancelled
&& vis
&& mdef
->mspeed
!= MSLOW
&& !(magr
->mtame
&& (rn2(100) <= mdef
->data
->mr
))) {
5036 unsigned int oldspeed
= mdef
->mspeed
;
5038 mon_adjust_speed(mdef
, -1, (struct obj
*)0);
5039 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5040 if (mdef
->mspeed
!= oldspeed
&& vis
)
5041 pline("%s slows down.", Monnam(mdef
));
5044 if (vis
) pline("%s's weight increases.", Monnam(mdef
));
5045 mdef
->inertia
+= tmp
;
5050 if(!cancelled
&& vis
&& mdef
->mspeed
!= MSLOW
) {
5051 unsigned int oldspeed
= mdef
->mspeed
;
5053 mon_adjust_speed(mdef
, -1, (struct obj
*)0);
5054 mon_adjust_speed(mdef
, -1, (struct obj
*)0);
5055 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5056 if (mdef
->mspeed
!= oldspeed
&& vis
)
5057 pline("%s slows down.", Monnam(mdef
));
5061 if (!mdef
->inertia
) pline("%s slows down to a crawl.", Monnam(mdef
));
5062 else pline("%s seems even slower.", Monnam(mdef
));
5064 mdef
->inertia
+= (5 + (tmp
* 5));
5069 if(!cancelled
&& vis
&& mdef
->mspeed
!= MSLOW
) {
5070 unsigned int oldspeed
= mdef
->mspeed
;
5072 mon_adjust_speed(mdef
, -1, (struct obj
*)0);
5073 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5074 if (mdef
->mspeed
!= oldspeed
&& vis
)
5075 pline("%s slows down.", Monnam(mdef
));
5077 if(!cancelled
&& !rn2(3) && (!rn2(4) || !(magr
->mtame
)) && mdef
->mcanmove
&& !(dmgtype(mdef
->data
, AD_PLYS
))) {
5079 int parlyzdur
= rnd(magr
->mtame
? 4 : 10);
5080 if (!rn2(4)) parlyzdur
= tmp
;
5082 if (parlyzdur
> 3) {
5083 parlyzdur
= rnd(parlyzdur
);
5084 if (parlyzdur
< 3) parlyzdur
= 3;
5086 if (parlyzdur
> 1) parlyzdur
= rnd(parlyzdur
);
5088 if (parlyzdur
> 127) parlyzdur
= 127;
5091 strcpy(buf
, Monnam(mdef
));
5092 pline("%s is frozen by %s.", buf
, mon_nam(magr
));
5095 mdef
->mfrozen
= parlyzdur
;
5096 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5099 mdef
->inertia
+= (3 + (tmp
* 3));
5100 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
5101 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5106 if(!cancelled
&& !rn2(10) && vis
&& mdef
->mspeed
!= MSLOW
) {
5107 unsigned int oldspeed
= mdef
->mspeed
;
5109 mon_adjust_speed(mdef
, -1, (struct obj
*)0);
5110 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5111 if (mdef
->mspeed
!= oldspeed
&& vis
)
5112 pline("%s is numbed.", Monnam(mdef
));
5114 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5116 if (tmp
< 1) tmp
= 1;
5118 if (mdef
->mtame
&& !rn2(15)) badpeteffect(mdef
);
5121 do_clear_area(mdef
->mx
,mdef
->my
, 7, set_lit
, (void *)((char *)0));
5122 if (vis
) pline("A sinister darkness fills the area!");
5123 if (mdef
->data
->mlet
== S_ANGEL
) tmp
*= 2;
5127 if (magr
->mhp
> 0) {
5129 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
5130 if (vis
) pline("%s feeds on the lifeblood!", Monnam(magr
) );
5136 if (magr
->mhp
> 0) {
5138 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
5139 if (vis
) pline("%s feeds on the lifeblood!", Monnam(magr
) );
5142 if (mdef
->mtame
&& !rn2(10)) {
5144 if (!cancelled
&& rn2(2) && !resists_drli(mdef
)) {
5145 if (vis
) pline("%s suddenly seems weaker!", Monnam(mdef
));
5146 mdef
->mhpmax
-= d(2,6);
5147 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5148 if (mdef
->m_lev
== 0) tmp
= mdef
->mhp
;
5150 /* Automatic kill if drained past level 0 */
5160 if (vis
) pline("%s seems more vulnerable!", Monnam(mdef
));
5161 mdef
->mhpmax
-= rnd(8);
5162 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5163 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5164 if (mdef
->m_lev
== 0) tmp
= mdef
->mhp
;
5180 if (mdef
->mtame
&& !rn2(2)) tmp
*= 3;
5184 if (mdef
->mtame
&& !rn2(2)) tmp
*= 2;
5188 if (mdef
->mtame
&& !rn2(2)) tmp
*= 2;
5192 if (mdef
->mtame
&& !rn2(3)) badpeteffect(mdef
);
5214 allbadpeteffects(mdef
);
5220 mdef
->bleedout
+= tmp
;
5221 if (vis
) pline("%s sustains a cut.", Monnam(mdef
));
5227 if (!rn2(3)) badpeteffect(mdef
);
5229 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
5230 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5236 if (mdef
->mtame
&& !rn2(40)) {
5237 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
5238 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5243 if (magr
->data
== &mons
[PM_BUILDER
]) terrainterror(1);
5244 else terrainterror(0);
5254 if (mdef
->mtame
&& !rn2(5)) {
5260 if (mdef
->mtame
&& !rn2(3)) {
5282 if (evilfriday
&& magr
->m_lev
> 1) evilragnarok(FALSE
,magr
->m_lev
);
5289 reset_rndmonst(NON_PM
);
5290 (void) makemon((struct permonst
*)0, magr
->mx
, magr
->my
, MM_ANGRY
|MM_ADJACENTOK
|MM_FRENZIED
);
5299 mdef
->isegotype
= 1;
5300 mdef
->egotype_contaminator
= 1;
5303 mdef
->isegotype
= 1;
5304 mdef
->egotype_weeper
= 1;
5307 mdef
->isegotype
= 1;
5308 mdef
->egotype_radiator
= 1;
5311 mdef
->isegotype
= 1;
5312 mdef
->egotype_reactor
= 1;
5317 int untamingchance
= 10;
5319 if (!(PlayerCannotUseSkills
)) {
5320 switch (P_SKILL(P_PETKEEPING
)) {
5321 default: untamingchance
= 10; break;
5322 case P_BASIC
: untamingchance
= 9; break;
5323 case P_SKILLED
: untamingchance
= 8; break;
5324 case P_EXPERT
: untamingchance
= 7; break;
5325 case P_MASTER
: untamingchance
= 6; break;
5326 case P_GRAND_MASTER
: untamingchance
= 5; break;
5327 case P_SUPREME_MASTER
: untamingchance
= 4; break;
5331 /* Certain monsters aren't even made peaceful. */
5332 if (!mdef
->iswiz
&& mdef
->data
!= &mons
[PM_MEDUSA
] &&
5333 !(mdef
->data
->mflags3
& M3_COVETOUS
) && !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && mdef
->data
->mlet
== S_DRAGON
) && !(mdef
->data
->geno
& G_UNIQ
) &&
5334 ((magr
->mtame
&& !rn2(10)) || (mdef
->mtame
&& (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4)) )) {
5335 if (vis
) pline("%s looks calmer.", Monnam(mdef
));
5336 if (mdef
== u
.usteed
&& !mayfalloffsteed())
5337 dismount_steed(DISMOUNT_THROWN
);
5338 if (!mdef
->mfrenzied
&& !rn2(3)) mdef
->mpeaceful
= 1;
5339 else mdef
->mpeaceful
= 0;
5344 } else if (!rn2(3)) {
5347 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
5348 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5355 if (!resists_cold(mdef
) && resists_fire(mdef
)) {
5357 if (vis
) pline("%s is freezing!", Monnam(mdef
));
5359 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5361 if (tmp
< 1) tmp
= 1;
5364 pline("%s seems to be moving slower.", Monnam(mdef
));
5365 if (!rn2(3)) mon_adjust_speed(mdef
, -1, (struct obj
*)0);
5366 if (!rn2(3)) mdef
->inertia
+= tmp
;
5371 if (!resists_cold(mdef
)) {
5373 if (vis
) pline("%s is hit with ice blocks!", Monnam(mdef
));
5375 if (mdef
->mtame
&& !rn2(2)) {
5376 pline("%s seems to be moving slower.", Monnam(mdef
));
5377 if (!rn2(3)) mon_adjust_speed(mdef
, -1, (struct obj
*)0);
5378 if (!rn2(3)) mdef
->inertia
+= tmp
;
5384 if (!resists_elec(mdef
)) {
5386 if (vis
) pline("%s is shocked!", Monnam(mdef
));
5389 if (mdef
->mtame
&& !rn2(5)) {
5390 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
5391 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5397 if (has_head(mdef
->data
)) {
5401 if (vis
) pline("%s's %s is torn apart!", Monnam(mdef
), mbodypart(mdef
, HEAD
));
5402 } else if (vis
) pline("%s's %s is spiked!", Monnam(mdef
), mbodypart(mdef
, HEAD
));
5407 if (!which_armor(mdef
, W_ARMH
)) tmp
*= 2;
5414 if (!is_flyer(mdef
->data
)) {
5416 if (vis
) pline("%s is slammed into the ground!", Monnam(mdef
));
5419 if (mdef
->mtame
&& !rn2(2) && !mdef
->mfrozen
) {
5421 mdef
->mfrozen
= rnd(10);
5422 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5428 if (magr
->m_lev
> mdef
->m_lev
) tmp
+= (magr
->m_lev
- mdef
->m_lev
);
5432 if ((tmp
> 0) && (mdef
->mhpmax
> 1)) {
5434 if (vis
) pline("%s feels bad!", Monnam(mdef
));
5436 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5438 if (tmp
< 1) tmp
= 1;
5440 if (mdef
->mtame
) badpeteffect(mdef
);
5449 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5451 if (tmp
< 1) tmp
= 1;
5453 if (mdef
->mtame
&& !rn2(10)) badpeteffect(mdef
);
5457 if (resists_cold(mdef
) && !resists_fire(mdef
)) {
5459 if (vis
) pline("%s is burning!", Monnam(mdef
));
5461 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5463 if (tmp
< 1) tmp
= 1;
5465 if (mdef
->mtame
) mdef
->healblock
+= (5 + (tmp
* 5));
5470 if (!resists_fire(mdef
)) {
5472 if (vis
) pline("%s is enveloped by searing plasma radiation!", Monnam(mdef
));
5475 mdef
->healblock
+= (10 + (tmp
* 10));
5476 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
5477 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5483 if (!resists_acid(mdef
)) {
5485 if (vis
) pline("%s is covered with sludge!", Monnam(mdef
));
5488 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= rnd(3);
5489 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5490 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5497 if (resists_cold(mdef
) && !resists_fire(mdef
)) {
5499 if (vis
) pline("%s is scorched!", Monnam(mdef
));
5500 } else if (!resists_fire(mdef
)) {
5502 if (vis
) pline("%s is severely burned!", Monnam(mdef
));
5505 mdef
->healblock
+= (20 + (tmp
* 20));
5506 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= 5;
5507 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5508 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5509 if (mdef
->m_lev
> 0) mdef
->m_lev
--;
5515 pline("%s", fauxmessage());
5516 u
.cnd_plineamount
++;
5518 pline("%s", fauxmessage());
5519 u
.cnd_plineamount
++;
5525 (void) maketrap(mdef
->mx
, mdef
->my
, WEB
, 0, FALSE
);
5526 if (!rn2(issoviet
? 2 : 8)) makerandomtrap(FALSE
);
5531 if (t_at(mdef
->mx
, mdef
->my
) == 0) (void) maketrap(mdef
->mx
, mdef
->my
, rndtrap(), 0, FALSE
);
5532 else makerandomtrap(FALSE
);
5537 if (rnd(100) > mdef
->data
->mr
) {
5538 cancelmonsterlite(mdef
);
5539 if (vis
) pline("%s is covered in sparkling lights!", Monnam(mdef
));
5541 if (mdef
->mtame
&& !rn2(2)) {
5542 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
5543 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5550 if (rnd(100) > mdef
->data
->mr
) {
5551 monflee(mdef
, rnd(1 + tmp
), FALSE
, TRUE
);
5552 if (vis
) pline("%s screams in fear!",Monnam(mdef
));
5554 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5556 if (tmp
< 1) tmp
= 1;
5564 /* STUPID bug where the game displays the same name twice for some inexplicable reason --Amy */
5565 strcpy(buf
, Monnam(mdef
));
5570 pline("%s sees %s chow dead bodies.", buf
, mon_nam(magr
)); break;
5572 pline("%s shudders at %s's terrifying %s.", buf
, mon_nam(magr
), makeplural(mbodypart(magr
, EYE
)) ); break;
5574 pline("%s feels sick at entrails caught in %s's tentacles.", buf
, mon_nam(magr
)); break;
5576 pline("%s sees maggots breed in the rent %s of %s.", buf
, mbodypart(magr
, STOMACH
), mon_nam(magr
)); break;
5582 if (mdef
->mtame
&& !rn2(5)) badpeteffect(mdef
);
5587 if (rnd(100) > mdef
->data
->mr
) {
5588 monflee(mdef
, rnd(1 + tmp
), FALSE
, TRUE
);
5589 if (vis
) pline("%s screams in fear!",Monnam(mdef
));
5591 if (!magr
->mcan
&& !mdef
->mconf
&& !magr
->mspec_used
) {
5592 if (vis
) pline("%s looks confused.", Monnam(mdef
));
5594 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5596 if (!magr
->mcan
&& canseemon(mdef
))
5597 pline("%s %s for a moment.", Monnam(mdef
), makeplural(stagger(mdef
->data
, "stagger")));
5600 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5602 if (tmp
< 1) tmp
= 1;
5604 if (mdef
->mtame
&& !rn2(2)) badpeteffect(mdef
);
5609 if (!mdef
->mcanmove
) {
5611 if (vis
) pline("%s's dream is eaten!",Monnam(mdef
));
5618 /* Since confusing another monster doesn't have a real time
5619 * limit, setting spec_used would not really be right (though
5620 * we still should check for it).
5622 if (!magr
->mcan
&& !mdef
->mconf
&& !magr
->mspec_used
) {
5623 if (vis
) pline("%s looks confused.", Monnam(mdef
));
5625 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5627 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5629 if (tmp
< 1) tmp
= 1;
5635 /* Since confusing another monster doesn't have a real time
5636 * limit, setting spec_used would not really be right (though
5637 * we still should check for it).
5639 if (!magr
->mcan
&& !mdef
->mconf
&& !magr
->mspec_used
) {
5640 if (vis
) pline("%s looks confused.", Monnam(mdef
));
5642 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5644 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5646 if (tmp
< 1) tmp
= 1;
5648 if (mdef
->mtame
&& !rn2(2)) badpeteffect(mdef
);
5653 makedoghungry(mdef
, tmp
* rnd(50));
5654 if (vis
) pline("%s suddenly looks hungry.", Monnam(mdef
));
5659 mon_drain_en(mdef
, ((mdef
->m_lev
> 0) ? (rnd(mdef
->m_lev
)) : 0) + 1 + tmp
);
5662 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= rnd(5);
5663 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5664 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5669 if (mdef
->mtame
) tmp
*= 2;
5670 mon_drain_en(mdef
, ((mdef
->m_lev
> 0) ? (rnd(mdef
->m_lev
)) : 0) + 1 + tmp
);
5674 mon_drain_en(mdef
, ((mdef
->m_lev
> 0) ? (rnd(mdef
->m_lev
)) : 0) + 1 + tmp
);
5675 if (mdef
->mtame
&& !rn2(7)) badpeteffect(mdef
);
5679 mon_drain_en(mdef
, ((mdef
->m_lev
> 0) ? (rnd(mdef
->m_lev
)) : 0) + 1 + tmp
);
5680 if (mdef
->mtame
&& !rn2(50)) {
5681 int untamingchance
= 10;
5683 if (!(PlayerCannotUseSkills
)) {
5684 switch (P_SKILL(P_PETKEEPING
)) {
5685 default: untamingchance
= 10; break;
5686 case P_BASIC
: untamingchance
= 9; break;
5687 case P_SKILLED
: untamingchance
= 8; break;
5688 case P_EXPERT
: untamingchance
= 7; break;
5689 case P_MASTER
: untamingchance
= 6; break;
5690 case P_GRAND_MASTER
: untamingchance
= 5; break;
5691 case P_SUPREME_MASTER
: untamingchance
= 4; break;
5695 /* Certain monsters aren't even made peaceful. */
5696 if (!mdef
->iswiz
&& mdef
->data
!= &mons
[PM_MEDUSA
] &&
5697 !(mdef
->data
->mflags3
& M3_COVETOUS
) && !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && mdef
->data
->mlet
== S_DRAGON
) && !(mdef
->data
->geno
& G_UNIQ
) &&
5698 ((magr
->mtame
&& !rn2(10)) || (mdef
->mtame
&& (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4)) )) {
5699 if (vis
) pline("%s looks calmer.", Monnam(mdef
));
5700 if (mdef
== u
.usteed
&& !mayfalloffsteed())
5701 dismount_steed(DISMOUNT_THROWN
);
5702 if (!mdef
->mfrenzied
&& !rn2(3)) mdef
->mpeaceful
= 1;
5703 else mdef
->mpeaceful
= 0;
5712 mon_drain_en(mdef
, ((mdef
->m_lev
> 0) ? (rnd(mdef
->m_lev
)) : 0) + 1 + tmp
);
5713 if (mdef
->mtame
&& !rn2(8)) {
5714 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= rnd(8);
5715 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5716 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5717 if (mdef
->m_lev
> 0) mdef
->m_lev
--;
5723 if (resists_magm(mdef
)) {
5725 shieldeff(mdef
->mx
,mdef
->my
);
5726 pline("%s is unaffected.", Monnam(mdef
));
5730 ((mdef
->m_lev
> 0) ? (rnd(mdef
->m_lev
)) : 0) + 1);
5732 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5734 if (tmp
< 1) tmp
= 1;
5740 if (can_blnd(magr
, mdef
, mattk
->aatyp
, (struct obj
*)0)) {
5741 register unsigned rnd_tmp
;
5743 if (vis
&& mdef
->mcansee
)
5744 pline("%s is blinded.", Monnam(mdef
));
5745 rnd_tmp
= d((int)mattk
->damn
, (int)mattk
->damd
);
5746 if ((rnd_tmp
+= mdef
->mblinded
) > 127) rnd_tmp
= 127;
5747 mdef
->mblinded
= rnd_tmp
;
5749 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5752 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5754 if (tmp
< 1) tmp
= 1;
5758 if (!magr
->mcan
&& haseyes(pd
) && mdef
->mcansee
) {
5759 if (vis
) pline("%s looks %sconfused.",
5760 Monnam(mdef
), mdef
->mconf
? "more " : "");
5762 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5765 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5767 if (tmp
< 1) tmp
= 1;
5769 if (mdef
->mtame
&& !rn2(3)) badpeteffect(mdef
);
5772 if (!magr
->mcan
&& haseyes(pd
) && mdef
->mcansee
) {
5773 if (vis
) pline("%s looks %sconfused.",
5774 Monnam(mdef
), mdef
->mconf
? "more " : "");
5776 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5779 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
5781 if (tmp
< 1) tmp
= 1;
5785 if (mdef
->m_lev
> 0) mdef
->m_lev
--;
5786 if (mdef
->m_lev
> 0) mdef
->m_lev
--;
5787 if (mdef
->m_lev
== 0) tmp
*= 10;
5793 if (!magr
->mcan
&& !rn2(10) && (rnd(100) > mdef
->data
->mr
) ) {
5794 cancelmonsterlite(mdef
); /* cancelled regardless of lifesave */
5795 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5796 if (is_were(pd
) && pd
->mlet
!= S_HUMAN
)
5798 if (pd
== &mons
[PM_CLAY_GOLEM
]) {
5800 pline("Some writing vanishes from %s head!",
5801 s_suffix(mon_nam(mdef
)));
5802 pline("%s is destroyed!", Monnam(mdef
));
5805 if (mdef
->mhp
> 0) return 0;
5806 else if (mdef
->mtame
&& !vis
)
5807 You(brief_feeling
, "strangely sad");
5808 return (MM_DEF_DIED
| (grow_up(magr
,mdef
) ?
5811 if (flags
.soundok
) {
5812 if (!vis
) You_hear("laughter.");
5813 else pline("%s chuckles.", Monnam(magr
));
5814 if (PlayerHearsSoundEffects
) pline(issoviet
? "Tip bloka l'da smeyetsya tozhe." : "Hoehoehoehoe!");
5821 if (!magr
->mcan
&& !rn2(10) && (rnd(100) > mdef
->data
->mr
) ) {
5822 cancelmonsterlite(mdef
); /* cancelled regardless of lifesave */
5823 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5824 if (is_were(pd
) && pd
->mlet
!= S_HUMAN
)
5826 if (pd
== &mons
[PM_CLAY_GOLEM
]) {
5828 pline("Some writing vanishes from %s head!",
5829 s_suffix(mon_nam(mdef
)));
5830 pline("%s is destroyed!", Monnam(mdef
));
5833 if (mdef
->mhp
> 0) return 0;
5834 else if (mdef
->mtame
&& !vis
)
5835 You(brief_feeling
, "strangely sad");
5836 return (MM_DEF_DIED
| (grow_up(magr
,mdef
) ?
5839 if (flags
.soundok
) {
5840 if (!vis
) You_hear("laughter.");
5841 else pline("%s chuckles.", Monnam(magr
));
5842 if (PlayerHearsSoundEffects
) pline(issoviet
? "Tip bloka l'da smeyetsya tozhe." : "Hoehoehoehoe!");
5847 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= rnd(8);
5848 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5849 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5850 if (mdef
->m_lev
> 0) mdef
->m_lev
--;
5856 if (!magr
->mcan
&& !rn2(10) && (rnd(100) > mdef
->data
->mr
) ) {
5857 cancelmonsterlite(mdef
); /* cancelled regardless of lifesave */
5858 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5859 if (is_were(pd
) && pd
->mlet
!= S_HUMAN
)
5861 if (pd
== &mons
[PM_CLAY_GOLEM
]) {
5863 pline("Some writing vanishes from %s head!",
5864 s_suffix(mon_nam(mdef
)));
5865 pline("%s is destroyed!", Monnam(mdef
));
5868 if (mdef
->mhp
> 0) return 0;
5869 else if (mdef
->mtame
&& !vis
)
5870 You(brief_feeling
, "strangely sad");
5871 return (MM_DEF_DIED
| (grow_up(magr
,mdef
) ?
5874 if (flags
.soundok
) {
5875 if (!vis
) You_hear("laughter.");
5876 else pline("%s chuckles.", Monnam(magr
));
5877 if (PlayerHearsSoundEffects
) pline(issoviet
? "Tip bloka l'da smeyetsya tozhe." : "Hoehoehoehoe!");
5880 if (mdef
->mtame
) allbadpeteffects(mdef
);
5886 if (magr
->mcan
|| !mdef
->mgold
) break;
5887 /* technically incorrect; no check for stealing gold from
5888 * between mdef's feet...
5890 magr
->mgold
+= mdef
->mgold
;
5893 if (magr
->mcan
) break;
5894 /* technically incorrect; no check for stealing gold from
5895 * between mdef's feet...
5898 struct obj
*gold
= findgold(mdef
->minvent
);
5900 obj_extract_self(gold
);
5901 add_to_minv(magr
, gold
);
5904 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
5906 strcpy(buf
, Monnam(magr
));
5907 pline("%s steals some gold from %s.", buf
, mon_nam(mdef
));
5909 if (!tele_restrict(magr
)) {
5910 (void) rloc(magr
, FALSE
);
5911 if (vis
&& !canspotmon(magr
))
5912 pline("%s suddenly disappears!", buf
);
5917 if (mdef
->mhp
> 9) tmp
+= (mdef
->mhp
/ 10);
5918 if (vis
) pline("%s shrieks in pain!", Monnam(mdef
));
5924 if (!cancelled
&& magr
->mtame
&& !magr
->isminion
&&
5925 is_vampire(pa
) && mattk
->aatyp
== AT_BITE
&&
5927 EDOG(magr
)->hungrytime
+= ((int)((mdef
->data
)->cnutrit
/ 20) + 1);
5929 if (!cancelled
&& rn2(2) && !resists_drli(mdef
)) {
5930 if (vis
) pline("%s suddenly seems weaker!", Monnam(mdef
));
5931 mdef
->mhpmax
-= d(2,6);
5932 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5933 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5934 if (mdef
->m_lev
== 0) tmp
= mdef
->mhp
;
5936 /* Automatic kill if drained past level 0 */
5942 if (!cancelled
&& magr
->mtame
&& !magr
->isminion
&&
5943 is_vampire(pa
) && mattk
->aatyp
== AT_BITE
&&
5945 EDOG(magr
)->hungrytime
+= ((int)((mdef
->data
)->cnutrit
/ 20) + 1);
5947 if (!cancelled
&& rn2(2) && (!resists_drli(mdef
) || mdef
->mtame
) ) {
5948 if (vis
) pline("%s suddenly seems weaker!", Monnam(mdef
));
5949 mdef
->mhpmax
-= d(2,6);
5950 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5951 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5952 if (mdef
->m_lev
== 0) tmp
= mdef
->mhp
;
5954 /* Automatic kill if drained past level 0 */
5956 if (mdef
->mtame
&& !rn2(2)) badpeteffect(mdef
);
5961 if (!cancelled
&& magr
->mtame
&& !magr
->isminion
&&
5962 is_vampire(pa
) && mattk
->aatyp
== AT_BITE
&&
5964 EDOG(magr
)->hungrytime
+= ((int)((mdef
->data
)->cnutrit
/ 20) + 1);
5966 if (!cancelled
&& rn2(2) && !resists_drli(mdef
)) {
5967 if (vis
) pline("%s suddenly seems weaker!", Monnam(mdef
));
5968 mdef
->mhpmax
-= d(2,6);
5969 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5970 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5971 if (mdef
->m_lev
== 0) tmp
= mdef
->mhp
;
5973 /* Automatic kill if drained past level 0 */
5976 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= rnd(8);
5977 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5978 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5979 if (mdef
->m_lev
> 0) mdef
->m_lev
--;
5985 if (!cancelled
&& magr
->mtame
&& !magr
->isminion
&&
5986 is_vampire(pa
) && mattk
->aatyp
== AT_BITE
&&
5988 EDOG(magr
)->hungrytime
+= ((int)((mdef
->data
)->cnutrit
/ 20) + 1);
5990 if (!cancelled
&& rn2(2) && !resists_drli(mdef
)) {
5991 if (vis
) pline("%s suddenly seems weaker!", Monnam(mdef
));
5992 mdef
->mhpmax
-= d(2,6);
5993 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
5994 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
5995 if (mdef
->m_lev
== 0) tmp
= mdef
->mhp
;
5997 /* Automatic kill if drained past level 0 */
5999 if (mdef
->mtame
&& !rn2(50)) mdef
->willbebanished
= 1;
6004 if (!cancelled
&& magr
->mtame
&& !magr
->isminion
&&
6005 is_vampire(pa
) && mattk
->aatyp
== AT_BITE
&&
6007 EDOG(magr
)->hungrytime
+= ((int)((mdef
->data
)->cnutrit
/ 20) + 1);
6009 if ((!cancelled
|| mdef
->mtame
) && (rn2(2) || mdef
->mtame
) && !resists_drli(mdef
)) {
6010 if (vis
) pline("%s suddenly seems weaker!", Monnam(mdef
));
6011 mdef
->mhpmax
-= d(2,6);
6012 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
6013 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6014 if (mdef
->m_lev
== 0) tmp
= mdef
->mhp
;
6016 /* Automatic kill if drained past level 0 */
6020 case AD_SITM
: /* for now these are the same */
6023 if (magr
->mcan
) break;
6024 /* find an object to steal, non-cursed if magr is tame */
6025 for (obj
= mdef
->minvent
; obj
; obj
= obj
->nobj
)
6026 if (!magr
->mtame
|| !obj
->cursed
)
6030 char onambuf
[BUFSZ
], mdefnambuf
[BUFSZ
];
6032 /* make a special x_monnam() call that never omits
6033 the saddle, and save it for later messages */
6034 strcpy(mdefnambuf
, x_monnam(mdef
, ARTICLE_THE
, (char *)0, 0, FALSE
));
6037 if (u
.usteed
== mdef
&&
6038 otmp
== which_armor(mdef
, W_SADDLE
)) {
6040 /* I took the liberty of making saddles less likely to be stolen, but for a long time that code was only in steal.c
6041 * and therefore never actually did anything. Now, your steed should no longer be super vulnerable
6042 * to those motherfucker item-stealers! --Amy */
6043 if (rn2(5) && !issoviet
) break;
6045 /* "You can no longer ride <steed>." */
6046 dismount_steed(DISMOUNT_POLY
);
6048 obj_extract_self(otmp
);
6049 if (otmp
->owornmask
) {
6050 mdef
->misc_worn_check
&= ~otmp
->owornmask
;
6051 if (otmp
->owornmask
& W_WEP
)
6052 setmnotwielded(mdef
,otmp
);
6053 otmp
->owornmask
= 0L;
6054 update_mon_intrinsics(mdef
, otmp
, FALSE
, FALSE
);
6056 /* add_to_minv() might free otmp [if it merges] */
6058 strcpy(onambuf
, doname(otmp
));
6059 (void) add_to_minv(magr
, otmp
);
6061 strcpy(buf
, Monnam(magr
));
6062 pline("%s steals %s from %s!", buf
,
6063 onambuf
, mdefnambuf
);
6065 possibly_unwield(mdef
, FALSE
);
6066 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
6067 mselftouch(mdef
, (const char *)0, FALSE
);
6069 return (MM_DEF_DIED
| (grow_up(magr
,mdef
) ?
6071 if (magr
->data
->mlet
== S_NYMPH
&&
6072 !tele_restrict(magr
) && !rn2(5) ) {
6073 (void) rloc(magr
, FALSE
);
6074 if (vis
&& !canspotmon(magr
))
6075 pline("%s suddenly disappears!", buf
);
6079 if (mdef
->mtame
&& atttyp
== AD_STTP
) {
6095 if (!cancelled
&& !rn2(8)) {
6097 pline("%s %s was poisoned!", s_suffix(Monnam(magr
)),
6098 mpoisons_subj(magr
, mattk
));
6099 if (resists_poison(mdef
) && !player_will_pierce_resistance()) {
6101 pline_The("poison doesn't seem to affect %s.",
6104 if (rn2(100) || resists_poison(mdef
)) tmp
+= rn1(10,6);
6106 if (vis
) pline_The("poison was deadly...");
6115 if (!cancelled
&& !rn2(8)) {
6117 pline("%s %s was poisoned!", s_suffix(Monnam(magr
)),
6118 mpoisons_subj(magr
, mattk
));
6119 if (resists_poison(mdef
) && !player_will_pierce_resistance()) {
6121 pline_The("poison doesn't seem to affect %s.",
6124 if (rn2(100) || resists_poison(mdef
)) tmp
+= rn1(10,6);
6126 if (vis
) pline_The("poison was deadly...");
6133 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
6134 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6141 if (!cancelled
&& !rn2(3)) {
6142 if (resists_poison(mdef
) && !player_will_pierce_resistance()) {
6144 pline_The("poison doesn't seem to affect %s.",
6147 if (vis
) pline("%s is badly poisoned!", Monnam(mdef
));
6148 if (rn2(10) || resists_poison(mdef
)) tmp
+= rn1(20,12);
6150 if (vis
) pline_The("poison was deadly...");
6158 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= rnd(8);
6159 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
6160 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6166 if (notonhead
|| !has_head(pd
)) {
6167 if (vis
) pline("%s doesn't seem harmed.", Monnam(mdef
));
6168 /* Not clear what to do for green slimes */
6172 if ((mdef
->misc_worn_check
& W_ARMH
) && rn2(8)) {
6174 strcpy(buf
, s_suffix(Monnam(mdef
)));
6175 pline("%s helmet blocks %s attack to %s head.",
6176 buf
, s_suffix(mon_nam(magr
)),
6181 if (vis
) pline("%s brain is eaten!", s_suffix(Monnam(mdef
)));
6182 if (mindless(pd
) || mdef
->egotype_undead
) {
6183 if (vis
) pline("%s doesn't notice.", Monnam(mdef
));
6186 tmp
+= rnd(10); /* fakery, since monsters lack INT scores */
6187 if (magr
->mtame
&& !magr
->isminion
) {
6188 EDOG(magr
)->hungrytime
+= rnd(60);
6191 if (tmp
>= mdef
->mhp
&& vis
)
6192 pline("%s last thought fades away...",
6193 s_suffix(Monnam(mdef
)));
6195 case AD_SLIM
: /* no easy sliming Death or Famine --Amy */
6196 if (cancelled
|| (rn2(100) < mdef
->data
->mr
) ) break; /* physical damage only */
6197 if (!rn2(400) && !flaming(mdef
->data
) &&
6198 !slime_on_touch(mdef
->data
) ) {
6199 if (newcham(mdef
, &mons
[PM_GREEN_SLIME
], FALSE
, vis
)) {
6200 mdef
->oldmonnm
= PM_GREEN_SLIME
;
6201 (void) stop_timer(UNPOLY_MON
, (void *) mdef
);
6203 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
6207 if (cancelled
|| (rn2(100) < mdef
->data
->mr
) ) break; /* physical damage only */
6208 if (!rn2(mdef
->mtame
? 40 : 400) && !flaming(mdef
->data
) &&
6209 !slime_on_touch(mdef
->data
) ) {
6210 if (newcham(mdef
, &mons
[PM_GREEN_SLIME
], FALSE
, vis
)) {
6211 mdef
->oldmonnm
= PM_GREEN_SLIME
;
6212 (void) stop_timer(UNPOLY_MON
, (void *) mdef
);
6214 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
6218 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
6219 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6220 if (!rn2(3)) badpeteffect(mdef
);
6224 if (mdef
->mtame
&& !rn2(10) && !resists_disint(mdef
)) {
6225 if (vis
) pline("%s is hit by disintegration!", Monnam(mdef
));
6227 otmp2
= (struct obj
*)0;
6228 if (mdef
->misc_worn_check
& W_ARMS
) {
6229 otmp2
= which_armor(mdef
, W_ARMS
);
6230 } else if (mdef
->misc_worn_check
& W_ARMC
) {
6231 otmp2
= which_armor(mdef
, W_ARMC
);
6232 } else if (mdef
->misc_worn_check
& W_ARM
) {
6233 otmp2
= which_armor(mdef
, W_ARM
);
6234 } else if (mdef
->misc_worn_check
& W_ARMU
) {
6235 otmp2
= which_armor(mdef
, W_ARMU
);
6237 /* no body armor, victim dies; destroy cloak
6238 and shirt now in case target gets life-saved */
6241 if (otmp2
&& (otmp2
!= (struct obj
*)0) ) m_useup(mdef
, otmp2
);
6247 if (vis
) pline("%s is being shredded!", Monnam(mdef
));
6249 otmp2
= (struct obj
*)0;
6256 if (mdef
->misc_worn_check
& W_ARMS
) {
6257 otmp2
= which_armor(mdef
, W_ARMS
);
6258 } else if (mdef
->misc_worn_check
& W_ARMC
) {
6259 otmp2
= which_armor(mdef
, W_ARMC
);
6260 } else if (mdef
->misc_worn_check
& W_ARM
) {
6261 otmp2
= which_armor(mdef
, W_ARM
);
6262 } else if (mdef
->misc_worn_check
& W_ARMU
) {
6263 otmp2
= which_armor(mdef
, W_ARMU
);
6265 /* no body armor, victim dies; destroy cloak
6266 and shirt now in case target gets life-saved */
6269 if (otmp2
&& (otmp2
!= (struct obj
*)0) ) m_useup(mdef
, otmp2
);
6276 if (vis
) pline("%s is doused with water!", Monnam(mdef
));
6277 if (rn2(3)) mdef
->mconf
= 1;
6278 if (!rn2(3)) mon_adjust_speed(mdef
, -1, (struct obj
*)0);
6279 if (!rn2(5)) badpeteffect(mdef
);
6283 if (mdef
->mtame
) tmp
*= rnd(4);
6286 if (mdef
->mtame
&& !rn2(4)) badpeteffect(mdef
);
6289 if (mdef
->mtame
&& !rn2(4)) badpeteffect(mdef
);
6292 if (mdef
->mtame
&& !rn2(5)) badpeteffect(mdef
);
6296 if (vis
) pline("%s is sucked by a vacuum cleaner!", Monnam(mdef
));
6301 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
6302 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6307 if (mdef
->mtame
) tmp
*= 3;
6308 if (mdef
->mtame
&& !rn2(10) && !resists_disint(mdef
)) {
6309 if (vis
) pline("%s is hit by vaporization!", Monnam(mdef
));
6311 otmp2
= (struct obj
*)0;
6312 if (mdef
->misc_worn_check
& W_ARMS
) {
6313 otmp2
= which_armor(mdef
, W_ARMS
);
6314 } else if (mdef
->misc_worn_check
& W_ARMC
) {
6315 otmp2
= which_armor(mdef
, W_ARMC
);
6316 } else if (mdef
->misc_worn_check
& W_ARM
) {
6317 otmp2
= which_armor(mdef
, W_ARM
);
6318 } else if (mdef
->misc_worn_check
& W_ARMU
) {
6319 otmp2
= which_armor(mdef
, W_ARMU
);
6321 /* no body armor, victim dies; destroy cloak
6322 and shirt now in case target gets life-saved */
6325 if (otmp2
&& (otmp2
!= (struct obj
*)0) ) m_useup(mdef
, otmp2
);
6330 if (mdef
->mtame
&& !rn2(3)) {
6331 if (vis
) pline("%s looks sick.", Monnam(mdef
));
6332 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
6333 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6337 if (mdef
->mtame
&& !rn2(4)) {
6338 if (vis
) pline("%s looks sick.", Monnam(mdef
));
6340 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
6341 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6343 if (!rn2(3)) mdef
->mconf
= TRUE
;
6344 if (!rn2(3)) mdef
->mstun
= TRUE
;
6345 if (!rn2(5) && mdef
->mcanmove
) {
6348 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
6353 if (mdef
->mtame
&& !rn2(20)) badpeteffect(mdef
);
6357 if (vis
) pline("%s withers!", Monnam(mdef
));
6358 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= rnd(8);
6359 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
6360 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6361 if (mdef
->m_lev
> 0) mdef
->m_lev
--;
6365 if (mdef
->mtame
&& !rn2(5)) badpeteffect(mdef
);
6369 if (vis
) pline("%s seems oblivious!", Monnam(mdef
));
6371 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
6372 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6373 if (mdef
->m_lev
> 0) mdef
->m_lev
--;
6382 if (vis
) pline("%s seems less protected!", Monnam(mdef
));
6384 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
6385 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6386 if (mdef
->m_lev
> 0) mdef
->m_lev
--;
6393 if (mdef
->mtame
&& !rn2(3) && mdef
->mcanmove
) {
6396 mdef
->mstrategy
&= ~STRAT_WAITFORU
;
6397 if (vis
) pline("%s is stopped in %s tracks.", Monnam(mdef
), mhis(mdef
));
6402 if (vis
) pline("%s looks very sick.", Monnam(mdef
));
6403 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
6404 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6408 if (cancelled
) tmp
= 0;
6410 case AD_WRAP
: /* monsters cannot grab one another, it's too hard */
6411 if (magr
->mcan
) tmp
= 0;
6412 if (mdef
->mtame
&& !rn2(10)) {
6414 if (is_drowningpool(magr
->mx
, magr
->my
)) tmp
*= 10;
6419 /* There's no msomearmor() function, so just do damage */
6420 /* if (cancelled) break; */
6421 if (mdef
->mtame
&& !rn2(3)) {
6422 if (mdef
->mhpmax
> 1) mdef
->mhpmax
--;
6423 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6429 if (mdef
->mhpmax
> (Role_if(PM_ZOOKEEPER
) ? 480 : 240)) {
6430 int reduction
= rnd(mdef
->mhpmax
/ 10);
6431 if (reduction
< 1) reduction
= 1; /* shouldn't happen */
6432 mdef
->mhpmax
-= reduction
;
6433 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
6434 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6435 if (vis
) pline("%s is in pain!", Monnam(mdef
));
6436 } else if (mdef
->mhpmax
> (Role_if(PM_ZOOKEEPER
) ? 320 : 160)) {
6438 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
6439 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6440 if (vis
) pline("%s seems to be hurt!", Monnam(mdef
));
6445 if (mdef
->mtame
) tmp
*= 10;
6448 if (mdef
->mtame
&& !rn2(3)) {
6450 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= 8;
6451 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
6452 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6455 int untamingchance
= 10;
6457 if (!(PlayerCannotUseSkills
)) {
6458 switch (P_SKILL(P_PETKEEPING
)) {
6459 default: untamingchance
= 10; break;
6460 case P_BASIC
: untamingchance
= 9; break;
6461 case P_SKILLED
: untamingchance
= 8; break;
6462 case P_EXPERT
: untamingchance
= 7; break;
6463 case P_MASTER
: untamingchance
= 6; break;
6464 case P_GRAND_MASTER
: untamingchance
= 5; break;
6465 case P_SUPREME_MASTER
: untamingchance
= 4; break;
6469 if (!mdef
->mfrenzied
&& !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && mdef
->data
->mlet
== S_DRAGON
) && (!mdef
->mtame
|| (mdef
->mtame
<= rnd(21) && (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4) ) ) ) {
6470 mdef
->mpeaceful
= mdef
->mtame
= 0;
6471 mdef
->mfrenzied
= 1;
6472 if (vis
) pline("%s enters a state of frenzy!", Monnam(mdef
));
6479 if (mdef
->mtame
&& !rn2(10)) badpeteffect(mdef
);
6483 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= 5;
6484 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
6485 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6492 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= rnd(3);
6493 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
6494 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6500 if (mdef
->mhpmax
> 1) mdef
->mhpmax
-= rnd(20);
6501 if (mdef
->mhpmax
< 1) mdef
->mhpmax
= 1;
6502 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
6511 if (!magr
->mcan
&& tmp
< mdef
->mhp
) {
6512 if (resists_magm(mdef
) || (rn2(100) < mdef
->data
->mr
) ) { /* no easy taming Death or Famine! --Amy */
6513 /* magic resistance protects from polymorph traps, so
6514 * make it guard against involuntary polymorph attacks
6516 if (vis
) shieldeff(mdef
->mx
, mdef
->my
);
6520 if (!rn2(25) || !mon_poly(mdef
)) {
6522 pline("%s shudders!", Monnam(mdef
));
6523 /* no corpse after system shock */
6527 (void) mon_poly(mdef
, FALSE
,
6528 "%s undergoes a freakish metamorphosis!");
6533 if (!magr
->mcan
&& tmp
< mdef
->mhp
) {
6534 if (resists_magm(mdef
) || (rn2(100) < mdef
->data
->mr
) ) { /* no easy taming Death or Famine! --Amy */
6535 /* magic resistance protects from polymorph traps, so
6536 * make it guard against involuntary polymorph attacks
6538 if (vis
) shieldeff(mdef
->mx
, mdef
->my
);
6541 (void) mon_poly(mdef
, FALSE
,
6542 "%s undergoes a freakish metamorphosis!");
6544 if ((tmp
> 0) && (mdef
&& mdef
->mhpmax
> 1)) {
6546 if (vis
) pline("%s feels bad!", Monnam(mdef
));
6548 if (mdef
->mtame
) badpeteffect(mdef
);
6552 case AD_CALM
: /* KMH -- koala attack */
6555 int untamingchance
= 10;
6557 if (!(PlayerCannotUseSkills
)) {
6558 switch (P_SKILL(P_PETKEEPING
)) {
6559 default: untamingchance
= 10; break;
6560 case P_BASIC
: untamingchance
= 9; break;
6561 case P_SKILLED
: untamingchance
= 8; break;
6562 case P_EXPERT
: untamingchance
= 7; break;
6563 case P_MASTER
: untamingchance
= 6; break;
6564 case P_GRAND_MASTER
: untamingchance
= 5; break;
6565 case P_SUPREME_MASTER
: untamingchance
= 4; break;
6569 /* Certain monsters aren't even made peaceful. */
6570 if (!mdef
->iswiz
&& mdef
->data
!= &mons
[PM_MEDUSA
] &&
6571 !(mdef
->data
->mflags3
& M3_COVETOUS
) &&
6572 !(mdef
->data
->geno
& G_UNIQ
) && !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && mdef
->data
->mlet
== S_DRAGON
) &&
6573 ((magr
->mtame
&& !rn2(10)) || (mdef
->mtame
&& (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4)) )) {
6574 if (vis
) pline("%s looks calmer.", Monnam(mdef
));
6575 if (mdef
== u
.usteed
&& !mayfalloffsteed())
6576 dismount_steed(DISMOUNT_THROWN
);
6577 if (!mdef
->mfrenzied
) mdef
->mpeaceful
= 1;
6588 int untamingchance
= 10;
6590 if (!(PlayerCannotUseSkills
)) {
6591 switch (P_SKILL(P_PETKEEPING
)) {
6592 default: untamingchance
= 10; break;
6593 case P_BASIC
: untamingchance
= 9; break;
6594 case P_SKILLED
: untamingchance
= 8; break;
6595 case P_EXPERT
: untamingchance
= 7; break;
6596 case P_MASTER
: untamingchance
= 6; break;
6597 case P_GRAND_MASTER
: untamingchance
= 5; break;
6598 case P_SUPREME_MASTER
: untamingchance
= 4; break;
6602 if (!mdef
->mfrenzied
&& !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && mdef
->data
->mlet
== S_DRAGON
) && (!mdef
->mtame
|| (mdef
->mtame
<= rnd(21) && (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4) ) ) ) {
6603 mdef
->mpeaceful
= mdef
->mtame
= 0;
6604 mdef
->mfrenzied
= 1;
6605 if (vis
) pline("%s enters a state of frenzy!", Monnam(mdef
));
6611 default: /*tmp = 0;*/
6612 if (mattk
->aatyp
== AT_EXPL
&& tmp
> 1) {
6614 if (tmp
< 1) tmp
= 1;
6616 break; /* necessary change to make pets more viable --Amy */
6618 if(!tmp
) return(MM_MISS
);
6620 /* STEPHEN WHITE'S NEW CODE */
6621 if (objenchant
< canhitmon
&& vis
&& nohit
) {
6622 strcpy(buf
, Monnam(magr
));
6623 pline("%s doesn't seem to harm %s.", buf
,
6627 /* WAC -- Caveman Primal Roar ability */
6628 if (magr
->mtame
!= 0 && tech_inuse(T_PRIMAL_ROAR
)) {
6629 tmp
*= 2; /* Double Damage! */
6632 if (Race_if(PM_BOVER
) && u
.usteed
&& (mdef
== u
.usteed
) && tmp
> 1) tmp
/= 2;
6633 if (Race_if(PM_CARTHAGE
) && u
.usteed
&& (mdef
== u
.usteed
) && (mcalcmove(u
.usteed
) < 12) && tmp
> 1) tmp
/= 2;
6635 if((mdef
->mhp
-= tmp
) < 1) {
6636 if (m_at(mdef
->mx
, mdef
->my
) == magr
) { /* see gulpmm() */
6637 remove_monster(mdef
->mx
, mdef
->my
);
6638 mdef
->mhp
= 1; /* otherwise place_monster will complain */
6639 place_monster(mdef
, mdef
->mx
, mdef
->my
);
6642 /* get experience from spell creatures */
6643 if (magr
->uexp
) mon_xkilled(mdef
, "", (int)mattk
->adtyp
);
6644 else monkilled(mdef
, "", (int)mattk
->adtyp
);
6646 if (mdef
->mhp
> 0) return 0; /* mdef lifesaved */
6648 if (magr
->mhp
> 0 && magr
->mtame
) use_skill(P_PETKEEPING
,1);
6650 if (mattk
->adtyp
== AD_DGST
) {
6651 /* various checks similar to dog_eat and meatobj.
6652 * after monkilled() to provide better message ordering */
6653 if (mdef
->cham
!= CHAM_ORDINARY
) {
6654 (void) newcham(magr
, (struct permonst
*)0, FALSE
, TRUE
);
6655 } else if (mdef
->data
== &mons
[PM_GREEN_SLIME
]) {
6656 (void) newcham(magr
, &mons
[PM_GREEN_SLIME
], FALSE
, TRUE
);
6657 } else if (mdef
->data
== &mons
[PM_WRAITH
]) {
6658 (void) grow_up(magr
, (struct monst
*)0);
6659 /* don't grow up twice */
6660 return (MM_DEF_DIED
| (magr
->mhp
> 0 ? 0 : MM_AGR_DIED
));
6661 } else if (mdef
->data
== &mons
[PM_NURSE
]) {
6662 magr
->mhp
= magr
->mhpmax
;
6666 return (MM_DEF_DIED
|
6667 ((magr
->mhp
> 0 && grow_up(magr
,mdef
)) ? 0 : MM_AGR_DIED
));
6669 if (mdef
->mhp
> 0) monster_pain(mdef
);
6680 noattacks(ptr
) /* returns 1 if monster doesn't attack */
6681 struct permonst
*ptr
;
6685 for(i
= 0; i
< NATTK
; i
++)
6686 if(ptr
->mattk
[i
].aatyp
) return(0);
6691 /* `mon' is hit by a sleep attack; return 1 if it's affected, 0 otherwise */
6693 sleep_monst(mon
, amt
, how
)
6697 if (resists_sleep(mon
) ||
6698 (how
>= 0 && resist(mon
, (char)how
, 0, NOTELL
))) {
6699 if (resists_sleep(mon
) && canseemon(mon
)) pline("%s is immune to sleep!", Monnam(mon
));
6700 shieldeff(mon
->mx
, mon
->my
);
6701 } else if (mon
->mcanmove
) {
6702 amt
+= (int) mon
->mfrozen
;
6703 if (amt
> 0) { /* sleep for N turns */
6705 mon
->mfrozen
= min(amt
, 127);
6707 } else { /* sleep until awakened */
6715 /* sleeping grabber releases, engulfer doesn't; don't use for paralysis! */
6720 if ((mon
->msleeping
|| !mon
->mcanmove
) && mon
== u
.ustuck
&&
6721 !sticks(youmonst
.data
) && !u
.uswallow
) {
6722 pline("%s grip relaxes.", s_suffix(Monnam(mon
)));
6731 mrustm(magr
, mdef
, obj
)
6732 register struct monst
*magr
, *mdef
;
6733 register struct obj
*obj
;
6737 if (DEADMONSTER(magr
)) return;
6738 if (DEADMONSTER(mdef
)) return;
6740 if (!magr
|| !mdef
|| !obj
) return; /* just in case */
6742 /* It is just teh uber cheat0r that non-passive rusting attacks still cause the attacking monster's shit to rust. */
6743 if (attackdamagetype(mdef
->data
, AT_NONE
, AD_CORR
)) {
6745 } else if (attackdamagetype(mdef
->data
, AT_NONE
, AD_RUST
)) {
6747 } else if (attackdamagetype(mdef
->data
, AT_RATH
, AD_CORR
)) {
6749 } else if (attackdamagetype(mdef
->data
, AT_RATH
, AD_RUST
)) {
6752 /* In Soviet Russia, the Amy is considered the antichrist and everything she does must be bad. She can go ahead and
6753 * do obvious bug fixes that every sane person would immediately recognize as such, but the type of ice block goes
6754 * ahead and says 'she made this change, therefore it must be bad REVERTREVERTREVERTREVERTREVERTREVERTREVERT'. */
6755 } else if (issoviet
) {
6756 if (dmgtype(mdef
->data
, AD_CORR
))
6758 else if (dmgtype(mdef
->data
, AD_RUST
))
6765 (is_acid
? (is_corrodeable(obj
) && !(objects
[obj
->otyp
].oc_material
== MT_GREEN_STEEL
&& rn2(2)) ) : (is_rustprone(obj
) && !(objects
[obj
->otyp
].oc_material
== MT_COBALT
&& rn2(2) ) && !(objects
[obj
->otyp
].oc_material
== MT_BRONZE
&& rn2(2) ) ) ) && !stack_too_big(obj
) &&
6766 (is_acid
? obj
->oeroded2
: obj
->oeroded
) < MAX_ERODE
) {
6767 if (obj
->greased
|| (obj
->oartifact
&& rn2(4)) || obj
->oerodeproof
|| (obj
->blessed
&& rn2(3))) {
6768 if (cansee(mdef
->mx
, mdef
->my
) && flags
.verbose
)
6769 pline("%s weapon is not affected.",
6770 s_suffix(Monnam(magr
)));
6771 if (obj
->greased
&& !rn2(2)) obj
->greased
-= 1;
6773 if (cansee(mdef
->mx
, mdef
->my
)) {
6774 pline("%s %s%s!", s_suffix(Monnam(magr
)),
6775 aobjnam(obj
, (is_acid
? "corrode" : "rust")),
6776 (is_acid
? obj
->oeroded2
: obj
->oeroded
)
6779 if (is_acid
) obj
->oeroded2
++;
6780 else obj
->oeroded
++;
6786 mswingsm(magr
, mdef
, otemp
)
6787 register struct monst
*magr
, *mdef
;
6788 register struct obj
*otemp
;
6790 if (DEADMONSTER(magr
)) return;
6791 if (DEADMONSTER(mdef
)) return;
6794 if (!flags
.verbose
|| Blind
|| !mon_visible(magr
)) return;
6795 strcpy(buf
, mon_nam(mdef
));
6796 pline("%s %s %s %s at %s.", Monnam(magr
),
6797 (objects
[otemp
->otyp
].oc_dir
& PIERCE
) ? "thrusts" : "swings",
6798 mhis(magr
), singular(otemp
, xname
), buf
);
6802 * Passive responses by defenders. Does not replicate responses already
6803 * handled above. Returns same values as mattackm.
6806 passivemm(magr
,mdef
,mhit
,mdead
,attnumber
)
6807 register struct monst
*magr
, *mdef
;
6812 register struct permonst
*mddat
= mdef
->data
;
6813 register struct permonst
*madat
= magr
->data
;
6817 if (DEADMONSTER(magr
)) return 0;
6818 /* mdef may be dead --Amy */
6822 if ( (mdef
->mtame
|| !(attacktype(mdef
->data
, AT_RATH
))) && !monnear(magr
, mdef
->mx
, mdef
->my
)) return 0;
6825 if(i
>= NATTK
) return (mdead
| mhit
); /* no passive attacks */
6826 if((i
== attnumber
) && (mddat
->mattk
[i
].aatyp
== AT_NONE
|| mddat
->mattk
[i
].aatyp
== AT_RATH
)) break;
6829 if (mddat
->mattk
[i
].damn
)
6830 tmp
= d((int)mddat
->mattk
[i
].damn
,
6831 (int)mddat
->mattk
[i
].damd
);
6832 else if(mddat
->mattk
[i
].damd
)
6833 tmp
= d((int)mddat
->mlevel
+1, (int)mddat
->mattk
[i
].damd
);
6837 atttypB
= mddat
->mattk
[i
].adtyp
;
6841 if (atttypB
== AD_RBRE
) {
6842 while (atttypB
== AD_ENDS
|| atttypB
== AD_RBRE
|| atttypB
== AD_WERE
) {
6843 atttypB
= randattack();
6847 if (atttypB
== AD_DAMA
) {
6848 atttypB
= randomdamageattack();
6851 if (atttypB
== AD_ILLU
) {
6852 atttypB
= randomillusionattack();
6855 if (atttypB
== AD_THIE
) {
6856 atttypB
= randomthievingattack();
6859 if (atttypB
== AD_RNG
) {
6860 while (atttypB
== AD_ENDS
|| atttypB
== AD_RNG
|| atttypB
== AD_WERE
) {
6861 atttypB
= rn2(AD_ENDS
); }
6864 if (atttypB
== AD_PART
) atttypB
= u
.adpartattack
;
6866 if (atttypB
== AD_MIDI
) {
6867 atttypB
= mdef
->m_id
;
6868 if (atttypB
< 0) atttypB
*= -1;
6869 while (atttypB
>= AD_ENDS
) atttypB
-= AD_ENDS
;
6870 if (!(atttypB
>= AD_PHYS
&& atttypB
< AD_ENDS
)) atttypB
= AD_PHYS
; /* fail safe --Amy */
6871 if (atttypB
== AD_WERE
) atttypB
= AD_PHYS
;
6875 /* These affect the enemy even if defender killed */
6878 if (mhit
&& !rn2(2)) {
6879 strcpy(buf
, Monnam(magr
));
6881 pline("%s is splashed by %s acid!",
6882 buf
, s_suffix(mon_nam(mdef
)));
6883 if (resists_acid(magr
) && !player_will_pierce_resistance()) {
6885 pline("%s is not affected.", Monnam(magr
));
6891 /* wrath of gods for attacking Oracle */
6892 if(resists_magm(magr
)) {
6893 if(canseemon(magr
)) {
6894 shieldeff(magr
->mx
, magr
->my
);
6895 pline("A hail of magic missiles narrowly misses %s!",mon_nam(magr
));
6899 pline(magr
->data
== &mons
[PM_WOODCHUCK
] ? "ZOT!" :
6900 "%s is hit by magic missiles appearing from thin air!",Monnam(magr
));
6904 case AD_ENCH
: /* KMH -- remove enchantment (disenchanter) */
6905 if (mhit
&& !mdef
->mcan
&& otmp
) {
6909 if (magr
->mtame
&& !rn2(3)) {
6910 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
6911 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
6916 if (magr
->mtame
&& !rn2(3)) {
6917 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
6918 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
6924 if (magr
->mhpmax
> (Role_if(PM_ZOOKEEPER
) ? 480 : 240)) {
6925 int reduction
= rnd(magr
->mhpmax
/ 10);
6926 if (reduction
< 1) reduction
= 1; /* shouldn't happen */
6927 magr
->mhpmax
-= reduction
;
6928 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
6929 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
6930 if (canseemon(magr
)) pline("%s is in pain!", Monnam(magr
));
6931 } else if (magr
->mhpmax
> (Role_if(PM_ZOOKEEPER
) ? 320 : 160)) {
6933 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
6934 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
6935 if (canseemon(magr
)) pline("%s seems to be hurt!", Monnam(magr
));
6941 if (mhit
&& !mdef
->mcan
&& otmp
) {
6946 if (magr
->mhpmax
> 1) magr
->mhpmax
-= 5;
6947 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
6948 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
6957 if ((mdead
&& !magr
->mtame
) || mdef
->mcan
) return (mdead
|mhit
);
6959 /* These affect the enemy only if defender is still alive */
6960 if (rn2(3)) switch(atttypB
) {
6961 case AD_PLYS
: /* Floating eye */
6964 int parlyzdur
= rnd(magr
->mtame
? 4 : 10);
6965 if (!rn2(4)) parlyzdur
= tmp
;
6967 if (parlyzdur
> 3) {
6968 parlyzdur
= rnd(parlyzdur
);
6969 if (parlyzdur
< 3) parlyzdur
= 3;
6971 if (parlyzdur
> 1) parlyzdur
= rnd(parlyzdur
);
6973 if (parlyzdur
> 127) parlyzdur
= 127;
6975 if (dmgtype(magr
->data
, AD_PLYS
)) return 1;
6977 if (tmp
> 127) tmp
= 127;
6978 if (mddat
== &mons
[PM_FLOATING_EYE
]) {
6979 /*if (!rn2(4)) tmp = 127;*/
6980 if (magr
->mcansee
&& (!rn2(4) || !(mdef
->mtame
)) && haseyes(madat
) && mdef
->mcansee
&& !mdef
->minvisreal
&&
6981 (perceives(madat
) || !mdef
->minvis
)) {
6982 sprintf(buf
, "%s gaze is reflected by %%s %%s.",
6983 s_suffix(mon_nam(mdef
)));
6984 if (mon_reflects(magr
,
6985 canseemon(magr
) ? buf
: (char *)0))
6987 strcpy(buf
, Monnam(magr
));
6989 pline("%s is frozen by %s gaze!",
6990 buf
, s_suffix(mon_nam(mdef
)));
6992 magr
->mfrozen
= parlyzdur
;
6993 return (mdead
|mhit
);
6995 } else if (!rn2(4) || !(mdef
->mtame
)) { /* gelatinous cube */
6996 strcpy(buf
, Monnam(magr
));
6998 pline("%s is frozen by %s.", buf
, mon_nam(mdef
));
7000 magr
->mfrozen
= parlyzdur
;
7001 return (mdead
|mhit
);
7007 if (resists_cold(magr
) && !player_will_pierce_resistance()) {
7008 if (canseemon(magr
)) {
7009 pline("%s is mildly chilly.", Monnam(magr
));
7010 golemeffects(magr
, AD_COLD
, tmp
);
7016 pline("%s is suddenly very cold!", Monnam(magr
));
7018 mdef
->mhp
+= tmp
/ 2;
7019 if (mdef
->mhpmax
< mdef
->mhp
) mdef
->mhpmax
= mdef
->mhp
;
7020 if (mdef
->mhpmax
> ((int) (mdef
->m_lev
+1) * 8) && !rn2(50) ) /* split much less often --Amy */
7021 (void)split_mon(mdef
, magr
);
7025 if (magr
->mtame
&& !rn2(3)) {
7027 int untamingchance
= 10;
7029 if (!(PlayerCannotUseSkills
)) {
7030 switch (P_SKILL(P_PETKEEPING
)) {
7031 default: untamingchance
= 10; break;
7032 case P_BASIC
: untamingchance
= 9; break;
7033 case P_SKILLED
: untamingchance
= 8; break;
7034 case P_EXPERT
: untamingchance
= 7; break;
7035 case P_MASTER
: untamingchance
= 6; break;
7036 case P_GRAND_MASTER
: untamingchance
= 5; break;
7037 case P_SUPREME_MASTER
: untamingchance
= 4; break;
7041 /* Certain monsters aren't even made peaceful. */
7042 if (!magr
->iswiz
&& magr
->data
!= &mons
[PM_MEDUSA
] &&
7043 !(magr
->data
->mflags3
& M3_COVETOUS
) && !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && magr
->data
->mlet
== S_DRAGON
) && !(magr
->data
->geno
& G_UNIQ
) &&
7044 ((mdef
->mtame
&& !rn2(10)) || (magr
->mtame
&& (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4)) )) {
7045 if (canseemon(magr
)) pline("%s looks calmer.", Monnam(magr
));
7046 if (magr
== u
.usteed
&& !mayfalloffsteed())
7047 dismount_steed(DISMOUNT_THROWN
);
7048 if (!magr
->mfrenzied
&& !rn2(3)) magr
->mpeaceful
= 1;
7049 else magr
->mpeaceful
= 0;
7059 int untamingchance
= 10;
7061 if (!(PlayerCannotUseSkills
)) {
7062 switch (P_SKILL(P_PETKEEPING
)) {
7063 default: untamingchance
= 10; break;
7064 case P_BASIC
: untamingchance
= 9; break;
7065 case P_SKILLED
: untamingchance
= 8; break;
7066 case P_EXPERT
: untamingchance
= 7; break;
7067 case P_MASTER
: untamingchance
= 6; break;
7068 case P_GRAND_MASTER
: untamingchance
= 5; break;
7069 case P_SUPREME_MASTER
: untamingchance
= 4; break;
7073 /* Certain monsters aren't even made peaceful. */
7074 if (!magr
->iswiz
&& magr
->data
!= &mons
[PM_MEDUSA
] &&
7075 !(magr
->data
->mflags3
& M3_COVETOUS
) && !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && magr
->data
->mlet
== S_DRAGON
) && !(magr
->data
->geno
& G_UNIQ
) &&
7076 ((mdef
->mtame
&& !rn2(10)) || (magr
->mtame
&& (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4)) )) {
7077 if (canseemon(magr
)) pline("%s looks calmer.", Monnam(magr
));
7078 if (magr
== u
.usteed
&& !mayfalloffsteed())
7079 dismount_steed(DISMOUNT_THROWN
);
7080 if (!magr
->mfrenzied
&& !rn2(3)) magr
->mpeaceful
= 1;
7081 else magr
->mpeaceful
= 0;
7091 int untamingchance
= 10;
7093 if (!(PlayerCannotUseSkills
)) {
7094 switch (P_SKILL(P_PETKEEPING
)) {
7095 default: untamingchance
= 10; break;
7096 case P_BASIC
: untamingchance
= 9; break;
7097 case P_SKILLED
: untamingchance
= 8; break;
7098 case P_EXPERT
: untamingchance
= 7; break;
7099 case P_MASTER
: untamingchance
= 6; break;
7100 case P_GRAND_MASTER
: untamingchance
= 5; break;
7101 case P_SUPREME_MASTER
: untamingchance
= 4; break;
7105 if (!magr
->mfrenzied
&& !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && magr
->data
->mlet
== S_DRAGON
) && (!magr
->mtame
|| (magr
->mtame
<= rnd(21) && (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4) ) ) ) {
7106 magr
->mpeaceful
= magr
->mtame
= 0;
7107 magr
->mfrenzied
= 1;
7108 if (canseemon(magr
)) pline("%s enters a state of frenzy!", Monnam(magr
));
7115 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7116 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7120 if (!magr
->mtame
) tmp
= 0;
7123 if (canseemon(magr
))
7124 pline("%s %s...", Monnam(magr
), makeplural(stagger(magr
->data
, "stagger")));
7131 if (canseemon(magr
))
7132 pline("%s %s...", Monnam(magr
), makeplural(stagger(magr
->data
, "stagger")));
7134 if (magr
->mtame
&& !rn2(4)) {
7135 mon_adjust_speed(magr
, -1, (struct obj
*)0);
7136 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7137 if (!rn2(4)) magr
->inertia
+= (2 + (tmp
* 2));
7143 if (canseemon(magr
))
7144 pline("%s %s...", Monnam(magr
), makeplural(stagger(magr
->data
, "stagger")));
7147 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7148 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7149 if (!rn2(3)) badpeteffect(magr
);
7155 if (canseemon(magr
))
7156 pline("%s %s...", Monnam(magr
), makeplural(stagger(magr
->data
, "stagger")));
7160 if (!rn2(5)) badpeteffect(magr
);
7164 if (resists_fire(magr
) && !player_will_pierce_resistance()) {
7165 if (canseemon(magr
)) {
7166 pline("%s is mildly warmed.", Monnam(magr
));
7167 golemeffects(magr
, AD_FIRE
, tmp
);
7173 pline("%s is suddenly very hot!", Monnam(magr
));
7176 if (resists_elec(magr
) && !player_will_pierce_resistance()) {
7177 if (canseemon(magr
)) {
7178 pline("%s is mildly tingled.", Monnam(magr
));
7179 golemeffects(magr
, AD_ELEC
, tmp
);
7185 pline("%s is jolted with electricity!", Monnam(magr
));
7189 if (is_vampire(magr
->data
)) {
7190 tmp
*= 2; /* vampires take more damage from sunlight --Amy */
7191 if (canseemon(magr
)) pline("%s is irradiated!", Monnam(magr
));
7194 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7195 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7199 if (magr
->mtame
&& !rn2(3)) {
7200 magr
->willbebanished
= TRUE
;
7202 } /* else fall through */
7204 if (!tele_restrict(magr
)) (void) rloc(magr
, FALSE
);
7207 if (!tele_restrict(magr
)) (void) rloc(magr
, FALSE
);
7210 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7211 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7213 if (!rn2(7)) badpeteffect(magr
);
7217 if (!tele_restrict(magr
)) (void) rloc(magr
, FALSE
);
7218 if (magr
->mtame
) badpeteffect(magr
);
7222 int parlyzdur
= rnd(mdef
->mtame
? 3 : 10);
7223 if (!rn2(5)) parlyzdur
= tmp
;
7225 if (parlyzdur
> 2) {
7226 parlyzdur
= rnd(parlyzdur
);
7227 if (parlyzdur
< 2) parlyzdur
= 2;
7229 if (parlyzdur
> 1) parlyzdur
= rnd(parlyzdur
);
7231 if (parlyzdur
> 127) parlyzdur
= 127;
7233 if (!magr
->msleeping
&& (!rn2(5) || !(mdef
->mtame
)) && sleep_monst(magr
, parlyzdur
, -1)) {
7234 if (canseemon(magr
)) {
7235 pline("%s is put to sleep.", Monnam(magr
));
7237 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7245 if(magr
->mspeed
!= MSLOW
) {
7246 unsigned int oldspeed
= magr
->mspeed
;
7248 mon_adjust_speed(magr
, -1, (struct obj
*)0);
7249 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7250 if (magr
->mspeed
!= oldspeed
&& canseemon(magr
))
7251 pline("%s slows down.", Monnam(magr
));
7256 if(magr
->mspeed
!= MSLOW
) {
7257 unsigned int oldspeed
= magr
->mspeed
;
7259 mon_adjust_speed(magr
, -1, (struct obj
*)0);
7260 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7261 if (magr
->mspeed
!= oldspeed
&& canseemon(magr
))
7262 pline("%s slows down.", Monnam(magr
));
7265 if (canseemon(magr
)) pline("%s's weight increases.", Monnam(magr
));
7266 magr
->inertia
+= tmp
;
7271 if(magr
->mspeed
!= MSLOW
) {
7272 unsigned int oldspeed
= magr
->mspeed
;
7274 mon_adjust_speed(magr
, -1, (struct obj
*)0);
7275 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7276 if (magr
->mspeed
!= oldspeed
&& canseemon(magr
))
7277 pline("%s slows down.", Monnam(magr
));
7280 if (canseemon(magr
)) {
7281 if (!magr
->inertia
) pline("%s slows down to a crawl.", Monnam(magr
));
7282 else pline("%s seems even slower.", Monnam(magr
));
7284 magr
->inertia
+= (5 + (tmp
* 5));
7289 if(magr
->mspeed
!= MSLOW
) {
7290 unsigned int oldspeed
= magr
->mspeed
;
7292 mon_adjust_speed(magr
, -1, (struct obj
*)0);
7293 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7294 if (magr
->mspeed
!= oldspeed
&& canseemon(magr
))
7295 pline("%s slows down.", Monnam(magr
));
7297 if(!rn2(3) && (!rn2(4) || !(mdef
->mtame
)) && magr
->mcanmove
&& !(dmgtype(magr
->data
, AD_PLYS
))) {
7299 int parlyzdur
= rnd(magr
->mtame
? 4 : 10);
7300 if (!rn2(4)) parlyzdur
= tmp
;
7302 if (parlyzdur
> 3) {
7303 parlyzdur
= rnd(parlyzdur
);
7304 if (parlyzdur
< 3) parlyzdur
= 3;
7306 if (parlyzdur
> 1) parlyzdur
= rnd(parlyzdur
);
7308 if (parlyzdur
> 127) parlyzdur
= 127;
7310 if (canseemon(magr
)) {
7311 pline("%s is paralyzed.", Monnam(magr
));
7314 magr
->mfrozen
= parlyzdur
;
7315 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7318 magr
->inertia
+= (3 + (tmp
* 3));
7319 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7320 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7325 if(!rn2(10) && magr
->mspeed
!= MSLOW
) {
7326 unsigned int oldspeed
= magr
->mspeed
;
7328 mon_adjust_speed(magr
, -1, (struct obj
*)0);
7329 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7330 if (magr
->mspeed
!= oldspeed
&& canseemon(magr
))
7331 pline("%s is numbed.", Monnam(magr
));
7333 if (magr
->mtame
&& !rn2(15)) badpeteffect(magr
);
7339 if (!rn2(100)) tmp
+= 10000; /* The poison was deadly... */
7341 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7342 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7347 do_clear_area(magr
->mx
,magr
->my
, 7, set_lit
, (void *)((char *)0));
7348 if (canseemon(magr
)) pline("A sinister darkness fills the area!");
7349 if (magr
->data
->mlet
== S_ANGEL
) tmp
*= 2;
7353 if (!mdead
&& (mdef
->mhp
> 0)) {
7355 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
7356 if (canseemon(mdef
)) pline("%s looks healthier!", Monnam(mdef
) );
7361 if (!mdead
&& (mdef
->mhp
> 0)) {
7363 if (mdef
->mhp
> mdef
->mhpmax
) mdef
->mhp
= mdef
->mhpmax
;
7364 if (canseemon(mdef
)) pline("%s looks healthier!", Monnam(mdef
) );
7366 if (magr
->mtame
&& !rn2(10)) {
7368 if (rn2(2) && !resists_drli(magr
)) {
7369 if (canseemon(magr
)) pline("%s suddenly seems weaker!", Monnam(magr
));
7370 magr
->mhpmax
-= d(2,6);
7371 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
7372 if (magr
->m_lev
== 0) tmp
= magr
->mhp
;
7374 /* Automatic kill if drained past level 0 */
7383 if (evilfriday
&& mdef
->m_lev
> 1) evilragnarok(FALSE
,mdef
->m_lev
);
7391 reset_rndmonst(NON_PM
);
7392 if (mdef
) (void) makemon((struct permonst
*)0, mdef
->mx
, mdef
->my
, MM_ANGRY
|MM_ADJACENTOK
|MM_FRENZIED
);
7401 magr
->isegotype
= 1;
7402 magr
->egotype_contaminator
= 1;
7405 magr
->isegotype
= 1;
7406 magr
->egotype_weeper
= 1;
7409 magr
->isegotype
= 1;
7410 magr
->egotype_radiator
= 1;
7413 magr
->isegotype
= 1;
7414 magr
->egotype_reactor
= 1;
7419 int untamingchance
= 10;
7421 if (!(PlayerCannotUseSkills
)) {
7422 switch (P_SKILL(P_PETKEEPING
)) {
7423 default: untamingchance
= 10; break;
7424 case P_BASIC
: untamingchance
= 9; break;
7425 case P_SKILLED
: untamingchance
= 8; break;
7426 case P_EXPERT
: untamingchance
= 7; break;
7427 case P_MASTER
: untamingchance
= 6; break;
7428 case P_GRAND_MASTER
: untamingchance
= 5; break;
7429 case P_SUPREME_MASTER
: untamingchance
= 4; break;
7433 /* Certain monsters aren't even made peaceful. */
7434 if (!magr
->iswiz
&& magr
->data
!= &mons
[PM_MEDUSA
] &&
7435 !(magr
->data
->mflags3
& M3_COVETOUS
) && !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && magr
->data
->mlet
== S_DRAGON
) && !(magr
->data
->geno
& G_UNIQ
) &&
7436 ((mdef
->mtame
&& !rn2(10)) || (magr
->mtame
&& (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4)) )) {
7437 if (canseemon(magr
)) pline("%s looks calmer.", Monnam(magr
));
7438 if (magr
== u
.usteed
&& !mayfalloffsteed())
7439 dismount_steed(DISMOUNT_THROWN
);
7440 if (!magr
->mfrenzied
&& !rn2(3)) magr
->mpeaceful
= 1;
7441 else magr
->mpeaceful
= 0;
7446 } else if (!rn2(3)) {
7449 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7450 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7457 if (magr
->mtame
&& !rn2(5)) {
7458 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7459 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7460 if (canseemon(magr
)) pline("%s rusts!", Monnam(magr
));
7465 if (magr
->mtame
&& !rn2(5)) {
7466 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7467 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7468 if (canseemon(magr
)) pline("%s corrodes!", Monnam(magr
));
7473 if (magr
->mtame
&& !rn2(5)) {
7474 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7475 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7476 if (canseemon(magr
)) pline("%s decays!", Monnam(magr
));
7482 if (magr
->mtame
&& !rn2(5)) {
7483 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7484 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7485 if (canseemon(magr
)) pline("%s burns!", Monnam(magr
));
7490 if (!resists_cold(magr
) && resists_fire(magr
)) {
7492 if (canseemon(magr
)) pline("%s is suddenly ice-cold!", Monnam(magr
));
7495 pline("%s seems to be moving slower.", Monnam(magr
));
7496 if (!rn2(3)) mon_adjust_speed(magr
, -1, (struct obj
*)0);
7497 if (!rn2(3)) magr
->inertia
+= tmp
;
7502 if (!resists_cold(magr
)) {
7504 if (canseemon(magr
)) pline("%s is suddenly shockfrosted!", Monnam(magr
));
7506 if (magr
->mtame
&& !rn2(2)) {
7507 pline("%s seems to be moving slower.", Monnam(magr
));
7508 if (!rn2(3)) mon_adjust_speed(magr
, -1, (struct obj
*)0);
7509 if (!rn2(3)) magr
->inertia
+= tmp
;
7513 if (!resists_elec(magr
)) {
7515 if (canseemon(magr
)) pline("%s is jolted by high voltage!", Monnam(magr
));
7517 if (magr
->mtame
&& !rn2(5)) {
7518 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7519 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7523 if (has_head(magr
->data
)) {
7527 if (canseemon(magr
)) pline("%s's %s is torn apart!", Monnam(magr
), mbodypart(magr
, HEAD
));
7528 } else if (canseemon(magr
)) pline("%s's %s is spiked!", Monnam(magr
), mbodypart(magr
, HEAD
));
7532 if (!which_armor(magr
, W_ARMH
)) tmp
*= 2;
7537 if (!is_flyer(magr
->data
)) {
7539 if (canseemon(magr
)) pline("%s slams into the ground!", Monnam(magr
));
7541 if (magr
->mtame
&& !rn2(2) && !magr
->mfrozen
) {
7543 magr
->mfrozen
= rnd(10);
7544 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7548 if (mdef
->m_lev
> magr
->m_lev
) tmp
+= (mdef
->m_lev
- magr
->m_lev
);
7551 if ((tmp
> 0) && (magr
->mhpmax
> 1)) {
7553 if (canseemon(magr
)) pline("%s feels bad!", Monnam(magr
));
7555 if (magr
->mtame
) badpeteffect(magr
);
7562 if (magr
->mtame
&& !rn2(10)) badpeteffect(magr
);
7565 if (resists_cold(magr
) && !resists_fire(magr
)) {
7567 if (canseemon(magr
)) pline("%s is burning!", Monnam(magr
));
7569 if (magr
->mtame
) magr
->healblock
+= (5 + (tmp
* 5));
7572 if (!resists_fire(magr
)) {
7574 if (canseemon(magr
)) pline("%s is suddenly extremely hot!", Monnam(magr
));
7577 magr
->healblock
+= (10 + (tmp
* 10));
7578 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7579 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7584 if (!rn2(16)) tmp
+= 10000; /* instant death */
7586 if (canseemon(magr
)) pline("%s is hit by the touch of death!", Monnam(magr
));
7587 magr
->mhpmax
-= rnd(10);
7588 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
7589 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7594 if (!resists_acid(magr
)) {
7596 if (canseemon(magr
)) pline("%s is covered with sludge!", Monnam(magr
));
7599 if (magr
->mhpmax
> 1) magr
->mhpmax
-= rnd(3);
7600 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
7601 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7606 if (resists_cold(magr
) && !resists_fire(magr
)) {
7608 if (canseemon(magr
)) pline("%s is scorched by hot lava!", Monnam(magr
));
7609 } else if (!resists_fire(magr
)) {
7611 if (canseemon(magr
)) pline("%s is covered with hot lava!", Monnam(magr
));
7614 magr
->healblock
+= (20 + (tmp
* 20));
7615 if (magr
->mhpmax
> 1) magr
->mhpmax
-= 5;
7616 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
7617 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7618 if (magr
->m_lev
> 0) magr
->m_lev
--;
7622 pline("%s", fauxmessage());
7623 u
.cnd_plineamount
++;
7625 pline("%s", fauxmessage());
7626 u
.cnd_plineamount
++;
7630 (void) maketrap(magr
->mx
, magr
->my
, WEB
, 0, FALSE
);
7631 if (!rn2(issoviet
? 2 : 8)) makerandomtrap(FALSE
);
7634 if (t_at(magr
->mx
, magr
->my
) == 0) (void) maketrap(magr
->mx
, magr
->my
, rndtrap(), 0, FALSE
);
7635 else makerandomtrap(FALSE
);
7640 if (rnd(100) > magr
->data
->mr
) {
7641 cancelmonsterlite(magr
);
7642 if (canseemon(magr
)) pline("%s is covered in sparkling lights!", Monnam(magr
));
7644 if (magr
->mtame
&& !rn2(2)) {
7645 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7646 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7651 if (!rn2(10) && (rnd(100) > magr
->data
->mr
)) {
7652 cancelmonsterlite(magr
);
7656 if (magr
->mhpmax
> 1) magr
->mhpmax
-= rnd(8);
7657 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
7658 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7659 if (magr
->m_lev
> 0) magr
->m_lev
--;
7663 if (!rn2(10) && (rnd(100) > magr
->data
->mr
)) {
7664 cancelmonsterlite(magr
);
7666 if (magr
->mtame
) allbadpeteffects(magr
);
7669 if (!rn2(10) && (rnd(100) > magr
->data
->mr
)) {
7670 cancelmonsterlite(magr
);
7674 if (magr
->mtame
&& !rn2(7)) {
7675 mon_adjust_speed(magr
, -1, (struct obj
*)0);
7676 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7677 if (tmp
> 0) magr
->bleedout
+= rnd(tmp
);
7678 if (!rn2(3)) magr
->inertia
+= (3 + (tmp
* 3));
7682 if (rnd(100) > magr
->data
->mr
) {
7683 monflee(magr
, rnd(1 + tmp
), FALSE
, TRUE
);
7684 if (canseemon(magr
)) pline("%s is suddenly very afraid!",Monnam(magr
));
7688 if (rnd(100) > magr
->data
->mr
) {
7689 monflee(magr
, rnd(1 + tmp
), FALSE
, TRUE
);
7690 if (canseemon(magr
)) pline("%s is suddenly very afraid!",Monnam(magr
));
7694 if (canseemon(magr
))
7695 pline("%s %s...", Monnam(magr
),
7696 makeplural(stagger(magr
->data
, "stagger")));
7699 if (canseemon(magr
)) pline("%s is suddenly very confused!", Monnam(magr
));
7701 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7703 if (magr
->mtame
&& !rn2(2)) badpeteffect(magr
);
7709 /* STUPID bug where the game displays the same name twice for some inexplicable reason --Amy */
7710 strcpy(buf
, Monnam(magr
));
7716 pline("%s sees %s chow dead bodies.", buf
, mon_nam(mdef
)); break;
7718 pline("%s shudders at %s's terrifying %s.", buf
, mon_nam(mdef
), makeplural(mbodypart(mdef
, EYE
)) ); break;
7720 pline("%s feels sick at entrails caught in %s's tentacles.", buf
, mon_nam(mdef
)); break;
7722 pline("%s sees maggots breed in the rent %s of %s.", buf
, mbodypart(mdef
, STOMACH
), mon_nam(mdef
)); break;
7727 if (magr
->mtame
&& !rn2(5)) badpeteffect(magr
);
7731 if (!magr
->mcanmove
) {
7733 if (canseemon(magr
)) pline("%s's dream is eaten!",Monnam(magr
));
7738 if (canseemon(magr
)) pline("%s is suddenly very confused!", Monnam(magr
));
7740 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7746 if (canseemon(magr
)) pline("%s is suddenly very confused!", Monnam(magr
));
7748 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7750 if (magr
->mtame
&& !rn2(3)) badpeteffect(magr
);
7755 if (canseemon(magr
)) pline("%s is suddenly very confused!", Monnam(magr
));
7757 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7761 if (magr
->m_lev
> 0) magr
->m_lev
--;
7762 if (magr
->m_lev
> 0) magr
->m_lev
--;
7763 if (magr
->m_lev
== 0) tmp
*= 10;
7769 if (canseemon(magr
)) pline("%s is suddenly very confused!", Monnam(magr
));
7771 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7773 if (magr
->mtame
&& !rn2(2)) badpeteffect(magr
);
7779 if (canseemon(magr
)) pline("%s seems oblivious!", Monnam(magr
));
7781 if (!rn2(3)) badpeteffect(magr
);
7787 makedoghungry(magr
, tmp
* rnd(50));
7788 if (canseemon(magr
)) pline("%s suddenly looks hungry.", Monnam(magr
));
7793 mon_drain_en(magr
, ((magr
->m_lev
> 0) ? (rnd(magr
->m_lev
)) : 0) + 1 + tmp
);
7796 if (magr
->mhpmax
> 1) magr
->mhpmax
-= rnd(5);
7797 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
7798 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7802 if (magr
->mtame
) tmp
*= 2;
7803 mon_drain_en(magr
, ((magr
->m_lev
> 0) ? (rnd(magr
->m_lev
)) : 0) + 1 + tmp
);
7806 mon_drain_en(magr
, ((magr
->m_lev
> 0) ? (rnd(magr
->m_lev
)) : 0) + 1 + tmp
);
7807 if (magr
->mtame
&& !rn2(7)) badpeteffect(magr
);
7810 mon_drain_en(magr
, ((magr
->m_lev
> 0) ? (rnd(magr
->m_lev
)) : 0) + 1 + tmp
);
7811 if (magr
->mtame
&& !rn2(50)) {
7812 int untamingchance
= 10;
7814 if (!(PlayerCannotUseSkills
)) {
7815 switch (P_SKILL(P_PETKEEPING
)) {
7816 default: untamingchance
= 10; break;
7817 case P_BASIC
: untamingchance
= 9; break;
7818 case P_SKILLED
: untamingchance
= 8; break;
7819 case P_EXPERT
: untamingchance
= 7; break;
7820 case P_MASTER
: untamingchance
= 6; break;
7821 case P_GRAND_MASTER
: untamingchance
= 5; break;
7822 case P_SUPREME_MASTER
: untamingchance
= 4; break;
7826 /* Certain monsters aren't even made peaceful. */
7827 if (!magr
->iswiz
&& magr
->data
!= &mons
[PM_MEDUSA
] &&
7828 !(magr
->data
->mflags3
& M3_COVETOUS
) && !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && magr
->data
->mlet
== S_DRAGON
) && !(magr
->data
->geno
& G_UNIQ
) &&
7829 ((mdef
->mtame
&& !rn2(10)) || (magr
->mtame
&& (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4)) )) {
7830 if (canseemon(magr
)) pline("%s looks calmer.", Monnam(magr
));
7831 if (magr
== u
.usteed
&& !mayfalloffsteed())
7832 dismount_steed(DISMOUNT_THROWN
);
7833 if (!magr
->mfrenzied
&& !rn2(3)) magr
->mpeaceful
= 1;
7834 else magr
->mpeaceful
= 0;
7842 mon_drain_en(magr
, ((magr
->m_lev
> 0) ? (rnd(magr
->m_lev
)) : 0) + 1 + tmp
);
7843 if (magr
->mtame
&& !rn2(8)) {
7844 if (magr
->mhpmax
> 1) magr
->mhpmax
-= rnd(8);
7845 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
7846 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7847 if (magr
->m_lev
> 0) magr
->m_lev
--;
7851 if (!resists_magm(magr
)) {
7852 mon_drain_en(magr
, ((magr
->m_lev
> 0) ? (rnd(magr
->m_lev
)) : 0) + 1);
7856 if (canseemon(magr
) && magr
->mcansee
)
7857 pline("%s is blinded.", Monnam(magr
));
7858 if ((tmp
+= magr
->mblinded
) > 127) tmp
= 127;
7859 magr
->mblinded
= tmp
;
7861 magr
->mstrategy
&= ~STRAT_WAITFORU
;
7862 if (!magr
->mtame
) tmp
= 0;
7867 if (canseemon(magr
)) pline("%s is doused with water!", Monnam(magr
));
7868 if (rn2(3)) magr
->mconf
= 1;
7869 if (!rn2(3)) mon_adjust_speed(magr
, -1, (struct obj
*)0);
7870 if (!rn2(5)) badpeteffect(magr
);
7874 if (magr
->mtame
) tmp
*= rnd(4);
7877 if (magr
->mtame
) tmp
*= 10;
7880 if (magr
->mtame
&& !rn2(3)) {
7882 if (magr
->mhpmax
> 1) magr
->mhpmax
-= 8;
7883 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
7884 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7887 int untamingchance
= 10;
7889 if (!(PlayerCannotUseSkills
)) {
7890 switch (P_SKILL(P_PETKEEPING
)) {
7891 default: untamingchance
= 10; break;
7892 case P_BASIC
: untamingchance
= 9; break;
7893 case P_SKILLED
: untamingchance
= 8; break;
7894 case P_EXPERT
: untamingchance
= 7; break;
7895 case P_MASTER
: untamingchance
= 6; break;
7896 case P_GRAND_MASTER
: untamingchance
= 5; break;
7897 case P_SUPREME_MASTER
: untamingchance
= 4; break;
7901 if (!magr
->mfrenzied
&& !(Role_if(PM_DRAGONMASTER
) && uarms
&& Is_dragon_shield(uarms
) && magr
->data
->mlet
== S_DRAGON
) && (!magr
->mtame
|| (magr
->mtame
<= rnd(21) && (untamingchance
> rnd(10)) && !((rnd(30 - ACURR(A_CHA
))) < 4) ) ) ) {
7902 magr
->mpeaceful
= magr
->mtame
= 0;
7903 magr
->mfrenzied
= 1;
7904 if (canseemon(magr
)) pline("%s enters a state of frenzy!", Monnam(magr
));
7911 if (magr
->mtame
&& !rn2(10)) badpeteffect(magr
);
7915 if (magr
->mhpmax
> 1) magr
->mhpmax
-= 5;
7916 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
7917 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7924 if (magr
->mhpmax
> 1) magr
->mhpmax
-= rnd(3);
7925 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
7926 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7932 if (magr
->mhpmax
> 1) magr
->mhpmax
-= rnd(20);
7933 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
7934 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7943 if (magr
->mtame
&& !rn2(10)) {
7945 if (!mdead
&& mdef
&& is_drowningpool(mdef
->mx
, mdef
->my
)) tmp
*= 10;
7949 if (magr
->mtame
&& !rn2(4)) badpeteffect(magr
);
7952 if (magr
->mtame
&& !rn2(4)) badpeteffect(magr
);
7955 if (magr
->mtame
&& !rn2(5)) badpeteffect(magr
);
7959 if (canseemon(magr
)) pline("%s is sucked by a vacuum cleaner!", Monnam(magr
));
7964 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7965 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
7970 if (magr
->mtame
) tmp
*= 3;
7971 if (magr
->mtame
&& !rn2(10) && !resists_disint(magr
)) {
7972 if (canseemon(magr
)) pline("%s is hit by vaporization!", Monnam(magr
));
7974 otmp2
= (struct obj
*)0;
7975 if (magr
->misc_worn_check
& W_ARMS
) {
7976 otmp2
= which_armor(magr
, W_ARMS
);
7977 } else if (magr
->misc_worn_check
& W_ARMC
) {
7978 otmp2
= which_armor(magr
, W_ARMC
);
7979 } else if (magr
->misc_worn_check
& W_ARM
) {
7980 otmp2
= which_armor(magr
, W_ARM
);
7981 } else if (magr
->misc_worn_check
& W_ARMU
) {
7982 otmp2
= which_armor(magr
, W_ARMU
);
7984 /* no body armor, victim dies; destroy cloak
7985 and shirt now in case target gets life-saved */
7988 if (otmp2
&& (otmp2
!= (struct obj
*)0) ) m_useup(magr
, otmp2
);
7993 if (magr
->mtame
&& !rn2(3)) {
7994 if (canseemon(magr
)) pline("%s looks sick.", Monnam(magr
));
7995 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
7996 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8000 if (magr
->mtame
&& !rn2(4)) {
8001 if (canseemon(magr
)) pline("%s looks sick.", Monnam(magr
));
8003 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
8004 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8006 if (!rn2(3)) magr
->mconf
= TRUE
;
8007 if (!rn2(3)) magr
->mstun
= TRUE
;
8008 if (!rn2(5) && magr
->mcanmove
) {
8011 magr
->mstrategy
&= ~STRAT_WAITFORU
;
8016 if (magr
->mtame
&& !rn2(20)) badpeteffect(magr
);
8020 if (canseemon(magr
)) pline("%s withers!", Monnam(magr
));
8021 if (magr
->mhpmax
> 1) magr
->mhpmax
-= rnd(8);
8022 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
8023 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8024 if (magr
->m_lev
> 0) magr
->m_lev
--;
8028 if (magr
->mtame
&& !rn2(5)) badpeteffect(magr
);
8032 if (canseemon(magr
)) pline("%s seems oblivious!", Monnam(magr
));
8034 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
8035 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8036 if (magr
->m_lev
> 0) magr
->m_lev
--;
8045 if (canseemon(magr
)) pline("%s seems less protected!", Monnam(magr
));
8047 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
8048 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8049 if (magr
->m_lev
> 0) magr
->m_lev
--;
8056 if (magr
->mtame
&& !rn2(3) && magr
->mcanmove
) {
8059 magr
->mstrategy
&= ~STRAT_WAITFORU
;
8060 if (canseemon(magr
)) pline("%s is stopped in %s tracks.", Monnam(magr
), mhis(magr
));
8065 if (canseemon(magr
)) pline("%s looks very sick.", Monnam(magr
));
8066 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
8067 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8072 if (magr
->mhp
> 9) tmp
+= (magr
->mhp
/ 10);
8073 if (canseemon(magr
)) pline("%s shrieks in pain!", Monnam(magr
));
8079 if (canseemon(magr
)) pline("%s seems more vulnerable!", Monnam(magr
));
8080 magr
->mhpmax
-= rnd(8);
8081 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
8082 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8083 if (magr
->m_lev
== 0) tmp
= magr
->mhp
;
8098 if (magr
->mtame
&& !rn2(2)) tmp
*= 3;
8102 if (magr
->mtame
&& !rn2(2)) tmp
*= 2;
8106 if (magr
->mtame
&& !rn2(2)) tmp
*= 2;
8110 if (magr
->mtame
&& !rn2(3)) badpeteffect(magr
);
8115 if (!rn2(5)) badpeteffect(magr
);
8120 if (magr
->mtame
&& !rn2(10) && !resists_disint(magr
)) {
8121 if (canseemon(magr
)) pline("%s is hit by disintegration!", Monnam(magr
));
8123 otmp2
= (struct obj
*)0;
8124 if (magr
->misc_worn_check
& W_ARMS
) {
8125 otmp2
= which_armor(magr
, W_ARMS
);
8126 } else if (magr
->misc_worn_check
& W_ARMC
) {
8127 otmp2
= which_armor(magr
, W_ARMC
);
8128 } else if (magr
->misc_worn_check
& W_ARM
) {
8129 otmp2
= which_armor(magr
, W_ARM
);
8130 } else if (magr
->misc_worn_check
& W_ARMU
) {
8131 otmp2
= which_armor(magr
, W_ARMU
);
8135 if (otmp2
&& (otmp2
!= (struct obj
*)0) ) m_useup(magr
, otmp2
);
8141 if (canseemon(magr
)) pline("%s is being shredded!", Monnam(magr
));
8143 otmp2
= (struct obj
*)0;
8150 if (magr
->misc_worn_check
& W_ARMS
) {
8151 otmp2
= which_armor(magr
, W_ARMS
);
8152 } else if (magr
->misc_worn_check
& W_ARMC
) {
8153 otmp2
= which_armor(magr
, W_ARMC
);
8154 } else if (magr
->misc_worn_check
& W_ARM
) {
8155 otmp2
= which_armor(magr
, W_ARM
);
8156 } else if (magr
->misc_worn_check
& W_ARMU
) {
8157 otmp2
= which_armor(magr
, W_ARMU
);
8159 /* no body armor, victim dies; destroy cloak
8160 and shirt now in case target gets life-saved */
8163 if (otmp2
&& (otmp2
!= (struct obj
*)0) ) m_useup(magr
, otmp2
);
8171 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
8172 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8173 if (!rn2(3)) badpeteffect(magr
);
8178 if (magr
->mtame
&& !rn2(3)) {
8208 allbadpeteffects(magr
);
8228 magr
->bleedout
+= tmp
;
8229 if (vis
) pline("%s is struck by several thorns.", Monnam(magr
));
8235 if (!rn2(3)) badpeteffect(magr
);
8237 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
8238 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8244 if (magr
->mtame
&& !rn2(40)) {
8245 if (magr
->mhpmax
> 1) magr
->mhpmax
--;
8246 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8251 if (mdef
->data
== &mons
[PM_BUILDER
]) terrainterror(1);
8252 else terrainterror(0);
8262 if (magr
->mtame
&& !rn2(5)) {
8268 if (magr
->mtame
&& !rn2(3)) {
8274 if (!resists_drli(magr
)) {
8275 if (canseemon(magr
))
8276 pline("%s suddenly seems weaker!", Monnam(magr
));
8277 if (magr
->m_lev
== 0)
8280 /* Automatic kill if drained past level 0 */
8292 if (!resists_drli(magr
)) {
8293 if (canseemon(magr
))
8294 pline("%s suddenly seems weaker!", Monnam(magr
));
8295 if (magr
->m_lev
== 0)
8298 /* Automatic kill if drained past level 0 */
8300 if (magr
->mtame
&& !rn2(2)) badpeteffect(magr
);
8304 if (!resists_drli(magr
)) {
8305 if (canseemon(magr
))
8306 pline("%s suddenly seems weaker!", Monnam(magr
));
8307 if (magr
->m_lev
== 0)
8310 /* Automatic kill if drained past level 0 */
8313 if (magr
->mhpmax
> 1) magr
->mhpmax
-= rnd(8);
8314 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
8315 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8316 if (magr
->m_lev
> 0) magr
->m_lev
--;
8321 if (!resists_drli(magr
)) {
8322 if (canseemon(magr
))
8323 pline("%s suddenly seems weaker!", Monnam(magr
));
8324 if (magr
->m_lev
== 0)
8327 /* Automatic kill if drained past level 0 */
8329 if (magr
->mtame
&& !rn2(50)) magr
->willbebanished
= 1;
8333 if (!resists_drli(magr
)) {
8334 if (canseemon(magr
))
8335 pline("%s suddenly seems weaker!", Monnam(magr
));
8336 if (magr
->m_lev
== 0)
8339 /* Automatic kill if drained past level 0 */
8343 if (resists_poison(magr
) && !player_will_pierce_resistance()) {
8344 if (canseemon(magr
))
8345 pline_The("poison doesn't seem to affect %s.",
8348 if (canseemon(magr
)) pline("%s is badly poisoned!", Monnam(magr
));
8349 if (rn2(10) || resists_poison(magr
)) tmp
+= rn1(20,12);
8351 if (canseemon(magr
)) pline_The("poison was deadly...");
8358 if (magr
->mhpmax
> 1) magr
->mhpmax
-= rnd(8);
8359 if (magr
->mhpmax
< 1) magr
->mhpmax
= 1;
8360 if (magr
->mhp
> magr
->mhpmax
) magr
->mhp
= magr
->mhpmax
;
8366 default: /*tmp = 0;*/
8373 if (Race_if(PM_BOVER
) && u
.usteed
&& (magr
== u
.usteed
) && tmp
> 1) tmp
/= 2;
8374 if (Race_if(PM_CARTHAGE
) && u
.usteed
&& (magr
== u
.usteed
) && (mcalcmove(u
.usteed
) < 12) && tmp
> 1) tmp
/= 2;
8376 if((magr
->mhp
-= tmp
) <= 0) {
8377 /* get experience from spell creatures */
8378 if (mdef
->uexp
) mon_xkilled(magr
, "", (int)mddat
->mattk
[i
].adtyp
);
8379 else monkilled(magr
, "", (int)mddat
->mattk
[i
].adtyp
);
8381 return (mdead
| mhit
| MM_AGR_DIED
);
8383 return (mdead
| mhit
);
8386 /* "aggressive defense"; what type of armor prevents specified attack
8387 from touching its target? */
8389 attk_protection(aatyp
)
8404 w_mask
= ~0L; /* special case; no defense needed */
8409 w_mask
= W_ARMG
; /* caller needs to check for weapon */
8418 w_mask
= (W_ARMC
|W_ARMG
); /* attacker needs both to be protected */
8428 w_mask
= 0L; /* no defense available */
8443 snuff_light_source(x
, y
);
8447 /* have the stooges say something funny */
8451 verbalize("%s", random_joke
[rn2(SIZE(random_joke
))]);