OSDN Git Service

update year to 2020
[jnethack/source.git] / src / mcastu.c
index fabb2ad..f31d7da 100644 (file)
@@ -1,11 +1,11 @@
-/* NetHack 3.6 mcastu.c        $NHDT-Date: 1436753517 2015/07/13 02:11:57 $  $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */
+/* NetHack 3.6 mcastu.c        $NHDT-Date: 1567418129 2019/09/02 09:55:29 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.55 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2011. */
 /* 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"
@@ -43,6 +43,7 @@ enum mcast_cleric_spells {
 STATIC_DCL void FDECL(cursetxt, (struct monst *, BOOLEAN_P));
 STATIC_DCL int FDECL(choose_magic_spell, (int));
 STATIC_DCL int FDECL(choose_clerical_spell, (int));
+STATIC_DCL int FDECL(m_cure_self, (struct monst *, int));
 STATIC_DCL void FDECL(cast_wizard_spell, (struct monst *, int, int));
 STATIC_DCL void FDECL(cast_cleric_spell, (struct monst *, int, int));
 STATIC_DCL boolean FDECL(is_undirected_spell, (unsigned int, int));
@@ -91,10 +92,12 @@ boolean undirected;
         pline("%s\82Í%s\8ew\8d·\82µ\81C\8eô\82¢\82ð\82©\82¯\82½\81D", Monnam(mtmp), point_msg);
     } else if ((!(moves % 4) || !rn2(4))) {
         if (!Deaf)
-/*JP
-            Norep("You hear a mumbled curse.");
-*/
+#if 0 /*JP*/
+            Norep("You hear a mumbled curse.");   /* Deaf-aware */
+#else
+            /*JP:TODO:Deaf\91Î\89\9e*/
             Norep("\8eô\82¢\82Ì\8c¾\97t\82ð\82Â\82Ô\82â\82­\90º\82ð\95·\82¢\82½\81D");
+#endif
     }
 }
 
@@ -268,7 +271,7 @@ boolean foundyou;
        penalizing mspec_used. */
     if (!foundyou && thinks_it_foundyou
         && !is_undirected_spell(mattk->adtyp, spellnum)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s casts a spell at %s!",
               canseemon(mtmp) ? Monnam(mtmp) : "Something",
               levl[mtmp->mux][mtmp->muy].typ == WATER ? "empty water"
@@ -297,7 +300,7 @@ boolean foundyou;
               canspotmon(mtmp) ? Monnam(mtmp) : "Something",
               is_undirected_spell(mattk->adtyp, spellnum)
                   ? ""
-                  : (Invisible && !perceives(mtmp->data)
+                  : (Invis && !perceives(mtmp->data)
                      && (mtmp->mux != u.ux || mtmp->muy != u.uy))
                         ? " at a spot near you"
                         : (Displaced
@@ -403,6 +406,25 @@ boolean foundyou;
     return (ret);
 }
 
+STATIC_OVL int
+m_cure_self(mtmp, dmg)
+struct monst *mtmp;
+int dmg;
+{
+    if (mtmp->mhp < mtmp->mhpmax) {
+        if (canseemon(mtmp))
+/*JP
+            pline("%s looks better.", Monnam(mtmp));
+*/
+            pline("%s\82Í\8bC\95ª\82ª\82æ\82­\82È\82Á\82½\82æ\82¤\82¾\81D", Monnam(mtmp));
+        /* note: player healing does 6d4; this used to do 1d8 */
+        if ((mtmp->mhp += d(3, 6)) > mtmp->mhpmax)
+            mtmp->mhp = mtmp->mhpmax;
+        dmg = 0;
+    }
+    return dmg;
+}
+
 /* monster wizard and cleric spellcasting functions */
 /*
    If dmg is zero, then the monster is not casting at you.
@@ -476,34 +498,34 @@ int spellnum;
 
         count = nasty(mtmp); /* summon something nasty */
 #endif
-        if (mtmp->iswiz)
+        if (mtmp->iswiz) {
 /*JP
             verbalize("Destroy the thief, my pet%s!", plur(count));
 */
             verbalize("\93\90\91¯\82ð\8eE\82¹\81I\89ä\82ª\89º\96l\82æ\81I");
-        else {
+        else {
 #if 0 /*JP*/
-            const char *mappear =
-                (count == 1) ? "A monster appears" : "Monsters appear";
+            const char *mappear = (count == 1) ? "A monster appears"
+                                               : "Monsters appear";
 #endif
 
             /* messages not quite right if plural monsters created but
                only a single monster is seen */
-            if (Invisible && !perceives(mtmp->data)
+            if (Invis && !perceives(mtmp->data)
                 && (mtmp->mux != u.ux || mtmp->muy != u.uy))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s around a spot near you!", mappear);
 #else
                 pline("\89ö\95¨\82ª\82 \82È\82½\82Ì\82·\82®\82»\82Î\82É\8c»\82ê\82½\81I");
 #endif
             else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s around your displaced image!", mappear);
 #else
                 pline("\89ö\95¨\82ª\82 \82È\82½\82Ì\8c\89e\82Ì\82·\82®\82»\82Î\82É\8c»\82ê\82½\81I");
 #endif
             else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s from nowhere!", mappear);
 #else
                 pline("\89ö\95¨\82ª\82Ç\82±\82©\82ç\82Æ\82à\82È\82­\8c»\82ê\82½\81I");
@@ -567,7 +589,7 @@ int spellnum;
     case MGC_DISAPPEAR: /* makes self invisible */
         if (!mtmp->minvis && !mtmp->invis_blkd) {
             if (canseemon(mtmp))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s suddenly %s!", Monnam(mtmp),
                       !See_invisible ? "disappears" : "becomes transparent");
 #else
@@ -607,17 +629,7 @@ int spellnum;
         dmg = 0;
         break;
     case MGC_CURE_SELF:
-        if (mtmp->mhp < mtmp->mhpmax) {
-            if (canseemon(mtmp))
-/*JP
-                pline("%s looks better.", Monnam(mtmp));
-*/
-                pline("%s\82Í\8bC\95ª\82ª\82æ\82­\82È\82Á\82½\82æ\82¤\82¾\81D", Monnam(mtmp));
-            /* note: player healing does 6d4; this used to do 1d8 */
-            if ((mtmp->mhp += d(3, 6)) > mtmp->mhpmax)
-                mtmp->mhp = mtmp->mhpmax;
-            dmg = 0;
-        }
+        dmg = m_cure_self(mtmp, dmg);
         break;
     case MGC_PSI_BOLT:
         /* prior to 3.4.0 Antimagic was setting the damage to 1--this
@@ -784,7 +796,7 @@ int spellnum;
                 /* unseen caster summoned seen critter(s) */
                 arg = (newseen == oldseen + 1) ? an(what) : makeplural(what);
                 if (!Deaf)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     You_hear("someone summoning something, and %s %s.", arg,
                              vtense(arg, "appear"));
 #else
@@ -798,11 +810,11 @@ int spellnum;
                     pline("%s\82ª\8c»\82ê\82½\81D", arg);
             }
 
-            /* seen caster, possibly producing unseen--or just one--critters;
-               hero is told what the caster is doing and doesn't necessarily
-               observe complete accuracy of that caster's results (in other
-               words, no need to fuss with visibility or singularization;
-               player is told what's happening even if hero is unconscious) */
+        /* seen caster, possibly producing unseen--or just one--critters;
+           hero is told what the caster is doing and doesn't necessarily
+           observe complete accuracy of that caster's results (in other
+           words, no need to fuss with visibility or singularization;
+           player is told what's happening even if hero is unconscious) */
         } else if (!success)
 /*JP
             fmt = "%s casts at a clump of sticks, but nothing happens.";
@@ -813,7 +825,7 @@ int spellnum;
             fmt = "%s transforms a clump of sticks into snakes!";
 */
             fmt = "%s\82Í\96_\90Ø\82ê\82ð\83w\83r\82É\95Ï\82¦\82½\81I";
-        else if (Invisible && !perceives(mtmp->data)
+        else if (Invis && !perceives(mtmp->data)
                  && (mtmp->mux != u.ux || mtmp->muy != u.uy))
 /*JP
             fmt = "%s summons insects around a spot near you!";
@@ -838,7 +850,7 @@ int spellnum;
     case CLC_BLIND_YOU:
         /* note: resists_blnd() doesn't apply here */
         if (!Blinded) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             int num_eyes = eyecount(youmonst.data);
             pline("Scales cover your %s!", (num_eyes == 1)
                                                ? body_part(EYE)
@@ -899,33 +911,20 @@ int spellnum;
                 dmg = (dmg + 1) / 2;
             make_confused(HConfusion + dmg, TRUE);
             if (Hallucination)
-#if 0 /*JP*/
+/*JP
                 You_feel("%s!", oldprop ? "trippier" : "trippy");
-#else
+*/
                 You("%s\82Ö\82ë\82Ö\82ë\82É\82È\82Á\82½\81I", oldprop ? "\82à\82Á\82Æ" : "");
-#endif
             else
-#if 0 /*JP*/
+/*JP
                 You_feel("%sconfused!", oldprop ? "more " : "");
-#else
+*/
                 You("%s\8d¬\97\90\82µ\82½\81I", oldprop ? "\82à\82Á\82Æ" : "");
-#endif
         }
         dmg = 0;
         break;
     case CLC_CURE_SELF:
-        if (mtmp->mhp < mtmp->mhpmax) {
-            if (canseemon(mtmp))
-#if 0 /*JP*/
-                pline("%s looks better.", Monnam(mtmp));
-#else
-                pline("%s\82Í\8bC\95ª\82ª\82æ\82­\82È\82Á\82½\82æ\82¤\82¾\81D", Monnam(mtmp));
-#endif
-            /* note: player healing does 6d4; this used to do 1d8 */
-            if ((mtmp->mhp += d(3, 6)) > mtmp->mhpmax)
-                mtmp->mhp = mtmp->mhpmax;
-            dmg = 0;
-        }
+        dmg = m_cure_self(mtmp, dmg);
         break;
     case CLC_OPEN_WOUNDS:
         if (Antimagic) {
@@ -1087,7 +1086,7 @@ register struct attack *mattk;
         nomul(0);
         if (mattk->adtyp && (mattk->adtyp < 11)) { /* no cf unsigned >0 */
             if (canseemon(mtmp))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s zaps you with a %s!", Monnam(mtmp),
                       flash_types[ad_to_typ(mattk->adtyp)]);
 #else