OSDN Git Service

Add a monster, Young quicksilver dragon.
[hengband/hengband.git] / src / mind.c
index c4f54fb..4e5788f 100644 (file)
@@ -1,15 +1,15 @@
 /* File: mind.c */
 
-/* Purpose: Mindcrafter code */
-
 /*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
  *
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies.  Other copyrights may also apply.
  */
 
+/* Purpose: Mindcrafter code */
+
 #include "angband.h"
 #include "mindtips.h"
 
@@ -20,20 +20,20 @@ mind_power mind_powers[5] =
     {
       /* Level gained,  cost,  %fail,  name */
 #ifdef JP
-      { 1,   1,  15, "Îî»ë"            , "Precognition"},
-      { 2,   1,  20, "¿À·Ð¹¶·â"        , "Neural Blast"},
-      { 3,   2,  25, "¼¡¸µ¤Î½Ö¤­"      , "Minor Displacement"},
-      { 7,   6,  35, "µõ¶õ¤Î¸¸±Æ"      , "Major Displacement"},
-      { 9,   7,  50, "Àº¿À»ÙÇÛ"        , "Domination"},
-      { 11,  7,  30, "Ç°Æ°¾×·âÃÆ"      , "Pulverise"},
-      { 13, 12,  50, "³»²½"            , "Character Armour"},
-      { 15, 12,  60, "¥µ¥¤¥³¥á¥È¥ê¡¼" , "Psychometry" },
-      { 18, 10,  45, "Àº¿ÀÇÈÆ°", "Mind Wave" },
-      { 23, 15,  50, "¥¢¥É¥ì¥Ê¥ê¥ó¡¦¥É¡¼¥Ô¥ó¥°" , "Adrenaline Channeling"},
-      { 26, 28,  60, "¥Æ¥ì¥­¥Í¥·¥¹" ,"Telekinesis"},
-      { 28, 10,  40, "¥µ¥¤¥­¥Ã¥¯¡¦¥É¥ì¥¤¥ó" ,"Psychic Drain"},
-      { 35, 35,  75, "¸÷¤Î·õ",  "Psycho-Spear"},
-      { 45,150,  85, "´°Á´¤ÊÀ¤³¦",  "The World"},
+      { 1,   1,  15, "Îî»ë"},
+      { 2,   1,  20, "¿À·Ð¹¶·â"},
+      { 3,   2,  25, "¼¡¸µ¤Î½Ö¤­"},
+      { 7,   6,  35, "µõ¶õ¤Î¸¸±Æ"},
+      { 9,   7,  50, "Àº¿À»ÙÇÛ"},
+      { 11,  7,  30, "Ç°Æ°¾×·âÃÆ"},
+      { 13, 12,  50, "³»²½"},
+      { 15, 12,  60, "¥µ¥¤¥³¥á¥È¥ê¡¼"},
+      { 18, 10,  45, "Àº¿ÀÇÈÆ°"},
+      { 23, 15,  50, "¥¢¥É¥ì¥Ê¥ê¥ó¡¦¥É¡¼¥Ô¥ó¥°"},
+      { 26, 28,  60, "¥Æ¥ì¥­¥Í¥·¥¹"},
+      { 28, 10,  40, "¥µ¥¤¥­¥Ã¥¯¡¦¥É¥ì¥¤¥ó"},
+      { 35, 35,  75, "¸÷¤Î·õ"},
+      { 45,150,  85, "´°Á´¤ÊÀ¤³¦"},
       { 99,  0,   0, ""},
       { 99,  0,   0, ""},
       { 99,  0,   0, ""},
@@ -72,20 +72,20 @@ mind_power mind_powers[5] =
     {
       /* Level gained,  cost,  %fail,  name */
 #ifdef JP
-      { 1,   1,  15, "¾®Î¶"            , "Small Force Ball"},
-      { 3,   3,  30, "Á®¸÷"            , "Flash Light"},
-      { 5,   6,  35, "Éñ¶õ½Ñ"          , "Flying Technique"},
-      { 8,   5,  40, "¥«¥á¥Ï¥áÇÈ"      , "Kamehameha"},
-      { 10,  7,  45, "ÂÐËâË¡Ëɸæ"      , "Magic Resistance"},
-      { 13,  5,  60, "Îýµ¤"            , "Improve Force"},
-      { 17, 17,  50, "ŻƮµ¤"          , "Aura of Force"},
-      { 20, 20,  50, "¾×ÇÈ"            , "Shock Power"},
-      { 23, 18,  55, "×Âζ"            , "Large Force Ball"},
-      { 25, 30,  70, "¤¤¤Æ¤Ä¤¯ÇÈÆ°"    , "Dispel"},
-      { 28, 26,  50, "¸¸Î´­"        , "Summon Ghost"},
-      { 32, 35,  65, "Îû¹ö²Ð±ê"        , "Exploding Frame"},
-      { 38, 42,  75, "Ķ¥«¥á¥Ï¥áÇÈ"    , "Super Kamehameha"},
-      { 44, 50,  80, "¸÷®°ÜÆ°"        , "Light Speed"},
+      { 1,   1,  15, "¾®Î¶"},
+      { 3,   3,  30, "Á®¸÷"},
+      { 5,   6,  35, "Éñ¶õ½Ñ"},
+      { 8,   5,  40, "¥«¥á¥Ï¥áÇÈ"},
+      { 10,  7,  45, "ÂÐËâË¡Ëɸæ"},
+      { 13,  5,  60, "Îýµ¤"},
+      { 17, 17,  50, "ŻƮµ¤"},
+      { 20, 20,  50, "¾×ÇÈ"},
+      { 23, 18,  55, "×Âζ"},
+      { 25, 30,  70, "¤¤¤Æ¤Ä¤¯ÇÈÆ°"},
+      { 28, 26,  50, "¸¸Î´­"},
+      { 32, 35,  65, "Îû¹ö²Ð±ê"},
+      { 38, 42,  75, "Ķ¥«¥á¥Ï¥áÇÈ"},
+      { 44, 50,  80, "¸÷®°ÜÆ°"},
       { 99,  0,   0, ""},
       { 99,  0,   0, ""},
       { 99,  0,   0, ""},
@@ -124,27 +124,27 @@ mind_power mind_powers[5] =
     {
       /* Level gained,  cost,  %fail,  name */
 #ifdef JP
-      {  8,  5,  40, "»¦µ¤´¶ÃÎ"        , "Detect Atmosphere of Menace"},
-      { 15, 20,   0, "ÆÍ·â"            , "Charge"},
-      { 20, 15,   0, "¥È¥é¥Ã¥×Ê´ºÕ"    , "Smash a Trap"},
-      { 25, 20,  60, "ÃÏ¿Ì"            , "Quake"},
-      { 30, 80,  75, "³§»¦¤·"  , "Massacre"},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
-      { 99,  0,   0, ""                , ""},
+      {  8,  5,  40, "»¦µ¤´¶ÃÎ"},
+      { 15, 20,   0, "ÆÍ·â"},
+      { 20, 15,   0, "¥È¥é¥Ã¥×Ê´ºÕ"},
+      { 25, 20,  60, "ÃÏ¿Ì"},
+      { 30, 80,  75, "³§»¦¤·"},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
+      { 99,  0,   0, ""},
 #else
       {  8,  5,  40, "Detect Atmosphere of Menace"},
       { 15, 20,   0, "Charge"},
@@ -176,30 +176,30 @@ mind_power mind_powers[5] =
     {
       /* Level gained,  cost,  %fail,  name */
 #ifdef JP
-      { 1,   1,  15, "¿¿¸«¤Î¶À"                , "Mirror of Seeing"},
-      { 1,   2,  40, "¶ÀÀ¸À®"          , "Making a Mirror"},
-      { 2,   2,  20, "¸÷¤Î¤·¤º¤¯"      , "Drip of Light"},
-      { 3,   2,  20, "ÏĤó¤À¶À"                , "Warped Mirror"},
-      { 5,   3,  35, "Á®¸÷¶À"          , "Mirror of Light"},
-      { 6,   5,  35, "×Ǥ¨¤ë¶À"                , "Mirror of Wandering"},
-
-      { 10,  5,  30, "Èù¿Ð±£¤ì"                , "Robe of Dust"},
-      { 12, 12,  30, "ÄÉÊü¤Î¶À"         , "Banishing Mirror"},
-      { 15, 15,  30, "¶ÀºÕ¤­"          , "Mirror Clashing"},
-      { 19, 13,  30, "ºÅ̲¶À"          , "Mirror Sleeping"},
-      { 23, 18,  50, "¥·¡¼¥«¡¼¥ì¥¤"    , "Seeker Ray"},
-
-      { 25, 20,  40, "¶À¤ÎÉõ°õ"         , "Seal of Mirror"},
-      { 27, 30,  60, "¿å¶À¤Î½â"                , "Shield of Water"},
-      { 29, 30,  60, "¥¹¡¼¥Ñ¡¼¥ì¥¤"     , "Super Ray"},
-      { 31, 35,  60, "¸¸ÏǤθ÷"         , "Illusion Light"},
-      { 33, 50,  80, "¶À¤Î¹ñ"          , "Mirror Shift"},
-
-      { 36, 30,  80, "¶ÀÈ´¤±"          , "Mirror Tunnel"},
-      { 38, 40,  70, "µ¢´Ô¤Î¶À"         , "Mirror of Recall"},
-      { 40, 50,  55, "±Æʬ¿È"          , "Multi-Shadow"},
-      { 43, 55,  70, "ÉõËâ·ë³¦"                , "Binding Field"},
-      { 46, 70,  75, "¥é¥Õ¥Î¡¼¥ë¤Î¶À"  , "Mirror of Ruffnor"},
+      { 1,   1,  15, "¿¿¸«¤Î¶À"},
+      { 1,   2,  40, "¶ÀÀ¸À®"},
+      { 2,   2,  20, "¸÷¤Î¤·¤º¤¯"},
+      { 3,   2,  20, "ÏĤó¤À¶À"},
+      { 5,   3,  35, "Á®¸÷¶À"},
+      { 6,   5,  35, "×Ǥ¨¤ë¶À"},
+
+      { 10,  5,  30, "Èù¿Ð±£¤ì"},
+      { 12, 12,  30, "ÄÉÊü¤Î¶À"},
+      { 15, 15,  30, "¶ÀºÕ¤­"},
+      { 19, 13,  30, "ºÅ̲¶À"},
+      { 23, 18,  50, "¥·¡¼¥«¡¼¥ì¥¤"},
+
+      { 25, 20,  40, "¶À¤ÎÉõ°õ"},
+      { 27, 30,  60, "¿å¶À¤Î½â"},
+      { 29, 30,  60, "¥¹¡¼¥Ñ¡¼¥ì¥¤"},
+      { 31, 35,  60, "¸¸ÏǤθ÷"},
+      { 33, 50,  80, "¶À¤Î¹ñ"},
+
+      { 36, 30,  80, "¶ÀÈ´¤±"},
+      { 38, 40,  70, "µ¢´Ô¤Î¶À"},
+      { 40, 50,  55, "±Æʬ¿È"},
+      { 43, 55,  70, "ÉõËâ·ë³¦"},
+      { 46, 70,  75, "¥é¥Õ¥Î¡¼¥ë¤Î¶À"},
 #else
       { 1,   1,  15, "Mirror of Seeing"},
       { 1,   2,  40, "Making a Mirror"},
@@ -234,27 +234,27 @@ mind_power mind_powers[5] =
     {
       /* Level gained,  cost,  %fail,  name */
 #ifdef JP
-      {  1,  1,  20, "°Å°ÇÀ¸À®"        , "Create Darkness"},
-      {  2,  2,  25, "¼þÊÕÄ´ºº"        , "Detect Near"},
-      {  3,  3,  25, "ÍÕ±£¤ì"          , "Hide in Leafs"},
-      {  5,  3,  30, "ÊѤï¤ê¿È"        , "Quick Substitution"},
-      {  7,  8,  35, "¹âÈô¤Ó"          , "Absconding"},
-      {  8, 10,  35, "°ì·âΥæ"                , "Hit And Away"},
-      { 10, 10,  40, "¶âÇû¤ê"          , "Bind Monster"},
-      { 12, 12,  70, "¸Å¤Î¸ýÅÁ"                , "Ancient Knowledge"},
-      { 15, 10,  50, "Éâ±À"            , "Floating"},
-      { 17, 12,  45, "²ÐÆÛ"            , "Hide in Flame"},
-      { 18, 20,  40, "Æþ¿È"            , "Surprise Attack"},
-      { 20,  5,  50, "ȬÊý¼ê΢·õ"      , "Syuriken Spread"},
-      { 22, 15,  55, "º¿³ù"            , "Chain Hook"},
-      { 25, 32,  60, "±ì¶Ì"            , "Smoke Ball"},
-      { 28, 32,  60, "ž¿È"            , "Swap Step"},
-      { 30, 30,  70, "Çúȯ¤ÎÌæ¾Ï"      , "Glyph of Explosion"},
-      { 32, 40,  40, "ÅÚÆÛ"            , "Hide in Mud"},
-      { 34, 35,  50, "̸±£¤ì"          , "Hide in Mist"},
-      { 38, 40,  60, "Îû¹ö²Ð±ê"                , "Flame Hell"},
-      { 41, 50,  55, "ʬ¿È"            , "Multi Shadow"},
-      { 99,  0,   0, ""                , ""},
+      {  1,  1,  20, "°Å°ÇÀ¸À®"},
+      {  2,  2,  25, "¼þÊÕÄ´ºº"},
+      {  3,  3,  25, "ÍÕ±£¤ì"},
+      {  5,  3,  30, "ÊѤï¤ê¿È"},
+      {  7,  8,  35, "¹âÈô¤Ó"},
+      {  8, 10,  35, "°ì·âΥæ"},
+      { 10, 10,  40, "¶âÇû¤ê"},
+      { 12, 12,  70, "¸Å¤Î¸ýÅÁ"},
+      { 15, 10,  50, "Éâ±À"},
+      { 17, 12,  45, "²ÐÆÛ"},
+      { 18, 20,  40, "Æþ¿È"},
+      { 20,  5,  50, "ȬÊý¼ê΢·õ"},
+      { 22, 15,  55, "º¿³ù"},
+      { 25, 32,  60, "±ì¶Ì"},
+      { 28, 32,  60, "ž¿È"},
+      { 30, 30,  70, "Çúȯ¤ÎÌæ¾Ï"},
+      { 32, 40,  40, "ÅÚÆÛ"},
+      { 34, 35,  50, "̸±£¤ì"},
+      { 38, 40,  60, "Îû¹ö²Ð±ê"},
+      { 41, 50,  55, "ʬ¿È"},
+      { 99,  0,   0, ""},
 #else
       {  1,  1,  20, "Create Darkness"},
       {  2,  2,  25, "Detect Near"},
@@ -295,128 +295,128 @@ void mindcraft_info(char *p, int use_mind, int power)
        cptr s_dur = "dur ";
        cptr s_range = "range ";
 #endif
-  int plev = p_ptr->lev;
+       int plev = p_ptr->lev;
 
-  strcpy(p, "");
+       strcpy(p, "");
 
-  switch (use_mind)
-    {
-    case MIND_MINDCRAFTER:
-      switch (power)
+       switch (use_mind)
        {
-       case 0:  break;
-       case 1:  sprintf(p, " %s%dd%d", s_dam, 3 + ((plev - 1) / 4), 3 + plev/15); break;
-       case 2:  sprintf(p, " %s10", s_range); break;
-       case 3:  sprintf(p, " %s%d", s_range, plev * 5);  break;
-       case 4:  break;
-       case 5: sprintf(p, " %s%dd8", s_dam, 8 + ((plev - 5) / 4));  break;
-       case 6:  sprintf(p, " %s%d", s_dur, plev);  break;
-       case 7:  break;
-       case 8:  sprintf(p, (plev < 25 ? " %s%d" : " %sd%d"), s_dam, (plev < 25 ? plev * 3 / 2 : plev * ((plev - 5) / 10 + 1))); break;
-       case 9:  sprintf(p, " %s10+d%d", s_dur, plev * 3 / 2);  break;
+       case MIND_MINDCRAFTER:
+               switch (power)
+               {
+               case 0:  break;
+               case 1:  sprintf(p, " %s%dd%d", s_dam, 3 + ((plev - 1) / 4), 3 + plev/15); break;
+               case 2:  sprintf(p, " %s10", s_range); break;
+               case 3:  sprintf(p, " %s%d", s_range, plev * 5);  break;
+               case 4:  break;
+               case 5: sprintf(p, " %s%dd8", s_dam, 8 + ((plev - 5) / 4));  break;
+               case 6:  sprintf(p, " %s%d", s_dur, plev);  break;
+               case 7:  break;
+               case 8:  sprintf(p, (plev < 25 ? " %s%d" : " %sd%d"), s_dam, (plev < 25 ? plev * 3 / 2 : plev * ((plev - 5) / 10 + 1))); break;
+               case 9:  sprintf(p, " %s10+d%d", s_dur, plev * 3 / 2);  break;
 #ifdef JP
-       case 10: sprintf(p, " ºÇÂç½ÅÎÌ:%d.%dkg", lbtokg1(plev * 15),lbtokg2(plev * 15));  break;
+               case 10: sprintf(p, " ºÇÂç½ÅÎÌ:%d.%dkg", lbtokg1(plev * 15),lbtokg2(plev * 15));  break;
 #else
-       case 10: sprintf(p, " max wgt %d", plev * 15);  break;
+               case 10: sprintf(p, " max wgt %d", plev * 15);  break;
 #endif
-       case 11: sprintf(p, " %s%dd6", s_dam, plev / 2);  break;
-       case 12: sprintf(p, " %sd%d+%d", s_dam, plev * 3, plev * 3); break;
+               case 11: sprintf(p, " %s%dd6", s_dam, plev / 2);  break;
+               case 12: sprintf(p, " %sd%d+%d", s_dam, plev * 3, plev * 3); break;
 #ifdef JP
-       case 13: sprintf(p, " ¹ÔÆ°:%d²ó", (p_ptr->csp + p_ptr->energy - 50)/100); break;
+               case 13: sprintf(p, " ¹ÔÆ°:%ld²ó", (long int)(p_ptr->csp + 100-p_ptr->energy_need - 50)/100); break;
 #else
-       case 13: sprintf(p, " %d acts.", (p_ptr->csp + p_ptr->energy - 50)/100); break;
+               case 13: sprintf(p, " %ld acts.", (p_ptr->csp + 100-p_ptr->energy_need - 50)/100); break;
 #endif
-       }
-      break;
-    case MIND_KI:
-      {
-       int boost = p_ptr->magic_num1[0];
+               }
+               break;
+       case MIND_KI:
+       {
+               int boost = p_ptr->magic_num1[0];
 
-       if (heavy_armor()) boost /= 2;
+               if (heavy_armor()) boost /= 2;
 
-       switch (power)
-         {
-         case 0:  sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5) + boost / 12); break;
-         case 1:  break;
-         case 2:  sprintf(p, " %s%d+d30", s_dur, 30 + boost / 5); break;
-         case 3:  sprintf(p, " %s%dd5", s_dam, 5 + ((plev - 1) / 5) + boost / 10); break;
-         case 4:  sprintf(p, " %s%d+d20", s_dur, 20 + boost / 5); break;
-         case 5:  break;
-         case 6:  sprintf(p, " %s%d+d%d", s_dur, 15 + boost / 7, plev / 2); break;
-         case 7:  sprintf(p, " %s%dd8", s_dam, 8 + ((plev - 5) / 5) + boost / 12); break;
-         case 8:  sprintf(p, " %s10d6+%d", s_dam, plev * 3 / 2 + boost * 3 / 5); break;
-         case 9:  break;
+               switch (power)
+               {
+               case 0:  sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5) + boost / 12); break;
+               case 1:  break;
+               case 2:  sprintf(p, " %s%d+d30", s_dur, 30 + boost / 5); break;
+               case 3:  sprintf(p, " %s%dd5", s_dam, 5 + ((plev - 1) / 5) + boost / 10); break;
+               case 4:  sprintf(p, " %s%d+d20", s_dur, 20 + boost / 5); break;
+               case 5:  break;
+               case 6:  sprintf(p, " %s%d+d%d", s_dur, 15 + boost / 7, plev / 2); break;
+               case 7:  sprintf(p, " %s%dd8", s_dam, 8 + ((plev - 5) / 5) + boost / 12); break;
+               case 8:  sprintf(p, " %s10d6+%d", s_dam, plev * 3 / 2 + boost * 3 / 5); break;
+               case 9:  break;
 #ifdef JP
-         case 10: sprintf(p, " ºÇÂç%dɤ", 1+boost/100); break;
+               case 10: sprintf(p, " ºÇÂç%dÂÎ", 1+boost/100); break;
 #else
-         case 10: sprintf(p, " max %d", 1+boost/100); break;
+               case 10: sprintf(p, " max %d", 1+boost/100); break;
 #endif
-         case 11: sprintf(p, " %s%d", s_dam, 100 + plev + boost); break;
-         case 12: sprintf(p, " %s%dd15", s_dam, 10 + plev / 2 + boost * 3 / 10); break;
+               case 11: sprintf(p, " %s%d", s_dam, 100 + plev + boost); break;
+               case 12: sprintf(p, " %s%dd15", s_dam, 10 + plev / 2 + boost * 3 / 10); break;
 #ifdef JP
-         case 13: sprintf(p, " ¹ÔÆ°:%d+d16²ó", 16+boost/20); break;
+               case 13: sprintf(p, " ¹ÔÆ°:%d+d16²ó", 16+boost/20); break;
 #else
-         case 13: sprintf(p, " %d+d16 acts", 16+boost/20); break;
+               case 13: sprintf(p, " %d+d16 acts", 16+boost/20); break;
 #endif
-         }
-       break;
-      case MIND_MIRROR_MASTER:
+               }
+               break;
+       }
+       case MIND_MIRROR_MASTER:
        {
-         switch (power)
-           {
-           case 0:  break;
-           case 1:  break;
-           case 2:  sprintf(p, " %s%dd4", s_dam,  3 + ((plev - 1) / 5) ); break;
-           case 3:  sprintf(p, " %s10", s_range); break;
-           case 4:  break;
-           case 5:  sprintf(p, " %s%d", s_range, plev *5); break;
-           case 6:  sprintf(p, " %s20+d20", s_dur);  break;
-           case 7:  break;
-           case 8:  sprintf(p, " %s%dd8", s_dam, 8+((plev -5)/4) ); break;
-           case 9:  break;
-           case 10: sprintf(p, " %s%dd8", s_dam, 11+(plev-5)/4 ); break;
-           case 11: break;
-           case 12: sprintf(p, " %s20+d20", s_dur);  break;
-           case 13: sprintf(p, " %s150+d%d", s_dam, plev*2 ); break;
-           case 14: break;
-           case 15: break;
-           case 16: sprintf(p, " %s%d", s_range, plev/2 +10); break;
-           case 17: break;
-           case 18: sprintf(p, " %s6+d6", s_dur);  break;
-           case 19: sprintf(p, " %s%d", s_dam, plev*11+5 ); break;
-           case 20: sprintf(p, " %s4+d4", s_dur);  break;
-           }
-         break;
+               switch (power)
+               {
+               case 0:  break;
+               case 1:  break;
+               case 2:  sprintf(p, " %s%dd4", s_dam,  3 + ((plev - 1) / 5) ); break;
+               case 3:  sprintf(p, " %s10", s_range); break;
+               case 4:  break;
+               case 5:  sprintf(p, " %s%d", s_range, plev *5); break;
+               case 6:  sprintf(p, " %s20+d20", s_dur);  break;
+               case 7:  break;
+               case 8:  sprintf(p, " %s%dd8", s_dam, 8+((plev -5)/4) ); break;
+               case 9:  break;
+               case 10: sprintf(p, " %s%dd8", s_dam, 11+(plev-5)/4 ); break;
+               case 11: break;
+               case 12: sprintf(p, " %s20+d20", s_dur);  break;
+               case 13: sprintf(p, " %s150+d%d", s_dam, plev*2 ); break;
+               case 14: break;
+               case 15: break;
+               case 16: sprintf(p, " %s%d", s_range, plev/2 +10); break;
+               case 17: break;
+               case 18: sprintf(p, " %s6+d6", s_dur);  break;
+               case 19: sprintf(p, " %s%d", s_dam, plev*11+5 ); break;
+               case 20: sprintf(p, " %s4+d4", s_dur);  break;
+               }
+               break;
        }
-      case MIND_NINJUTSU:
+       case MIND_NINJUTSU:
        {
-         switch (power)
-           {
-           case 0:  break;
-           case 1:  break;
-           case 2:  sprintf(p, " %s10", s_range); break;
-           case 3:  break;
-           case 4:  sprintf(p, " %s%d", s_range , plev *5); break;
-           case 5:  sprintf(p, " %s30", s_range); break;
-           case 6:  break;
-           case 7:  break;
-           case 8:  sprintf(p, " %s20+d20", s_dur);  break;
-           case 9:  sprintf(p, " %s%d", s_dam, (50+plev)/2 ); break;
-           case 10: break;
-           case 11: break;
-           case 12: break;
-           case 13: break;
-           case 14: break;
-           case 15: break;
-           case 16: sprintf(p, " %s%d+d%d", s_dur, plev/2, plev/2);  break;
-           case 17: sprintf(p, " %s%d*3", s_dam, (75+plev*2/3)/2 ); break;
-           case 18: sprintf(p, " %s%dd10", s_dam, 6+plev/8 ); break;
-           case 19: sprintf(p, " %s6+d6", s_dur);  break;
-           }
-         break;
+               switch (power)
+               {
+               case 0:  break;
+               case 1:  break;
+               case 2:  sprintf(p, " %s10", s_range); break;
+               case 3:  break;
+               case 4:  sprintf(p, " %s%d", s_range , plev *5); break;
+               case 5:  sprintf(p, " %s30", s_range); break;
+               case 6:  break;
+               case 7:  break;
+               case 8:  sprintf(p, " %s20+d20", s_dur);  break;
+               case 9:  sprintf(p, " %s%d", s_dam, (50+plev)/2 ); break;
+               case 10: break;
+               case 11: break;
+               case 12: break;
+               case 13: break;
+               case 14: break;
+               case 15: break;
+               case 16: sprintf(p, " %s%d+d%d", s_dur, plev/2, plev/2);  break;
+               case 17: sprintf(p, " %s%d*3", s_dam, (75+plev*2/3)/2 ); break;
+               case 18: sprintf(p, " %s%dd10", s_dam, 6+plev/8 ); break;
+               case 19: sprintf(p, " %s6+d6", s_dur);  break;
+               }
+               break;
+       }
        }
-      }
-    }
 }
 
   /*
@@ -524,15 +524,18 @@ void mindcraft_info(char *p, int use_mind, int power)
 
 #ifdef ALLOW_REPEAT /* TNB */
 
-      /* Get the spell, if available */
-      if (repeat_pull(sn))
+       /* Get the spell, if available */
+       if (repeat_pull(sn))
        {
-         /* Verify the spell */
-         if (mind_ptr->info[*sn].min_lev <= plev)
-           {
-             /* Success */
-             return (TRUE);
-           }
+               /* Hack -- If requested INVEN_FORCE(1111), pull again */
+               if (*sn == INVEN_FORCE) repeat_pull(sn);
+
+               /* Verify the spell */
+               if (mind_ptr->info[*sn].min_lev <= plev)
+               {
+                       /* Success */
+                       return (TRUE);
+               }
        }
 
 #endif /* ALLOW_REPEAT -- TNB */
@@ -568,15 +571,15 @@ void mindcraft_info(char *p, int use_mind, int power)
 #else
                (void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
 #endif
-               p, I2A(0), I2A(num - 1), p);
+               p, I2A(0), I2A(num - 1), p);
        }
 
        if (use_menu && !only_browse) screen_save();
        /* Get a spell from the user */
 
-        choice= (always_show_list || use_menu) ? ESCAPE:1 ;
-        while (!flag)
-        {
+       choice= (always_show_list || use_menu) ? ESCAPE:1 ;
+       while (!flag)
+       {
                if(choice==ESCAPE) choice = ' '; 
                else if( !get_com(out_val, &choice, TRUE) )break;
 
@@ -588,7 +591,6 @@ void mindcraft_info(char *p, int use_mind, int power)
                                {
                                        if (!only_browse) screen_load();
                                        return (FALSE);
-                                       break;
                                }
 
                                case '8':
@@ -610,6 +612,7 @@ void mindcraft_info(char *p, int use_mind, int power)
                                case 'x':
                                case 'X':
                                case '\r':
+                               case '\n':
                                {
                                        i = menu_line - 1;
                                        ask = FALSE;
@@ -692,9 +695,7 @@ put_str(format("Lv   %s   Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind
                                                        chance += 5 * (mana_cost - p_ptr->csp);
                                                }
 
-                                               if (p_ptr->pseikaku == SEIKAKU_NAMAKE) chance += 10;
-                                               if (p_ptr->pseikaku == SEIKAKU_KIREMONO) chance -= 3;
-                                               if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) chance++;
+                                               chance += p_ptr->to_m_chance;
 
                                                /* Extract the minimum failure rate */
                                                minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
@@ -808,14 +809,10 @@ put_str(format("Lv   %s   Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind
        if (redraw && !only_browse) screen_load();
 
        /* Show choices */
-       if (show_choices)
-       {
-               /* Update */
-               p_ptr->window |= (PW_SPELL);
+       p_ptr->window |= (PW_SPELL);
 
-               /* Window stuff */
-               window_stuff();
-       }
+       /* Window stuff */
+       window_stuff();
 
        /* Abort if needed */
        if (!flag) return (FALSE);
@@ -852,7 +849,7 @@ static bool cast_mindcrafter_spell(int spell)
                {
                        chg_virtue(V_KNOWLEDGE, 1);
                        chg_virtue(V_ENLIGHTEN, 1);
-                       wiz_lite(FALSE, FALSE);
+                       wiz_lite(FALSE);
                }
                else if (plev > 19)
                        map_area(DETECT_RAD_MAP);
@@ -862,7 +859,7 @@ static bool cast_mindcrafter_spell(int spell)
                        b = detect_monsters_normal(DETECT_RAD_DEFAULT);
                        if (plev > 14) b |= detect_monsters_invis(DETECT_RAD_DEFAULT);
                        if (plev > 4)  {
-                               b |= detect_traps(DETECT_RAD_DEFAULT);
+                               b |= detect_traps(DETECT_RAD_DEFAULT, TRUE);
                                b |= detect_doors(DETECT_RAD_DEFAULT);
                        }
                }
@@ -885,18 +882,18 @@ if (!b) msg_print("
                /* Mindblast */
                if (!get_aim_dir(&dir)) return FALSE;
 
-               if (randint(100) < plev * 2)
+               if (randint1(100) < plev * 2)
                        fire_beam(GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)));
                else
                        fire_ball(GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)), 0);
                break;
        case 2:
                /* Minor displace */
-               teleport_player(10);
+               teleport_player(10, 0L);
                break;
        case 3:
                /* Major displace */
-               teleport_player(plev * 5);
+               teleport_player(plev * 5, 0L);
                break;
        case 4:
                /* Domination */
@@ -933,7 +930,6 @@ if (!b) msg_print("
                        return psychometry();
                else
                        return ident_spell(FALSE);
-               break;
        case 8:
                /* Mindwave */
 #ifdef JP
@@ -946,7 +942,7 @@ msg_print("
                        project(0, 2 + plev / 10, py, px,
                        (plev * 3), GF_PSI, PROJECT_KILL, -1);
                else
-                       (void)mindblast_monsters(randint(plev * ((plev - 5) / 10 + 1)));
+                       (void)mindblast_monsters(randint1(plev * ((plev - 5) / 10 + 1)));
                break;
        case 9:
                /* Adrenaline */
@@ -957,12 +953,12 @@ msg_print("
                 * Only heal when Adrenalin Channeling is not active. We check
                 * that by checking if the player isn't fast and 'heroed' atm.
                 */
-               if (!p_ptr->fast || !p_ptr->hero)
+               if (!IS_FAST() || !IS_HERO())
                {
                        hp_player(plev);
                }
 
-               b = 10 + randint((plev * 3) / 2);
+               b = 10 + randint1((plev * 3) / 2);
                set_hero(b, FALSE);
                /* Haste */
                (void)set_fast(b, FALSE);
@@ -982,13 +978,13 @@ msg_print("
 
                /* This is always a radius-0 ball now */
                if (fire_ball(GF_PSI_DRAIN, dir, b, 0))
-                       p_ptr->energy -= randint(150);
+                       p_ptr->energy_need += randint1(150);
                break;
        case 12:
                /* psycho-spear */
                if (!get_aim_dir(&dir)) return FALSE;
 
-               fire_beam(GF_PSY_SPEAR, dir, randint(plev*3)+plev*3);
+               fire_beam(GF_PSY_SPEAR, dir, randint1(plev*3)+plev*3);
                break;
        case 13:
        {
@@ -1009,7 +1005,8 @@ msg_print("
 #endif
                msg_print(NULL);
 
-               p_ptr->energy += (p_ptr->csp + 950);
+               /* Hack */
+               p_ptr->energy_need -= 1000 + (100 + p_ptr->csp - 50)*TURNS_PER_TICK/10;
 
                /* Redraw map */
                p_ptr->redraw |= (PR_MAP);
@@ -1059,7 +1056,7 @@ static bool cast_force_spell(int spell)
                (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
                break;
        case 2:
-               set_tim_ffall(randint(30) + 30 + boost / 5, FALSE);
+               set_tim_levitation(randint1(30) + 30 + boost / 5, FALSE);
                break;
        case 3:
                project_length = plev / 8 + 3;
@@ -1068,7 +1065,7 @@ static bool cast_force_spell(int spell)
                fire_beam(GF_MISSILE, dir, damroll(5 + ((plev - 1) / 5) + boost / 10, 5));
                break;
        case 4:
-               set_resist_magic(randint(20) + 20 + boost / 5, FALSE);
+               set_resist_magic(randint1(20) + 20 + boost / 5, FALSE);
                break;
        case 5:
 #ifdef JP
@@ -1077,7 +1074,8 @@ static bool cast_force_spell(int spell)
                msg_print("You improved the Force.");
 #endif
                p_ptr->magic_num1[0] += (70 + plev);
-               if (randint(p_ptr->magic_num1[0]) > (plev * 4 + 120))
+               p_ptr->update |= (PU_BONUS);
+               if (randint1(p_ptr->magic_num1[0]) > (plev * 4 + 120))
                {
 #ifdef JP
                        msg_print("µ¤¤¬Ë½Áö¤·¤¿¡ª");
@@ -1094,7 +1092,7 @@ static bool cast_force_spell(int spell)
                else return TRUE;
                break;
        case 6:
-               set_tim_sh_touki(randint(plev / 2) + 15 + boost / 7, FALSE);
+               set_tim_sh_touki(randint1(plev / 2) + 15 + boost / 7, FALSE);
                break;
        case 7:
        {
@@ -1113,11 +1111,12 @@ static bool cast_force_spell(int spell)
                        int oy = y, ox = x;
                        int m_idx = cave[y][x].m_idx;
                        monster_type *m_ptr = &m_list[m_idx];
+                       monster_race *r_ptr = &r_info[m_ptr->r_idx];
                        char m_name[80];
 
                        monster_desc(m_name, m_ptr, 0);
 
-                       if (randint(r_info[m_ptr->r_idx].level * 3 / 2) > rand_int(dam / 2) + dam/2)
+                       if (randint1(r_ptr->level * 3 / 2) > randint0(dam / 2) + dam/2)
                        {
 #ifdef JP
                                msg_format("%s¤ÏÈô¤Ð¤µ¤ì¤Ê¤«¤Ã¤¿¡£", m_name);
@@ -1153,6 +1152,9 @@ static bool cast_force_spell(int spell)
                                        update_mon(m_idx, TRUE);
                                        lite_spot(oy, ox);
                                        lite_spot(ty, tx);
+
+                                       if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+                                               p_ptr->update |= (PU_MON_LITE);
                                }
                        }
                }
@@ -1164,44 +1166,14 @@ static bool cast_force_spell(int spell)
                break;
        case 9:
        {
-               monster_type *m_ptr;
-               char m_name[80];
+               int m_idx;
 
                if (!target_set(TARGET_KILL)) return FALSE;
-               if (!cave[target_row][target_col].m_idx) break;
-               if (!los(py, px, target_row, target_col)) break;
-               m_ptr = &m_list[cave[target_row][target_col].m_idx];
-               monster_desc(m_name, m_ptr, 0);
-               if (m_ptr->invulner)
-               {
-                       m_ptr->invulner = 0;
-#ifdef JP
-msg_format("%s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ï¤Ê¤¤¡£", m_name);
-#else
-                       msg_format("%^s is no longer invulnerable.", m_name);
-#endif
-               }
-               if (m_ptr->fast)
-               {
-                       m_ptr->fast = 0;
-#ifdef JP
-msg_format("%s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
-#else
-                       msg_format("%^s is no longer fast.", m_name);
-#endif
-               }
-               if (m_ptr->slow)
-               {
-                       m_ptr->slow = 0;
-#ifdef JP
-msg_format("%s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
-#else
-                       msg_format("%^s is no longer slow.", m_name);
-#endif
-               }
-               p_ptr->redraw |= (PR_HEALTH);
-               if (p_ptr->riding == cave[target_row][target_col].m_idx) p_ptr->redraw |= (PR_UHEALTH);
-
+               m_idx = cave[target_row][target_col].m_idx;
+               if (!m_idx) break;
+               if (!player_has_los_bold(target_row, target_col)) break;
+               if (!projectable(py, px, target_row, target_col)) break;
+               dispel_monster_status(m_idx);
                break;
        }
        case 10:
@@ -1210,7 +1182,7 @@ msg_format("%s
                bool success = FALSE;
 
                for (i = 0; i < 1 + boost/100; i++)
-                       if (summon_specific(-1, py, px, plev, SUMMON_PHANTOM, FALSE, TRUE, TRUE, FALSE, FALSE))
+                       if (summon_specific(-1, py, px, plev, SUMMON_PHANTOM, PM_FORCE_PET))
                                success = TRUE;
                if (success)
                {
@@ -1239,7 +1211,7 @@ msg_print("
                fire_beam(GF_MANA, dir, damroll(10 + (plev / 2) + boost * 3 / 10, 15));
                break;
        case 13:
-               set_lightspeed(randint(16) + 16 + boost / 20, FALSE);
+               set_lightspeed(randint1(16) + 16 + boost / 20, FALSE);
                break;
        default:
 #ifdef JP
@@ -1250,6 +1222,7 @@ msg_print("
 
        }
        p_ptr->magic_num1[0] = 0;
+       p_ptr->update |= (PU_BONUS);
 
        return TRUE;
 }
@@ -1262,7 +1235,7 @@ static int number_of_mirrors( void )
   int val=0;
   for( x=0 ; x < cur_wid ; x++ ){
     for( y=0 ; y < cur_hgt ; y++ ){
-      if( cave[y][x].feat == FEAT_MIRROR )val++;
+      if (is_mirror_grid(&cave[y][x])) val++;
     }
   }
   return val;
@@ -1280,7 +1253,7 @@ static bool cast_mirror_spell(int spell)
        {
        /* mirror of seeing */
        case 0:
-         tmp = cave[py][px].feat == FEAT_MIRROR ? 4 : 0;
+         tmp = is_mirror_grid(&cave[py][px]) ? 4 : 0;
          if( plev + tmp > 4)detect_monsters_normal(DETECT_RAD_DEFAULT);
          if( plev + tmp > 18 )detect_monsters_invis(DETECT_RAD_DEFAULT);
          if( plev + tmp > 28 )set_tim_esp(plev,FALSE);
@@ -1296,7 +1269,7 @@ static bool cast_mirror_spell(int spell)
        /* drip of light */
        case 1:
          if( number_of_mirrors() < 4 + plev/10 ){
-           warding_mirror();
+           place_mirror();
          }
          else {
 #ifdef JP
@@ -1308,7 +1281,7 @@ msg_format("There are too many mirrors to control!");
          break;
        case 2:
          if (!get_aim_dir(&dir)) return FALSE;
-         if ( plev > 9 && cave[py][px].feat == FEAT_MIRROR ){
+         if ( plev > 9 && is_mirror_grid(&cave[py][px]) ) {
            fire_beam(GF_LITE, dir,damroll(3+((plev-1)/5),4));
          }
          else {
@@ -1317,7 +1290,7 @@ msg_format("There are too many mirrors to control!");
          break;
        /* warped mirror */
        case 3:
-         teleport_player(10);
+         teleport_player(10, 0L);
          break;
        /* mirror of light */
        case 4:
@@ -1325,11 +1298,11 @@ msg_format("There are too many mirrors to control!");
          break;
        /* mirror of wandering */
        case 5:
-         teleport_player(plev * 5);
+         teleport_player(plev * 5, 0L);
          break;
        /* robe of dust */
        case 6:
-         set_dustrobe(20+randint(20),FALSE);
+         set_dustrobe(20+randint1(20),FALSE);
          break;
        /* banishing mirror */
        case 7:
@@ -1346,8 +1319,8 @@ msg_format("There are too many mirrors to control!");
        case 9:
          for(x=0;x<cur_wid;x++){
            for(y=0;y<cur_hgt;y++){
-             if(cave[y][x].feat == FEAT_MIRROR){
-               project(0,2,y,x,plev,GF_OLD_SLEEP,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF|PROJECT_NO_HANGEKI),-1);
+             if (is_mirror_grid(&cave[y][x])) {
+               project(0,2,y,x,plev,GF_OLD_SLEEP,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_HANGEKI),-1);
              }
            }
          }
@@ -1363,7 +1336,7 @@ msg_format("There are too many mirrors to control!");
          break;
        /* shield of water */
        case 12:
-         tmp = 20+randint(20);
+         tmp = 20+randint1(20);
          set_shield(tmp, FALSE);
          if( plev > 31 )set_tim_reflect(tmp, FALSE);
          if( plev > 39 )set_resist_magic(tmp,FALSE);
@@ -1371,12 +1344,12 @@ msg_format("There are too many mirrors to control!");
        /* super ray */
        case 13:
          if (!get_aim_dir(&dir)) return FALSE;
-         fire_beam(GF_SUPER_RAY,dir, 150+randint(2*plev));
+         fire_beam(GF_SUPER_RAY,dir, 150+randint1(2*plev));
          break;
        /* illusion light */
        case 14:
-         tmp = cave[py][px].feat == FEAT_MIRROR ? 4 : 3;
-         slow_monsters();
+         tmp = is_mirror_grid(&cave[py][px]) ? 4 : 3;
+         slow_monsters(plev);
          stun_monsters(plev*tmp);
          confuse_monsters(plev*tmp);
          turn_monsters(plev*tmp);
@@ -1385,7 +1358,7 @@ msg_format("There are too many mirrors to control!");
          break;
        /* mirror shift */
        case 15:
-         if(  cave[py][px].feat != FEAT_MIRROR ){
+         if( !is_mirror_grid(&cave[py][px]) ){
 #ifdef JP
                msg_print("¶À¤Î¹ñ¤Î¾ì½ê¤¬¤ï¤«¤é¤Ê¤¤¡ª");
 #else
@@ -1402,14 +1375,14 @@ msg_format("There are too many mirrors to control!");
 #else
          msg_print("Go through the world of mirror...");
 #endif
-         return dimension_door();
+         return mirror_tunnel();
+
        /* mirror of recall */
        case 17:
-         if(!word_of_recall())return FALSE;
-         break;
+               return word_of_recall();
        /* multi-shadow */
        case 18:
-         set_multishadow(6+randint(6),FALSE);
+         set_multishadow(6+randint1(6),FALSE);
          break;
        /* binding field */
        case 19:
@@ -1421,7 +1394,7 @@ msg_format("There are too many mirrors to control!");
          break;
        /* mirror of Ruffnor */
        case 20:
-         (void)set_invuln(randint(4)+4,FALSE);
+         (void)set_invuln(randint1(4)+4,FALSE);
          break;
        default:
 #ifdef JP
@@ -1482,48 +1455,18 @@ static bool cast_berserk_spell(int spell)
 
                py_attack(y, x, 0);
 
-               if (!player_can_enter(cave[y][x].feat) || is_trap(cave[y][x].feat))
+               if (!player_can_enter(cave[y][x].feat, 0) || is_trap(cave[y][x].feat))
                        break;
 
                y += ddy[dir];
                x += ddx[dir];
 
-               if (player_can_enter(cave[y][x].feat) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
+               if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
                {
-                       int oy, ox;
-
                        msg_print(NULL);
 
-                       /* Save the old location */
-                       oy = py;
-                       ox = px;
-
                        /* Move the player */
-                       py = y;
-                       px = x;
-
-                       forget_flow();
-
-                       /* Redraw the old spot */
-                       lite_spot(oy, ox);
-
-                       /* Redraw the new spot */
-                       lite_spot(py, px);
-
-                       /* Check for new panel (redraw map) */
-                       verify_panel();
-
-                       /* Update stuff */
-                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
-
-                       /* Update the monsters */
-                       p_ptr->update |= (PU_DISTANCE);
-
-                       /* Window stuff */
-                       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
-                       /* Handle stuff XXX XXX XXX */
-                       handle_stuff();
+                       (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
                }
                break;
        }
@@ -1536,28 +1479,11 @@ static bool cast_berserk_spell(int spell)
                break;
        }
        case 3:
-               earthquake(py, px, 8+rand_int(5));
+               earthquake(py, px, 8+randint0(5));
                break;
        case 4:
-       {
-               cave_type       *c_ptr;
-               monster_type    *m_ptr;
-
-               for (dir = 0; dir < 8; dir++)
-               {
-                       y = py + ddy_ddd[dir];
-                       x = px + ddx_ddd[dir];
-                       c_ptr = &cave[y][x];
-
-                       /* Get the monster */
-                       m_ptr = &m_list[c_ptr->m_idx];
-
-                       /* Hack -- attack monsters */
-                       if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
-                               py_attack(y, x, 0);
-               }
+               massacre(py, px);
                break;
-       }
        default:
 #ifdef JP
 msg_print("¤Ê¤Ë¡©");
@@ -1590,12 +1516,12 @@ static bool cast_ninja_spell(int spell)
        case 1:
                if (plev > 44)
                {
-                       wiz_lite(FALSE, TRUE);
+                       wiz_lite(TRUE);
                }
                detect_monsters_normal(DETECT_RAD_DEFAULT);
                if (plev > 4)
                {
-                       detect_traps(DETECT_RAD_DEFAULT);
+                       detect_traps(DETECT_RAD_DEFAULT, TRUE);
                        detect_doors(DETECT_RAD_DEFAULT);
                        detect_stairs(DETECT_RAD_DEFAULT);
                }
@@ -1606,9 +1532,7 @@ static bool cast_ninja_spell(int spell)
                break;
        case 2:
        {
-               teleport_player(10);
-               if (cave[py][px].info & (CAVE_GLOW | CAVE_MNLT)) set_superstealth(FALSE);
-               else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
+               teleport_player(10, 0L);
                break;
        }
        case 3:
@@ -1628,9 +1552,7 @@ static bool cast_ninja_spell(int spell)
        }
        case 4:
        {
-               teleport_player(p_ptr->lev*5);
-               if (cave[py][px].info & (CAVE_GLOW | CAVE_MNLT)) set_superstealth(FALSE);
-               else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
+               teleport_player(p_ptr->lev * 5, 0L);
                break;
        }
        case 5:
@@ -1641,7 +1563,7 @@ static bool cast_ninja_spell(int spell)
                if (cave[y][x].m_idx)
                {
                        py_attack(y, x, 0);
-                       if (rand_int(p_ptr->skill_dis) < 7)
+                       if (randint0(p_ptr->skill_dis) < 7)
 #ifdef JP
 msg_print("¤¦¤Þ¤¯Æ¨¤²¤é¤ì¤Ê¤«¤Ã¤¿¡£");
 #else
@@ -1649,9 +1571,7 @@ msg_print("
 #endif
                        else
                        {
-                               teleport_player(30);
-                               if (cave[py][px].info & (CAVE_GLOW | CAVE_MNLT)) set_superstealth(FALSE);
-                               else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
+                               teleport_player(30, 0L);
                        }
                }
                else
@@ -1674,23 +1594,16 @@ msg_print("
        }
        case 7:
                return ident_spell(FALSE);
-               break;
        case 8:
-               set_tim_ffall(randint(20) + 20, FALSE);
+               set_tim_levitation(randint1(20) + 20, FALSE);
                break;
        case 9:
                fire_ball(GF_FIRE, 0, 50+plev, plev/10+2);
-               teleport_player(30);
-               if (cave[py][px].info & (CAVE_GLOW | CAVE_MNLT)) set_superstealth(FALSE);
-               else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
+               teleport_player(30, 0L);
                set_oppose_fire(plev, FALSE);
                break;
        case 10:
-               project_length = 5;
-               if (!get_aim_dir(&dir)) return FALSE;
-               project_hook(GF_ATTACK, dir, HISSATSU_NYUSIN, PROJECT_STOP | PROJECT_KILL | PROJECT_NO_REF);
-
-               break;
+               return rush_attack(NULL);
        case 11:
        {
                int i;
@@ -1734,7 +1647,9 @@ msg_print("
                if (!target_set(TARGET_KILL)) return FALSE;
                m_idx = cave[target_row][target_col].m_idx;
                if (!m_idx) break;
+               if (m_idx == p_ptr->riding) break;
                if (!player_has_los_bold(target_row, target_col)) break;
+               if (!projectable(py, px, target_row, target_col)) break;
                m_ptr = &m_list[m_idx];
                monster_desc(m_name, m_ptr, 0);
 #ifdef JP
@@ -1749,12 +1664,11 @@ msg_print("
                {
                        int ny = GRID_Y(path_g[i]);
                        int nx = GRID_X(path_g[i]);
-                       
+                       cave_type *c_ptr = &cave[ny][nx];
+
                        if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) &&
-                           cave[ny][nx].feat != FEAT_GLYPH &&
-                           cave[ny][nx].feat != FEAT_MINOR_GLYPH &&
-                           !(cave[ny][nx].feat >= FEAT_PATTERN_START &&
-                             cave[ny][nx].feat <= FEAT_PATTERN_XTRA2))
+                           !(c_ptr->info & CAVE_OBJECT) &&
+                               !pattern_tile(ny, nx))
                        {
                                ty = ny;
                                tx = nx;
@@ -1763,7 +1677,7 @@ msg_print("
                /* Update the old location */
                cave[target_row][target_col].m_idx = 0;
 
-               /* Update the new location */
+               /* Update the new location */
                cave[ty][tx].m_idx = m_idx;
 
                /* Move the monster */
@@ -1771,7 +1685,7 @@ msg_print("
                m_ptr->fx = tx;
 
                /* Wake the monster up */
-               m_ptr->csleep = 0;
+               (void)set_monster_csleep(m_idx, 0);
 
                /* Update the monster (new location) */
                update_mon(m_idx, TRUE);
@@ -1782,7 +1696,17 @@ msg_print("
                /* Redraw the new grid */
                lite_spot(ty, tx);
 
-               p_ptr->update |= (PU_MON_LITE);
+               if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+                       p_ptr->update |= (PU_MON_LITE);
+
+               if (m_ptr->ml)
+               {
+                       /* Auto-Recall if possible and visible */
+                       if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
+
+                       /* Track a new monster */
+                       health_track(m_idx);
+               }
 
                break;
        }
@@ -1805,16 +1729,14 @@ msg_print("
                explosive_rune();
                break;
        case 16:
-               (void)set_kabenuke(randint(plev/2) + plev/2, FALSE);
+               (void)set_kabenuke(randint1(plev/2) + plev/2, FALSE);
                set_oppose_acid(plev, FALSE);
                break;
        case 17:
                fire_ball(GF_POIS, 0, 75+plev*2/3, plev/5+2);
                fire_ball(GF_OLD_DRAIN, 0, 75+plev*2/3, plev/5+2);
                fire_ball(GF_CONFUSION, 0, 75+plev*2/3, plev/5+2);
-               teleport_player(30);
-               if (cave[py][px].info & (CAVE_GLOW | CAVE_MNLT)) set_superstealth(FALSE);
-               else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
+               teleport_player(30, 0L);
                break;
        case 18:
        {
@@ -1826,11 +1748,11 @@ msg_print("
                        int typ = one_in_(2) ? GF_FIRE : one_in_(3) ? GF_NETHER : GF_PLASMA;
                        int attempts = 1000;
 
-                       while(attempts--)
+                       while (attempts--)
                        {
                                scatter(&y, &x, py, px, 4, 0);
 
-                               if ((y != py) || (x != px)) break;
+                               if (!player_bold(y, x)) break;
                        }
                        project(0, 0, y, x, damroll(6 + plev / 8, 10), typ,
                                (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL), -1);
@@ -1838,7 +1760,7 @@ msg_print("
                break;
        }
        case 19:
-               set_multishadow(6+randint(6), FALSE);
+               set_multishadow(6+randint1(6), FALSE);
                break;
        default:
 #ifdef JP
@@ -1968,9 +1890,7 @@ if (!get_check("
                /* Reduce failure rate by "effective" level adjustment */
                chance -= 3 * (plev - spell.min_lev);
 
-               if (p_ptr->pseikaku == SEIKAKU_NAMAKE) chance += 10;
-               if (p_ptr->pseikaku == SEIKAKU_KIREMONO) chance -= 3;
-               if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) chance++;
+               chance += p_ptr->to_m_chance;
 
                /* Reduce failure rate by INT/WIS adjustment */
                chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
@@ -2003,7 +1923,7 @@ if (!get_check("
        if (chance > 95) chance = 95;
 
        /* Failed spell */
-       if (rand_int(100) < chance)
+       if (randint0(100) < chance)
        {
                if (flush_failure) flush();
 #ifdef JP
@@ -2026,10 +1946,10 @@ msg_format("%s
                                p_ptr->magic_num1[0] = 0;
                        }
 
-                       if (randint(100) < (chance / 2))
+                       if (randint1(100) < (chance / 2))
                        {
                                /* Backfire */
-                         b = randint(100);
+                         b = randint1(100);
 
                          if( use_mind == MIND_MINDCRAFTER ){
                                if (b < 5)
@@ -2050,7 +1970,7 @@ msg_print("
                                        msg_print("Weird visions seem to dance before your eyes...");
 #endif
 
-                                       set_image(p_ptr->image + 5 + randint(10));
+                                       set_image(p_ptr->image + 5 + randint1(10));
                                }
                                else if (b < 45)
                                {
@@ -2060,11 +1980,11 @@ msg_print("
                                        msg_print("Your brain is addled!");
 #endif
 
-                                       set_confused(p_ptr->confused + randint(8));
+                                       set_confused(p_ptr->confused + randint1(8));
                                }
                                else if (b < 90)
                                {
-                                       set_stun(p_ptr->stun + randint(8));
+                                       set_stun(p_ptr->stun + randint1(8));
                                }
                                else
                                {
@@ -2075,7 +1995,7 @@ msg_format("%s
                                        msg_print("Your mind unleashes its power in an uncontrollable storm!");
 #endif
 
-                                       project(1, 2 + plev / 10, py, px, plev * 2,
+                                       project(PROJECT_WHO_UNCTRL_POWER, 2 + plev / 10, py, px, plev * 2,
                                                GF_MANA, PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM, -1);
                                        p_ptr->csp = MAX(0, p_ptr->csp - plev * MAX(1, plev / 10));
                                }
@@ -2092,8 +2012,7 @@ msg_print("
 #else
                                        msg_print("Weird visions seem to dance before your eyes...");
 #endif
-                                       teleport_player(10);
-                                       
+                                       teleport_player(10, TELEPORT_PASSIVE);
                                }
                                else if (b < 96)
                                {
@@ -2103,7 +2022,7 @@ msg_print("
                                        msg_print("Your brain is addled!");
 #endif
 
-                                       set_image(p_ptr->image + 5 + randint(10));
+                                       set_image(p_ptr->image + 5 + randint1(10));
                                }
                                else
                                {
@@ -2114,7 +2033,7 @@ msg_format("%s
                                        msg_print("Your mind unleashes its power in an uncontrollable storm!");
 #endif
 
-                                       project(1, 2 + plev / 10, py, px, plev * 2,
+                                       project(PROJECT_WHO_UNCTRL_POWER, 2 + plev / 10, py, px, plev * 2,
                                                GF_MANA, PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM, -1);
                                        p_ptr->csp = MAX(0, p_ptr->csp - plev * MAX(1, plev / 10));
                                }
@@ -2142,7 +2061,7 @@ msg_format("%s
                        break;
                case MIND_MIRROR_MASTER:
                        /* Cast the spell */
-                       if( cave[py][px].feat == FEAT_MIRROR )on_mirror = TRUE;
+                       if( is_mirror_grid(&cave[py][px]) )on_mirror = TRUE;
                        cast = cast_mirror_spell(n);
                        break;
                case MIND_NINJUTSU:
@@ -2167,7 +2086,7 @@ msg_format("%s
        /* teleport from mirror costs small energy */
        if( on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER )
        {
-         if( n==2 || n==4 || n==6 || n==15 )energy_use = 50;
+         if( n==3 || n==5 || n==7 || n==16 )energy_use = 50;
        }
 
        if ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU))
@@ -2216,12 +2135,12 @@ msg_format("%s
 
 
                /* Hack -- Bypass free action */
-               (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1));
+               (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
 
                /* Damage WIS (possibly permanently) */
-               if (rand_int(100) < 50)
+               if (randint0(100) < 50)
                {
-                       bool perm = (rand_int(100) < 25);
+                       bool perm = (randint0(100) < 25);
 
                        /* Message */
 #ifdef JP
@@ -2232,7 +2151,7 @@ msg_print("
 
 
                        /* Reduce constitution */
-                       (void)dec_stat(A_WIS, 15 + randint(10), perm);
+                       (void)dec_stat(A_WIS, 15 + randint1(10), perm);
                }
        }
 
@@ -2282,7 +2201,7 @@ void do_cmd_mind_browse(void)
                Term_erase(12, 17, 255);
                Term_erase(12, 16, 255);
 
-               roff_to_buf( mind_tips[use_mind][n],62,temp);
+               roff_to_buf(mind_tips[use_mind][n], 62, temp, sizeof(temp));
                for(j=0, line = 17;temp[j];j+=(1+strlen(&temp[j])))
                {
                        prt(&temp[j], line, 15);
@@ -2300,6 +2219,4 @@ void do_cmd_mind_browse(void)
                  (void)inkey();
                }
        }
-
-       screen_load();
 }