1 /* NetHack 3.6 uhitm.c $NHDT-Date: 1446887537 2015/11/07 09:12:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.151 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 /* JNetHack Copyright */
6 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
7 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016 */
8 /* JNetHack may be freely redistributed. See license for details. */
12 STATIC_DCL boolean FDECL(known_hitum, (struct monst *, struct obj *, int *,
13 int, int, struct attack *));
14 STATIC_DCL boolean FDECL(theft_petrifies, (struct obj *));
15 STATIC_DCL void FDECL(steal_it, (struct monst *, struct attack *));
16 STATIC_DCL boolean FDECL(hitum, (struct monst *, struct attack *));
17 STATIC_DCL boolean FDECL(hmon_hitmon, (struct monst *, struct obj *, int));
18 STATIC_DCL int FDECL(joust, (struct monst *, struct obj *));
19 STATIC_DCL void NDECL(demonpet);
20 STATIC_DCL boolean FDECL(m_slips_free, (struct monst * mtmp,
21 struct attack *mattk));
22 STATIC_DCL int FDECL(explum, (struct monst *, struct attack *));
23 STATIC_DCL void FDECL(start_engulf, (struct monst *));
24 STATIC_DCL void NDECL(end_engulf);
25 STATIC_DCL int FDECL(gulpum, (struct monst *, struct attack *));
26 STATIC_DCL boolean FDECL(hmonas, (struct monst *));
27 STATIC_DCL void FDECL(nohandglow, (struct monst *));
28 STATIC_DCL boolean FDECL(shade_aware, (struct obj *));
30 extern boolean notonhead; /* for long worms */
31 /* The below might become a parameter instead if we use it a lot */
33 /* Used to flag attacks caused by Stormbringer's maliciousness. */
34 static boolean override_confirmation = FALSE;
36 #define PROJECTILE(obj) ((obj) && is_ammo(obj))
39 erode_armor(mdef, hurt)
45 /* What the following code does: it keeps looping until it
46 * finds a target for the rust monster.
47 * Head, feet, etc... not covered by metal, or covered by
48 * rusty metal, are not targets. However, your body always
49 * is, no matter what covers it.
54 target = which_armor(mdef, W_ARMH);
56 || erode_obj(target, xname(target), hurt, EF_GREASE)
61 target = which_armor(mdef, W_ARMC);
63 (void) erode_obj(target, xname(target), hurt,
64 EF_GREASE | EF_VERBOSE);
67 if ((target = which_armor(mdef, W_ARM)) != (struct obj *) 0) {
68 (void) erode_obj(target, xname(target), hurt,
69 EF_GREASE | EF_VERBOSE);
70 } else if ((target = which_armor(mdef, W_ARMU))
71 != (struct obj *) 0) {
72 (void) erode_obj(target, xname(target), hurt,
73 EF_GREASE | EF_VERBOSE);
77 target = which_armor(mdef, W_ARMS);
79 || erode_obj(target, xname(target), hurt, EF_GREASE)
84 target = which_armor(mdef, W_ARMG);
86 || erode_obj(target, xname(target), hurt, EF_GREASE)
91 target = which_armor(mdef, W_ARMF);
93 || erode_obj(target, xname(target), hurt, EF_GREASE)
98 break; /* Out of while loop */
102 /* FALSE means it's OK to attack */
104 attack_checks(mtmp, wep)
105 register struct monst *mtmp;
106 struct obj *wep; /* uwep for attack(), null for kick_monster() */
110 /* if you're close enough to attack, alert any waiting monster */
111 mtmp->mstrategy &= ~STRAT_WAITMASK;
113 if (u.uswallow && mtmp == u.ustuck)
116 if (context.forcefight) {
117 /* Do this in the caller, after we checked that the monster
118 * didn't die from the blow. Reason: putting the 'I' there
119 * causes the hero to forget the square's contents since
120 * both 'I' and remembered contents are stored in .glyph.
121 * If the monster dies immediately from the blow, the 'I' will
122 * not stay there, so the player will have suddenly forgotten
123 * the square's contents for no apparent reason.
124 if (!canspotmon(mtmp)
125 && !glyph_is_invisible(levl[bhitpos.x][bhitpos.y].glyph))
126 map_invisible(bhitpos.x, bhitpos.y);
131 /* Put up an invisible monster marker, but with exceptions for
132 * monsters that hide and monsters you've been warned about.
133 * The former already prints a warning message and
134 * prevents you from hitting the monster just via the hidden monster
135 * code below; if we also did that here, similar behavior would be
136 * happening two turns in a row. The latter shows a glyph on
137 * the screen, so you know something is there.
139 if (!canspotmon(mtmp) && !glyph_is_warning(glyph_at(bhitpos.x, bhitpos.y))
140 && !glyph_is_invisible(levl[bhitpos.x][bhitpos.y].glyph)
141 && !(!Blind && mtmp->mundetected && hides_under(mtmp->data))) {
143 pline("Wait! There's %s there you can't see!", something);
145 pline("
\82¿
\82å
\82Á
\82Æ
\91Ò
\82Á
\82½
\81I
\8ep
\82Ì
\8c©
\82¦
\82È
\82¢%s
\82ª
\82¢
\82é
\81I", something);
146 map_invisible(bhitpos.x, bhitpos.y);
147 /* if it was an invisible mimic, treat it as if we stumbled
148 * onto a visible mimic
150 if (mtmp->m_ap_type && !Protection_from_shape_changers
151 /* applied pole-arm attack is too far to get stuck */
152 && distu(mtmp->mx, mtmp->my) <= 2) {
153 if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK))
156 wakeup(mtmp); /* always necessary; also un-mimics mimics */
160 if (mtmp->m_ap_type && !Protection_from_shape_changers && !sensemon(mtmp)
161 && !glyph_is_warning(glyph_at(bhitpos.x, bhitpos.y))) {
162 /* If a hidden mimic was in a square where a player remembers
163 * some (probably different) unseen monster, the player is in
164 * luck--he attacks it even though it's hidden.
166 if (glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph)) {
170 stumble_onto_mimic(mtmp);
174 if (mtmp->mundetected && !canseemon(mtmp)
175 && !glyph_is_warning(glyph_at(bhitpos.x, bhitpos.y))
176 && (hides_under(mtmp->data) || mtmp->data->mlet == S_EEL)) {
177 mtmp->mundetected = mtmp->msleeping = 0;
178 newsym(mtmp->mx, mtmp->my);
179 if (glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph)) {
183 if (!((Blind ? Blind_telepat : Unblind_telepat) || Detect_monsters)) {
186 if (Blind || (is_pool(mtmp->mx, mtmp->my) && !Underwater))
188 pline("Wait! There's a hidden monster there!");
190 pline("
\91Ò
\82Ä
\81I
\89ö
\95¨
\82ª
\89B
\82ê
\82Ä
\82¢
\82é
\81I");
191 else if ((obj = level.objects[mtmp->mx][mtmp->my]) != 0)
193 pline("Wait! There's %s hiding under %s!",
194 an(l_monnam(mtmp)), doname(obj));
196 pline("
\91Ò
\82Ä
\81I%s
\82Ì
\89º
\82É%s
\82ª
\89B
\82ê
\82Ä
\82¢
\82é
\81I",
197 doname(obj), l_monnam(mtmp));
204 * make sure to wake up a monster from the above cases if the
205 * hero can sense that the monster is there.
207 if ((mtmp->mundetected || mtmp->m_ap_type) && sensemon(mtmp)) {
208 mtmp->mundetected = 0;
212 if (flags.confirm && mtmp->mpeaceful && !Confusion && !Hallucination
214 /* Intelligent chaotic weapons (Stormbringer) want blood */
215 if (wep && wep->oartifact == ART_STORMBRINGER) {
216 override_confirmation = TRUE;
219 if (canspotmon(mtmp)) {
221 Sprintf(qbuf, "Really attack %s?", mon_nam(mtmp));
223 Sprintf(qbuf, "
\96{
\93\96\82É%s
\82ð
\8dU
\8c\82\82·
\82é
\82Ì
\81H", mon_nam(mtmp));
224 if (!paranoid_query(ParanoidHit, qbuf)) {
235 * It is unchivalrous for a knight to attack the defenseless or from behind.
241 if (u.ualign.record <= -10)
244 if (Role_if(PM_KNIGHT) && u.ualign.type == A_LAWFUL
245 && (!mtmp->mcanmove || mtmp->msleeping
246 || (mtmp->mflee && !mtmp->mavenge))) {
250 pline("
\82±
\82ê
\82Í
\94Ú
\8b¯
\82È
\8ds
\82¢
\82¾
\81I");
252 } else if (Role_if(PM_SAMURAI) && mtmp->mpeaceful) {
253 /* attacking peaceful creatures is bad for the samurai's giri */
255 You("dishonorably attack the innocent!");
257 pline("
\96³
\8eÀ
\82Ì
\8eÒ
\82ð
\8dU
\8c\82\82·
\82é
\82Ì
\82Í
\95s
\96¼
\97_
\82¾
\81I");
263 find_roll_to_hit(mtmp, aatyp, weapon, attk_count, role_roll_penalty)
264 register struct monst *mtmp;
265 uchar aatyp; /* usually AT_WEAP or AT_KICK */
266 struct obj *weapon; /* uwep or uswapwep or NULL */
267 int *attk_count, *role_roll_penalty;
271 *role_roll_penalty = 0; /* default is `none' */
273 tmp = 1 + Luck + abon() + find_mac(mtmp) + u.uhitinc
274 + maybe_polyd(youmonst.data->mlevel, u.ulevel);
276 /* some actions should occur only once during multiple attacks */
277 if (!(*attk_count)++) {
278 /* knight's chivalry or samurai's giri */
282 /* adjust vs. (and possibly modify) monster state */
288 if (mtmp->msleeping) {
292 if (!mtmp->mcanmove) {
300 /* role/race adjustments */
301 if (Role_if(PM_MONK) && !Upolyd) {
303 tmp -= (*role_roll_penalty = urole.spelarmr);
304 else if (!uwep && !uarms)
305 tmp += (u.ulevel / 3) + 2;
307 if (is_orc(mtmp->data)
308 && maybe_polyd(is_elf(youmonst.data), Race_if(PM_ELF)))
311 /* encumbrance: with a lot of luggage, your agility diminishes */
312 if ((tmp2 = near_capacity()) != 0)
313 tmp -= (tmp2 * 2) - 1;
318 * hitval applies if making a weapon attack while wielding a weapon;
319 * weapon_hit_bonus applies if doing a weapon attack even bare-handed
320 * or if kicking as martial artist
322 if (aatyp == AT_WEAP || aatyp == AT_CLAW) {
324 tmp += hitval(weapon, mtmp);
325 tmp += weapon_hit_bonus(weapon);
326 } else if (aatyp == AT_KICK && martial_bonus()) {
327 tmp += weapon_hit_bonus((struct obj *) 0);
333 /* try to attack; return False if monster evaded;
334 u.dx and u.dy must be set */
337 register struct monst *mtmp;
339 register struct permonst *mdat = mtmp->data;
341 /* This section of code provides protection against accidentally
342 * hitting peaceful (like '@') and tame (like 'd') monsters.
343 * Protection is provided as long as player is not: blind, confused,
344 * hallucinating or stunned.
345 * changes by wwp 5/16/85
346 * More changes 12/90, -dkh-. if its tame and safepet, (and protected
347 * 07/92) then we assume that you're not trying to attack. Instead,
348 * you'll usually just swap places if this is a movement command
350 /* Intelligent chaotic weapons (Stormbringer) want blood */
351 if (is_safepet(mtmp) && !context.forcefight) {
352 if (!uwep || uwep->oartifact != ART_STORMBRINGER) {
353 /* there are some additional considerations: this won't work
354 * if in a shop or Punished or you miss a random roll or
355 * if you can walk thru walls and your pet cannot (KAA) or
356 * if your pet is a long worm (unless someone does better).
357 * there's also a chance of displacing a "frozen" monster.
358 * sleeping monsters might magically walk in their sleep.
360 boolean foo = (Punished || !rn2(7) || is_longworm(mtmp->data)),
364 for (p = in_rooms(mtmp->mx, mtmp->my, SHOPBASE); *p; p++)
365 if (tended_shop(&rooms[*p - ROOMOFFSET])) {
370 if (inshop || foo || (IS_ROCK(levl[u.ux][u.uy].typ)
371 && !passes_walls(mtmp->data))) {
374 monflee(mtmp, rnd(6), FALSE, FALSE);
375 Strcpy(buf, y_monnam(mtmp));
376 buf[0] = highc(buf[0]);
378 You("stop. %s is in the way!", buf);
380 You("
\8e~
\82Ü
\82Á
\82½
\81D%s
\82ª
\93¹
\82É
\82¢
\82é
\81I", buf);
382 } else if ((mtmp->mfrozen || (!mtmp->mcanmove)
383 || (mtmp->data->mmove == 0)) && rn2(6)) {
385 pline("%s doesn't seem to move!", Monnam(mtmp));
387 pline("%s
\82Í
\93®
\82¯
\82È
\82¢
\82æ
\82¤
\82¾
\81I", Monnam(mtmp));
394 /* possibly set in attack_checks;
395 examined in known_hitum, called via hitum or hmonas below */
396 override_confirmation = FALSE;
397 /* attack_checks() used to use <u.ux+u.dx,u.uy+u.dy> directly, now
398 it uses bhitpos instead; it might map an invisible monster there */
399 bhitpos.x = u.ux + u.dx;
400 bhitpos.y = u.uy + u.dy;
401 if (attack_checks(mtmp, uwep))
404 if (Upolyd && noattacks(youmonst.data)) {
405 /* certain "pacifist" monsters don't attack */
407 You("have no way to attack monsters physically.");
409 You("
\95¨
\97\9d\93I
\82É
\89ö
\95¨
\82ð
\8dU
\8c\82\82·
\82é
\82·
\82×
\82ª
\82È
\82¢
\81D");
410 mtmp->mstrategy &= ~STRAT_WAITMASK;
415 if (check_capacity("You cannot fight while so heavily loaded.")
417 if (check_capacity("
\82 \82È
\82½
\82Í
\95¨
\82ð
\82½
\82
\82³
\82ñ
\8e\9d\82¿
\82·
\82¬
\82Ä
\90í
\82¦
\82È
\82¢
\81D")
418 /* consume extra nutrition during combat; maybe pass out */
422 if (u.twoweap && !can_twoweapon())
430 You("begin bashing monsters with %s.",
432 You("%s
\82Å
\89ö
\95¨
\82ð
\82È
\82®
\82è
\82Â
\82¯
\82½
\81D",
433 yobjnam(uwep, (char *) 0));
434 else if (!cantwield(youmonst.data))
436 You("begin %sing monsters with your %s %s.",
437 Role_if(PM_MONK) ? "strik" : "bash",
438 uarmg ? "gloved" : "bare", /* Del Lamb */
439 makeplural(body_part(HAND)));
441 You("%s%s
\82Å
\89ö
\95¨
\82ð%s
\82Â
\82¯
\82½
\81D",
442 uarmg ? "
\83O
\83\8d\81[
\83u
\82ð
\95t
\82¯
\82½" : "
\91f",
444 Role_if(PM_MONK) ? "
\91Å
\82¿" : "
\82È
\82®
\82è");
448 exercise(A_STR, TRUE); /* you're exercising muscles */
449 /* andrew@orca: prevent unlimited pick-axe attacks */
452 /* Is the "it died" check actually correct? */
453 if (mdat->mlet == S_LEPRECHAUN && !mtmp->mfrozen && !mtmp->msleeping
454 && !mtmp->mconf && mtmp->mcansee && !rn2(7)
455 && (m_move(mtmp, 0) == 2 /* it died */
456 || mtmp->mx != u.ux + u.dx
457 || mtmp->my != u.uy + u.dy)) /* it moved */
463 (void) hitum(mtmp, youmonst.data->mattk);
464 mtmp->mstrategy &= ~STRAT_WAITMASK;
467 /* see comment in attack_checks() */
468 /* we only need to check for this if we did an attack_checks()
469 * and it returned 0 (it's okay to attack), and the monster didn't
472 if (context.forcefight && mtmp->mhp > 0 && !canspotmon(mtmp)
473 && !glyph_is_invisible(levl[u.ux + u.dx][u.uy + u.dy].glyph)
474 && !(u.uswallow && mtmp == u.ustuck))
475 map_invisible(u.ux + u.dx, u.uy + u.dy);
480 /* really hit target monster; returns TRUE if it still lives */
482 known_hitum(mon, weapon, mhit, rollneeded, armorpenalty, uattk)
483 register struct monst *mon;
486 int rollneeded, armorpenalty; /* for monks */
487 struct attack *uattk;
489 register boolean malive = TRUE;
491 if (override_confirmation) {
492 /* this may need to be generalized if weapons other than
493 Stormbringer acquire similar anti-social behavior... */
496 Your("bloodthirsty blade attacks!");
498 Your("
\95\90\8aí
\82Í
\8c\8c\82É
\8bQ
\82¦
\82Ä
\82¢
\82é
\81I");
502 missum(mon, uattk, (rollneeded + armorpenalty > dieroll));
504 int oldhp = mon->mhp, x = u.ux + u.dx, y = u.uy + u.dy;
505 long oldweaphit = u.uconduct.weaphit;
508 if (weapon && (weapon->oclass == WEAPON_CLASS || is_weptool(weapon)))
509 u.uconduct.weaphit++;
511 /* we hit the monster; be careful: it might die or
512 be knocked into a different location */
513 notonhead = (mon->mx != x || mon->my != y);
514 malive = hmon(mon, weapon, HMON_MELEE);
516 /* monster still alive */
517 if (!rn2(25) && mon->mhp < mon->mhpmax / 2
518 && !(u.uswallow && mon == u.ustuck)) {
519 /* maybe should regurgitate if swallowed? */
520 monflee(mon, !rn2(3) ? rnd(100) : 0, FALSE, TRUE);
522 if (u.ustuck == mon && !u.uswallow && !sticks(youmonst.data))
525 /* Vorpal Blade hit converted to miss */
526 /* could be headless monster or worm tail */
527 if (mon->mhp == oldhp) {
529 /* a miss does not break conduct */
530 u.uconduct.weaphit = oldweaphit;
532 if (mon->wormno && *mhit)
533 cutworm(mon, x, y, weapon);
539 /* hit target monster; returns TRUE if it still lives */
543 struct attack *uattk;
545 boolean malive, wep_was_destroyed = FALSE;
546 struct obj *wepbefore = uwep;
547 int armorpenalty, attknum = 0, x = u.ux + u.dx, y = u.uy + u.dy,
548 tmp = find_roll_to_hit(mon, uattk->aatyp, uwep,
549 &attknum, &armorpenalty);
550 int mhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
553 exercise(A_DEX, TRUE);
554 malive = known_hitum(mon, uwep, &mhit, tmp, armorpenalty, uattk);
555 /* second attack for two-weapon combat; won't occur if Stormbringer
556 overrode confirmation (assumes Stormbringer is primary weapon)
557 or if the monster was killed or knocked to different location */
558 if (u.twoweap && !override_confirmation && malive && m_at(x, y) == mon) {
559 tmp = find_roll_to_hit(mon, uattk->aatyp, uswapwep, &attknum,
561 mhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
562 malive = known_hitum(mon, uswapwep, &mhit, tmp, armorpenalty, uattk);
564 if (wepbefore && !uwep)
565 wep_was_destroyed = TRUE;
566 (void) passive(mon, mhit, malive, AT_WEAP, wep_was_destroyed);
570 /* general "damage monster" routine; return True if mon still alive */
572 hmon(mon, obj, thrown)
575 int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
577 boolean result, anger_guards;
579 anger_guards = (mon->mpeaceful
580 && (mon->ispriest || mon->isshk || is_watch(mon->data)));
581 result = hmon_hitmon(mon, obj, thrown);
582 if (mon->ispriest && !rn2(2))
585 (void) angry_guards(!!Deaf);
591 hmon_hitmon(mon, obj, thrown)
594 int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
597 struct permonst *mdat = mon->data;
598 int barehand_silver_rings = 0;
599 /* The basic reason we need all these booleans is that we don't want
600 * a "hit" message when a monster dies, so we have to know how much
601 * damage it did _before_ outputting a hit message, but any messages
602 * associated with the damage don't come out until _after_ outputting
605 boolean hittxt = FALSE, destroyed = FALSE, already_killed = FALSE;
606 boolean get_dmg_bonus = TRUE;
607 boolean ispoisoned = FALSE, needpoismsg = FALSE, poiskilled = FALSE,
609 boolean silvermsg = FALSE, silverobj = FALSE;
610 boolean valid_weapon_attack = FALSE;
611 boolean unarmed = !uwep && !uarm && !uarms;
612 boolean hand_to_hand = (thrown == HMON_MELEE
613 /* not grapnels; applied implies uwep */
614 || (thrown == HMON_APPLIED && is_pole(uwep)));
618 char unconventional[BUFSZ]; /* substituted for word "attack" in msg */
619 char saved_oname[BUFSZ];
621 unconventional[0] = '\0';
622 saved_oname[0] = '\0';
625 if (!obj) { /* attack with bare hands */
626 if (mdat == &mons[PM_SHADE])
628 else if (martial_bonus())
629 tmp = rnd(4); /* bonus for martial arts */
632 valid_weapon_attack = (tmp > 1);
633 /* blessed gloves give bonuses when fighting 'bare-handed' */
634 if (uarmg && uarmg->blessed
635 && (is_undead(mdat) || is_demon(mdat) || is_vampshifter(mon)))
637 /* So do silver rings. Note: rings are worn under gloves, so you
638 * don't get both bonuses.
641 if (uleft && objects[uleft->otyp].oc_material == SILVER)
642 barehand_silver_rings++;
643 if (uright && objects[uright->otyp].oc_material == SILVER)
644 barehand_silver_rings++;
645 if (barehand_silver_rings && mon_hates_silver(mon)) {
651 Strcpy(saved_oname, cxname(obj));
652 if (obj->oclass == WEAPON_CLASS || is_weptool(obj)
653 || obj->oclass == GEM_CLASS) {
654 /* is it not a melee weapon? */
655 if (/* if you strike with a bow... */
657 /* or strike with a missile in your hand... */
658 || (!thrown && (is_missile(obj) || is_ammo(obj)))
659 /* or use a pole at short range and not mounted... */
660 || (!thrown && !u.usteed && is_pole(obj))
661 /* or throw a missile without the proper bow... */
662 || (is_ammo(obj) && (thrown != HMON_THROWN
663 || !ammo_and_launcher(obj, uwep)))) {
664 /* then do only 1-2 points of damage */
665 if (mdat == &mons[PM_SHADE] && !shade_glare(obj))
669 if (objects[obj->otyp].oc_material == SILVER
670 && mon_hates_silver(mon)) {
673 /* if it will already inflict dmg, make it worse */
674 tmp += rnd((tmp) ? 20 : 10);
676 if (!thrown && obj == uwep && obj->otyp == BOOMERANG
677 && rnl(4) == 4 - 1) {
678 boolean more_than_1 = (obj->quan > 1L);
681 pline("As you hit %s, %s%s breaks into splinters.",
682 mon_nam(mon), more_than_1 ? "one of " : "",
685 pline("%s
\82ð
\8dU
\8c\82\82·
\82é
\82Æ
\81C%s%s
\82Í
\82±
\82Á
\82Ï
\82Ý
\82¶
\82ñ
\82É
\82È
\82Á
\82½
\81D",
686 mon_nam(mon), yname(obj),
687 more_than_1 ? "
\82Ì
\82Ð
\82Æ
\82Â" : "");
690 uwepgone(); /* set unweapon */
693 obj = (struct obj *) 0;
695 if (mdat != &mons[PM_SHADE])
699 tmp = dmgval(obj, mon);
700 /* a minimal hit doesn't exercise proficiency */
701 valid_weapon_attack = (tmp > 1);
702 if (!valid_weapon_attack || mon == u.ustuck || u.twoweap) {
703 ; /* no special bonuses */
704 } else if (mon->mflee && Role_if(PM_ROGUE) && !Upolyd
705 /* multi-shot throwing is too powerful here */
708 You("strike %s from behind!", mon_nam(mon));
710 You("%s
\82ð
\94w
\8cã
\82©
\82ç
\8dU
\8c\82\82µ
\82½
\81I", mon_nam(mon));
711 tmp += rnd(u.ulevel);
713 } else if (dieroll == 2 && obj == uwep
714 && obj->oclass == WEAPON_CLASS
716 || (Role_if(PM_SAMURAI) && obj->otyp == KATANA
718 && ((wtype = uwep_skill_type()) != P_NONE
719 && P_SKILL(wtype) >= P_SKILLED)
720 && ((monwep = MON_WEP(mon)) != 0
721 && !is_flimsy(monwep)
723 monwep, 50 + 15 * greatest_erosion(obj),
726 * 2.5% chance of shattering defender's weapon when
727 * using a two-handed weapon; less if uwep is rusted.
728 * [dieroll == 2 is most successful non-beheading or
729 * -bisecting hit, in case of special artifact damage;
730 * the percentage chance is (1/20)*(50/100).]
732 setmnotwielded(mon, monwep);
733 mon->weapon_check = NEED_WEAPON;
735 pline("%s from the force of your blow!",
736 Yobjnam2(monwep, "shatter"));
738 pline("%s
\82Ì%s
\82Í
\82 \82È
\82½
\82Ì
\88ê
\8c\82\82Å
\95²
\81X
\82É
\82È
\82Á
\82½
\81I",
739 Monnam(mon), xname(monwep));
741 m_useupall(mon, monwep);
742 /* If someone just shattered MY weapon, I'd flee! */
744 monflee(mon, d(2, 3), TRUE, TRUE);
750 && artifact_hit(&youmonst, mon, obj, &tmp, dieroll)) {
751 if (mon->mhp <= 0) /* artifact killed monster */
757 if (objects[obj->otyp].oc_material == SILVER
758 && mon_hates_silver(mon)) {
762 if (u.usteed && !thrown && tmp > 0
763 && weapon_type(obj) == P_LANCE && mon != u.ustuck) {
764 jousting = joust(mon, obj);
765 /* exercise skill even for minimal damage hits */
767 valid_weapon_attack = TRUE;
769 if (thrown == HMON_THROWN
770 && (is_ammo(obj) || is_missile(obj))) {
771 if (ammo_and_launcher(obj, uwep)) {
772 /* Elves and Samurai do extra damage using
773 * their bows&arrows; they're highly trained.
775 if (Role_if(PM_SAMURAI) && obj->otyp == YA
776 && uwep->otyp == YUMI)
778 else if (Race_if(PM_ELF) && obj->otyp == ELVEN_ARROW
779 && uwep->otyp == ELVEN_BOW)
782 if (obj->opoisoned && is_poisonable(obj))
786 } else if (obj->oclass == POTION_CLASS) {
788 obj = splitobj(obj, 1L);
790 setuwep((struct obj *) 0);
792 potionhit(mon, obj, TRUE);
794 return FALSE; /* killed */
796 /* in case potion effect causes transformation */
798 tmp = (mdat == &mons[PM_SHADE]) ? 0 : 1;
800 if (mdat == &mons[PM_SHADE] && !shade_aware(obj)) {
803 Strcpy(unconventional, cxname(obj));
807 case BOULDER: /* 1d20 */
808 case HEAVY_IRON_BALL: /* 1d25 */
809 case IRON_CHAIN: /* 1d4+1 */
810 tmp = dmgval(obj, mon);
813 if (breaktest(obj)) {
815 You("break %s. That's bad luck!", ysimple_name(obj));
817 You("%s
\8b¾
\82ð
\89ó
\82µ
\82Ä
\82µ
\82Ü
\82Á
\82½
\81D
\82±
\82è
\82á
\82Ü
\82¢
\82Á
\82½
\81I", ysimple_name(obj));
820 obj = (struct obj *) 0;
821 unarmed = FALSE; /* avoid obj==0 confusion */
822 get_dmg_bonus = FALSE;
827 case EXPENSIVE_CAMERA:
829 You("succeed in destroying %s. Congratulations!",
831 You("%s
\83J
\83\81\83\89\82ð
\89ó
\82·
\82±
\82Æ
\82ª
\82Å
\82«
\82½
\81D
\82¨
\82ß
\82Å
\82Æ
\82¤
\81I",
833 release_camera_demon(obj, u.ux, u.uy);
836 case CORPSE: /* fixed by polder@cs.vu.nl */
837 if (touch_petrifies(&mons[obj->corpsenm])) {
841 You("hit %s with %s.", mon_nam(mon),
842 corpse_xname(obj, (const char *) 0,
843 obj->dknown ? CXN_PFX_THE
846 You("%s
\82ð%s
\82Å
\8dU
\8c\82\82µ
\82½
\81D", mon_nam(mon),
847 corpse_xname(obj, (const char *) 0,
848 obj->dknown ? CXN_PFX_THE
852 if (!munstone(mon, TRUE))
853 minstapetrify(mon, TRUE);
854 if (resists_ston(mon))
856 /* note: hp may be <= 0 even if munstoned==TRUE */
857 return (boolean) (mon->mhp > 0);
859 } else if (touch_petrifies(mdat)) {
860 ; /* maybe turn the corpse into a statue? */
863 tmp = (obj->corpsenm >= LOW_PM ? mons[obj->corpsenm].msize
867 #define useup_eggs(o) \
870 obfree(o, (struct obj *) 0); \
873 o = (struct obj *) 0; \
876 long cnt = obj->quan;
878 tmp = 1; /* nominal physical damage */
879 get_dmg_bonus = FALSE;
880 hittxt = TRUE; /* message always given */
881 /* egg is always either used up or transformed, so next
882 hand-to-hand attack should yield a "bashing" mesg */
885 if (obj->spe && obj->corpsenm >= LOW_PM) {
887 change_luck((schar) - (obj->quan));
892 if (touch_petrifies(&mons[obj->corpsenm])) {
893 /*learn_egg_type(obj->corpsenm);*/
895 pline("Splat! You hit %s with %s %s egg%s!",
897 obj->known ? "the" : cnt > 1L ? "some" : "a",
898 obj->known ? mons[obj->corpsenm].mname
902 pline("
\83r
\83`
\83\83\83b
\81I
\82 \82È
\82½
\82Í%s
\82É%s%s
\82Ì
\97\91\82ð
\93\8a\82°
\82Â
\82¯
\82½
\81I",
904 cnt > 1L ? "
\82¢
\82
\82Â
\82©
\82Ì" : "",
905 obj->known ? mons[obj->corpsenm].mname
908 obj->known = 1; /* (not much point...) */
910 if (!munstone(mon, TRUE))
911 minstapetrify(mon, TRUE);
912 if (resists_ston(mon))
914 return (boolean) (mon->mhp > 0);
915 } else { /* ordinary egg(s) */
918 (obj->corpsenm != NON_PM && obj->known)
919 ? the(mons[obj->corpsenm].mname)
920 : (cnt > 1L) ? "some" : "an";
921 You("hit %s with %s egg%s.", mon_nam(mon), eggp,
925 (obj->corpsenm != NON_PM && obj->known)
926 ? mons[obj->corpsenm].mname : "";
927 You("%s
\82É%s%s
\97\91\82ð
\93\8a\82°
\82Â
\82¯
\82½
\81D",
928 mon_nam(mon), eggp, *eggp ? "
\82Ì" : "");
930 if (touch_petrifies(mdat) && !stale_egg(obj)) {
932 pline_The("egg%s %s alive any more...", plur(cnt),
933 (cnt == 1L) ? "isn't" : "aren't");
935 pline("
\82à
\82¤
\97\91\82ª
\9bz
\89»
\82·
\82é
\82±
\82Æ
\82Í
\82È
\82¢
\82¾
\82ë
\82¤
\81D
\81D
\81D");
938 obj_stop_timers(obj);
940 obj->oclass = GEM_CLASS;
943 obj->known = obj->dknown = obj->bknown = 0;
944 obj->owt = weight(obj);
946 place_object(obj, mon->mx, mon->my);
951 pline("
\83r
\83`
\83\83\83b
\81I");
953 exercise(A_WIS, FALSE);
959 case CLOVE_OF_GARLIC: /* no effect against demons */
960 if (is_undead(mdat) || is_vampshifter(mon)) {
961 monflee(mon, d(2, 4), FALSE, TRUE);
968 if (can_blnd(&youmonst, mon,
969 (uchar) (obj->otyp == BLINDING_VENOM
975 pline(obj->otyp == CREAM_PIE ? "Splat!"
978 pline(obj->otyp == CREAM_PIE ? "
\83r
\83V
\83\83\83b
\81I"
979 : "
\83s
\83`
\83\83\83b
\81I");
981 } else if (obj->otyp == BLINDING_VENOM) {
983 pline_The("venom blinds %s%s!", mon_nam(mon),
984 mon->mcansee ? "" : " further");
986 pline("
\93Å
\89t
\82Å%s
\82Í%s
\96Ú
\82ª
\8c©
\82¦
\82È
\82
\82È
\82Á
\82½
\81I", mon_nam(mon),
987 mon->mcansee ? "" : "
\82³
\82ç
\82É");
990 char *whom = mon_nam(mon);
991 char *what = The(xname(obj));
993 if (!thrown && obj->quan > 1L)
994 what = An(singular(obj, xname));
995 /* note: s_suffix returns a modifiable buffer */
997 && mdat != &mons[PM_FLOATING_EYE])
999 whom = strcat(strcat(s_suffix(whom), " "),
1000 mbodypart(mon, FACE));
1002 whom = strcat(strcat(s_suffix(whom), "
\82Ì"),
1003 mbodypart(mon, FACE));
1006 pline("%s %s over %s!", what,
1007 vtense(what, "splash"), whom);
1009 pline("%s
\82Í%s
\82É
\82Ô
\82¿
\82Ü
\82¯
\82ç
\82ê
\82½
\81I",
1016 if (((int) mon->mblinded + tmp) > 127)
1017 mon->mblinded = 127;
1019 mon->mblinded += tmp;
1022 pline(obj->otyp == CREAM_PIE ? "Splat!" : "Splash!");
1024 pline(obj->otyp==CREAM_PIE ? "
\83r
\83V
\83\83\83b
\81I" : "
\83s
\83`
\83\83\83b
\81I");
1028 obfree(obj, (struct obj *) 0);
1032 get_dmg_bonus = FALSE;
1035 case ACID_VENOM: /* thrown (or spit) */
1036 if (resists_acid(mon)) {
1038 Your("venom hits %s harmlessly.", mon_nam(mon));
1040 pline("
\93Å
\89t
\82Í%s
\82É
\82Í
\8cø
\89Ê
\82ª
\82È
\82©
\82Á
\82½
\81D", mon_nam(mon));
1044 Your("venom burns %s!", mon_nam(mon));
1046 Your("
\93Å
\89t
\82Í%s
\82ð
\8fÄ
\82¢
\82½
\81I", mon_nam(mon));
1047 tmp = dmgval(obj, mon);
1050 obfree(obj, (struct obj *) 0);
1054 get_dmg_bonus = FALSE;
1057 /* non-weapons can damage because of their weight */
1058 /* (but not too much) */
1059 tmp = obj->owt / 100;
1060 if (is_wet_towel(obj)) {
1061 /* wielded wet towel should probably use whip skill
1062 (but not by setting objects[TOWEL].oc_skill==P_WHIP
1063 because that would turn towel into a weptool) */
1065 if (rn2(obj->spe + 1)) /* usually lose some wetness */
1066 dry_a_towel(obj, -1, TRUE);
1075 * Things like silver wands can arrive here so
1076 * so we need another silver check.
1078 if (objects[obj->otyp].oc_material == SILVER
1079 && mon_hates_silver(mon)) {
1089 /****** NOTE: perhaps obj is undefined!! (if !thrown && BOOMERANG)
1090 * *OR* if attacking bare-handed!! */
1092 if (get_dmg_bonus && tmp > 0) {
1094 /* If you throw using a propellor, you don't get a strength
1095 * bonus but you do get an increase-damage bonus.
1097 if (thrown != HMON_THROWN || !obj || !uwep
1098 || !ammo_and_launcher(obj, uwep))
1102 if (valid_weapon_attack) {
1105 /* to be valid a projectile must have had the correct projector */
1106 wep = PROJECTILE(obj) ? uwep : obj;
1107 tmp += weapon_dam_bonus(wep);
1108 /* [this assumes that `!thrown' implies wielded...] */
1109 wtype = thrown ? weapon_type(wep) : uwep_skill_type();
1110 use_skill(wtype, 1);
1114 int nopoison = (10 - (obj->owt / 10));
1118 if (Role_if(PM_SAMURAI)) {
1120 You("dishonorably use a poisoned weapon!");
1122 You("
\95s
\96¼
\97_
\82É
\82à
\93Å
\82Ì
\95\90\8aí
\82ð
\8eg
\97p
\82µ
\82½
\81I");
1123 adjalign(-sgn(u.ualign.type));
1124 } else if (u.ualign.type == A_LAWFUL && u.ualign.record > -10) {
1126 You_feel("like an evil coward for using a poisoned weapon.");
1128 You("
\93Å
\82Ì
\95\90\8aí
\82ð
\8eg
\97p
\82·
\82é
\82Ì
\82Í
\94Ú
\8b¯
\82¾
\82Æ
\8a´
\82¶
\82½
\81D");
1131 if (obj && !rn2(nopoison)) {
1132 /* remove poison now in case obj ends up in a bones file */
1133 obj->opoisoned = FALSE;
1134 /* defer "obj is no longer poisoned" until after hit message */
1137 if (resists_poison(mon))
1145 /* make sure that negative damage adjustment can't result
1146 in inadvertently boosting the victim's hit points */
1148 if (mdat == &mons[PM_SHADE]) {
1151 const char *what = *unconventional ? unconventional : "attack";
1153 Your("%s %s harmlessly through %s.", what,
1154 vtense(what, "pass"), mon_nam(mon));
1156 Your("
\8dU
\8c\82\82Í%s
\82ð
\92Ê
\82è
\82Ê
\82¯
\82½
\81D", mon_nam(mon));
1167 tmp += d(2, (obj == uwep) ? 10 : 2); /* [was in dmgval()] */
1169 You("joust %s%s", mon_nam(mon), canseemon(mon) ? exclam(tmp) : ".");
1171 You("%s
\82É
\93Ë
\8c\82\82µ
\82½%s", mon_nam(mon), canseemon(mon) ? exclam(tmp) : "
\81D");
1174 pline("%s shatters on impact!", Yname2(obj));
1176 Your("%s
\82Í
\8fÕ
\8c\82\82Å
\89ó
\82ê
\82½
\81I", xname(obj));
1177 /* (must be either primary or secondary weapon to get here) */
1178 u.twoweap = FALSE; /* untwoweapon() is too verbose here */
1180 uwepgone(); /* set unweapon */
1181 /* minor side-effect: broken lance won't split puddings */
1185 /* avoid migrating a dead monster */
1186 if (mon->mhp > tmp) {
1187 mhurtle(mon, u.dx, u.dy, 1);
1188 mdat = mon->data; /* in case of a polymorph trap */
1189 if (DEADMONSTER(mon))
1190 already_killed = TRUE;
1193 } else if (unarmed && tmp > 1 && !thrown && !obj && !Upolyd) {
1194 /* VERY small chance of stunning opponent if unarmed. */
1195 if (rnd(100) < P_SKILL(P_BARE_HANDED_COMBAT) && !bigmonst(mdat)
1196 && !thick_skinned(mdat)) {
1197 if (canspotmon(mon))
1199 pline("%s %s from your powerful strike!", Monnam(mon),
1200 makeplural(stagger(mon->data, "stagger")));
1202 pline("%s
\82Í
\82 \82È
\82½
\82Ì
\89ï
\90S
\82Ì
\88ê
\8c\82\82Å%s
\81I", Monnam(mon),
1203 jpast(stagger(mon->data, "
\82æ
\82ë
\82ß
\82")));
1205 /* avoid migrating a dead monster */
1206 if (mon->mhp > tmp) {
1207 mhurtle(mon, u.dx, u.dy, 1);
1208 mdat = mon->data; /* in case of a polymorph trap */
1209 if (DEADMONSTER(mon))
1210 already_killed = TRUE;
1216 if (!already_killed)
1218 /* adjustments might have made tmp become less than what
1219 a level draining artifact has already done to max HP */
1220 if (mon->mhp > mon->mhpmax)
1221 mon->mhp = mon->mhpmax;
1224 if (mon->mtame && tmp > 0) {
1225 /* do this even if the pet is being killed (affects revival) */
1226 abuse_dog(mon); /* reduces tameness */
1227 /* flee if still alive and still tame; if already suffering from
1228 untimed fleeing, no effect, otherwise increases timed fleeing */
1229 if (mon->mtame && !destroyed)
1230 monflee(mon, 10 * rnd(tmp), FALSE, FALSE);
1232 if ((mdat == &mons[PM_BLACK_PUDDING] || mdat == &mons[PM_BROWN_PUDDING])
1233 /* pudding is alive and healthy enough to split */
1234 && mon->mhp > 1 && !mon->mcan
1235 /* iron weapon using melee or polearm hit */
1236 && obj && obj == uwep && objects[obj->otyp].oc_material == IRON
1238 if (clone_mon(mon, 0, 0)) {
1240 pline("%s divides as you hit it!", Monnam(mon));
1242 pline("
\82 \82È
\82½
\82Ì
\8dU
\8c\82\82Å%s
\82Í
\95ª
\97ô
\82µ
\82½
\81I", Monnam(mon));
1247 if (!hittxt /*( thrown => obj exists )*/
1249 || (thrown && m_shot.n > 1 && m_shot.o == obj->otyp))) {
1251 hit(mshot_xname(obj), mon, exclam(tmp));
1252 else if (!flags.verbose)
1256 pline("
\8dU
\8c\82\82Í
\96½
\92\86\82µ
\82½
\81D");
1259 You("%s %s%s", Role_if(PM_BARBARIAN) ? "smite" : "hit",
1260 mon_nam(mon), canseemon(mon) ? exclam(tmp) : ".");
1262 Your("%s
\82Ö
\82Ì
\8dU
\8c\82\82Í
\96½
\92\86\82µ
\82½%s",
1263 mon_nam(mon), canseemon(mon) ? exclam(tmp) : "
\81D");
1269 char *whom = mon_nam(mon);
1270 char silverobjbuf[BUFSZ];
1272 if (canspotmon(mon)) {
1273 if (barehand_silver_rings == 1)
1275 fmt = "Your silver ring sears %s!";
1277 fmt = "%s
\82Í
\8bâ
\82Ì
\8ew
\97Ö
\82Å
\8fÄ
\82©
\82ê
\82½
\81I";
1278 else if (barehand_silver_rings == 2)
1280 fmt = "Your silver rings sear %s!";
1282 fmt = "%s
\82Í
\8bâ
\82Ì
\8ew
\97Ö
\82Å
\8fÄ
\82©
\82ê
\82½
\81I";
1283 else if (silverobj && saved_oname[0]) {
1285 Sprintf(silverobjbuf, "Your %s%s %s %%s!",
1286 strstri(saved_oname, "silver") ? "" : "silver ",
1287 saved_oname, vtense(saved_oname, "sear"));
1289 Sprintf(silverobjbuf, "%%s
\82Í%s%s
\82Å
\8fÄ
\82©
\82ê
\82½
\81I",
1290 strstri(saved_oname, "
\8bâ") ?
1297 fmt = "The silver sears %s!";
1299 fmt = "%s
\82Í
\8bâ
\82Å
\8fÄ
\82©
\82ê
\82½
\81I";
1301 *whom = highc(*whom); /* "it" -> "It" */
1303 fmt = "%s is seared!";
1305 fmt = "%s
\82Í
\8fÄ
\82©
\82ê
\82½
\81I";
1307 /* note: s_suffix returns a modifiable buffer */
1308 if (!noncorporeal(mdat) && !amorphous(mdat))
1310 whom = strcat(s_suffix(whom), " flesh");
1312 whom = strcat(s_suffix(whom), "
\82Ì
\93÷");
1315 /* if a "no longer poisoned" message is coming, it will be last;
1316 obj->opoisoned was cleared above and any message referring to
1317 "poisoned <obj>" has now been given; we want just "<obj>" for
1318 last message, so reformat while obj is still accessible */
1320 Strcpy(saved_oname, cxname(obj));
1322 /* [note: thrown obj might go away during killed/xkilled call] */
1326 pline_The("poison doesn't seem to affect %s.", mon_nam(mon));
1328 pline("
\93Å
\82Í%s
\82É
\8cø
\82©
\82È
\82©
\82Á
\82½
\82æ
\82¤
\82¾
\81D", mon_nam(mon));
1331 pline_The("poison was deadly...");
1333 pline("
\93Å
\82Í
\92v
\8e\80\97Ê
\82¾
\82Á
\82½
\81D
\81D
\81D");
1334 if (!already_killed)
1336 destroyed = TRUE; /* return FALSE; */
1337 } else if (destroyed) {
1338 if (!already_killed)
1339 killed(mon); /* takes care of most messages */
1340 } else if (u.umconf && hand_to_hand) {
1342 if (!mon->mconf && !resist(mon, SPBOOK_CLASS, 0, NOTELL)) {
1344 if (!mon->mstun && mon->mcanmove && !mon->msleeping
1347 pline("%s appears confused.", Monnam(mon));
1349 pline("%s
\82Í
\8d¬
\97\90\82µ
\82Ä
\82¢
\82é
\82æ
\82¤
\82¾
\81D", Monnam(mon));
1354 Your("%s %s no longer poisoned.", saved_oname,
1355 vtense(saved_oname, "are"));
1357 Your("%s
\82Í
\82à
\82¤
\93Å
\82ª
\93h
\82ç
\82ê
\82Ä
\82¢
\82È
\82¢
\81D", xname(obj));
1360 return destroyed ? FALSE : TRUE;
1370 * The things in this list either
1373 * 2) are dealt with properly by other routines
1374 * when it comes to shades.
1376 if (obj->otyp == BOULDER
1377 || obj->otyp == HEAVY_IRON_BALL
1378 || obj->otyp == IRON_CHAIN /* dmgval handles those first three */
1379 || obj->otyp == MIRROR /* silver in the reflective surface */
1380 || obj->otyp == CLOVE_OF_GARLIC /* causes shades to flee */
1381 || objects[obj->otyp].oc_material == SILVER)
1386 /* check whether slippery clothing protects from hug or wrap attack */
1387 /* [currently assumes that you are the attacker] */
1389 m_slips_free(mdef, mattk)
1391 struct attack *mattk;
1395 if (mattk->adtyp == AD_DRIN) {
1396 /* intelligence drain attacks the head */
1397 obj = which_armor(mdef, W_ARMH);
1399 /* grabbing attacks the body */
1400 obj = which_armor(mdef, W_ARMC); /* cloak */
1402 obj = which_armor(mdef, W_ARM); /* suit */
1404 obj = which_armor(mdef, W_ARMU); /* shirt */
1407 /* if monster's cloak/armor is greased, your grab slips off; this
1408 protection might fail (33% chance) when the armor is cursed */
1409 if (obj && (obj->greased || obj->otyp == OILSKIN_CLOAK)
1410 && (!obj->cursed || rn2(3))) {
1413 mattk->adtyp == AD_WRAP ? "slip off of"
1414 : "grab, but cannot hold onto",
1415 s_suffix(mon_nam(mdef)), obj->greased ? "greased" : "slippery",
1416 /* avoid "slippery slippery cloak"
1417 for undiscovered oilskin cloak */
1418 (obj->greased || objects[obj->otyp].oc_name_known)
1420 : cloak_simple_name(obj));
1422 You("%s
\82Ì%s%s%s
\81I",
1423 mon_nam(mdef), obj->greased ? "
\96û
\82Ì
\93h
\82ç
\82ê
\82½" : "
\8a\8a\82è
\82â
\82·
\82¢",
1424 (obj->greased || objects[obj->otyp].oc_name_known)
1426 : cloak_simple_name(obj),
1427 mattk->adtyp == AD_WRAP ? "
\82Å
\8a\8a\82Á
\82½"
1428 : "
\82ð
\82Â
\82©
\82Ü
\82æ
\82¤
\82Æ
\82µ
\82½
\82ª
\81C
\82Å
\82«
\82È
\82©
\82Á
\82½");
1431 if (obj->greased && !rn2(2)) {
1433 pline_The("grease wears off.");
1435 pline("
\96û
\82Í
\97\8e\82¿
\82Ä
\82µ
\82Ü
\82Á
\82½
\81D");
1443 /* used when hitting a monster with a lance while mounted;
1444 1: joust hit; 0: ordinary hit; -1: joust but break lance */
1447 struct monst *mon; /* target */
1448 struct obj *obj; /* weapon */
1450 int skill_rating, joust_dieroll;
1452 if (Fumbling || Stunned)
1454 /* sanity check; lance must be wielded in order to joust */
1455 if (obj != uwep && (obj != uswapwep || !u.twoweap))
1458 /* if using two weapons, use worse of lance and two-weapon skills */
1459 skill_rating = P_SKILL(weapon_type(obj)); /* lance skill */
1460 if (u.twoweap && P_SKILL(P_TWO_WEAPON_COMBAT) < skill_rating)
1461 skill_rating = P_SKILL(P_TWO_WEAPON_COMBAT);
1462 if (skill_rating == P_ISRESTRICTED)
1463 skill_rating = P_UNSKILLED; /* 0=>1 */
1465 /* odds to joust are expert:80%, skilled:60%, basic:40%, unskilled:20% */
1466 if ((joust_dieroll = rn2(5)) < skill_rating) {
1467 if (joust_dieroll == 0 && rnl(50) == (50 - 1) && !unsolid(mon->data)
1468 && !obj_resists(obj, 0, 100))
1469 return -1; /* hit that breaks lance */
1470 return 1; /* successful joust */
1472 return 0; /* no joust bonus; revert to ordinary attack */
1476 * Send in a demon pet for the hero. Exercise wisdom.
1478 * This function used to be inline to damageum(), but the Metrowerks compiler
1479 * (DR4 and DR4.5) screws up with an internal error 5 "Expression Too
1481 * Pulling it out makes it work.
1487 struct permonst *pm;
1491 pline("Some hell-p has arrived!");
1493 pline("
\92n
\8d\96\82Ì
\92\87\8aÔ
\82ª
\8c»
\82í
\82ê
\82½
\81I");
1494 i = !rn2(6) ? ndemon(u.ualign.type) : NON_PM;
1495 pm = i != NON_PM ? &mons[i] : youmonst.data;
1496 if ((dtmp = makemon(pm, u.ux, u.uy, NO_MM_FLAGS)) != 0)
1497 (void) tamedog(dtmp, (struct obj *) 0);
1498 exercise(A_WIS, TRUE);
1502 theft_petrifies(otmp)
1505 if (uarmg || otmp->otyp != CORPSE
1506 || !touch_petrifies(&mons[otmp->corpsenm]) || Stone_resistance)
1509 #if 0 /* no poly_when_stoned() critter has theft capability */
1510 if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) {
1511 display_nhwindow(WIN_MESSAGE, FALSE); /* --More-- */
1516 /* stealing this corpse is fatal... */
1518 instapetrify(corpse_xname(otmp, "stolen", CXN_ARTICLE));
1520 instapetrify(corpse_xname(otmp, "
\93\90\82Ü
\82ê
\82½", CXN_ARTICLE));
1521 /* apparently wasn't fatal after all... */
1526 * Player uses theft attack against monster.
1528 * If the target is wearing body armor, take all of its possessions;
1529 * otherwise, take one object. [Is this really the behavior we want?]
1532 steal_it(mdef, mattk)
1534 struct attack *mattk;
1536 struct obj *otmp, *stealoid, **minvent_ptr;
1540 return; /* nothing to take */
1542 /* look for worn body armor */
1543 stealoid = (struct obj *) 0;
1544 if (could_seduce(&youmonst, mdef, mattk)) {
1545 /* find armor, and move it to end of inventory in the process */
1546 minvent_ptr = &mdef->minvent;
1547 while ((otmp = *minvent_ptr) != 0)
1548 if (otmp->owornmask & W_ARM) {
1550 panic("steal_it: multiple worn suits");
1551 *minvent_ptr = otmp->nobj; /* take armor out of minvent */
1553 stealoid->nobj = (struct obj *) 0;
1555 minvent_ptr = &otmp->nobj;
1557 *minvent_ptr = stealoid; /* put armor back into minvent */
1560 if (stealoid) { /* we will be taking everything */
1561 if (gender(mdef) == (int) u.mfemale && youmonst.data->mlet == S_NYMPH)
1563 You("charm %s. She gladly hands over her possessions.",
1565 You("%s
\82ð
\82¤
\82Á
\82Æ
\82è
\82³
\82¹
\82½
\81D
\94Þ
\8f\97\82Í
\82æ
\82ë
\82±
\82ñ
\82Å
\8e\9d\82¿
\95¨
\82ð
\82³
\82µ
\82¾
\82µ
\82½
\81D",
1569 You("seduce %s and %s starts to take off %s clothes.",
1570 mon_nam(mdef), mhe(mdef), mhis(mdef));
1572 You("%s
\82ð
\97U
\98f
\82µ
\82½
\81D%s
\82Í
\95\9e\82ð
\92E
\82¬
\82Í
\82¶
\82ß
\82½
\81D",
1573 mon_nam(mdef), mhe(mdef));
1577 while ((otmp = mdef->minvent) != 0) {
1579 break; /* no longer have ability to steal */
1580 /* take the object away from the monster */
1581 obj_extract_self(otmp);
1582 if ((unwornmask = otmp->owornmask) != 0L) {
1583 mdef->misc_worn_check &= ~unwornmask;
1584 if (otmp->owornmask & W_WEP)
1585 setmnotwielded(mdef, otmp);
1586 otmp->owornmask = 0L;
1587 update_mon_intrinsics(mdef, otmp, FALSE, FALSE);
1589 if (otmp == stealoid) /* special message for final item */
1591 pline("%s finishes taking off %s suit.", Monnam(mdef),
1594 pline("%s
\82Í
\92E
\82¬
\8fI
\82¦
\82½
\81D", Monnam(mdef));
1597 /* give the object to the character */
1599 otmp = hold_another_object(otmp, "You snatched but dropped %s.",
1600 doname(otmp), "You steal: ");
1602 otmp = hold_another_object(otmp, "
\82 \82È
\82½
\82Í%s
\82ð
\93\90\82ñ
\82¾
\82ª
\97\8e\82Æ
\82µ
\82½
\81D",
1603 doname(otmp), "
\82ð
\93\90\82ñ
\82¾
\81D");
1605 if (otmp->where != OBJ_INVENT)
1607 if (theft_petrifies(otmp))
1608 break; /* stop thieving even though hero survived */
1609 /* more take-away handling, after theft message */
1610 if (unwornmask & W_WEP) { /* stole wielded weapon */
1611 possibly_unwield(mdef, FALSE);
1612 } else if (unwornmask & W_ARMG) { /* stole worn gloves */
1613 mselftouch(mdef, (const char *) 0, TRUE);
1614 if (mdef->mhp <= 0) /* it's now a statue */
1615 return; /* can't continue stealing */
1619 break; /* only taking one item */
1624 damageum(mdef, mattk)
1625 register struct monst *mdef;
1626 register struct attack *mattk;
1628 register struct permonst *pd = mdef->data;
1629 int armpro, tmp = d((int) mattk->damn, (int) mattk->damd);
1632 armpro = magic_negation(mdef);
1633 /* since hero can't be cancelled, only defender's armor applies */
1634 negated = !(rn2(10) >= 3 * armpro);
1636 if (is_demon(youmonst.data) && !rn2(13) && !uwep
1637 && u.umonnum != PM_SUCCUBUS && u.umonnum != PM_INCUBUS
1638 && u.umonnum != PM_BALROG) {
1642 switch (mattk->adtyp) {
1646 pline("%s %s for a moment.", Monnam(mdef),
1647 makeplural(stagger(pd, "stagger")));
1649 pline("%s
\82Í
\88ê
\8fu%s
\81D", Monnam(mdef),
1650 jpast(stagger(pd, "
\82æ
\82ë
\82ß
\82")));
1662 case AD_WERE: /* no special effect on monsters */
1663 case AD_HEAL: /* likewise */
1666 if (mattk->aatyp == AT_WEAP) {
1669 } else if (mattk->aatyp == AT_KICK) {
1670 if (thick_skinned(pd))
1672 if (pd == &mons[PM_SHADE]) {
1673 if (!(uarmf && uarmf->blessed)) {
1674 impossible("bad shade attack function flow?");
1677 tmp = rnd(4); /* bless damage */
1679 /* add ring(s) of increase damage */
1680 if (u.udaminc > 0) {
1681 /* applies even if damage was 0 */
1683 } else if (tmp > 0) {
1684 /* ring(s) might be negative; avoid converting
1685 0 to non-0 or positive to non-positive */
1699 pline("%s is %s!", Monnam(mdef), on_fire(pd, mattk));
1701 pline("%s
\82Í%s
\81I", Monnam(mdef), on_fire(mdef->data, mattk));
1702 if (pd == &mons[PM_STRAW_GOLEM] || pd == &mons[PM_PAPER_GOLEM]) {
1705 pline("%s burns completely!", Monnam(mdef));
1707 pline("%s
\82Í
\8a®
\91S
\82É
\94R
\82¦
\90s
\82«
\82½
\81I", Monnam(mdef));
1711 /* Don't return yet; keep hp<1 and tmp=0 for pet msg */
1713 tmp += destroy_mitem(mdef, SCROLL_CLASS, AD_FIRE);
1714 tmp += destroy_mitem(mdef, SPBOOK_CLASS, AD_FIRE);
1715 if (resists_fire(mdef)) {
1718 pline_The("fire doesn't heat %s!", mon_nam(mdef));
1720 pline("
\89\8a\82Í%s
\82É
\89e
\8b¿
\82ª
\82È
\82¢
\81I", mon_nam(mdef));
1721 golemeffects(mdef, AD_FIRE, tmp);
1722 shieldeff(mdef->mx, mdef->my);
1725 /* only potions damage resistant players in destroy_item */
1726 tmp += destroy_mitem(mdef, POTION_CLASS, AD_FIRE);
1735 pline("%s is covered in frost!", Monnam(mdef));
1737 pline("%s
\82Í
\95X
\82Å
\95¢
\82í
\82ê
\82½
\81I", Monnam(mdef));
1738 if (resists_cold(mdef)) {
1739 shieldeff(mdef->mx, mdef->my);
1742 pline_The("frost doesn't chill %s!", mon_nam(mdef));
1744 pline("
\95X
\82Í%s
\82ð
\93\80\82ç
\82·
\82±
\82Æ
\82ª
\82Å
\82«
\82È
\82¢
\81I", mon_nam(mdef));
1745 golemeffects(mdef, AD_COLD, tmp);
1748 tmp += destroy_mitem(mdef, POTION_CLASS, AD_COLD);
1757 pline("%s is zapped!", Monnam(mdef));
1759 pline("%s
\82Í
\93d
\8c\82\82ð
\82
\82ç
\82Á
\82½
\81I", Monnam(mdef));
1760 tmp += destroy_mitem(mdef, WAND_CLASS, AD_ELEC);
1761 if (resists_elec(mdef)) {
1764 pline_The("zap doesn't shock %s!", mon_nam(mdef));
1766 pline("
\93d
\8c\82\82Í%s
\82É
\89e
\8b¿
\82ð
\97^
\82¦
\82È
\82¢
\81I", mon_nam(mdef));
1767 golemeffects(mdef, AD_ELEC, tmp);
1768 shieldeff(mdef->mx, mdef->my);
1771 /* only rings damage resistant players in destroy_item */
1772 tmp += destroy_mitem(mdef, RING_CLASS, AD_ELEC);
1775 if (resists_acid(mdef))
1779 if (!munstone(mdef, TRUE))
1780 minstapetrify(mdef, TRUE);
1786 steal_it(mdef, mattk);
1790 /* This you as a leprechaun, so steal
1791 real gold only, no lesser coins */
1793 struct obj *mongold = findgold(mdef->minvent);
1795 obj_extract_self(mongold);
1796 if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) {
1799 Your("purse feels heavier.");
1801 You("
\8dà
\95z
\82ª
\8fd
\82
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
1804 You("grab %s's gold, but find no room in your knapsack.",
1806 You("%s
\82Ì
\82¨
\8bà
\82ð
\82Â
\82©
\82ñ
\82¾
\82ª
\81C
\8e\9d\82¿
\95¨
\91Ü
\82É
\93ü
\82ç
\82È
\82©
\82Á
\82½
\81D",
1812 exercise(A_DEX, TRUE);
1818 if (!negated && tmp < mdef->mhp) {
1821 canseemon(mdef) || (u.uswallow && u.ustuck == mdef);
1822 /* record the name before losing sight of monster */
1823 Strcpy(nambuf, Monnam(mdef));
1824 if (u_teleport_mon(mdef, FALSE) && u_saw_mon
1825 && !(canseemon(mdef) || (u.uswallow && u.ustuck == mdef)))
1827 pline("%s suddenly disappears!", nambuf);
1829 pline("%s
\82Í
\93Ë
\91R
\8fÁ
\82¦
\82½
\81I", nambuf);
1833 if (can_blnd(&youmonst, mdef, mattk->aatyp, (struct obj *) 0)) {
1834 if (!Blind && mdef->mcansee)
1836 pline("%s is blinded.", Monnam(mdef));
1838 pline("%s
\82Í
\96Ú
\82ª
\8c©
\82¦
\82È
\82
\82È
\82Á
\82½
\81D", Monnam(mdef));
1840 tmp += mdef->mblinded;
1843 mdef->mblinded = tmp;
1848 if (night() && !rn2(10) && !mdef->mcan) {
1849 if (pd == &mons[PM_CLAY_GOLEM]) {
1852 pline("Some writing vanishes from %s head!",
1854 pline("%s
\82Ì
\93ª
\82É
\8f\91\82¢
\82Ä
\82 \82é
\95¶
\8e\9a\82Ì
\82¢
\82
\82Â
\82©
\82ª
\8fÁ
\82¦
\82½
\81I",
1855 s_suffix(mon_nam(mdef)));
1857 /* Don't return yet; keep hp<1 and tmp=0 for pet msg */
1863 You("
\82
\82·
\82
\82·
\8fÎ
\82Á
\82½
\81D");
1869 if (!negated && !rn2(3) && !resists_drli(mdef)) {
1872 pline("%s suddenly seems weaker!", Monnam(mdef));
1874 pline("%s
\82Í
\93Ë
\91R
\8eã
\82
\82È
\82Á
\82½
\82æ
\82¤
\82É
\8c©
\82¦
\82½
\81I", Monnam(mdef));
1875 mdef->mhpmax -= xtmp;
1876 if ((mdef->mhp -= xtmp) <= 0 || !mdef->m_lev) {
1878 pline("%s dies!", Monnam(mdef));
1880 pline("%s
\82Í
\8e\80\82ñ
\82¾
\81I", Monnam(mdef));
1888 if (pd == &mons[PM_IRON_GOLEM]) {
1890 pline("%s falls to pieces!", Monnam(mdef));
1892 pline("%s
\82Í
\83o
\83\89\83o
\83\89\82É
\82È
\82Á
\82½
\81I", Monnam(mdef));
1895 erode_armor(mdef, ERODE_RUST);
1899 erode_armor(mdef, ERODE_CORRODE);
1903 if (pd == &mons[PM_WOOD_GOLEM] || pd == &mons[PM_LEATHER_GOLEM]) {
1905 pline("%s falls to pieces!", Monnam(mdef));
1907 pline("%s
\82Í
\83o
\83\89\83o
\83\89\82É
\82È
\82Á
\82½
\81I", Monnam(mdef));
1910 erode_armor(mdef, ERODE_ROT);
1914 if (!negated && !rn2(4))
1915 xdrainenergym(mdef, TRUE);
1921 if (!negated && !rn2(8)) {
1923 Your("%s was poisoned!", mpoisons_subj(&youmonst, mattk));
1925 Your("%s
\82Í
\93Å
\82³
\82ê
\82Ä
\82¢
\82é
\81I", mpoisons_subj(&youmonst, mattk));
1926 if (resists_poison(mdef))
1928 pline_The("poison doesn't seem to affect %s.", mon_nam(mdef));
1930 pline("
\93Å
\82Í%s
\82É
\89e
\8b¿
\82ð
\97^
\82¦
\82È
\82¢
\81D", mon_nam(mdef));
1934 Your("poison was deadly...");
1936 Your("
\97^
\82¦
\82½
\93Å
\82Í
\92v
\8e\80\97Ê
\82¾
\82Á
\82½
\81D
\81D
\81D");
1946 if (notonhead || !has_head(pd)) {
1948 pline("%s doesn't seem harmed.", Monnam(mdef));
1950 pline("%s
\82Í
\8f\9d\82Â
\82¢
\82½
\82æ
\82¤
\82É
\82Í
\8c©
\82¦
\82È
\82¢
\81D", Monnam(mdef));
1952 if (!Unchanging && pd == &mons[PM_GREEN_SLIME]) {
1955 You("suck in some slime and don't feel very well.");
1957 You("
\83X
\83\89\83C
\83\80\82ð
\8bz
\82¢
\8eæ
\82Á
\82Ä
\81C
\8bï
\8d\87\82ª
\88«
\82
\82È
\82Á
\82½
\81D");
1958 make_slimed(10L, (char *) 0);
1963 if (m_slips_free(mdef, mattk))
1966 if ((helmet = which_armor(mdef, W_ARMH)) != 0 && rn2(8)) {
1968 pline("%s %s blocks your attack to %s head.",
1969 s_suffix(Monnam(mdef)), helm_simple_name(helmet),
1972 pline("%s
\82Ì%s
\82ª
\93ª
\82Ö
\82Ì
\8dU
\8c\82\82ð
\96h
\82¢
\82¾
\81D",
1973 Monnam(mdef), helm_simple_name(helmet));
1978 (void) eat_brains(&youmonst, mdef, TRUE, &tmp);
1982 if (!negated && !sticks(pd))
1983 u.ustuck = mdef; /* it's now stuck to you */
1987 if (!u.ustuck && !rn2(10)) {
1988 if (m_slips_free(mdef, mattk)) {
1992 You("swing yourself around %s!", mon_nam(mdef));
1994 You("%s
\82É
\90g
\91Ì
\82ð
\97\8d\82Ý
\82Â
\82©
\82¹
\82½
\81I", mon_nam(mdef));
1997 } else if (u.ustuck == mdef) {
1998 /* Monsters don't wear amulets of magical breathing */
1999 if (is_pool(u.ux, u.uy) && !is_swimmer(pd)
2000 && !amphibious(pd)) {
2002 You("drown %s...", mon_nam(mdef));
2004 You("%s
\82ð
\93M
\82ê
\82³
\82¹
\82½
\81D
\81D
\81D", mon_nam(mdef));
2006 } else if (mattk->aatyp == AT_HUGS)
2008 pline("%s is being crushed.", Monnam(mdef));
2010 pline("%s
\82Í
\89\9f\82µ
\82Â
\82Ô
\82³
\82ê
\82Ä
\82¢
\82é
\81D", Monnam(mdef));
2015 You("brush against %s %s.", s_suffix(mon_nam(mdef)),
2016 mbodypart(mdef, LEG));
2018 You("%s
\82Ì%s
\82É
\90G
\82ê
\82½
\81D", mon_nam(mdef),
2019 mbodypart(mdef, LEG));
2026 if (!negated && mdef->mcanmove && !rn2(3) && tmp < mdef->mhp) {
2029 pline("%s is frozen by you!", Monnam(mdef));
2031 pline("%s
\82Í
\82 \82È
\82½
\82Ì
\82É
\82ç
\82Ý
\82Å
\93®
\82¯
\82È
\82
\82È
\82Á
\82½
\81I", Monnam(mdef));
2032 paralyze_monst(mdef, rnd(10));
2036 if (!negated && !mdef->msleeping && sleep_monst(mdef, rnd(10), -1)) {
2039 pline("%s is put to sleep by you!", Monnam(mdef));
2041 pline("%s
\82Í
\93Ë
\91R
\96°
\82è
\82É
\82¨
\82¿
\82½
\81I", Monnam(mdef));
2047 break; /* physical damage only */
2048 if (!rn2(4) && !slimeproof(pd)) {
2049 if (!munslime(mdef, TRUE) && mdef->mhp > 0) {
2050 /* this assumes newcham() won't fail; since hero has
2051 a slime attack, green slimes haven't been geno'd */
2053 You("turn %s into slime.", mon_nam(mdef));
2055 pline("%s
\82Í
\83X
\83\89\83C
\83\80\82É
\82È
\82Á
\82½
\81D", mon_nam(mdef));
2056 if (newcham(mdef, &mons[PM_GREEN_SLIME], FALSE, FALSE))
2059 /* munslime attempt could have been fatal */
2061 return 2; /* skip death message */
2065 case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
2066 /* there's no msomearmor() function, so just do damage */
2067 /* if (negated) break; */
2070 if (!negated && mdef->mspeed != MSLOW) {
2071 unsigned int oldspeed = mdef->mspeed;
2073 mon_adjust_speed(mdef, -1, (struct obj *) 0);
2074 if (mdef->mspeed != oldspeed && canseemon(mdef))
2076 pline("%s slows down.", Monnam(mdef));
2078 pline("%s
\82Í
\82Ì
\82ë
\82
\82È
\82Á
\82½
\81D", Monnam(mdef));
2083 if (canseemon(mdef))
2085 pline("%s looks confused.", Monnam(mdef));
2087 pline("%s
\82Í
\8d¬
\97\90\82µ
\82½
\82æ
\82¤
\82¾
\81D", Monnam(mdef));
2096 mdef->mstrategy &= ~STRAT_WAITFORU; /* in case player is very fast */
2097 if ((mdef->mhp -= tmp) < 1) {
2098 if (mdef->mtame && !cansee(mdef->mx, mdef->my)) {
2100 You_feel("embarrassed for a moment.");
2102 You("
\82µ
\82Î
\82ç
\82
\8d¢
\98f
\82µ
\82½
\81D");
2104 xkilled(mdef, 0); /* !tmp but hp<1: already killed */
2105 } else if (!flags.verbose) {
2109 You("
\93|
\82µ
\82½
\81I");
2121 register struct monst *mdef;
2122 register struct attack *mattk;
2124 register int tmp = d((int) mattk->damn, (int) mattk->damd);
2129 You("
\94\9a\94
\82µ
\82½
\81I");
2130 switch (mattk->adtyp) {
2131 boolean resistance; /* only for cold/fire/elec */
2134 if (!resists_blnd(mdef)) {
2136 pline("%s is blinded by your flash of light!", Monnam(mdef));
2138 pline("%s
\82Í
\82Ü
\82Î
\82ä
\82¢
\8cõ
\82Å
\96Ú
\82ª
\82
\82ç
\82ñ
\82¾
\81I", Monnam(mdef));
2139 mdef->mblinded = min((int) mdef->mblinded + tmp, 127);
2144 if (haseyes(mdef->data) && mdef->mcansee) {
2146 pline("%s is affected by your flash of light!", Monnam(mdef));
2148 pline("%s
\82Í
\82Ü
\82Î
\82ä
\82¢
\8cõ
\82Å
\89e
\8b¿
\82ð
\8eó
\82¯
\82½
\81I", Monnam(mdef));
2153 resistance = resists_cold(mdef);
2156 resistance = resists_fire(mdef);
2159 resistance = resists_elec(mdef);
2163 pline("%s gets blasted!", Monnam(mdef));
2165 pline("%s
\82Í
\94\9a\94
\82ð
\97\81\82Ñ
\82½
\81I", Monnam(mdef));
2167 if (mdef->mhp <= 0) {
2172 shieldeff(mdef->mx, mdef->my);
2173 if (is_golem(mdef->data))
2174 golemeffects(mdef, (int) mattk->adtyp, tmp);
2177 pline_The("blast doesn't seem to affect %s.", mon_nam(mdef));
2179 pline("
\94\9a\94
\82Í%s
\82É
\89e
\8b¿
\82ð
\97^
\82¦
\82È
\82©
\82Á
\82½
\82æ
\82¤
\82¾
\81D", mon_nam(mdef));
2193 map_location(u.ux, u.uy, TRUE);
2194 tmp_at(DISP_ALWAYS, mon_to_glyph(&youmonst));
2195 tmp_at(mdef->mx, mdef->my);
2198 You("engulf %s!", mon_nam(mdef));
2200 You("%s
\82ð
\88ù
\82Ý
\8d\9e\82ñ
\82¾
\81I", mon_nam(mdef));
2209 tmp_at(DISP_END, 0);
2216 register struct monst *mdef;
2217 register struct attack *mattk;
2219 #ifdef LINT /* static char msgbuf[BUFSZ]; */
2222 static char msgbuf[BUFSZ]; /* for nomovemsg */
2225 register int dam = d((int) mattk->damn, (int) mattk->damd);
2228 struct permonst *pd = mdef->data;
2230 /* Not totally the same as for real monsters. Specifically, these
2231 * don't take multiple moves. (It's just too hard, for too little
2232 * result, to program monsters which attack from inside you, which
2233 * would be necessary if done accurately.) Instead, we arbitrarily
2234 * kill the monster immediately for AD_DGST and we regurgitate them
2235 * after exactly 1 round of attack otherwise. -KAA
2238 if (!engulf_target(&youmonst, mdef))
2241 if (u.uhunger < 1500 && !u.uswallow) {
2242 for (otmp = mdef->minvent; otmp; otmp = otmp->nobj)
2243 (void) snuff_lit(otmp);
2245 /* engulfing a cockatrice or digesting a Rider or Medusa */
2246 fatal_gulp = (touch_petrifies(pd) && !Stone_resistance)
2247 || (mattk->adtyp == AD_DGST
2248 && (is_rider(pd) || (pd == &mons[PM_MEDUSA]
2249 && !Stone_resistance)));
2251 if ((mattk->adtyp == AD_DGST && !Slow_digestion) || fatal_gulp)
2252 eating_conducts(pd);
2254 if (fatal_gulp && !is_rider(pd)) { /* petrification */
2256 const char *mname = pd->mname;
2258 if (!type_is_pname(pd))
2261 You("englut %s.", mon_nam(mdef));
2263 You("%s
\82ð
\88ù
\82Ý
\8d\9e\82ñ
\82¾
\81D", mon_nam(mdef));
2265 Sprintf(kbuf, "swallowing %s whole", mname);
2267 Sprintf(kbuf, "%s
\82ð
\88ù
\82Ý
\8d\9e\82ñ
\82Å", mname);
2271 switch (mattk->adtyp) {
2273 /* eating a Rider or its corpse is fatal */
2276 pline("Unfortunately, digesting any of it is fatal.");
2278 pline("
\8ec
\94O
\82È
\82ª
\82ç
\81C
\82»
\82ê
\82ð
\90H
\82×
\82é
\82Ì
\82Í
\92v
\96½
\93I
\82È
\8aÔ
\88á
\82¢
\82¾
\81D");
2281 Sprintf(killer.name, "unwisely tried to eat %s",
2283 killer.format = NO_KILLER_PREFIX;
2285 Sprintf(killer.name, "
\8bð
\82©
\82É
\82à%s
\82ð
\90H
\82×
\82æ
\82¤
\82Æ
\82µ
\82Ä",
2287 killer.format = KILLED_BY;
2290 return 0; /* lifesaved */
2293 if (Slow_digestion) {
2298 /* Use up amulet of life saving */
2299 if (!!(otmp = mlifesaver(mdef)))
2300 m_useup(mdef, otmp);
2304 if (mdef->mhp > 0) { /* monster lifesaved */
2306 You("hurriedly regurgitate the sizzling in your %s.",
2308 You("%s
\82Ì
\92\86\82Å
\83V
\83\85\81[
\83V
\83\85\81[
\82Æ
\82¢
\82¤
\89¹
\82ð
\97§
\82Ä
\82Ä
\82¢
\82é
\82à
\82Ì
\82ð
\91å
\8b}
\82¬
\82Å
\93f
\82«
\96ß
\82µ
\82½
\81D",
2309 body_part(STOMACH));
2311 tmp = 1 + (pd->cwt >> 8);
2312 if (corpse_chance(mdef, &youmonst, TRUE)
2313 && !(mvitals[monsndx(pd)].mvflags & G_NOCORPSE)) {
2314 /* nutrition only if there can be a corpse */
2315 u.uhunger += (pd->cnutrit + 1) / 2;
2319 Sprintf(msgbuf, "You totally digest %s.", mon_nam(mdef));
2321 Sprintf(msgbuf, "
\82 \82È
\82½
\82Í%s
\82ð
\8a®
\91S
\82É
\8fÁ
\89»
\82µ
\82½
\81D", mon_nam(mdef));
2323 /* setting afternmv = end_engulf is tempting,
2324 * but will cause problems if the player is
2325 * attacked (which uses his real location) or
2326 * if his See_invisible wears off
2329 You("digest %s.", mon_nam(mdef));
2331 You("%s
\82ð
\8fÁ
\89»
\82µ
\82Ä
\82¢
\82é
\81D", mon_nam(mdef));
2336 multi_reason = "digesting something";
2338 multi_reason = "
\8fÁ
\89»
\92\86\82É";
2342 if (pd == &mons[PM_GREEN_SLIME]) {
2344 Sprintf(msgbuf, "%s isn't sitting well with you.",
2346 Sprintf(msgbuf, "%s
\82Í
\82 \82È
\82½
\82Æ
\82¤
\82Ü
\82
\90Ü
\82è
\8d\87\82¢
\82ð
\82Â
\82¯
\82ç
\82ê
\82È
\82¢
\82æ
\82¤
\82¾
\81D",
2349 make_slimed(5L, (char *) 0);
2352 exercise(A_CON, TRUE);
2357 if (youmonst.data == &mons[PM_FOG_CLOUD]) {
2359 pline("%s is laden with your moisture.", Monnam(mdef));
2361 pline("%s
\82Í
\82 \82È
\82½
\82Ì
\8e¼
\8bC
\82É
\8bê
\82µ
\82ß
\82ç
\82ê
\82Ä
\82¢
\82é
\81D", Monnam(mdef));
2362 if (amphibious(pd) && !flaming(pd)) {
2365 pline("%s seems unharmed.", Monnam(mdef));
2367 pline("%s
\82Í
\8f\9d\82Â
\82¢
\82Ä
\82¢
\82È
\82¢
\82æ
\82¤
\82¾
\81D", Monnam(mdef));
2371 pline("%s is pummeled with your debris!", Monnam(mdef));
2373 pline("%s
\82Í
\8a¢âI
\82Å
\92É
\82ß
\82Â
\82¯
\82ç
\82ê
\82½
\81I", Monnam(mdef));
2377 pline("%s is covered with your goo!", Monnam(mdef));
2379 pline("%s
\82Í
\82Ë
\82Î
\82Â
\82
\82à
\82Ì
\82Å
\95¢
\82í
\82ê
\82½
\81I", Monnam(mdef));
2380 if (resists_acid(mdef)) {
2382 pline("It seems harmless to %s.", mon_nam(mdef));
2384 pline("
\82µ
\82©
\82µ
\81C%s
\82Í
\82È
\82ñ
\82Æ
\82à
\82È
\82¢
\81D", mon_nam(mdef));
2389 if (can_blnd(&youmonst, mdef, mattk->aatyp,
2390 (struct obj *) 0)) {
2393 pline("%s can't see in there!", Monnam(mdef));
2395 pline("%s
\82Í
\96Ú
\82ª
\8c©
\82¦
\82È
\82
\82È
\82Á
\82½
\81I", mon_nam(mdef));
2397 dam += mdef->mblinded;
2400 mdef->mblinded = dam;
2407 pline_The("air around %s crackles with electricity.",
2409 pline("%s
\82Ì
\89ñ
\82è
\82Ì
\8bó
\8bC
\82Í
\93d
\8bC
\82Å
\83s
\83\8a\83s
\83\8a\82µ
\82Ä
\82¢
\82é
\81D",
2411 if (resists_elec(mdef)) {
2413 pline("%s seems unhurt.", Monnam(mdef));
2415 pline("
\82µ
\82©
\82µ
\81C%s
\82Í
\95½
\8bC
\82È
\82æ
\82¤
\82¾
\81D", Monnam(mdef));
2418 golemeffects(mdef, (int) mattk->adtyp, dam);
2424 if (resists_cold(mdef)) {
2426 pline("%s seems mildly chilly.", Monnam(mdef));
2428 pline("%s
\82Í
\97â
\82¦
\82½
\82æ
\82¤
\82¾
\81D", Monnam(mdef));
2432 pline("%s is freezing to death!", Monnam(mdef));
2434 pline("%s
\82Í
\93\80\8e\80\82µ
\82»
\82¤
\82¾
\81I", Monnam(mdef));
2435 golemeffects(mdef, (int) mattk->adtyp, dam);
2441 if (resists_fire(mdef)) {
2443 pline("%s seems mildly hot.", Monnam(mdef));
2445 pline("%s
\82Í
\92g
\82©
\82
\82È
\82Á
\82½
\82æ
\82¤
\82¾
\81D", Monnam(mdef));
2449 pline("%s is burning to a crisp!", Monnam(mdef));
2451 pline("%s
\82Í
\94R
\82¦
\82Ä
\83J
\83\89\83J
\83\89\82É
\82È
\82Á
\82½
\81I", Monnam(mdef));
2452 golemeffects(mdef, (int) mattk->adtyp, dam);
2458 xdrainenergym(mdef, TRUE);
2463 if ((mdef->mhp -= dam) <= 0) {
2465 if (mdef->mhp <= 0) /* not lifesaved */
2469 You("%s %s!", is_animal(youmonst.data) ? "regurgitate" : "expel",
2472 You("%s
\82ð%s
\82µ
\82½
\81I", mon_nam(mdef),
2473 is_animal(youmonst.data) ? "
\93f
\82«
\96ß" : "
\94r
\8fo");
2475 if (Slow_digestion || is_animal(youmonst.data)) {
2477 pline("Obviously, you didn't like %s taste.",
2479 pline("
\82Ç
\82¤
\82à%s
\82Ì
\96¡
\82Í
\8dD
\82«
\82É
\82È
\82ê
\82È
\82¢
\81D",
2480 s_suffix(mon_nam(mdef)));
2488 missum(mdef, mattk, wouldhavehit)
2489 register struct monst *mdef;
2490 register struct attack *mattk;
2491 boolean wouldhavehit;
2493 if (wouldhavehit) /* monk is missing due to penalty for wearing suit */
2495 Your("armor is rather cumbersome...");
2497 Your("
\96h
\8bï
\82Í
\8f
\82µ
\8e×
\96\82\82¾
\81D
\81D
\81D");
2499 if (could_seduce(&youmonst, mdef, mattk))
2501 You("pretend to be friendly to %s.", mon_nam(mdef));
2503 You("%s
\82É
\97F
\8dD
\93I
\82È
\82Ó
\82è
\82ð
\82µ
\82½
\81D", mon_nam(mdef));
2504 else if (canspotmon(mdef) && flags.verbose)
2506 You("miss %s.", mon_nam(mdef));
2508 Your("%s
\82Ö
\82Ì
\8dU
\8c\82\82Í
\8aO
\82ê
\82½
\81D", mon_nam(mdef));
2513 Your("
\89½
\8eÒ
\82©
\82Ö
\82Ì
\8dU
\8c\82\82Í
\8aO
\82ê
\82½
\81D");
2514 if (!mdef->msleeping && mdef->mcanmove)
2518 /* attack monster as a monster. */
2521 register struct monst *mon;
2523 struct attack *mattk, alt_attk;
2525 boolean altwep = FALSE, weapon_used = FALSE;
2526 int i, tmp, armorpenalty, sum[NATTK], nsum = 0, dhit = 0, attknum = 0;
2528 for (i = 0; i < NATTK; i++) {
2530 mattk = getmattk(youmonst.data, i, sum, &alt_attk);
2531 switch (mattk->aatyp) {
2534 /* Certain monsters don't use weapons when encountered as enemies,
2535 * but players who polymorph into them have hands or claws and
2536 * thus should be able to use weapons. This shouldn't prohibit
2537 * the use of most special abilities, either.
2538 * If monster has multiple claw attacks, only one can use weapon.
2541 /* Potential problem: if the monster gets multiple weapon attacks,
2542 * we currently allow the player to get each of these as a weapon
2543 * attack. Is this really desirable?
2545 /* approximate two-weapon mode */
2546 weapon = (altwep && uswapwep) ? uswapwep : uwep;
2547 altwep = !altwep; /* toggle for next attack */
2548 tmp = find_roll_to_hit(mon, AT_WEAP, weapon, &attknum,
2550 dhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
2551 /* Enemy dead, before any special abilities used */
2552 if (!known_hitum(mon, weapon, &dhit, tmp, armorpenalty, mattk)) {
2557 /* might be a worm that gets cut in half */
2558 if (m_at(u.ux + u.dx, u.uy + u.dy) != mon)
2559 return (boolean) (nsum != 0);
2560 /* Do not print "You hit" message, since known_hitum
2563 if (dhit && mattk->adtyp != AD_SPEL && mattk->adtyp != AD_PHYS)
2564 sum[i] = damageum(mon, mattk);
2567 if (uwep && !cantwield(youmonst.data) && !weapon_used)
2571 if (uwep && youmonst.data->mlet == S_LICH && !weapon_used)
2579 tmp = find_roll_to_hit(mon, mattk->aatyp, (struct obj *) 0,
2580 &attknum, &armorpenalty);
2581 dhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
2586 && (compat = could_seduce(&youmonst, mon, mattk))) {
2589 mon->mcansee && haseyes(mon->data) ? "smile at"
2592 compat == 2 ? "engagingly" : "seductively");
2594 You("%s
\82Ö%s%s
\81D",
2596 compat == 2 ? "
\96£
\97Í
\93I
\82É" : "
\97U
\98f
\93I
\82É",
2597 mon->mcansee && haseyes(mon->data) ? "
\94÷
\8fÎ
\82Ý
\82©
\82¯
\82½"
2598 : "
\98b
\82µ
\82©
\82¯
\82½");
2600 /* doesn't anger it; no wakeup() */
2601 sum[i] = damageum(mon, mattk);
2605 /* maybe this check should be in damageum()? */
2606 if (mon->data == &mons[PM_SHADE]
2607 && !(mattk->aatyp == AT_KICK && uarmf
2608 && uarmf->blessed)) {
2610 Your("attack passes harmlessly through %s.",
2612 Your("
\8dU
\8c\82\82Í%s
\82ð
\82·
\82Á
\82Æ
\92Ê
\82è
\82Ê
\82¯
\82½
\81D",
2616 if (mattk->aatyp == AT_KICK)
2618 You("kick %s.", mon_nam(mon));
2620 You("%s
\82ð
\8fR
\82Á
\82½
\81D", mon_nam(mon));
2621 else if (mattk->aatyp == AT_BITE)
2623 You("bite %s.", mon_nam(mon));
2625 You("%s
\82É
\8a\9a\82Ý
\82Â
\82¢
\82½
\81D", mon_nam(mon));
2626 else if (mattk->aatyp == AT_STNG)
2628 You("sting %s.", mon_nam(mon));
2630 You("%s
\82É
\93Ë
\82«
\82³
\82µ
\82½
\81D", mon_nam(mon));
2631 else if (mattk->aatyp == AT_BUTT)
2633 You("butt %s.", mon_nam(mon));
2635 You("%s
\82É
\93ª
\93Ë
\82«
\82ð
\82
\82ç
\82í
\82µ
\82½
\81D", mon_nam(mon));
2636 else if (mattk->aatyp == AT_TUCH)
2638 You("touch %s.", mon_nam(mon));
2640 You("%s
\82É
\90G
\82ê
\82½
\81D", mon_nam(mon));
2641 else if (mattk->aatyp == AT_TENT)
2643 Your("tentacles suck %s.", mon_nam(mon));
2645 Your("
\90G
\8eè
\82ª%s
\82Ì
\91Ì
\89t
\82ð
\8bz
\82¢
\82Æ
\82Á
\82½
\81D", mon_nam(mon));
2648 You("hit %s.", mon_nam(mon));
2650 Your("%s
\82Ö
\82Ì
\8dU
\8c\82\82Í
\96½
\92\86\82µ
\82½
\81D", mon_nam(mon));
2651 sum[i] = damageum(mon, mattk);
2653 missum(mon, mattk, (tmp + armorpenalty > dieroll));
2658 /* automatic if prev two attacks succeed, or if
2659 * already grabbed in a previous attack
2663 if (mon->data == &mons[PM_SHADE])
2665 Your("hug passes harmlessly through %s.", mon_nam(mon));
2667 You("%s
\82ð
\82Â
\82©
\82Ü
\82¦
\82æ
\82¤
\82Æ
\82µ
\82½
\82ª
\92Ê
\82è
\82Ê
\82¯
\82½
\81D", mon_nam(mon));
2668 else if (!sticks(mon->data) && !u.uswallow) {
2669 if (mon == u.ustuck) {
2671 pline("%s is being %s.", Monnam(mon),
2672 u.umonnum == PM_ROPE_GOLEM ? "choked" : "crushed");
2674 pline("%s
\82Í%s
\81D", Monnam(mon),
2675 u.umonnum==PM_ROPE_GOLEM ? "
\8eñ
\82ð
\8di
\82ß
\82ç
\82ê
\82Ä
\82¢
\82é"
2676 : "
\89\9f\82µ
\82Â
\82Ô
\82³
\82ê
\82Ä
\82¢
\82é");
2678 sum[i] = damageum(mon, mattk);
2679 } else if (i >= 2 && sum[i - 1] && sum[i - 2]) {
2681 You("grab %s!", mon_nam(mon));
2683 You("%s
\82ð
\82Â
\82©
\82Ü
\82¦
\82½
\81I", mon_nam(mon));
2685 sum[i] = damageum(mon, mattk);
2690 case AT_EXPL: /* automatic hit if next to */
2693 sum[i] = explum(mon, mattk);
2697 tmp = find_roll_to_hit(mon, mattk->aatyp, (struct obj *) 0,
2698 &attknum, &armorpenalty);
2699 if ((dhit = (tmp > rnd(20 + i)))) {
2701 if (mon->data == &mons[PM_SHADE])
2703 Your("attempt to surround %s is harmless.", mon_nam(mon));
2705 You("%s
\82ð
\88ù
\82Ý
\82±
\82à
\82¤
\82Æ
\82µ
\82½
\82ª
\8e¸
\94s
\82µ
\82½
\81D", mon_nam(mon));
2707 sum[i] = gulpum(mon, mattk);
2708 if (sum[i] == 2 && (mon->data->mlet == S_ZOMBIE
2709 || mon->data->mlet == S_MUMMY)
2710 && rn2(5) && !Sick_resistance) {
2712 You_feel("%ssick.", (Sick) ? "very " : "");
2714 You_feel("%s
\8bC
\95ª
\82ª
\88«
\82¢
\81D", (Sick) ? "
\82Æ
\82Ä
\82à" : "");
2715 mdamageu(mon, rnd(8));
2719 missum(mon, mattk, FALSE);
2724 /* No check for uwep; if wielding nothing we want to
2725 * do the normal 1-2 points bare hand damage...
2727 if ((youmonst.data->mlet == S_KOBOLD
2728 || youmonst.data->mlet == S_ORC
2729 || youmonst.data->mlet == S_GNOME) && !weapon_used)
2735 /* Not break--avoid passive attacks from enemy */
2739 case AT_GAZE: /* all done using #monster command */
2743 default: /* Strange... */
2744 impossible("strange attack of yours (%d)", mattk->aatyp);
2747 u.mh = -1; /* dead in the current form */
2751 return (boolean) passive(mon, 1, 0, mattk->aatyp, FALSE);
2754 (void) passive(mon, sum[i], 1, mattk->aatyp, FALSE);
2758 break; /* No extra attacks if no longer a monster */
2760 break; /* If paralyzed while attacking, i.e. floating eye */
2762 return (boolean) (nsum != 0);
2765 /* Special (passive) attacks on you by monsters done here.
2768 passive(mon, mhit, malive, aatyp, wep_was_destroyed)
2769 register struct monst *mon;
2770 register boolean mhit;
2771 register int malive;
2773 boolean wep_was_destroyed;
2775 register struct permonst *ptr = mon->data;
2776 register int i, tmp;
2780 return (malive | mhit); /* no passive attacks */
2781 if (ptr->mattk[i].aatyp == AT_NONE)
2782 break; /* try this one */
2784 /* Note: tmp not always used */
2785 if (ptr->mattk[i].damn)
2786 tmp = d((int) ptr->mattk[i].damn, (int) ptr->mattk[i].damd);
2787 else if (ptr->mattk[i].damd)
2788 tmp = d((int) mon->m_lev + 1, (int) ptr->mattk[i].damd);
2792 /* These affect you even if they just died.
2794 switch (ptr->mattk[i].adtyp) {
2796 if (mhit && !mon->mcan) {
2797 if (aatyp == AT_KICK) {
2798 if (uarmf && !rn2(6))
2799 (void) erode_obj(uarmf, xname(uarmf), ERODE_BURN,
2800 EF_GREASE | EF_VERBOSE);
2801 } else if (aatyp == AT_WEAP || aatyp == AT_CLAW
2802 || aatyp == AT_MAGC || aatyp == AT_TUCH)
2803 passive_obj(mon, (struct obj *) 0, &(ptr->mattk[i]));
2807 if (mhit && rn2(2)) {
2808 if (Blind || !flags.verbose)
2810 You("are splashed!");
2812 You("
\89½
\82©
\82ð
\97\81\82Ñ
\82¹
\82ç
\82ê
\82½
\81I");
2815 You("are splashed by %s acid!", s_suffix(mon_nam(mon)));
2817 You("%s
\82Ì
\8e_
\82ð
\97\81\82Ñ
\82¹
\82ç
\82ê
\82½
\81I", s_suffix(mon_nam(mon)));
2819 if (!Acid_resistance)
2822 erode_armor(&youmonst, ERODE_CORRODE);
2825 if (aatyp == AT_KICK) {
2826 if (uarmf && !rn2(6))
2827 (void) erode_obj(uarmf, xname(uarmf), ERODE_CORRODE,
2828 EF_GREASE | EF_VERBOSE);
2829 } else if (aatyp == AT_WEAP || aatyp == AT_CLAW
2830 || aatyp == AT_MAGC || aatyp == AT_TUCH)
2831 passive_obj(mon, (struct obj *) 0, &(ptr->mattk[i]));
2833 exercise(A_STR, FALSE);
2836 if (mhit) { /* successful attack */
2837 long protector = attk_protection((int) aatyp);
2839 /* hero using monsters' AT_MAGC attack is hitting hand to
2840 hand rather than casting a spell */
2841 if (aatyp == AT_MAGC)
2844 if (protector == 0L /* no protection */
2845 || (protector == W_ARMG && !uarmg
2846 && !uwep && !wep_was_destroyed)
2847 || (protector == W_ARMF && !uarmf)
2848 || (protector == W_ARMH && !uarmh)
2849 || (protector == (W_ARMC | W_ARMG) && (!uarmc || !uarmg))) {
2850 if (!Stone_resistance
2851 && !(poly_when_stoned(youmonst.data)
2852 && polymon(PM_STONE_GOLEM))) {
2853 done_in_by(mon, STONING); /* "You turn to stone..." */
2860 if (mhit && !mon->mcan) {
2861 if (aatyp == AT_KICK) {
2863 (void) erode_obj(uarmf, xname(uarmf), ERODE_RUST,
2864 EF_GREASE | EF_VERBOSE);
2865 } else if (aatyp == AT_WEAP || aatyp == AT_CLAW
2866 || aatyp == AT_MAGC || aatyp == AT_TUCH)
2867 passive_obj(mon, (struct obj *) 0, &(ptr->mattk[i]));
2871 if (mhit && !mon->mcan) {
2872 if (aatyp == AT_KICK) {
2874 (void) erode_obj(uarmf, xname(uarmf), ERODE_CORRODE,
2875 EF_GREASE | EF_VERBOSE);
2876 } else if (aatyp == AT_WEAP || aatyp == AT_CLAW
2877 || aatyp == AT_MAGC || aatyp == AT_TUCH)
2878 passive_obj(mon, (struct obj *) 0, &(ptr->mattk[i]));
2882 /* wrath of gods for attacking Oracle */
2884 shieldeff(u.ux, u.uy);
2886 pline("A hail of magic missiles narrowly misses you!");
2888 pline("
\96\82\96@
\82Ì
\96î
\82Ì
\89J
\82ð
\82È
\82ñ
\82Æ
\82©
\82©
\82í
\82µ
\82½
\81I");
2891 You("are hit by magic missiles appearing from thin air!");
2893 pline("
\93Ë
\94@
\8bó
\92\86\82É
\8c»
\82í
\82ê
\82½
\96\82\96@
\82Ì
\96î
\82ª
\96½
\92\86\82µ
\82½
\81I");
2897 case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
2899 struct obj *obj = (struct obj *) 0;
2901 if (aatyp == AT_KICK) {
2905 } else if (aatyp == AT_BITE || aatyp == AT_BUTT
2906 || (aatyp >= AT_STNG && aatyp < AT_WEAP)) {
2907 break; /* no object involved */
2909 passive_obj(mon, obj, &(ptr->mattk[i]));
2916 /* These only affect you if they still live.
2918 if (malive && !mon->mcan && rn2(3)) {
2919 switch (ptr->mattk[i].adtyp) {
2921 if (ptr == &mons[PM_FLOATING_EYE]) {
2922 if (!canseemon(mon)) {
2927 if (ureflects("%s gaze is reflected by your %s.",
2929 if (ureflects("%s
\82Ì
\82É
\82ç
\82Ý
\82Í%s
\82É
\82æ
\82Á
\82Ä
\94½
\8eË
\82³
\82ê
\82½
\81D",
2930 s_suffix(Monnam(mon)))) {
2932 } else if (Free_action) {
2934 You("momentarily stiffen under %s gaze!",
2936 You("%s
\82Ì
\82É
\82ç
\82Ý
\82Å
\88ê
\8fu
\8dd
\92¼
\82µ
\82½
\81I",
2937 s_suffix(mon_nam(mon)));
2938 } else if (Hallucination && rn2(4)) {
2940 pline("%s looks %s%s.", Monnam(mon),
2941 !rn2(2) ? "" : "rather ",
2942 !rn2(2) ? "numb" : "stupified");
2944 pline("%s
\82Í%s
\82Î
\82©
\82É
\82È
\82Á
\82½
\82æ
\82¤
\82¾
\81D", Monnam(mon),
2945 !rn2(2) ? "" : "
\8f
\82µ");
2949 You("are frozen by %s gaze!", s_suffix(mon_nam(mon)));
2951 You("%s
\82Ì
\82É
\82ç
\82Ý
\82Å
\93®
\82¯
\82È
\82
\82È
\82Á
\82½
\81I", mon_nam(mon));
2952 nomul((ACURR(A_WIS) > 12 || rn2(4)) ? -tmp : -127);
2954 multi_reason = "frozen by a monster's gaze";
2956 multi_reason = "
\89ö
\95¨
\82Ì
\82É
\82ç
\82Ý
\82Å
\8dd
\92¼
\82µ
\82Ä
\82¢
\82é
\8e\9e\82É";
2961 pline("%s cannot defend itself.",
2962 Adjmonnam(mon, "blind"));
2964 pline("%s
\82Í
\96h
\8cä
\82Å
\82«
\82È
\82¢
\81D",
2965 Adjmonnam(mon,"
\96Ú
\82Ì
\8c©
\82¦
\82È
\82¢"));
2970 } else if (Free_action) {
2972 You("momentarily stiffen.");
2974 You("
\88ê
\8fu
\8dd
\92¼
\82µ
\82½
\81D");
2975 } else { /* gelatinous cube */
2977 You("are frozen by %s!", mon_nam(mon));
2979 You("%s
\82É
\82æ
\82Á
\82Ä
\93®
\82¯
\82È
\82
\82È
\82Á
\82½
\81I", mon_nam(mon));
2980 nomovemsg = You_can_move_again;
2983 multi_reason = "frozen by a monster";
2985 multi_reason = "
\89ö
\95¨
\82É
\82æ
\82Á
\82Ä
\8dd
\92¼
\82µ
\82Ä
\82¢
\82é
\8e\9e\82É";
2986 exercise(A_DEX, FALSE);
2989 case AD_COLD: /* brown mold or blue jelly */
2990 if (monnear(mon, u.ux, u.uy)) {
2991 if (Cold_resistance) {
2992 shieldeff(u.ux, u.uy);
2994 You_feel("a mild chill.");
2996 You("
\8a¦
\82³
\82ð
\8a´
\82¶
\82½
\81D");
2997 ugolemeffects(AD_COLD, tmp);
3001 You("are suddenly very cold!");
3003 You("
\93Ë
\91R
\81C
\96Ò
\97ó
\82É
\8a¦
\82
\82È
\82Á
\82½
\81I");
3005 /* monster gets stronger with your heat! */
3006 mon->mhp += tmp / 2;
3007 if (mon->mhpmax < mon->mhp)
3008 mon->mhpmax = mon->mhp;
3009 /* at a certain point, the monster will reproduce! */
3010 if (mon->mhpmax > ((int) (mon->m_lev + 1) * 8))
3011 (void) split_mon(mon, &youmonst);
3014 case AD_STUN: /* specifically yellow mold */
3016 make_stunned((long) tmp, TRUE);
3019 if (monnear(mon, u.ux, u.uy)) {
3020 if (Fire_resistance) {
3021 shieldeff(u.ux, u.uy);
3023 You_feel("mildly warm.");
3025 You("
\92g
\82©
\82³
\82ð
\8a´
\82¶
\82½
\81D");
3026 ugolemeffects(AD_FIRE, tmp);
3030 You("are suddenly very hot!");
3032 You("
\93Ë
\91R
\81C
\96Ò
\97ó
\82É
\94M
\82
\82È
\82Á
\82½
\81I");
3033 mdamageu(mon, tmp); /* fire damage */
3037 if (Shock_resistance) {
3038 shieldeff(u.ux, u.uy);
3040 You_feel("a mild tingle.");
3042 You("
\83s
\83\8a\83s
\83\8a\82Æá
\83\82ê
\82ð
\8a´
\82¶
\82½
\81D");
3043 ugolemeffects(AD_ELEC, tmp);
3047 You("are jolted with electricity!");
3049 You("
\93d
\8bC
\83V
\83\87\83b
\83N
\82ð
\82¤
\82¯
\82½
\81I");
3056 return (malive | mhit);
3060 * Special (passive) attacks on an attacking object by monsters done here.
3061 * Assumes the attack was successful.
3064 passive_obj(mon, obj, mattk)
3065 register struct monst *mon;
3066 register struct obj *obj; /* null means pick uwep, uswapwep or uarmg */
3067 struct attack *mattk; /* null means we find one internally */
3069 struct permonst *ptr = mon->data;
3072 /* if caller hasn't specified an object, use uwep, uswapwep or uarmg */
3074 obj = (u.twoweap && uswapwep && !rn2(2)) ? uswapwep : uwep;
3075 if (!obj && mattk->adtyp == AD_ENCH)
3076 obj = uarmg; /* no weapon? then must be gloves */
3078 return; /* no object to affect */
3081 /* if caller hasn't specified an attack, find one */
3085 return; /* no passive attacks */
3086 if (ptr->mattk[i].aatyp == AT_NONE)
3087 break; /* try this one */
3089 mattk = &(ptr->mattk[i]);
3092 switch (mattk->adtyp) {
3094 if (!rn2(6) && !mon->mcan) {
3095 (void) erode_obj(obj, NULL, ERODE_BURN, EF_NONE);
3100 (void) erode_obj(obj, NULL, ERODE_CORRODE, EF_NONE);
3105 (void) erode_obj(obj, NULL, ERODE_RUST, EF_NONE);
3110 (void) erode_obj(obj, NULL, ERODE_CORRODE, EF_NONE);
3115 if (drain_item(obj) && carried(obj)
3116 && (obj->known || obj->oclass == ARMOR_CLASS)) {
3118 pline("%s less effective.", Yobjnam2(obj, "seem"));
3120 Your("%s
\82©
\82ç
\96\82\97Í
\82ª
\8fÁ
\82¦
\82½
\82æ
\82¤
\82¾
\81D", xname(obj));
3132 /* Note: caller must ascertain mtmp is mimicking... */
3134 stumble_onto_mimic(mtmp)
3138 const char *fmt = "Wait! That's %s!", *generic = "a monster", *what = 0;
3140 const char *fmt = "
\82¿
\82å
\82Á
\82Æ
\82Ü
\82Á
\82½
\81I%s
\82¾
\81I", *generic = "
\89ö
\95¨", *what = 0;
3142 if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK))
3147 what = generic; /* with default fmt */
3148 else if (mtmp->m_ap_type == M_AP_MONSTER)
3149 what = a_monnam(mtmp); /* differs from what was sensed */
3151 int glyph = levl[u.ux + u.dx][u.uy + u.dy].glyph;
3153 if (glyph_is_cmap(glyph) && (glyph_to_cmap(glyph) == S_hcdoor
3154 || glyph_to_cmap(glyph) == S_vcdoor))
3156 fmt = "The door actually was %s!";
3158 fmt = "
\94à
\82Í
\8eÀ
\8dÛ
\82É
\82Í%s
\82¾
\82Á
\82½
\81I";
3159 else if (glyph_is_object(glyph) && glyph_to_obj(glyph) == GOLD_PIECE)
3161 fmt = "That gold was %s!";
3163 fmt = "
\8bà
\89Ý
\82Í%s
\82¾
\82Á
\82½
\81I";
3165 /* cloned Wiz starts out mimicking some other monster and
3166 might make himself invisible before being revealed */
3167 if (mtmp->minvis && !See_invisible)
3170 what = a_monnam(mtmp);
3175 wakeup(mtmp); /* clears mimicking */
3176 /* if hero is blind, wakeup() won't display the monster even though
3177 it's no longer concealed */
3178 if (!canspotmon(mtmp)
3179 && !glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph))
3180 map_invisible(mtmp->mx, mtmp->my);
3187 char *hands = makeplural(body_part(HAND));
3189 if (!u.umconf || mon->mconf)
3191 if (u.umconf == 1) {
3194 Your("%s stop tingling.", hands);
3196 Your("%s
\82Ìá
\83\82ê
\82ª
\82Æ
\82ê
\82½
\81D", hands);
3199 Your("%s stop glowing %s.", hands, hcolor(NH_RED));
3201 Your("%s
\82Ì%s
\8bP
\82«
\82Í
\82È
\82
\82È
\82Á
\82½
\81D", hands, hcolor(NH_RED));
3205 pline_The("tingling in your %s lessens.", hands);
3207 pline("%s
\82Ìá
\83\82ê
\82ª
\82Æ
\82ê
\82Ä
\82«
\82½
\81D",hands);
3210 Your("%s no longer glow so brightly %s.", hands, hcolor(NH_RED));
3212 Your("%s
\82Ì%s
\8bP
\82«
\82ª
\82È
\82
\82È
\82Á
\82Ä
\82«
\82½
\81D",hands, hcolor(NH_RED));
3218 flash_hits_mon(mtmp, otmp)
3220 struct obj *otmp; /* source of flash */
3222 int tmp, amt, res = 0, useeit = canseemon(mtmp);
3224 if (mtmp->msleeping) {
3225 mtmp->msleeping = 0;
3228 pline_The("flash awakens %s.", mon_nam(mtmp));
3230 pline("
\91M
\8cõ
\82Å%s
\82ª
\96Ú
\82ð
\8ao
\82Ü
\82µ
\82½
\81D", mon_nam(mtmp));
3233 } else if (mtmp->data->mlet != S_LIGHT) {
3234 if (!resists_blnd(mtmp)) {
3235 tmp = dist2(otmp->ox, otmp->oy, mtmp->mx, mtmp->my);
3238 pline("%s is blinded by the flash!", Monnam(mtmp));
3240 pline("%s
\82Í
\91M
\8cõ
\82Å
\96Ú
\82ª
\8c©
\82¦
\82È
\82
\82È
\82Á
\82½
\81I", Monnam(mtmp));
3243 if (mtmp->data == &mons[PM_GREMLIN]) {
3244 /* Rule #1: Keep them out of the light. */
3245 amt = otmp->otyp == WAN_LIGHT ? d(1 + otmp->spe, 4)
3246 : rn2(min(mtmp->mhp, 4));
3247 light_hits_gremlin(mtmp, amt);
3249 if (mtmp->mhp > 0) {
3250 if (!context.mon_moving)
3252 if (tmp < 9 && !mtmp->isshk && rn2(4))
3253 monflee(mtmp, rn2(4) ? rnd(100) : 0, FALSE, TRUE);
3255 mtmp->mblinded = (tmp < 3) ? 0 : rnd(1 + 50 / tmp);
3263 light_hits_gremlin(mon, dmg)
3268 pline("%s %s!", Monnam(mon),
3269 (dmg > mon->mhp / 2) ? "wails in agony" : "cries out in pain");
3271 pline("%s
\82Í%s
\81I", Monnam(mon),
3272 (dmg > mon->mhp / 2) ? "
\8bê
\92É
\82Ì
\90º
\82ð
\82 \82°
\82½" : "
\8c\83\92É
\82Å
\8b©
\82ñ
\82¾");
3274 if ((mon->mhp -= dmg) <= 0) {
3275 if (context.mon_moving)
3276 monkilled(mon, (char *) 0, AD_BLND);
3279 } else if (cansee(mon->mx, mon->my) && !canspotmon(mon)) {
3280 map_invisible(mon->mx, mon->my);