OSDN Git Service

use const
[jnethack/source.git] / src / spell.c
index 71068c7..289f6a1 100644 (file)
@@ -1,7 +1,12 @@
-/* NetHack 3.6 spell.c $NHDT-Date: 1447653429 2015/11/16 05:57:09 $  $NHDT-Branch: master $:$NHDT-Revision: 1.72 $ */
+/* NetHack 3.6 spell.c $NHDT-Date: 1508479722 2017/10/20 06:08:42 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.84 $ */
 /*      Copyright (c) M. Stephenson 1988                          */
 /* 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-2018            */
+/* JNetHack may be freely redistributed.  See license for details. */
+
 #include "hack.h"
 
 /* spellmenu arguments; 0 thru n-1 used as spl_book[] index when swapping */
@@ -43,6 +48,7 @@ STATIC_DCL int NDECL(throwspell);
 STATIC_DCL void NDECL(cast_protection);
 STATIC_DCL void FDECL(spell_backfire, (int));
 STATIC_DCL const char *FDECL(spelltypemnemonic, (int));
+STATIC_DCL boolean FDECL(spell_aim_step, (genericptr_t, int, int));
 
 /* The roles[] table lists the role-specific values for tuning
  * percent_success().
@@ -97,7 +103,9 @@ STATIC_DCL const char *FDECL(spelltypemnemonic, (int));
 #define uarmfbon 2 /* All metal interferes to some degree */
 
 /* since the spellbook itself doesn't blow up, don't say just "explodes" */
+#if 0 /*JP*/
 static const char explodes[] = "radiates explosive energy";
+#endif
 
 /* convert a letter into a number in the range 0..51, or -1 if not a letter */
 STATIC_OVL int
@@ -120,16 +128,23 @@ STATIC_OVL boolean
 cursed_book(bp)
 struct obj *bp;
 {
+    boolean was_in_use;
     int lev = objects[bp->otyp].oc_level;
     int dmg = 0;
 
     switch (rn2(lev)) {
     case 0:
+/*JP
         You_feel("a wrenching sensation.");
+*/
+        You("\82Ë\82\82ç\82ê\82½\82æ\82¤\82È\8a´\8ao\82ð\8a´\82\82½\81D");
         tele(); /* teleport him */
         break;
     case 1:
+/*JP
         You_feel("threatened.");
+*/
+        You("\82¨\82Ç\82³\82ê\82Ä\82¢\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
         aggravate();
         break;
     case 2:
@@ -139,31 +154,56 @@ struct obj *bp;
         take_gold();
         break;
     case 4:
+/*JP
         pline("These runes were just too much to comprehend.");
+*/
+        pline("\82±\82Ì\83\8b\81[\83\93\95\8e\9a\82ð\97\9d\89ð\82·\82é\82Ì\82Í\8d¢\93ï\82¾\81D");
         make_confused(HConfusion + rn1(7, 16), FALSE);
         break;
     case 5:
+/*JP
         pline_The("book was coated with contact poison!");
+*/
+        pline("\82±\82Ì\96{\82Í\90Ú\90G\8c^\82Ì\93Å\82Å\95¢\82í\82ê\82Ä\82¢\82é\81I");
         if (uarmg) {
+#if 0 /*JP*/
             erode_obj(uarmg, "gloves", ERODE_CORRODE, EF_GREASE | EF_VERBOSE);
+#else
+            erode_obj(uarmg, "\8f¬\8eè", ERODE_CORRODE, EF_GREASE | EF_VERBOSE);
+#endif
             break;
         }
         /* temp disable in_use; death should not destroy the book */
+        was_in_use = bp->in_use;
         bp->in_use = FALSE;
         losestr(Poison_resistance ? rn1(2, 1) : rn1(4, 3));
+#if 0 /*JP*/
         losehp(rnd(Poison_resistance ? 6 : 10), "contact-poisoned spellbook",
                KILLED_BY_AN);
-        bp->in_use = TRUE;
+#else
+        losehp(rnd(Poison_resistance ? 6 : 10), "\90Ú\90G\93Å\82Ì\96\82\96@\8f\91\82Å",
+               KILLED_BY_AN);
+#endif
+        bp->in_use = was_in_use;
         break;
     case 6:
         if (Antimagic) {
             shieldeff(u.ux, u.uy);
+/*JP
             pline_The("book %s, but you are unharmed!", explodes);
+*/
+            pline("\96{\82Í\8b­\97Í\82È\83G\83l\83\8b\83M\81[\82ð\95ú\8fo\82µ\82½\81C\82µ\82©\82µ\82 \82È\82½\82Í\8f\9d\82Â\82©\82È\82¢\81I");
         } else {
+/*JP
             pline("As you read the book, it %s in your %s!", explodes,
+*/
+            pline("\96{\82Í\8b­\97Í\82È\83G\83l\83\8b\83M\81[\82ð\82 \82È\82½\82Ì%s\82É\95ú\8fo\82µ\82½\81I",
                   body_part(FACE));
             dmg = 2 * rnd(10) + 5;
+/*JP
             losehp(Maybe_Half_Phys(dmg), "exploding rune", KILLED_BY_AN);
+*/
+            losehp(Maybe_Half_Phys(dmg), "\8b­\97Í\82È\83\8b\81[\83\93\95\8e\9a\82Ì\83G\83l\83\8b\83M\81[\82Å", KILLED_BY_AN);
         }
         return TRUE;
     default:
@@ -183,17 +223,28 @@ struct obj *spellbook;
     if (!rn2(3) && spellbook->otyp != SPE_BOOK_OF_THE_DEAD) {
         spellbook->in_use = TRUE; /* in case called from learn */
         pline(
+/*JP
          "Being confused you have difficulties in controlling your actions.");
+*/
+         "\8d¬\97\90\82µ\82Ä\82¢\82é\82Ì\82Å\81C\82»\82¤\82¢\82¤\82±\82Æ\82ð\82·\82é\82Ì\82Í\93ï\82µ\82¢\81D");
         display_nhwindow(WIN_MESSAGE, FALSE);
+/*JP
         You("accidentally tear the spellbook to pieces.");
+*/
+        You("\82¤\82Á\82©\82è\81C\96\82\96@\8f\91\82ð\88ø\82«\82³\82¢\82Ä\82µ\82Ü\82Á\82½\81D");
         if (!objects[spellbook->otyp].oc_name_known
             && !objects[spellbook->otyp].oc_uname)
             docall(spellbook);
         useup(spellbook);
         gone = TRUE;
     } else {
+#if 0 /*JP*/
         You("find yourself reading the %s line over and over again.",
             spellbook == context.spbook.book ? "next" : "first");
+#else
+        You("%s\82Ì\8ds\82ð\89½\93x\82à\8cJ\82è\95Ô\82µ\82Ä\93Ç\82ñ\82Å\82¢\82½\82±\82Æ\82É\8bC\95t\82¢\82½\81D",
+            spellbook == context.spbook.book ? "\8e\9f" : "\8dÅ\8f\89");
+#endif
     }
     return gone;
 }
@@ -206,7 +257,10 @@ struct obj *book2;
     struct monst *mtmp, *mtmp2;
     coord mm;
 
+/*JP
     You("turn the pages of the Book of the Dead...");
+*/
+    You("\8e\80\8eÒ\82Ì\8f\91\82Ì\83y\81[\83W\82ð\82ß\82­\82Á\82½\81D\81D\81D");
     makeknown(SPE_BOOK_OF_THE_DEAD);
     /* KMH -- Need ->known to avoid "_a_ Book of the Dead" */
     book2->known = 1;
@@ -216,16 +270,28 @@ struct obj *book2;
                          arti_cursed = FALSE;
 
         if (book2->cursed) {
+/*JP
             pline_The("runes appear scrambled.  You can't read them!");
+*/
+            pline("\83\8b\81[\83\93\95\8e\9a\82Í\82²\82¿\82á\82Ü\82º\82É\82È\82Á\82Ä\82¨\82è\81C\93Ç\82Þ\82±\82Æ\82ª\82Å\82«\82È\82©\82Á\82½\81I");
             return;
         }
 
         if (!u.uhave.bell || !u.uhave.menorah) {
+/*JP
             pline("A chill runs down your %s.", body_part(SPINE));
+*/
+            Your("%s\82É\8a¦\82¯\82ª\91\96\82Á\82½\81D", body_part(SPINE));
             if (!u.uhave.bell)
+/*JP
                 You_hear("a faint chime...");
+*/
+                You_hear("\82©\82·\82©\82È\83x\83\8b\82Ì\89¹\82ð\95·\82¢\82½\81D\81D\81D");
             if (!u.uhave.menorah)
+/*JP
                 pline("Vlad's doppelganger is amused.");
+*/
+                pline("\83\94\83\89\83h\82Ì\90\97ì\82Í\8fÎ\82Á\82½\81D");
             return;
         }
 
@@ -247,8 +313,14 @@ struct obj *book2;
         }
 
         if (arti_cursed) {
+/*JP
             pline_The("invocation fails!");
+*/
+            pline("\93Á\8eê\94\\97Í\82Í\94­\8aö\82³\82ê\82È\82©\82Á\82½\81I");
+/*JP
             pline("At least one of your artifacts is cursed...");
+*/
+            pline("\8f­\82È\82­\82Æ\82à\90¹\8aí\82Ì\82Ð\82Æ\82Â\82ª\8eô\82í\82ê\82Ä\82¢\82é\81D\81D\81D");
         } else if (arti1_primed && arti2_primed) {
             unsigned soon =
                 (unsigned) d(2, 6); /* time til next intervene() */
@@ -262,7 +334,10 @@ struct obj *book2;
             if (!u.udg_cnt || u.udg_cnt > soon)
                 u.udg_cnt = soon;
         } else { /* at least one artifact not prepared properly */
+/*JP
             You("have a feeling that %s is amiss...", something);
+*/
+            You("\89½\82©\82ª\8aÔ\88á\82Á\82Ä\82¢\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D\81D\81D");
             goto raise_dead;
         }
         return;
@@ -272,7 +347,10 @@ struct obj *book2;
     if (book2->cursed) {
     raise_dead:
 
+/*JP
         You("raised the dead!");
+*/
+        You("\8e\80\8eÒ\82ð\91h\82ç\82¹\82½\81I");
         /* first maybe place a dangerous adversary */
         if (!rn2(3) && ((mtmp = makemon(&mons[PM_MASTER_LICH], u.ux, u.uy,
                                         NO_MINVENT)) != 0
@@ -310,18 +388,38 @@ struct obj *book2;
     } else {
         switch (rn2(3)) {
         case 0:
+/*JP
             Your("ancestors are annoyed with you!");
+*/
+            Your("\90æ\91c\82Í\82 \82È\82½\82ª\8c\99\82¢\82È\82æ\82¤\82¾\81I");
             break;
         case 1:
+/*JP
             pline_The("headstones in the cemetery begin to move!");
+*/
+            pline("\95æ\92n\82Ì\95æ\90Î\82ª\93®\82«\82Í\82\82ß\82½\81I");
             break;
         default:
+/*JP
             pline("Oh my!  Your name appears in the book!");
+*/
+            pline("\82È\82ñ\82Ä\82±\82Á\82½\82¢\81I\82 \82È\82½\82Ì\96¼\91O\82ª\96{\82É\8f\91\82¢\82Ä\82 \82é\81I");
         }
     }
     return;
 }
 
+/* 'book' has just become cursed; if we're reading it and realize it is
+   now cursed, interrupt */
+void
+book_cursed(book)
+struct obj *book;
+{
+    if (occupation == learn && context.spbook.book == book
+        && book->cursed && book->bknown && multi >= 0)
+        stop_occupation();
+}
+
 STATIC_PTR int
 learn(VOID_ARGS)
 {
@@ -339,14 +437,16 @@ learn(VOID_ARGS)
         context.spbook.book = 0; /* no longer studying */
         context.spbook.o_id = 0;
         nomul(context.spbook.delay); /* remaining delay is uninterrupted */
+/*JP
         multi_reason = "reading a book";
+*/
+        multi_reason = "\96{\82ð\93Ç\82ñ\82Å\82¢\82é\8e\9e\82É";
         nomovemsg = 0;
         context.spbook.delay = 0;
         return 0;
     }
-    if (context
-            .spbook.delay) { /* not if (context.spbook.delay++), so at end
-                                delay == 0 */
+    if (context.spbook.delay) {
+        /* not if (context.spbook.delay++), so at end delay == 0 */
         context.spbook.delay++;
         return 1; /* still busy */
     }
@@ -357,9 +457,15 @@ learn(VOID_ARGS)
         return 0;
     }
 
+#if 0 /*JP*/
     Sprintf(splname,
             objects[booktype].oc_name_known ? "\"%s\"" : "the \"%s\" spell",
             OBJ_NAME(objects[booktype]));
+#else
+    Sprintf(splname,
+            objects[booktype].oc_name_known ? "\"%s\"" : "\"%s\"",
+            OBJ_NAME(objects[booktype]));
+#endif
     for (i = 0; i < MAXSPELL; i++)
         if (spellid(i) == booktype || spellid(i) == NO_SPELL)
             break;
@@ -369,16 +475,27 @@ learn(VOID_ARGS)
     } else if (spellid(i) == booktype) {
         /* normal book can be read and re-read a total of 4 times */
         if (book->spestudied > MAX_SPELL_STUDY) {
+/*JP
             pline("This spellbook is too faint to be read any more.");
+*/
+            pline("\82±\82Ì\96\82\96@\8f\91\82Ì\95\8e\9a\82Í\94\96\82·\82¬\82Ä\82±\82ê\88È\8fã\93Ç\82ß\82È\82¢\81D");
             book->otyp = booktype = SPE_BLANK_PAPER;
             /* reset spestudied as if polymorph had taken place */
             book->spestudied = rn2(book->spestudied);
         } else if (spellknow(i) > KEEN / 10) {
+/*JP
             You("know %s quite well already.", splname);
+*/
+            You("\82·\82Å\82É%s\82ð\8fn\92m\82µ\82Ä\82¢\82é\81D", splname);
             costly = FALSE;
         } else { /* spellknow(i) <= KEEN/10 */
+#if 0 /*JP*/
             Your("knowledge of %s is %s.", splname,
                  spellknow(i) ? "keener" : "restored");
+#else
+            Your("%s\82É\91Î\82·\82é\92m\8e¯\82Í%s\82³\82ê\82½\81D", splname,
+                 spellknow(i) ? "\82³\82ç\82É\8c¤\82¬\82·\82Ü" : "\95\9c\8c³");
+#endif
             incrnknow(i, 1);
             book->spestudied++;
             exercise(A_WIS, TRUE); /* extra study */
@@ -392,7 +509,10 @@ learn(VOID_ARGS)
            one less reading is available than when re-learning */
         if (book->spestudied >= MAX_SPELL_STUDY) {
             /* pre-used due to being the product of polymorph */
+/*JP
             pline("This spellbook is too faint to read even once.");
+*/
+            pline("\82±\82Ì\96\82\96@\8f\91\82Ì\95\8e\9a\82Í\94\96\82·\82¬\82Ä\82±\82ê\88È\8fã\93Ç\82ß\82È\82¢\81D");
             book->otyp = booktype = SPE_BLANK_PAPER;
             /* reset spestudied as if polymorph had taken place */
             book->spestudied = rn2(book->spestudied);
@@ -401,7 +521,10 @@ learn(VOID_ARGS)
             spl_book[i].sp_lev = objects[booktype].oc_level;
             incrnknow(i, 1);
             book->spestudied++;
+/*JP
             You(i > 0 ? "add %s to your repertoire." : "learn %s.", splname);
+*/
+            You(i > 0 ? "%s\82ð\83\8c\83p\81[\83g\83\8a\81[\82É\89Á\82¦\82½\81D" : "%s\82ð\8fK\93¾\82µ\82½\81D", splname);
         }
         makeknown((int) booktype);
     }
@@ -430,8 +553,11 @@ register struct obj *spellbook;
     boolean too_hard = FALSE;
 
     /* attempting to read dull book may make hero fall asleep */
-    if (!confused && booktype != SPE_BLANK_PAPER
+    if (!confused && !Sleep_resistance
+/*JP
         && !strcmp(OBJ_DESCR(objects[booktype]), "dull")) {
+*/
+        && !strcmp(OBJ_DESCR(objects[booktype]), "\89\94\90F\82Ì\96\82\96@\8f\91")) {
         const char *eyes;
         int dullbook = rnd(25) - ACURR(A_WIS);
 
@@ -443,7 +569,10 @@ register struct obj *spellbook;
             eyes = body_part(EYE);
             if (eyecount(youmonst.data) > 1)
                 eyes = makeplural(eyes);
+/*JP
             pline("This book is so dull that you can't keep your %s open.",
+*/
+            pline("\82±\82Ì\96{\82Í\91Þ\8bü\82·\82¬\82Ä%s\82ð\8aJ\82¯\82Ä\82¢\82ç\82ê\82È\82¢\81D",
                   eyes);
             dullbook += rnd(2 * objects[booktype].oc_level);
             fall_asleep(-dullbook, TRUE);
@@ -455,17 +584,25 @@ register struct obj *spellbook;
         /* handle the sequence: start reading, get interrupted, have
            context.spbook.book become erased somehow, resume reading it */
         && booktype != SPE_BLANK_PAPER) {
+#if 0 /*JP*/
         You("continue your efforts to %s.",
             (booktype == SPE_NOVEL) ? "read the novel" : "memorize the spell");
+#else
+        You("%s\82ð\8dÄ\8aJ\82µ\82½\81D",
+            (booktype == SPE_NOVEL) ? "\93Ç\8f\91" : "\96\82\96@\82Ì\8aw\8fK");
+#endif
     } else {
         /* KMH -- Simplified this code */
         if (booktype == SPE_BLANK_PAPER) {
+/*JP
             pline("This spellbook is all blank.");
+*/
+            pline("\82±\82Ì\96\82\96@\8f\91\82Í\90^\82Á\94\92\82¾\81D");
             makeknown(booktype);
             return 1;
         }
 
-        /* 3.6.0 tribute */
+        /* 3.6 tribute */
         if (booktype == SPE_NOVEL) {
             /* Obtain current Terry Pratchett book title */
             const char *tribtitle = noveltitle(&spellbook->novelidx);
@@ -474,6 +611,7 @@ register struct obj *spellbook;
                              spellbook->o_id)) {
                 u.uconduct.literate++;
                 check_unpaid(spellbook);
+                makeknown(booktype);
                 if (!u.uevent.read_tribute) {
                     /* give bonus of 20 xp and 4*20+0 pts */
                     more_experienced(20, 0);
@@ -515,16 +653,23 @@ register struct obj *spellbook;
                 too_hard = TRUE;
             } else {
                 /* uncursed - chance to fail */
-                int read_ability =
-                    ACURR(A_INT) + 4 + u.ulevel / 2
-                    - 2 * objects[booktype].oc_level
-                    + ((ublindf && ublindf->otyp == LENSES) ? 2 : 0);
+                int read_ability = ACURR(A_INT) + 4 + u.ulevel / 2
+                                   - 2 * objects[booktype].oc_level
+                             + ((ublindf && ublindf->otyp == LENSES) ? 2 : 0);
+
                 /* only wizards know if a spell is too difficult */
                 if (Role_if(PM_WIZARD) && read_ability < 20 && !confused) {
                     char qbuf[QBUFSZ];
+
+#if 0 /*JP*/
                     Sprintf(qbuf,
-                     "This spellbook is %sdifficult to comprehend. Continue?",
+                    "This spellbook is %sdifficult to comprehend.  Continue?",
                             (read_ability < 12 ? "very " : ""));
+#else
+                    Sprintf(qbuf,
+                    "\82±\82Ì\96\82\96@\8f\91\82ð\97\9d\89ð\82·\82é\82Ì\82Í%s\8d¢\93ï\82¾\81D\91±\82¯\82Ü\82·\82©\81H",
+                            (read_ability < 12 ? "\82Æ\82Ä\82à" : ""));
+#endif
                     if (yn(qbuf) != 'y') {
                         spellbook->in_use = FALSE;
                         return 1;
@@ -541,12 +686,18 @@ register struct obj *spellbook;
             boolean gone = cursed_book(spellbook);
 
             nomul(context.spbook.delay); /* study time */
+/*JP
             multi_reason = "reading a book";
+*/
+            multi_reason = "\96{\82ð\93Ç\82ñ\82Å\82¢\82é\8e\9e\82É";
             nomovemsg = 0;
             context.spbook.delay = 0;
             if (gone || !rn2(3)) {
                 if (!gone)
+/*JP
                     pline_The("spellbook crumbles to dust!");
+*/
+                    pline("\96\82\96@\8f\91\82Í\90o\82Æ\82È\82Á\82½\81I");
                 if (!objects[spellbook->otyp].oc_name_known
                     && !objects[spellbook->otyp].oc_uname)
                     docall(spellbook);
@@ -559,21 +710,32 @@ register struct obj *spellbook;
                 spellbook->in_use = FALSE;
             }
             nomul(context.spbook.delay);
+/*JP
             multi_reason = "reading a book";
+*/
+            multi_reason = "\96{\82ð\93Ç\82ñ\82Å\82¢\82é\8e\9e\82É";
             nomovemsg = 0;
             context.spbook.delay = 0;
             return 1;
         }
         spellbook->in_use = FALSE;
 
+#if 0 /*JP*/
         You("begin to %s the runes.",
             spellbook->otyp == SPE_BOOK_OF_THE_DEAD ? "recite" : "memorize");
+#else
+        You("\83\8b\81[\83\93\95\8e\9a\82ð%s\82µ\82Í\82\82ß\82½\81D",
+            spellbook->otyp == SPE_BOOK_OF_THE_DEAD ? "\88Ã\8f¥" : "\8bL\89¯");
+#endif
     }
 
     context.spbook.book = spellbook;
     if (context.spbook.book)
         context.spbook.o_id = context.spbook.book->o_id;
+/*JP
     set_occupation(learn, "studying", 0);
+*/
+    set_occupation(learn, "\8aw\82Ô", 0);
     return 1;
 }
 
@@ -627,7 +789,16 @@ rejectcasting()
 {
     /* rejections which take place before selecting a particular spell */
     if (Stunned) {
+/*JP
         You("are too impaired to cast a spell.");
+*/
+        You("\82­\82ç\82­\82ç\82µ\82Ä\82¢\82Ä\96\82\96@\82ð\8eg\82¦\82È\82¢\81D");
+        return TRUE;
+    } else if (!can_chant(&youmonst)) {
+/*JP
+        You("are unable to chant the incantation.");
+*/
+        You("\8eô\95\82ð\8f¥\82¦\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81D");
         return TRUE;
     } else if (!freehand()) {
         /* Note: !freehand() occurs when weapon and shield (or two-handed
@@ -637,7 +808,10 @@ rejectcasting()
          * But why isn't lack of free arms (for gesturing) an issue when
          * poly'd hero has no limbs?
          */
+/*JP
         Your("arms are not free to cast!");
+*/
+        pline("\96\82\96@\82ð\8f¥\82¦\82æ\82¤\82É\82à\98r\82Ì\8e©\97R\82ª\8cø\82©\82È\82¢\81I");
         return TRUE;
     }
     return FALSE;
@@ -655,7 +829,10 @@ int *spell_no;
     char ilet, lets[BUFSZ], qbuf[QBUFSZ];
 
     if (spellid(0) == NO_SPELL) {
+/*JP
         You("don't know any spells right now.");
+*/
+        You("\8d¡\82Ì\82Æ\82±\82ë\89½\82Ì\96\82\96@\82à\92m\82ç\82È\82¢\81D");
         return FALSE;
     }
     if (rejectcasting())
@@ -678,7 +855,10 @@ int *spell_no;
             Sprintf(lets, "a-zA-%c", 'A' + nspells - 27);
 
         for (;;) {
+/*JP
             Sprintf(qbuf, "Cast which spell? [%s *?]", lets);
+*/
+            Sprintf(qbuf, "\82Ç\82Ì\96\82\96@\82ð\8f¥\82¦\82é\81H[%s ?]", lets);
             ilet = yn_function(qbuf, (char *) 0, '\0');
             if (ilet == '*' || ilet == '?')
                 break; /* use menu mode */
@@ -687,14 +867,20 @@ int *spell_no;
 
             idx = spell_let_to_idx(ilet);
             if (idx < 0 || idx >= nspells) {
+/*JP
                 You("don't know that spell.");
+*/
+                You("\82»\82ñ\82È\96\82\96@\82Í\92m\82ç\82È\82¢\81D");
                 continue; /* ask again */
             }
             *spell_no = idx;
             return TRUE;
         }
     }
+/*JP
     return dospellmenu("Choose which spell to cast", SPELLMENU_CAST,
+*/
+    return dospellmenu("\82Ç\82Ì\96\82\96@\82ð\8f¥\82¦\82é\81H", SPELLMENU_CAST,
                        spell_no);
 }
 
@@ -715,19 +901,40 @@ int skill;
 {
     switch (skill) {
     case P_ATTACK_SPELL:
+/*JP
         return "attack";
+*/
+        return "\8dU\8c\82";
     case P_HEALING_SPELL:
+/*JP
         return "healing";
+*/
+        return "\8e¡\96ü";
     case P_DIVINATION_SPELL:
+/*JP
         return "divination";
+*/
+        return "\97\\92m";
     case P_ENCHANTMENT_SPELL:
+/*JP
         return "enchantment";
+*/
+        return "\95â\8f\95";
     case P_CLERIC_SPELL:
+/*JP
         return "clerical";
+*/
+        return "\91m\97µ";
     case P_ESCAPE_SPELL:
+/*JP
         return "escape";
+*/
+        return "\92E\8fo";
     case P_MATTER_SPELL:
+/*JP
         return "matter";
+*/
+        return "\95¨\8e¿";
     default:
         impossible("Unknown spell skill, %d;", skill);
         return "";
@@ -786,28 +993,63 @@ cast_protection()
             const char *hgolden = hcolor(NH_GOLDEN), *atmosphere;
 
             if (u.uspellprot) {
+/*JP
                 pline_The("%s haze around you becomes more dense.", hgolden);
+*/
+                pline("\82 \82È\82½\82Ì\82Ü\82í\82è\82Ì%s\89à\82ª\94Z\82­\82È\82Á\82½\81D", hgolden);
             } else {
                 rmtyp = levl[u.ux][u.uy].typ;
                 atmosphere = u.uswallow
                                 ? ((u.ustuck->data == &mons[PM_FOG_CLOUD])
+/*JP
                                    ? "mist"
+*/
+                                   ? "\96¶"
                                    : is_whirly(u.ustuck->data)
+/*JP
                                       ? "maelstrom"
+*/
+                                      ? "\89Q"
                                       : is_animal(u.ustuck->data)
+/*JP
                                          ? "maw"
+*/
+                                         ? "\88Ý"
+/*JP
                                          : "ooze")
+*/
+                                         : "\82Ë\82Î\82Ë\82Î")
                                 : (u.uinwater
-                                   ? "water"
+/*JP
+                                   ? hliquid("water")
+*/
+                                   ? hliquid("\90\85")
                                    : (rmtyp == CLOUD)
+/*JP
                                       ? "cloud"
+*/
+                                      ? "\89_"
                                       : IS_TREE(rmtyp)
-                                         ? "vegitation"
+/*JP
+                                         ? "vegetation"
+*/
+                                         ? "\96Ø"
                                          : IS_STWALL(rmtyp)
+/*JP
                                             ? "stone"
+*/
+                                            ? "\90Î"
+/*JP
                                             : "air");
+*/
+                                            : "\8bó\8bC");
+#if 0 /*JP*/
                 pline_The("%s around you begins to shimmer with %s haze.",
                           atmosphere, an(hgolden));
+#else
+                pline("\82 \82È\82½\82Ì\82Ü\82í\82è\82Ì%s\82ª%s\96\82Å\83L\83\89\83L\83\89\82Æ\8cõ\82è\82Í\82\82ß\82½\81D",
+                          atmosphere, hgolden);
+#endif
             }
         }
         u.uspellprot += gain;
@@ -817,7 +1059,10 @@ cast_protection()
             u.usptime = u.uspmtime;
         find_ac();
     } else {
+/*JP
         Your("skin feels warm for a moment.");
+*/
+        Your("\94§\82Í\88ê\8fu\83|\83J\83|\83J\82µ\82½\81D");
     }
 }
 
@@ -852,8 +1097,8 @@ int spell;
         break;
     case 7:
     case 8:
-        make_stunned(old_conf + 2L * duration / 3L, FALSE); /* 20% */
-        make_confused(old_stun + duration / 3L, FALSE);
+        make_stunned(old_stun + 2L * duration / 3L, FALSE); /* 20% */
+        make_confused(old_conf + duration / 3L, FALSE);
         break;
     case 9:
         make_stunned(old_stun + duration, FALSE); /* 10% */
@@ -868,7 +1113,7 @@ int spell;
 boolean atme;
 {
     int energy, damage, chance, n, intell;
-    int skill, role_skill;
+    int skill, role_skill, res = 0;
     boolean confused = (Confusion != 0);
     boolean physical_damage = FALSE;
     struct obj *pseudo;
@@ -892,39 +1137,88 @@ boolean atme;
      * decrement of spell knowledge is done every turn.
      */
     if (spellknow(spell) <= 0) {
+/*JP
         Your("knowledge of this spell is twisted.");
+*/
+        Your("\82±\82Ì\96\82\96@\82É\8aÖ\82·\82é\92m\8e¯\82Í\82æ\82\82ê\82½\81D");
+/*JP
         pline("It invokes nightmarish images in your mind...");
+*/
+        pline("\82»\82ê\82Í\88«\96²\82ð\90S\82É\95\82\82Î\82¹\82½\81D\81D\81D");
         spell_backfire(spell);
         return 1;
     } else if (spellknow(spell) <= KEEN / 200) { /* 100 turns left */
+/*JP
         You("strain to recall the spell.");
+*/
+        You("\96\82\96@\82ð\8ev\82¢\82¾\82·\82Ì\82É\8bê\98J\82µ\82½\81D");
     } else if (spellknow(spell) <= KEEN / 40) { /* 500 turns left */
+/*JP
         You("have difficulty remembering the spell.");
+*/
+        You("\8eô\95\82ð\8ev\82¢\8fo\82·\82Ì\82ª\93ï\82µ\82­\82È\82Á\82Ä\82«\82½\81D");
     } else if (spellknow(spell) <= KEEN / 20) { /* 1000 turns left */
+/*JP
         Your("knowledge of this spell is growing faint.");
+*/
+        Your("\82±\82Ì\96\82\96@\82É\8aÖ\82·\82é\92m\8e¯\82ª\82¨\82Ú\82ë\82°\82É\82È\82Á\82Ä\82«\82½\81D");
     } else if (spellknow(spell) <= KEEN / 10) { /* 2000 turns left */
+/*JP
         Your("recall of this spell is gradually fading.");
+*/
+        Your("\82±\82Ì\96\82\96@\82É\8aÖ\82·\82é\92m\8e¯\82ª\8f\99\81X\82É\94\96\82ê\82Ä\82«\82½\81D");
     }
     energy = (spellev(spell) * 5); /* 5 <= energy <= 35 */
 
     if (u.uhunger <= 10 && spellid(spell) != SPE_DETECT_FOOD) {
+/*JP
         You("are too hungry to cast that spell.");
+*/
+        pline("\95 \82ª\8c¸\82è\82·\82¬\82Ä\96\82\96@\82ð\8f¥\82¦\82ç\82ê\82È\82¢\81D");
         return 0;
     } else if (ACURR(A_STR) < 4 && spellid(spell) != SPE_RESTORE_ABILITY) {
+/*JP
         You("lack the strength to cast spells.");
+*/
+        pline("\8b­\82³\82ª\8f­\82È\82·\82¬\82Ä\96\82\96@\82ð\8f¥\82¦\82ç\82ê\82È\82¢\81D");
         return 0;
     } else if (check_capacity(
+/*JP
                 "Your concentration falters while carrying so much stuff.")) {
+*/
+                "\82½\82­\82³\82ñ\82à\82Ì\82ð\8e\9d\82¿\82·\82¬\82Ä\8fW\92\86\82Å\82«\82È\82¢\81D")){
         return 1;
     }
 
-    if (u.uhave.amulet) {
+    /* if the cast attempt is already going to fail due to insufficient
+       energy (ie, u.uen < energy), the Amulet's drain effect won't kick
+       in and no turn will be consumed; however, when it does kick in,
+       the attempt may fail due to lack of energy after the draining, in
+       which case a turn will be used up in addition to the energy loss */
+    if (u.uhave.amulet && u.uen >= energy) {
+/*JP
         You_feel("the amulet draining your energy away.");
-        energy += rnd(2 * energy);
+*/
+        pline("\96\82\8f\9c\82¯\82ª\82 \82È\82½\82Ì\83G\83l\83\8b\83M\81[\82ð\8bz\82¢\82Æ\82Á\82Ä\82¢\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
+        /* this used to be 'energy += rnd(2 * energy)' (without 'res'),
+           so if amulet-induced cost was more than u.uen, nothing
+           (except the "don't have enough energy" message) happened
+           and player could just try again (and again and again...);
+           now we drain some energy immediately, which has a
+           side-effect of not increasing the hunger aspect of casting */
+        u.uen -= rnd(2 * energy);
+        if (u.uen < 0)
+            u.uen = 0;
+        context.botl = 1;
+        res = 1; /* time is going to elapse even if spell doesn't get cast */
     }
+
     if (energy > u.uen) {
+/*JP
         You("don't have enough energy to cast that spell.");
-        return 0;
+*/
+        pline("\96\82\96@\82ð\8f¥\82¦\82é\82¾\82¯\82Ì\8f\\95ª\82È\83G\83l\83\8b\83M\81[\82ª\82È\82¢\81D");
+        return res;
     } else {
         if (spellid(spell) != SPE_DETECT_FOOD) {
             int hungr = energy * 2;
@@ -978,7 +1272,10 @@ boolean atme;
 
     chance = percent_success(spell);
     if (confused || (rnd(100) > chance)) {
+/*JP
         You("fail to cast the spell correctly.");
+*/
+        You("\96\82\96@\82ð\90³\82µ\82­\8f¥\82¦\82é\82±\82Æ\82ª\82Å\82«\82È\82©\82Á\82½\81D");
         u.uen -= energy / 2;
         context.botl = 1;
         return 1;
@@ -1016,9 +1313,14 @@ boolean atme;
                     if (!u.dx && !u.dy && !u.dz) {
                         if ((damage = zapyourself(pseudo, TRUE)) != 0) {
                             char buf[BUFSZ];
+#if 0 /*JP*/
                             Sprintf(buf, "zapped %sself with a spell",
                                     uhim());
                             losehp(damage, buf, NO_KILLER_PREFIX);
+#else
+                            Strcpy(buf, "\8e©\95ª\8e©\90g\82Ì\96\82\96@\82ð\97\81\82Ñ\82Ä");
+                            losehp(damage, buf, KILLED_BY);
+#endif
                         }
                     } else {
                         explode(u.dx, u.dy,
@@ -1075,16 +1377,26 @@ boolean atme;
                  * spelleffects() is organized means that aborting with
                  * "nevermind" is not an option.
                  */
+/*JP
                 pline_The("magical energy is released!");
+*/
+                pline("\96\82\96@\82Ì\83G\83l\83\8b\83M\81[\82ª\89ð\95ú\82³\82ê\82½\81I");
             }
             if (!u.dx && !u.dy && !u.dz) {
                 if ((damage = zapyourself(pseudo, TRUE)) != 0) {
                     char buf[BUFSZ];
 
+/*JP
                     Sprintf(buf, "zapped %sself with a spell", uhim());
+*/
+                    Strcpy(buf, "\8e©\95ª\8e©\90g\82Ì\96\82\96@\82ð\97\81\82Ñ\82Ä");
                     if (physical_damage)
                         damage = Maybe_Half_Phys(damage);
+#if 0 /*JP*/
                     losehp(damage, buf, NO_KILLER_PREFIX);
+#else
+                    losehp(damage, buf, KILLED_BY);
+#endif
                 }
             } else
                 weffects(pseudo);
@@ -1122,26 +1434,38 @@ boolean atme;
     case SPE_INVISIBILITY:
         (void) peffects(pseudo);
         break;
+    /* end of potion-like spells */
 
     case SPE_CURE_BLINDNESS:
         healup(0, 0, FALSE, TRUE);
         break;
     case SPE_CURE_SICKNESS:
         if (Sick)
+/*JP
             You("are no longer ill.");
+*/
+            Your("\95a\8bC\82Í\92¼\82Á\82½\81D");
         if (Slimed)
+/*JP
             make_slimed(0L, "The slime disappears!");
+*/
+            make_slimed(0L, "\83X\83\89\83C\83\80\82Í\8fÁ\82¦\82½\81I");
         healup(0, 0, TRUE, FALSE);
         break;
     case SPE_CREATE_FAMILIAR:
         (void) make_familiar((struct obj *) 0, u.ux, u.uy, FALSE);
         break;
     case SPE_CLAIRVOYANCE:
-        if (!BClairvoyant)
-            do_vicinity_map();
+        if (!BClairvoyant) {
+            if (role_skill >= P_SKILLED)
+                pseudo->blessed = 1; /* detect monsters as well as map */
+            do_vicinity_map(pseudo);
         /* at present, only one thing blocks clairvoyance */
-        else if (uarmh && uarmh->otyp == CORNUTHAUM)
+        } else if (uarmh && uarmh->otyp == CORNUTHAUM)
+/*JP
             You("sense a pointy hat on top of your %s.", body_part(HEAD));
+*/
+            You("\82Æ\82ª\82Á\82½\96X\8eq\82ð%s\82Ì\8fã\82É\94­\8c©\82µ\82½\81D", body_part(HEAD));
         break;
     case SPE_PROTECTION:
         cast_protection();
@@ -1163,32 +1487,64 @@ boolean atme;
     return 1;
 }
 
+/*ARGSUSED*/
+STATIC_OVL boolean
+spell_aim_step(arg, x, y)
+genericptr_t arg UNUSED;
+int x, y;
+{
+    if (!isok(x,y))
+        return FALSE;
+    if (!ZAP_POS(levl[x][y].typ)
+        && !(IS_DOOR(levl[x][y].typ) && (levl[x][y].doormask & D_ISOPEN)))
+        return FALSE;
+    return TRUE;
+}
+
 /* Choose location where spell takes effect. */
 STATIC_OVL int
 throwspell()
 {
-    coord cc;
+    coord cc, uc;
     struct monst *mtmp;
 
     if (u.uinwater) {
+/*JP
         pline("You're joking! In this weather?");
+*/
+        pline("\90\85\92\86\82Å\89½\82ð\82µ\82æ\82¤\82Á\82Ä\82¢\82¤\82ñ\82¾\82¢\81H");
         return 0;
     } else if (Is_waterlevel(&u.uz)) {
+/*JP
         You("had better wait for the sun to come out.");
+*/
+        You("\91¾\97z\82ª\8c»\82ê\82é\82Ü\82Å\91Ò\82Á\82½\82Ù\82¤\82ª\82æ\82¢\82¾\82ë\82¤\81D");
         return 0;
     }
 
+/*JP
     pline("Where do you want to cast the spell?");
+*/
+    pline("\82Ç\82±\82É\8cü\82©\82Á\82Ä\96\82\96@\82ð\8f¥\82¦\82é\81H");
     cc.x = u.ux;
     cc.y = u.uy;
+/*JP
     if (getpos(&cc, TRUE, "the desired position") < 0)
+*/
+    if (getpos(&cc, TRUE, "\96]\82Ý\82Ì\8fê\8f\8a") < 0)
         return 0; /* user pressed ESC */
     /* The number of moves from hero to where the spell drops.*/
     if (distmin(u.ux, u.uy, cc.x, cc.y) > 10) {
+/*JP
         pline_The("spell dissipates over the distance!");
+*/
+        pline("\89\93\82·\82¬\82é\81I");
         return 0;
     } else if (u.uswallow) {
+/*JP
         pline_The("spell is cut short!");
+*/
+        pline("\82¾\82ß\82¾\81I\8bß\82·\82¬\82é\81I");
         exercise(A_WIS, FALSE); /* What were you THINKING! */
         u.dx = 0;
         u.dy = 0;
@@ -1196,10 +1552,18 @@ throwspell()
     } else if ((!cansee(cc.x, cc.y)
                 && (!(mtmp = m_at(cc.x, cc.y)) || !canspotmon(mtmp)))
                || IS_STWALL(levl[cc.x][cc.y].typ)) {
+/*JP
         Your("mind fails to lock onto that location!");
+*/
+        You("\82»\82±\82É\8cü\82©\82Á\82Ä\8fW\92\86\82µ\82½\82ª\8e¸\94s\82µ\82½\81I");
         return 0;
     }
 
+    uc.x = u.ux;
+    uc.y = u.uy;
+
+    walk_path(&uc, &cc, spell_aim_step, (genericptr_t) 0);
+
     u.dx = cc.x;
     u.dy = cc.y;
     return 1;
@@ -1287,26 +1651,58 @@ losespells()
  *      are learned, they get inserted into sorted order rather than be
  *      appended to the end of the list?
  */
-static const char *spl_sortchoices[] = {
+enum spl_sort_types {
+    SORTBY_LETTER = 0,
+    SORTBY_ALPHA,
+    SORTBY_LVL_LO,
+    SORTBY_LVL_HI,
+    SORTBY_SKL_AL,
+    SORTBY_SKL_LO,
+    SORTBY_SKL_HI,
+    SORTBY_CURRENT,
+    SORTRETAINORDER,
+
+    NUM_SPELL_SORTBY
+};
+
+static const char *spl_sortchoices[NUM_SPELL_SORTBY] = {
+/*JP
     "by casting letter",
-#define SORTBY_LETTER 0
+*/
+    "\91I\91ð\82·\82é\95\8e\9a\8f\87",
+/*JP
     "alphabetically",
-#define SORTBY_ALPHA 1
+*/
+    "\95\8e\9a\83R\81[\83h\8f\87",
+/*JP
     "by level, low to high",
-#define SORTBY_LVL_LO 2
+*/
+    "\83\8c\83x\83\8b\8f¸\8f\87",
+/*JP
     "by level, high to low",
-#define SORTBY_LVL_HI 3
+*/
+    "\83\8c\83x\83\8b\8d~\8f\87",
+/*JP
     "by skill group, alphabetized within each group",
-#define SORTBY_SKL_AL 4
+*/
+    "\83X\83L\83\8b\83O\83\8b\81[\83v\96\88\82É\95\8e\9a\83R\81[\83h\8f\87",
+/*JP
     "by skill group, low to high level within group",
-#define SORTBY_SKL_LO 5
+*/
+    "\83X\83L\83\8b\83O\83\8b\81[\83v\96\88\82É\83\8c\83x\83\8b\8f¸\8f\87",
+/*JP
     "by skill group, high to low level within group",
-#define SORTBY_SKL_HI 6
+*/
+    "\83X\83L\83\8b\83O\83\8b\81[\83v\96\88\82É\83\8c\83x\83\8b\8d~\8f\87",
+/*JP
     "maintain current ordering",
-#define SORTBY_CURRENT 7
+*/
+    "\8c»\8dÝ\82Ì\8f\87\8f\98\82ð\88Û\8e\9d",
     /* a menu choice rather than a sort choice */
+/*JP
     "reassign casting letters to retain current order",
-#define SORTRETAINORDER 8
+*/
+    "\8c»\8dÝ\82Ì\8f\87\8f\98\82ð\95Ï\82¦\82¸\82É\91I\91ð\82·\82é\95\8e\9a\82ð\8dÄ\8a\84\82è\93\96\82Ä",
 };
 static int spl_sortmode = 0;   /* index into spl_sortchoices[] */
 static int *spl_orderindx = 0; /* array of spl_book[] indices */
@@ -1471,15 +1867,24 @@ dovspell()
     struct spell spl_tmp;
 
     if (spellid(0) == NO_SPELL) {
+/*JP
         You("don't know any spells right now.");
+*/
+        You("\96\82\96@\82ð\92m\82ç\82È\82¢\81D");
     } else {
+/*JP
         while (dospellmenu("Currently known spells",
+*/
+        while (dospellmenu("\8c»\8dÝ\92m\82Á\82Ä\82¢\82é\96\82\96@\88ê\97\97",
                            SPELLMENU_VIEW, &splnum)) {
             if (splnum == SPELLMENU_SORT) {
                 if (spellsortmenu())
                     sortspells();
             } else {
+/*JP
                 Sprintf(qbuf, "Reordering spells; swap '%c' with",
+*/
+                Sprintf(qbuf, "'%c'\82Æ\95À\82Ñ\95Ï\82¦\82é\96\82\96@\82Í\81H",
                         spellet(splnum));
                 if (!dospellmenu(qbuf, splnum, &othnum))
                     break;
@@ -1523,11 +1928,18 @@ int *spell_no;
      * given string and are of the form "a - ".
      */
     if (!iflags.menu_tab_sep) {
+#if 0 /*JP*/
         Sprintf(buf, "%-20s     Level %-12s Fail Retention", "    Name",
                 "Category");
+#else
+        Sprintf(buf, "%-20s     Level  %-12s \90¬\8c÷\97¦", "    Name", "\95ª\97Þ");
+#endif
         fmt = "%-20s  %2d   %-12s %3d%% %9s";
     } else {
+/*JP
         Sprintf(buf, "Name\tLevel\tCategory\tFail\tRetention");
+*/
+        Sprintf(buf, "\96¼\91O\t\83\8c\83x\83\8b\t\95ª\97Þ\t\90¬\8c÷\97¦");
         fmt = "%s\t%-d\t%s\t%-d%%\t%s";
     }
     add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf,