OSDN Git Service

update year to 2020
[jnethack/source.git] / src / muse.c
index 2d74c03..9ba70d5 100644 (file)
@@ -1,10 +1,10 @@
-/* NetHack 3.6 muse.c  $NHDT-Date: 1505181522 2017/09/12 01:58:42 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.80 $ */
+/* NetHack 3.6 muse.c  $NHDT-Date: 1561053256 2019/06/20 17:54:16 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.97 $ */
 /*      Copyright (C) 1990 by Ken Arromdee                         */
 /* 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-2016            */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2020            */
 /* JNetHack may be freely redistributed.  See license for details. */
 
 /*
@@ -13,8 +13,6 @@
 
 #include "hack.h"
 
-extern const int monstr[];
-
 boolean m_using = FALSE;
 
 /* Let monsters use magic items.  Arbitrary assumptions: Monsters only use
@@ -25,7 +23,8 @@ boolean m_using = FALSE;
 
 STATIC_DCL struct permonst *FDECL(muse_newcham_mon, (struct monst *));
 STATIC_DCL int FDECL(precheck, (struct monst *, struct obj *));
-STATIC_DCL void FDECL(mzapmsg, (struct monst *, struct obj *, BOOLEAN_P));
+STATIC_DCL void FDECL(mzapwand, (struct monst *, struct obj *, BOOLEAN_P));
+STATIC_DCL void FDECL(mplayhorn, (struct monst *, struct obj *, BOOLEAN_P));
 STATIC_DCL void FDECL(mreadmsg, (struct monst *, struct obj *));
 STATIC_DCL void FDECL(mquaffmsg, (struct monst *, struct obj *));
 STATIC_DCL boolean FDECL(m_use_healing, (struct monst *));
@@ -102,7 +101,7 @@ struct obj *obj;
                         pline1(empty);
                 } else {
                     if (vis) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                         pline(
                             "As %s opens the bottle, an enormous %s emerges!",
                               mon_nam(mon),
@@ -190,11 +189,11 @@ struct obj *obj;
                   an(xname(obj)));
 #endif
         } else {
-            /* same near/far threshold as mzapmsg() */
+            /* same near/far threshold as mzapwand() */
             int range = couldsee(mon->mx, mon->my) /* 9 or 5 */
                            ? (BOLT_LIM + 1) : (BOLT_LIM - 3);
 
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             You_hear("a zap and an explosion %s.",
                      (distu(mon->mx, mon->my) <= range * range)
                         ? "nearby" : "in the distance");
@@ -206,7 +205,7 @@ struct obj *obj;
         }
         m_useup(mon, obj);
         mon->mhp -= dam;
-        if (mon->mhp <= 0) {
+        if (DEADMONSTER(mon)) {
             monkilled(mon, "", AD_RBRE);
             return 1;
         }
@@ -216,8 +215,10 @@ struct obj *obj;
     return 0;
 }
 
+/* when a monster zaps a wand give a message, deduct a charge, and if it
+   isn't directly seen, remove hero's memory of the number of charges */
 STATIC_OVL void
-mzapmsg(mtmp, otmp, self)
+mzapwand(mtmp, otmp, self)
 struct monst *mtmp;
 struct obj *otmp;
 boolean self;
@@ -226,7 +227,7 @@ boolean self;
         int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */
                        ? (BOLT_LIM + 1) : (BOLT_LIM - 3);
 
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         You_hear("a %s zap.", (distu(mtmp->mx, mtmp->my) <= range * range)
                                  ? "nearby" : "distant");
 #else
@@ -234,8 +235,9 @@ boolean self;
                               (distu(mtmp->mx, mtmp->my) <= range * range)
                                  ? "\8bß" : "\89\93");
 #endif
+        otmp->known = 0;
     } else if (self) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s zaps %sself with %s!", Monnam(mtmp), mhim(mtmp),
               doname(otmp));
 #else
@@ -249,6 +251,45 @@ boolean self;
         pline("%s\82Í%s\82ð\82Ó\82è\82©\82´\82µ\82½\81I", Monnam(mtmp), an(xname(otmp)));
         stop_occupation();
     }
+    otmp->spe -= 1;
+}
+
+/* similar to mzapwand() but for magical horns (only instrument mons play) */
+STATIC_OVL void
+mplayhorn(mtmp, otmp, self)
+struct monst *mtmp;
+struct obj *otmp;
+boolean self;
+{
+    if (!canseemon(mtmp)) {
+        int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */
+                       ? (BOLT_LIM + 1) : (BOLT_LIM - 3);
+
+#if 0 /*JP:T*/
+        You_hear("a horn being played %s.",
+                 (distu(mtmp->mx, mtmp->my) <= range * range)
+                 ? "nearby" : "in the distance");
+#else
+        You_hear("%s\82­\82Å\83z\83\8b\83\93\82Ì\89¹\82ð\95·\82¢\82½\81D",
+                 (distu(mtmp->mx, mtmp->my) <= range * range)
+                 ? "\8bß" : "\89\93");
+#endif
+        otmp->known = 0; /* hero doesn't know how many charges are left */
+    } else {
+        otmp->dknown = 1;
+#if 0 /*JP:T*/
+        pline("%s plays a %s directed at %s!", Monnam(mtmp), xname(otmp),
+              self ? mon_nam_too(mtmp, mtmp) : (char *) "you");
+#else
+        pline("%s\82Í%s\82É\8cü\82¯\82Ä%s\82ð\90\81\82¢\82½\81I", Monnam(mtmp),
+              self ? mon_nam_too(mtmp, mtmp) : (char *) "\82 \82È\82½",
+              xname(otmp));
+#endif
+        makeknown(otmp->otyp); /* (wands handle this slightly differently) */
+        if (!self)
+            stop_occupation();
+    }
+    otmp->spe -= 1; /* use a charge */
 }
 
 STATIC_OVL void
@@ -284,7 +325,7 @@ struct obj *otmp;
 */
         pline("%s\82Í%s\82ð\93Ç\82ñ\82¾\81I", Monnam(mtmp), onambuf);
     else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         You_hear("%s reading %s.",
                  x_monnam(mtmp, ARTICLE_A, (char *) 0,
                           (SUPPRESS_IT | SUPPRESS_INVISIBLE | SUPPRESS_SADDLE),
@@ -524,7 +565,7 @@ struct monst *mtmp;
                 || onscary(xx, yy, mtmp))
                 continue;
             /* use trap if it's the correct type */
-            if ((t->ttyp == TRAPDOOR || t->ttyp == HOLE)
+            if (is_hole(t->ttyp)
                 && !is_floater(mtmp->data)
                 && !mtmp->isshk && !mtmp->isgd && !mtmp->ispriest
                 && Can_fall_thru(&u.uz)) {
@@ -564,7 +605,7 @@ struct monst *mtmp;
                 }
             }
         }
   toot:
+ toot:
         ;
     }
 
@@ -574,7 +615,7 @@ struct monst *mtmp;
 
     /* kludge to cut down on trap destruction (particularly portals) */
     t = t_at(x, y);
-    if (t && (t->ttyp == PIT || t->ttyp == SPIKED_PIT || t->ttyp == WEB
+    if (t && (is_pit(t->ttyp) || t->ttyp == WEB
               || t->ttyp == BEAR_TRAP))
         t = 0; /* ok for monster to dig here */
 
@@ -672,7 +713,7 @@ struct monst *mtmp;
             m.has_defense = MUSE_SCR_CREATE_MONSTER;
         }
     }
-botm:
+ botm:
     return (boolean) !!m.has_defense;
 #undef nomore
 }
@@ -747,10 +788,9 @@ struct monst *mtmp;
         if ((mtmp->isshk && inhishop(mtmp)) || mtmp->isgd || mtmp->ispriest)
             return 2;
         m_flee(mtmp);
-        mzapmsg(mtmp, otmp, TRUE);
-        otmp->spe--;
+        mzapwand(mtmp, otmp, TRUE);
         how = WAN_TELEPORTATION;
   mon_tele:
+ mon_tele:
         if (tele_restrict(mtmp)) { /* mysterious force... */
             if (vismon && how)     /* mentions 'teleport' */
                 makeknown(how);
@@ -773,8 +813,7 @@ struct monst *mtmp;
         return 2;
     case MUSE_WAN_TELEPORTATION:
         zap_oseen = oseen;
-        mzapmsg(mtmp, otmp, FALSE);
-        otmp->spe--;
+        mzapwand(mtmp, otmp, FALSE);
         m_using = TRUE;
         mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp);
         /* monster learns that teleportation isn't useful here */
@@ -826,8 +865,7 @@ struct monst *mtmp;
         struct trap *ttmp;
 
         m_flee(mtmp);
-        mzapmsg(mtmp, otmp, FALSE);
-        otmp->spe--;
+        mzapwand(mtmp, otmp, FALSE);
         if (oseen)
             makeknown(WAN_DIGGING);
         if (IS_FURNITURE(levl[mtmp->mx][mtmp->my].typ)
@@ -846,7 +884,7 @@ struct monst *mtmp;
 /*JP
                 pline_The("%s here is too hard to dig in.",
 */
-                        pline("\82±\82±\82Ì%s\82Í\8cÅ\82­\82Ä\8c@\82ê\82È\82¢\81D",
+                pline("\82±\82±\82Ì%s\82Í\8cÅ\82­\82Ä\8c@\82ê\82È\82¢\81D",
                           surface(mtmp->mx, mtmp->my));
             return 2;
         }
@@ -855,14 +893,14 @@ struct monst *mtmp;
             return 2;
         seetrap(ttmp);
         if (vis) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s has made a hole in the %s.", Monnam(mtmp),
                   surface(mtmp->mx, mtmp->my));
 #else
             pline("%s\82Í%s\82É\8c\8a\82ð\8aJ\82¯\82½\81D", Monnam(mtmp),
                   surface(mtmp->mx, mtmp->my));
 #endif
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s %s through...", Monnam(mtmp),
                   is_flyer(mtmp->data) ? "dives" : "falls");
 #else
@@ -870,7 +908,7 @@ struct monst *mtmp;
                   is_flyer(mtmp->data) ? "\94ò\82Ñ\82±\82ñ\82¾" : "\97\8e\82¿\82½");
 #endif
         } else if (!Deaf)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             You_hear("%s crash through the %s.", something,
                      surface(mtmp->mx, mtmp->my));
 #else
@@ -893,8 +931,7 @@ struct monst *mtmp;
 
         if (!enexto(&cc, mtmp->mx, mtmp->my, pm))
             return 0;
-        mzapmsg(mtmp, otmp, FALSE);
-        otmp->spe--;
+        mzapwand(mtmp, otmp, FALSE);
         mon = makemon((struct permonst *) 0, cc.x, cc.y, NO_MM_FLAGS);
         if (mon && canspotmon(mon) && oseen)
             makeknown(WAN_CREATE_MONSTER);
@@ -950,9 +987,9 @@ struct monst *mtmp;
             struct trap *t = t_at(trapx, trapy);
 
             Mnam = Monnam(mtmp);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s %s into a %s!", Mnam,
-                  vtense(Mnam, locomotion(mtmp->data, "jump")),
+                  vtense(fakename[0], locomotion(mtmp->data, "jump")),
                   (t->ttyp == TRAPDOOR) ? "trap door" : "hole");
 #else
             pline("%s\82Í%s\82É%s\93ü\82Á\82½\81I", Mnam,
@@ -984,7 +1021,7 @@ struct monst *mtmp;
         if (Inhell && mon_has_amulet(mtmp) && !rn2(4)
             && (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz) - 3)) {
             if (vismon)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline(
     "As %s climbs the stairs, a mysterious force momentarily surrounds %s...",
                       mon_nam(mtmp), mhim(mtmp));
@@ -1042,7 +1079,7 @@ struct monst *mtmp;
     case MUSE_SSTAIRS:
         m_flee(mtmp);
         if (ledger_no(&u.uz) == 1) {
       escape:
+ escape:
             /* Monsters without the Amulet escape the dungeon and
              * are gone for good when they leave up the up stairs.
              * A monster with the Amulet would leave it behind
@@ -1061,7 +1098,7 @@ struct monst *mtmp;
             return 2;
         }
         if (vismon)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s escapes %sstairs!", Monnam(mtmp),
                   sstairs.up ? "up" : "down");
 #else
@@ -1081,8 +1118,9 @@ struct monst *mtmp;
             Mnam = Monnam(mtmp);
 #if 0 /*JP:T*/
             pline("%s %s onto a teleport trap!", Mnam,
-                  vtense(Mnam, locomotion(mtmp->data, "jump")));
-#else /* \93ú\96{\8cê\82Å\82Í\91S\82Ä\81u\94ò\82Ñ\8d\9e\82ñ\82¾\81v */
+                  vtense(fakename[0], locomotion(mtmp->data, "jump")));
+#else
+            /* \93ú\96{\8cê\82Å\82Í\91S\82Ä\81u\94ò\82Ñ\8d\9e\82ñ\82¾\81v */
             pline("%s\82Í\8fu\8aÔ\88Ú\93®\82Ìã©\82É\94ò\82Ñ\8d\9e\82ñ\82¾\81I", Mnam);
 #endif
             seetrap(t_at(trapx, trapy));
@@ -1166,13 +1204,13 @@ rnd_defensive_item(mtmp)
 struct monst *mtmp;
 {
     struct permonst *pm = mtmp->data;
-    int difficulty = monstr[(monsndx(pm))];
+    int difficulty = mons[(monsndx(pm))].difficulty;
     int trycnt = 0;
 
     if (is_animal(pm) || attacktype(pm, AT_EXPL) || mindless(mtmp->data)
         || pm->mlet == S_GHOST || pm->mlet == S_KOP)
         return 0;
-try_again:
+ try_again:
     switch (rn2(8 + (difficulty > 3) + (difficulty > 6) + (difficulty > 8))) {
     case 6:
     case 9:
@@ -1472,7 +1510,7 @@ register struct obj *otmp;
         break;
     }
     if (reveal_invis) {
-        if (mtmp->mhp > 0 && cansee(bhitpos.x, bhitpos.y)
+        if (!DEADMONSTER(mtmp) && cansee(bhitpos.x, bhitpos.y)
             && !canspotmon(mtmp))
             map_invisible(bhitpos.x, bhitpos.y);
     }
@@ -1596,8 +1634,7 @@ struct monst *mtmp;
     case MUSE_WAN_COLD:
     case MUSE_WAN_LIGHTNING:
     case MUSE_WAN_MAGIC_MISSILE:
-        mzapmsg(mtmp, otmp, FALSE);
-        otmp->spe--;
+        mzapwand(mtmp, otmp, FALSE);
         if (oseen)
             makeknown(otmp->otyp);
         m_using = TRUE;
@@ -1605,32 +1642,20 @@ struct monst *mtmp;
              (otmp->otyp == WAN_MAGIC_MISSILE) ? 2 : 6, mtmp->mx, mtmp->my,
              sgn(mtmp->mux - mtmp->mx), sgn(mtmp->muy - mtmp->my));
         m_using = FALSE;
-        return (mtmp->mhp <= 0) ? 1 : 2;
+        return (DEADMONSTER(mtmp)) ? 1 : 2;
     case MUSE_FIRE_HORN:
     case MUSE_FROST_HORN:
-        if (oseen) {
-            makeknown(otmp->otyp);
-/*JP
-            pline("%s plays a %s!", Monnam(mtmp), xname(otmp));
-*/
-            pline("%s\82Í%s\82ð\90\81\82¢\82½\81I", Monnam(mtmp), xname(otmp));
-        } else
-/*JP
-            You_hear("a horn being played.");
-*/
-            You_hear("\83z\83\8b\83\93\82Ì\89¹\82ð\95·\82¢\82½\81D");
-        otmp->spe--;
+        mplayhorn(mtmp, otmp, FALSE);
         m_using = TRUE;
         buzz(-30 - ((otmp->otyp == FROST_HORN) ? AD_COLD - 1 : AD_FIRE - 1),
              rn1(6, 6), mtmp->mx, mtmp->my, sgn(mtmp->mux - mtmp->mx),
              sgn(mtmp->muy - mtmp->my));
         m_using = FALSE;
-        return (mtmp->mhp <= 0) ? 1 : 2;
+        return (DEADMONSTER(mtmp)) ? 1 : 2;
     case MUSE_WAN_TELEPORTATION:
     case MUSE_WAN_STRIKING:
         zap_oseen = oseen;
-        mzapmsg(mtmp, otmp, FALSE);
-        otmp->spe--;
+        mzapwand(mtmp, otmp, FALSE);
         m_using = TRUE;
         mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp);
         m_using = FALSE;
@@ -1646,7 +1671,7 @@ struct monst *mtmp;
         mreadmsg(mtmp, otmp);
         /* Identify the scroll */
         if (canspotmon(mtmp)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline_The("%s rumbles %s %s!", ceiling(mtmp->mx, mtmp->my),
                       otmp->blessed ? "around" : "above", mon_nam(mtmp));
 #else
@@ -1688,7 +1713,7 @@ struct monst *mtmp;
             drop_boulder_on_player(confused, !is_cursed, FALSE, TRUE);
         }
 
-        return (mtmp->mhp <= 0) ? 1 : 2;
+        return (DEADMONSTER(mtmp)) ? 1 : 2;
     }
 #if 0
     case MUSE_SCR_FIRE: {
@@ -1743,7 +1768,7 @@ struct monst *mtmp;
                     mtmp2->mhp -= num;
                     if (resists_cold(mtmp2))
                         mtmp2->mhp -= 3 * num;
-                    if (mtmp2->mhp < 1) {
+                    if (DEADMONSTER(mtmp2)) {
                         mondied(mtmp2);
                         break;
                     }
@@ -1789,7 +1814,7 @@ rnd_offensive_item(mtmp)
 struct monst *mtmp;
 {
     struct permonst *pm = mtmp->data;
-    int difficulty = monstr[(monsndx(pm))];
+    int difficulty = mons[(monsndx(pm))].difficulty;
 
     if (is_animal(pm) || attacktype(pm, AT_EXPL) || mindless(mtmp->data)
         || pm->mlet == S_GHOST || pm->mlet == S_KOP)
@@ -1869,7 +1894,7 @@ struct monst *mtmp;
         return FALSE;
 
     if (!stuck && !immobile && (mtmp->cham == NON_PM)
-        && monstr[(pmidx = monsndx(mdat))] < 6) {
+        && mons[(pmidx = monsndx(mdat))].difficulty < 6) {
         boolean ignore_boulders = (verysmall(mdat) || throws_rocks(mdat)
                                    || passes_walls(mdat)),
             diag_ok = !NODIAG(pmidx);
@@ -1955,13 +1980,13 @@ struct monst *mtmp;
         }
         nomore(MUSE_WAN_POLYMORPH);
         if (obj->otyp == WAN_POLYMORPH && obj->spe > 0
-            && (mtmp->cham == NON_PM) && monstr[monsndx(mdat)] < 6) {
+            && (mtmp->cham == NON_PM) && mons[monsndx(mdat)].difficulty < 6) {
             m.misc = obj;
             m.has_misc = MUSE_WAN_POLYMORPH;
         }
         nomore(MUSE_POT_POLYMORPH);
         if (obj->otyp == POT_POLYMORPH && (mtmp->cham == NON_PM)
-            && monstr[monsndx(mdat)] < 6) {
+            && mons[monsndx(mdat)].difficulty < 6) {
             m.misc = obj;
             m.has_misc = MUSE_POT_POLYMORPH;
         }
@@ -2015,7 +2040,7 @@ struct monst *mtmp;
                 if (on_level(&tolevel, &u.uz))
                     goto skipmsg;
                 if (vismon) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     pline("%s rises up, through the %s!", Monnam(mtmp),
                           ceiling(mtmp->mx, mtmp->my));
 #else
@@ -2031,7 +2056,7 @@ struct monst *mtmp;
                                  (coord *) 0);
                 return 2;
             } else {
           skipmsg:
+ skipmsg:
                 if (vismon) {
 /*JP
                     pline("%s looks uneasy.", Monnam(mtmp));
@@ -2060,8 +2085,7 @@ struct monst *mtmp;
     case MUSE_WAN_MAKE_INVISIBLE:
     case MUSE_POT_INVISIBILITY:
         if (otmp->otyp == WAN_MAKE_INVISIBLE) {
-            mzapmsg(mtmp, otmp, TRUE);
-            otmp->spe--;
+            mzapwand(mtmp, otmp, TRUE);
         } else
             mquaffmsg(mtmp, otmp);
         /* format monster's name before altering its visibility */
@@ -2096,8 +2120,7 @@ struct monst *mtmp;
         }
         return 2;
     case MUSE_WAN_SPEED_MONSTER:
-        mzapmsg(mtmp, otmp, TRUE);
-        otmp->spe--;
+        mzapwand(mtmp, otmp, TRUE);
         mon_adjust_speed(mtmp, 1, otmp);
         return 2;
     case MUSE_POT_SPEED:
@@ -2110,8 +2133,7 @@ struct monst *mtmp;
         m_useup(mtmp, otmp);
         return 2;
     case MUSE_WAN_POLYMORPH:
-        mzapmsg(mtmp, otmp, TRUE);
-        otmp->spe--;
+        mzapwand(mtmp, otmp, TRUE);
         (void) newcham(mtmp, muse_newcham_mon(mtmp), TRUE, FALSE);
         if (oseen)
             makeknown(WAN_POLYMORPH);
@@ -2134,7 +2156,7 @@ struct monst *mtmp;
 
 #if 0 /*JP:T*/
             pline("%s deliberately %s onto a polymorph trap!", Mnam,
-                  vtense(Mnam, locomotion(mtmp->data, "jump")));
+                  vtense(fakename[0], locomotion(mtmp->data, "jump")));
 #else
             pline("%s\82Í\82í\82´\82Æ\95Ï\89»\82Ìã©\82É\94ò\82Ñ\82±\82ñ\82¾\81I", Mnam);
 #endif
@@ -2176,7 +2198,7 @@ struct monst *mtmp;
                 hand = makeplural(hand);
 
             if (vismon)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s flicks a bullwhip towards your %s!", Monnam(mtmp),
                       hand);
 #else
@@ -2190,7 +2212,7 @@ struct monst *mtmp;
                 pline("%s\82Í%s\82É\82Í\82©\82ç\82Ý\82Â\82©\82È\82©\82Á\82½\81D", The_whip, the_weapon);
                 return 1;
             }
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("%s wraps around %s you're wielding!", The_whip,
                   the_weapon);
 #else
@@ -2198,7 +2220,7 @@ struct monst *mtmp;
                   the_weapon);
 #endif
             if (welded(obj)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s welded to your %s%c",
                       !is_plural(obj) ? "It is" : "They are", hand,
                       !obj->bknown ? '!' : '.');
@@ -2211,7 +2233,7 @@ struct monst *mtmp;
                 where_to = 0;
             }
             if (!where_to) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline_The("whip slips free."); /* not `The_whip' */
 #else
                 pline("\95Ú\82Í\82Ù\82Ç\82¯\82½\81D");  /* not `The_whip' */
@@ -2227,7 +2249,7 @@ struct monst *mtmp;
             freeinv(obj);
             switch (where_to) {
             case 1: /* onto floor beneath mon */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s yanks %s from your %s!", Monnam(mtmp), the_weapon,
                       hand);
 #else
@@ -2237,7 +2259,7 @@ struct monst *mtmp;
                 place_object(obj, mtmp->mx, mtmp->my);
                 break;
             case 2: /* onto floor beneath you */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s yanks %s to the %s!", Monnam(mtmp), the_weapon,
                       surface(u.ux, u.uy));
 #else
@@ -2282,7 +2304,7 @@ struct monst *mtmp;
 #ifdef CLIPPING
     cliparound(mtmp->mx, mtmp->my);
 #endif
-    show_glyph(mtmp->mx, mtmp->my, mon_to_glyph(mtmp));
+    show_glyph(mtmp->mx, mtmp->my, mon_to_glyph(mtmp, rn2_on_display_rng));
     display_self();
 /*JP
     You_feel("aggravated at %s.", noit_mon_nam(mtmp));
@@ -2307,7 +2329,7 @@ rnd_misc_item(mtmp)
 struct monst *mtmp;
 {
     struct permonst *pm = mtmp->data;
-    int difficulty = monstr[(monsndx(pm))];
+    int difficulty = mons[(monsndx(pm))].difficulty;
 
     if (is_animal(pm) || attacktype(pm, AT_EXPL) || mindless(mtmp->data)
         || pm->mlet == S_GHOST || pm->mlet == S_KOP)
@@ -2362,7 +2384,7 @@ struct obj *obj;
         if (typ == WAN_DIGGING)
             return (boolean) !is_floater(mon->data);
         if (typ == WAN_POLYMORPH)
-            return (boolean) (monstr[monsndx(mon->data)] < 6);
+            return (boolean) (mons[monsndx(mon->data)].difficulty < 6);
         if (objects[typ].oc_dir == RAY || typ == WAN_STRIKING
             || typ == WAN_TELEPORTATION || typ == WAN_CREATE_MONSTER)
             return TRUE;
@@ -2585,7 +2607,7 @@ boolean stoning; /* True: stop petrification, False: cure stun && confusion */
         long save_quan = obj->quan;
 
         obj->quan = 1L;
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s %s %s.", Monnam(mon),
               (obj->oclass == POTION_CLASS)
                   ? "quaffs"
@@ -2602,7 +2624,7 @@ boolean stoning; /* True: stop petrification, False: cure stun && confusion */
 #endif
         obj->quan = save_quan;
     } else if (!Deaf)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         You_hear("%s.",
                  (obj->oclass == POTION_CLASS) ? "drinking" : "chewing");
 #else
@@ -2620,7 +2642,7 @@ boolean stoning; /* True: stop petrification, False: cure stun && confusion */
             pline("%s has a very bad case of stomach acid.", Monnam(mon));
 */
             pline("%s\82Í\88Ý\8e_\82Ì\92²\8eq\82ª\82Æ\82Ä\82à\88«\82¢\81D", Monnam(mon));
-        if (mon->mhp <= 0) {
+        if (DEADMONSTER(mon)) {
 /*JP
             pline("%s dies!", Monnam(mon));
 */
@@ -2682,6 +2704,8 @@ boolean tinok;
     if (obj->otyp != CORPSE && (obj->otyp != TIN || !tinok))
         return FALSE;
     /* corpse, or tin that mon can open */
+    if (obj->corpsenm == NON_PM) /* empty/special tin */
+        return FALSE;
     return (boolean) (obj->corpsenm == PM_LIZARD
                       || (acidic(&mons[obj->corpsenm])
                           && (obj->corpsenm != PM_GREEN_SLIME
@@ -2786,7 +2810,7 @@ boolean by_you;
             }
         }
         if (t && t->ttyp == FIRE_TRAP)
-            return muse_unslime(mon, &zeroobj, t, by_you);
+            return muse_unslime(mon, (struct obj *) &zeroobj, t, by_you);
 
     } /* MUSE */
 
@@ -2806,8 +2830,13 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
     boolean vis = canseemon(mon), res = TRUE;
 
     if (vis)
+#if 0 /*JP:T*/
         pline("%s starts turning %s.", Monnam(mon),
               green_mon(mon) ? "into ooze" : hcolor(NH_GREEN));
+#else
+        pline("%s\82Í%s\82É\82È\82è\82Í\82\82ß\82½\81D", Monnam(mon),
+              green_mon(mon) ? "\83X\83\89\83C\83\80" : hcolor(NH_GREEN));
+#endif
     /* -4 => sliming, causes quiet loss of enhanced speed */
     mon_adjust_speed(mon, -4, (struct obj *) 0);
 
@@ -2816,8 +2845,12 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
 
         if (mon->mx == trap->tx && mon->my == trap->ty) {
             if (vis)
+#if 0 /*JP:T*/
                 pline("%s triggers %s fire trap!", Mnam,
                       trap->tseen ? "the" : "a");
+#else
+                pline("%s\82Í\89\8a\82Ìã©\82ð\94­\93®\82³\82¹\82½\81I", Mnam);
+#endif
         } else {
             remove_monster(mon->mx, mon->my);
             newsym(mon->mx, mon->my);
@@ -2826,10 +2859,14 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
                 worm_move(mon);
             newsym(mon->mx, mon->my);
             if (vis)
+#if 0 /*JP:T*/
                 pline("%s %s %s %s fire trap!", Mnam,
-                      vtense(Mnam, locomotion(mon->data, "move")),
+                      vtense(fakename[0], locomotion(mon->data, "move")),
                       is_floater(mon->data) ? "over" : "onto",
                       trap->tseen ? "the" : "a");
+#else
+                pline("%s\82Í\89\8a\82Ìã©\82É\94ò\82Ñ\8d\9e\82ñ\82¾\81I", Mnam);
+#endif
         }
         /* hack to avoid mintrap()'s chance of avoiding known trap */
         mon->mtrapseen &= ~(1 << (FIRE_TRAP - 1));
@@ -2837,7 +2874,10 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
     } else if (otyp == STRANGE_OBJECT) {
         /* monster is using fire breath on self */
         if (vis)
+/*JP
             pline("%s breathes fire on %sself.", Monnam(mon), mhim(mon));
+*/
+            pline("%s\82Í\89Î\82ð\82Í\82¢\82½\81D", Monnam(mon));
         if (!rn2(3))
             mon->mspec_used = rn1(10, 5);
         /* -21 => monster's fire breath; 1 => # of damage dice */
@@ -2846,7 +2886,10 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
         mreadmsg(mon, obj);
         if (mon->mconf) {
             if (cansee(mon->mx, mon->my))
+/*JP
                 pline("Oh, what a pretty fire!");
+*/
+                pline("\82 \82ç\81A\82È\82ñ\82Ä\82©\82í\82¢\82¢\89Î\82¾\81I");
             if (vis && !objects[otyp].oc_name_known
                 && !objects[otyp].oc_uname)
                 docall(obj);
@@ -2854,8 +2897,8 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
             vis = FALSE;       /* skip makeknown() below */
             res = FALSE;       /* failed to cure sliming */
         } else {
-            m_useup(mon, obj); /* before explode() */
             dmg = (2 * (rn1(3, 3) + 2 * bcsign(obj)) + 1) / 3;
+            m_useup(mon, obj); /* before explode() */
             /* -11 => monster's fireball */
             explode(mon->mx, mon->my, -11, dmg, SCROLL_CLASS,
                     /* by_you: override -11 for mon but not others */
@@ -2863,8 +2906,10 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
             dmg = 0; /* damage has been applied by explode() */
         }
     } else { /* wand/horn of fire w/ positive charge count */
-        mzapmsg(mon, obj, TRUE);
-        obj->spe--;
+        if (obj->otyp == FIRE_HORN)
+            mplayhorn(mon, obj, TRUE);
+        else
+            mzapwand(mon, obj, TRUE);
         /* -1 => monster's wand of fire; 2 => # of damage dice */
         dmg = zhitm(mon, by_you ? 1 : -1, 2, &odummyp);
     }
@@ -2874,25 +2919,36 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
            for fire breath, dmg is going to be 0 (fire breathers are
            immune to fire damage) but for wand of fire or fire horn,
            'mon' could have taken damage so might die */
-        if (mon->mhp <= 0) {
+        if (DEADMONSTER(mon)) {
             if (by_you) {
                 /* mon killed self but hero gets credit and blame (except
                    for pacifist conduct); xkilled()'s message would say
                    "You killed/destroyed <mon>" so give our own message */
                 if (vis)
+#if 0 /*JP:T*/
                     pline("%s is %s by the fire!", Monnam(mon),
                           nonliving(mon->data) ? "destroyed" : "killed");
+#else
+                    pline("%s\82Í\89Î\82Å%s\82³\82ê\82½\81I", Monnam(mon),
+                          nonliving(mon->data) ? "\93|" : "\8eE");
+#endif
                 xkilled(mon, XKILL_NOMSG | XKILL_NOCONDUCT);
             } else
+/*JP
                 monkilled(mon, "fire", AD_FIRE);
+*/
+                monkilled(mon, "\89Î", AD_FIRE);
         } else {
             /* non-fatal damage occurred */
             if (vis)
+/*JP
                 pline("%s is burned%s", Monnam(mon), exclam(dmg));
+*/
+                pline("%s\82Í\94R\82¦\82½%s", Monnam(mon), exclam(dmg));
         }
     }
     if (vis) {
-        if (res && mon->mhp > 0)
+        if (res && !DEADMONSTER(mon))
 /*JP
             pline("%s slime is burned away!", s_suffix(Monnam(mon)));
 */
@@ -2937,7 +2993,11 @@ struct monst *mon;
         return (ptr->mcolor == CLR_GREEN || ptr->mcolor == CLR_BRIGHT_GREEN);
 #endif
     /* approximation */
+#if 0 /*JP*/
     if (strstri(ptr->mname, "green"))
+#else
+    if (strstri(ptr->mname, "\97Î"))
+#endif
         return TRUE;
     switch (monsndx(ptr)) {
     case PM_FOREST_CENTAUR: