OSDN Git Service

update year to 2020
[jnethack/source.git] / src / mhitu.c
index cfd858d..9aaa08b 100644 (file)
@@ -1,11 +1,11 @@
-/* NetHack 3.6 mhitu.c $NHDT-Date: 1556649298 2019/04/30 18:34:58 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.164 $ */
+/* NetHack 3.6 mhitu.c $NHDT-Date: 1575245065 2019/12/02 00:04:25 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.168 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
 
 /* JNetHack Copyright */
 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
-/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2019            */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2020            */
 /* JNetHack may be freely redistributed.  See license for details. */
 
 #include "hack.h"
@@ -131,7 +131,7 @@ struct attack *mattk;
 */
         pline("%s\82Í\97F\8dD\93I\82È\82Ó\82è\82ð\82µ\82Ä\82¢\82é\81D",Monnam(mtmp));
     else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s %smisses!", Monnam(mtmp),
               (nearmiss && flags.verbose) ? "just " : "");
 #else
@@ -176,7 +176,7 @@ struct attack *mattk;
 */
         return (!mwep || !mwep->opoisoned) ? "\8dU\8c\82" : "\95\90\8aí";
     } else {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         return (mattk->aatyp == AT_TUCH) ? "contact"
                   : (mattk->aatyp == AT_GAZE) ? "gaze"
                        : (mattk->aatyp == AT_BITE) ? "bite" : "sting";
@@ -264,7 +264,7 @@ struct attack *mattk;
                 pline("%s\82Ì\8dU\8c\82\82Í\82 \82È\82½\82Ì\98e\95 \82ð\82©\82·\82ß\82½\81D", Monst_name);
                 break;
             case 2:
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s strikes at %s!", Monst_name,
                       (levl[mtmp->mux][mtmp->muy].typ == WATER)
                         ? "empty water"
@@ -287,7 +287,7 @@ struct attack *mattk;
     } else if (Displaced) {
         /* give 'displaced' message even if hero is Blind */
         if (compat)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s smiles %s at your %sdisplaced image...", Monst_name,
                   (compat == 2) ? "engagingly" : "seductively",
                   Invis ? "invisible " : "");
@@ -297,7 +297,7 @@ struct attack *mattk;
                   (compat == 2) ? "\96£\97Í\93I\82É" : "\97U\98f\93I\82É");
 #endif
         else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s strikes at your %sdisplaced image and misses you!",
                   /* Note:  if you're both invisible and displaced, only
                    * monsters which see invisible will attack your displaced
@@ -603,7 +603,7 @@ register struct monst *mtmp;
 
             obj = which_armor(mtmp, WORN_HELMET);
             if (obj && is_metallic(obj)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 Your("blow glances off %s %s.", s_suffix(mon_nam(mtmp)),
                      helm_simple_name(obj));
 #else
@@ -658,7 +658,7 @@ register struct monst *mtmp;
                     if (youmonst.data->mlet == S_EEL
                         || u.umonnum == PM_TRAPPER)
                         pline(
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                              "Wait, %s!  There's a hidden %s named %s there!",
                               m_monnam(mtmp), youmonst.data->mname, plname);
 #else
@@ -667,7 +667,7 @@ register struct monst *mtmp;
 #endif
                     else
                         pline(
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                           "Wait, %s!  There's a %s named %s hiding under %s!",
                               m_monnam(mtmp), youmonst.data->mname, plname,
                               doname(level.objects[u.ux][u.uy]));
@@ -699,7 +699,7 @@ register struct monst *mtmp;
 */
             pline("\89½\8eÒ\82©\82ª\82 \82È\82½\82Ì\8fã\82É\82Ì\82µ\82©\82©\82Á\82½\81D");
         else /* see note about m_monnam() above */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("Wait, %s!  That's a %s named %s!", m_monnam(mtmp),
                   youmonst.data->mname, plname);
 #else
@@ -719,7 +719,7 @@ register struct monst *mtmp;
         if (!canspotmon(mtmp))
             map_invisible(mtmp->mx, mtmp->my);
         if (!youseeit)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s %s!", Something, (likes_gold(mtmp->data)
                                         && youmonst.mappearance == GOLD_PIECE)
                                            ? "tries to pick you up"
@@ -731,7 +731,7 @@ register struct monst *mtmp;
                                            : "\96³\8e\8b\82µ\82½");
 #endif
         else /* see note about m_monnam() above */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("Wait, %s!  That %s is really %s named %s!", m_monnam(mtmp),
                   mimic_obj_name(&youmonst), an(mons[u.umonnum].mname),
                   plname);
@@ -743,7 +743,7 @@ register struct monst *mtmp;
         if (multi < 0) { /* this should always be the case */
             char buf[BUFSZ];
 
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             Sprintf(buf, "You appear to be %s again.",
                     Upolyd ? (const char *) an(youmonst.data->mname)
                            : (const char *) "yourself");
@@ -965,7 +965,7 @@ register struct monst *mtmp;
 */
                         pline("%s\82Í\93Ë\90i\82µ\81C\96ß\82Á\82½\81I", Monnam(mtmp));
                     else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                         You_hear("a %s nearby.",
                                  is_whirly(mtmp->data) ? "rushing noise"
                                                        : "splat");
@@ -1090,7 +1090,7 @@ struct attack *mattk;
        protection might fail (33% chance) when the armor is cursed */
     if (obj && (obj->greased || obj->otyp == OILSKIN_CLOAK)
         && (!obj->cursed || rn2(3))) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s %s your %s %s!", Monnam(mtmp),
               (mattk->adtyp == AD_WRAP) ? "slips off of"
                                         : "grabs you, but cannot hold onto",
@@ -1254,7 +1254,7 @@ register struct attack *mattk;
                 }
             } else if (u.ustuck == mtmp) {
                 exercise(A_STR, FALSE);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 You("are being %s.", (mtmp->data == &mons[PM_ROPE_GOLEM])
                                          ? "choked"
                                          : "crushed");
@@ -1274,7 +1274,7 @@ register struct attack *mattk;
                 if (otmp->otyp == CORPSE
                     && touch_petrifies(&mons[otmp->corpsenm])) {
                     dmg = 1;
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     pline("%s hits you with the %s corpse.", Monnam(mtmp),
                           mons[otmp->corpsenm].mname);
 #else
@@ -1454,7 +1454,7 @@ register struct attack *mattk;
  dopois:
         hitmsg(mtmp, mattk);
         if (uncancelled && !rn2(8)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             Sprintf(buf, "%s %s", s_suffix(Monnam(mtmp)),
                     mpoisons_subj(mtmp, mattk));
 #else
@@ -1555,9 +1555,8 @@ register struct attack *mattk;
         /* This case is too obvious to ignore, but Nethack is not in
          * general very good at considering height--most short monsters
          * still _can_ attack you when you're flying or mounted.
-         * [FIXME: why can't a flying attacker overcome this?]
          */
-        if (u.usteed || Levitation || Flying) {
+        if ((u.usteed || Levitation || Flying) && !is_flyer(mtmp->data)) {
 /*JP
             pline("%s tries to reach your %s %s!", Monst_name, sidestr, leg);
 */
@@ -1584,7 +1583,7 @@ register struct attack *mattk;
                           Monst_name, sidestr, leg);
 #endif
                 } else if (!rn2(5)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     pline("%s pricks through your %s boot!", Monst_name,
                           sidestr);
 #else
@@ -1592,7 +1591,7 @@ register struct attack *mattk;
                           sidestr);
 #endif
                 } else {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     pline("%s scratches your %s boot!", Monst_name,
                           sidestr);
 #else
@@ -1698,7 +1697,7 @@ register struct attack *mattk;
             } else {
                 dmg = 0;
                 if (flags.verbose)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     pline("%s brushes against your %s.", Monnam(mtmp),
                           body_part(LEG));
 #else
@@ -1797,7 +1796,7 @@ register struct attack *mattk;
                 (void) rloc(mtmp, TRUE);
             if (is_animal(mtmp->data) && *buf) {
                 if (canseemon(mtmp))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     pline("%s tries to %s away with %s.", Monnam(mtmp),
                           locomotion(mtmp->data, "run"), buf);
 #else
@@ -1833,7 +1832,7 @@ register struct attack *mattk;
                      : "\82Æ\82Ä\82à");
 #endif
             tele();
-            /* 3.6.2:  make sure damage isn't fatal; previously, it
+            /* As of 3.6.2:  make sure damage isn't fatal; previously, it
                was possible to be teleported and then drop dead at
                the destination when QM's 1d4 damage gets applied below;
                even though that wasn't "wrong", it seemed strange,
@@ -2295,8 +2294,7 @@ struct attack *mattk;
 
         if (!engulf_target(mtmp, &youmonst))
             return 0;
-        if ((t && is_pit(t->ttyp))
-            && sobj_at(BOULDER, u.ux, u.uy))
+        if ((t && is_pit(t->ttyp)) && sobj_at(BOULDER, u.ux, u.uy))
             return 0;
 
         if (Punished)
@@ -2314,7 +2312,7 @@ struct attack *mattk;
              * like horses for now :-)
              */
             Strcpy(buf, mon_nam(u.usteed));
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s lunges forward and plucks you off %s!", Monnam(mtmp),
                   buf);
 #else
@@ -2343,7 +2341,7 @@ struct attack *mattk;
 
         i = number_leashed();
         if (i > 0) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             const char *s = (i > 1) ? "leashes" : "leash";
 
             pline_The("%s %s loose.", s, vtense(s, "snap"));
@@ -2396,6 +2394,14 @@ struct attack *mattk;
 
     if (mtmp != u.ustuck)
         return 0;
+    if (Punished) {
+        /* ball&chain are in limbo while swallowed; update their internal
+           location to be at swallower's spot */
+        if (uchain->where == OBJ_FREE)
+            uchain->ox = mtmp->mx, uchain->oy = mtmp->my;
+        if (uball->where == OBJ_FREE)
+            uball->ox = mtmp->mx, uball->oy = mtmp->my;
+    }
     if (u.uswldtim > 0)
         u.uswldtim -= 1;
 
@@ -2415,7 +2421,7 @@ struct attack *mattk;
             if (Half_physical_damage)
                 tmp *= 2; /* sorry */
         } else {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s%s digests you!", Monnam(mtmp),
                   (u.uswldtim == 2) ? " thoroughly"
                                     : (u.uswldtim == 1) ? " utterly" : "");
@@ -2430,7 +2436,7 @@ struct attack *mattk;
     case AD_PHYS:
         physical_damage = TRUE;
         if (mtmp->data == &mons[PM_FOG_CLOUD]) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             You("are laden with moisture and %s",
                 flaming(youmonst.data)
                     ? "are smoldering out!"
@@ -2588,7 +2594,7 @@ struct attack *mattk;
 #endif
         expels(mtmp, mtmp->data, FALSE);
     } else if (!u.uswldtim || youmonst.data->msize >= MZ_HUGE) {
-        /* 3.6.2: u.uswldtim used to be set to 0 by life-saving but it
+        /* As of 3.6.2: u.uswldtim used to be set to 0 by life-saving but it
            expels now so the !u.uswldtim case is no longer possible;
            however, polymorphing into a huge form while already
            swallowed is still possible */
@@ -2748,7 +2754,7 @@ struct monst *mtmp;
 struct attack *mattk;
 {
     static const char *const reactions[] = {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         "confused",              /* [0] */
         "stunned",               /* [1] */
         "puzzled",   "dazzled",  /* [2,3] */
@@ -2783,7 +2789,7 @@ struct attack *mattk;
         if (cancelled || !mtmp->mcansee) {
             if (!canseemon(mtmp))
                 break; /* silently */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s %s.", Monnam(mtmp),
                   (mtmp->data == &mons[PM_MEDUSA] && mtmp->mcan)
                       ? "doesn't look all that ugly"
@@ -2818,7 +2824,7 @@ struct attack *mattk;
                 break;
             if (!m_canseeu(mtmp)) { /* probably you're invisible */
                 if (useeit)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     pline(
                       "%s doesn't seem to notice that %s gaze was reflected.",
                           Monnam(mtmp), mhis(mtmp));
@@ -3010,7 +3016,7 @@ struct attack *mattk;
             react = rn2(SIZE(reactions));
         /* cancelled/hallucinatory feedback; monster might look "confused",
            "stunned",&c but we don't actually set corresponding attribute */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s looks %s%s.", Monnam(mtmp),
               !rn2(3) ? "" : already ? "quite "
                                      : (!rn2(2) ? "a bit " : "somewhat "),
@@ -3086,9 +3092,13 @@ struct attack *mattk; /* non-Null: current attack; Null: general capability */
     if (agrinvis && !defperc && adtyp == AD_SEDU)
         return 0;
 
+    /* nymphs have two attacks, one for steal-item damage and the other
+       for seduction, both pass the could_seduce() test;
+       incubi/succubi have three attacks, their claw attacks for damage
+       don't pass the test */
     if ((pagr->mlet != S_NYMPH
          && pagr != &mons[PM_INCUBUS] && pagr != &mons[PM_SUCCUBUS])
-        || (adtyp != AD_SEDU && adtyp != AD_SSEX))
+        || (adtyp != AD_SEDU && adtyp != AD_SSEX && adtyp != AD_SITM))
         return 0;
 
     return (genagr == 1 - gendef) ? 1 : (pagr->mlet == S_NYMPH) ? 2 : 0;
@@ -3106,7 +3116,7 @@ struct monst *mon;
     char qbuf[QBUFSZ], Who[QBUFSZ];
 
     if (mon->mcan || mon->mspec_used) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s acts as though %s has got a %sheadache.", Monnam(mon),
               mhe(mon), mon->mcan ? "severe " : "");
 #else
@@ -3345,7 +3355,10 @@ struct monst *mon;
                       flags.female ? "\83`\83\83\81[\83~\83\93\83O" : "\82·\82Ä\82«");
 #endif
         else if (seewho)
+/*JP
             pline("%s appears to sigh.", Monnam(mon));
+*/
+            pline("%s\82Í\82½\82ß\91§\82ð\82Â\82¢\82½\82æ\82¤\82¾\81D", Monnam(mon));
         /* else no regret message if can't see or hear seducer */
 
         if (!tele_restrict(mon))
@@ -3530,7 +3543,7 @@ struct monst *mon;
 */
             verbalize("\82±\82ê\82Í\82¨\82²\82è%s\81I", fem ? "\82æ" : "\82³");
         } else {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s takes %ld %s for services rendered!", noit_Monnam(mon),
                   cost, currency(cost));
 #else
@@ -3566,7 +3579,10 @@ const char *str;
 
     /* being deaf overrides confirmation prompt for high charisma */
     if (Deaf) {
+/*JP
         pline("%s takes off your %s.", seducer, str);
+*/
+        pline("%s\82Í\82 \82È\82½\82Ì%s\82ð\92E\82ª\82¹\82½\81D", seducer, str);
     } else if (rn2(20) < ACURR(A_CHA)) {
 #if 0 /*JP:T*/
         Sprintf(qbuf, "\"Shall I remove your %s, %s?\"", str,
@@ -3588,7 +3604,7 @@ const char *str;
                 flags.female ? "\82È\82ñ\82ÄãY\97í\82È%s\82È\82ñ\82¾" : "\8a\95\82ð\8eæ\82Á\82½\82ç\82È\82©\82È\82©\83C\83J\83X\82\82á\82È\82¢",
                 body_part(HAIR));
 #endif
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         verbalize("Take off your %s; %s.", str,
                   (obj == uarm)
                      ? "let's get a little closer"
@@ -3660,7 +3676,7 @@ struct attack *mattk;
     switch (oldu_mattk->adtyp) {
     case AD_ACID:
         if (!rn2(2)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s is splashed by %s%s!", Monnam(mtmp),
                   /* temporary? hack for sequencing issue:  "your acid"
                      looks strange coming immediately after player has
@@ -3806,7 +3822,7 @@ struct attack *mattk;
         case AD_STUN: /* Yellow mold */
             if (!mtmp->mstun) {
                 mtmp->mstun = 1;
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s %s.", Monnam(mtmp),
                       makeplural(stagger(mtmp->data, "stagger")));
 #else
@@ -3819,7 +3835,7 @@ struct attack *mattk;
         case AD_FIRE: /* Red mold */
             if (resists_fire(mtmp)) {
                 shieldeff(mtmp->mx, mtmp->my);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s is mildly warm.", Monnam(mtmp));
 #else
                 pline("%s\82Í\92g\82©\82­\82È\82Á\82½\81D", Monnam(mtmp));
@@ -3828,7 +3844,7 @@ struct attack *mattk;
                 tmp = 0;
                 break;
             }
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s is suddenly very hot!", Monnam(mtmp));
 #else
             pline("%s\82Í\93Ë\91R\94M\82­\82È\82Á\82½\81I", Monnam(mtmp));
@@ -3837,7 +3853,7 @@ struct attack *mattk;
         case AD_ELEC:
             if (resists_elec(mtmp)) {
                 shieldeff(mtmp->mx, mtmp->my);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s is slightly tingled.", Monnam(mtmp));
 #else
                 pline("%s\82Í\82¿\82å\82Á\82Æ\83s\83\8a\83s\83\8a\82µ\82½\81D", Monnam(mtmp));
@@ -3846,7 +3862,7 @@ struct attack *mattk;
                 tmp = 0;
                 break;
             }
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s is jolted with your electricity!", Monnam(mtmp));
 #else
             pline("%s\82Í\93d\8bC\83V\83\87\83b\83N\82ð\82¤\82¯\82½\81I", Monnam(mtmp));