OSDN Git Service

[Refactor] #37353 混乱時のコマンド制限処理を cmd_limit_confused() に統合。 / Integrate command limitat...
[hengband/hengband.git] / src / mind.c
index 1e6709d..4ea7ba2 100644 (file)
  * 特殊技能を揃えて実装している。
  */
 
-
-
 #include "angband.h"
+#include "melee.h"
+#include "projection.h"
+#include "spells-summon.h"
+#include "avatar.h"
+#include "player-status.h"
+#include "spells-status.h"
+#include "cmd-spell.h"
 
 /*! 特殊技能の一覧テーブル */
 mind_power const mind_powers[5] =
@@ -289,7 +294,7 @@ mind_power const mind_powers[5] =
 };
 
 /*! 特殊能力の解説文字列 */
-static cptr const mind_tips[5][MAX_MIND_POWERS] =
+static concptr const mind_tips[5][MAX_MIND_POWERS] =
 {
 #ifdef JP
 {
@@ -402,7 +407,7 @@ static cptr const mind_tips[5][MAX_MIND_POWERS] =
        "1体のモンスターと位置を交換する。",
        "自分のいる床の上に、モンスターが通ると爆発してダメージを与えるルーンを描く。",
        "一定時間、半物質化し壁を通り抜けられるようになる。さらに、一定時間酸への耐性を得る。装備による耐性に累積する。",
-       "自分を中心とした超巨大な毒、生命力吸収、混乱の球を発生させ、テレポートする。",
+       "自分を中心とした超巨大な毒、衰弱、混乱の球を発生させ、テレポートする。",
        "ランダムな方向に何回か炎か地獄かプラズマのビームを放つ。",
        "全ての攻撃が、1/2の確率で無効になる。",
        "",
@@ -420,7 +425,7 @@ static cptr const mind_tips[5][MAX_MIND_POWERS] =
        "Generate a ball centered on you which inflict monster with PSI damage. Or inflict all monsters with PSI damage at level 25.",
        "Removes fear and stun. Gives heroism and speed. Heals HP a little unless you already have heroism and temporal speed boost.",
        "Pulls a distant item close to you.",
-       "Fires a ball which damages monsters and absorbs monsters' mind power. Absorbing is takes more turns which from 0 to 1.5.",
+       "Fires a ball which damages, co. Absorbing is takes more turns which from 0 to 1.5.",
        "Fires a beam of pure energy which penetrate the invulnerability barrier.",
        "Stops time. Consumes all of your SP. The more consumes SP, the longer duration of spell.",
        "",
@@ -536,16 +541,7 @@ static cptr const mind_tips[5][MAX_MIND_POWERS] =
  */
 void mindcraft_info(char *p, int use_mind, int power)
 {
-#ifdef JP
-       cptr s_dam = "損傷:";
-       cptr s_dur = "期間:";
-       cptr s_range = "範囲:";
-#else
-       cptr s_dam = "dam ";
-       cptr s_dur = "dur ";
-       cptr s_range = "range ";
-#endif
-       int plev = p_ptr->lev;
+       PLAYER_LEVEL plev = p_ptr->lev;
 
        strcpy(p, "");
 
@@ -555,46 +551,46 @@ void mindcraft_info(char *p, int use_mind, int power)
                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 1:  sprintf(p, " %s%dd%d", KWD_DAM, 3 + ((plev - 1) / 4), 3 + plev/15); break;
+               case 2:  sprintf(p, " %s10", KWD_SPHERE); break;
+               case 3:  sprintf(p, " %s%d", KWD_SPHERE, 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 5: sprintf(p, " %s%dd8", KWD_DAM, 8 + ((plev - 5) / 4));  break;
+               case 6:  sprintf(p, " %s%d", KWD_DURATION, 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 8:  sprintf(p, (plev < 25 ? " %s%d" : " %sd%d"), KWD_DAM, (plev < 25 ? plev * 3 / 2 : plev * ((plev - 5) / 10 + 1))); break;
+               case 9:  sprintf(p, " %s10+d%d", KWD_DURATION, plev * 3 / 2);  break;
 #ifdef JP
                case 10: sprintf(p, " 最大重量:%d.%dkg", lbtokg1(plev * 15),lbtokg2(plev * 15));  break;
 #else
                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", KWD_DAM, plev / 2);  break;
+               case 12: sprintf(p, " %sd%d+%d", KWD_DAM, plev * 3, plev * 3); break;
                case 13: sprintf(p, _(" 行動:%ld回", " %ld acts."), (long int)(p_ptr->csp + 100-p_ptr->energy_need - 50)/100); break;
                }
                break;
        case MIND_KI:
        {
-               int boost = p_ptr->magic_num1[0];
+               int boost = P_PTR_KI;
 
                if (heavy_armor()) boost /= 2;
 
                switch (power)
                {
-               case 0:  sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5) + boost / 12); break;
+               case 0:  sprintf(p, " %s%dd4", KWD_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 2:  sprintf(p, " %s%d+d30", KWD_DURATION, 30 + boost / 5); break;
+               case 3:  sprintf(p, " %s%dd5", KWD_DAM, 5 + ((plev - 1) / 5) + boost / 10); break;
+               case 4:  sprintf(p, " %s%d+d20", KWD_DURATION, 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 6:  sprintf(p, " %s%d+d%d", KWD_DURATION, 15 + boost / 7, plev / 2); break;
+               case 7:  sprintf(p, " %s%dd8", KWD_DAM, 8 + ((plev - 5) / 4) + boost / 12); break;
+               case 8:  sprintf(p, " %s10d6+%d", KWD_DAM, plev * 3 / 2 + boost * 3 / 5); break;
                case 9:  break;
                case 10: sprintf(p, _(" 最大%d体", " max %d"), 1+boost/100); 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;
+               case 11: sprintf(p, " %s%d", KWD_DAM, 100 + plev + boost); break;
+               case 12: sprintf(p, " %s%dd15", KWD_DAM, 10 + plev / 2 + boost * 3 / 10); break;
                case 13: sprintf(p, _(" 行動:%d+d16回", " %d+d16 acts"), 16+boost/20); break;
                }
                break;
@@ -605,25 +601,25 @@ void mindcraft_info(char *p, int use_mind, int 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 2:  sprintf(p, " %s%dd4", KWD_DAM,  3 + ((plev - 1) / 5) ); break;
+               case 3:  sprintf(p, " %s10", KWD_SPHERE); 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 5:  sprintf(p, " %s%d", KWD_SPHERE, plev *5); break;
+               case 6:  sprintf(p, " %s20+d20", KWD_DURATION);  break;
                case 7:  break;
-               case 8:  sprintf(p, " %s%dd8", s_dam, 8+((plev -5)/4) ); break;
+               case 8:  sprintf(p, " %s%dd8", KWD_DAM, 8+((plev -5)/4) ); break;
                case 9:  break;
-               case 10: sprintf(p, " %s%dd8", s_dam, 11+(plev-5)/4 ); break;
+               case 10: sprintf(p, " %s%dd8", KWD_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 12: sprintf(p, " %s20+d20", KWD_DURATION);  break;
+               case 13: sprintf(p, " %s150+d%d", KWD_DAM, plev*2 ); break;
                case 14: break;
                case 15: break;
-               case 16: sprintf(p, " %s%d", s_range, plev/2 +10); break;
+               case 16: sprintf(p, " %s%d", KWD_SPHERE, 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;
+               case 18: sprintf(p, " %s6+d6", KWD_DURATION);  break;
+               case 19: sprintf(p, " %s%d", KWD_DAM, plev*11+5 ); break;
+               case 20: sprintf(p, " %s4+d4", KWD_DURATION);  break;
                }
                break;
        }
@@ -633,24 +629,24 @@ void mindcraft_info(char *p, int use_mind, int power)
                {
                case 0:  break;
                case 1:  break;
-               case 2:  sprintf(p, " %s10", s_range); break;
+               case 2:  sprintf(p, " %s10", KWD_SPHERE); break;
                case 3:  break;
-               case 4:  sprintf(p, " %s%d", s_range , plev *5); break;
-               case 5:  sprintf(p, " %s30", s_range); break;
+               case 4:  sprintf(p, " %s%d", KWD_SPHERE , plev *5); break;
+               case 5:  sprintf(p, " %s30", KWD_SPHERE); 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 8:  sprintf(p, " %s20+d20", KWD_DURATION);  break;
+               case 9:  sprintf(p, " %s%d", KWD_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;
+               case 16: sprintf(p, " %s%d+d%d", KWD_DURATION, plev/2, plev/2);  break;
+               case 17: sprintf(p, " %s%d*3", KWD_DAM, (75+plev*2/3)/2 ); break;
+               case 18: sprintf(p, " %s%dd10", KWD_DAM, 6+plev/8 ); break;
+               case 19: sprintf(p, " %s6+d6", KWD_DURATION);  break;
                }
                break;
        }
@@ -675,78 +671,79 @@ void mindcraft_info(char *p, int use_mind, int power)
  * when you run it. It's probably easy to fix but I haven't tried,\n
  * sorry.\n
  */
-  static int get_mind_power(int *sn, bool only_browse)
-    {
-      int             i;
-      int             num = 0;
-      int             y = 1;
-      int             x = 10;
-      int             minfail = 0;
-      int             plev = p_ptr->lev;
-      int             chance = 0;
-      int             ask = TRUE;
-      char            choice;
-      char            out_val[160];
-      char            comment[80];
-      cptr            p;
-
-      mind_type       spell;
-      const mind_power      *mind_ptr;
-      bool            flag, redraw;
-      int             use_mind;
-      int menu_line = (use_menu ? 1 : 0);
-
-      switch(p_ptr->pclass)
+static bool_hack get_mind_power(SPELL_IDX *sn, bool only_browse)
+{
+       SPELL_IDX i;
+       int             num = 0;
+       TERM_LEN y = 1;
+       TERM_LEN x = 10;
+       int             minfail = 0;
+       PLAYER_LEVEL plev = p_ptr->lev;
+       int             chance = 0;
+       int             ask = TRUE;
+       char            choice;
+       char            out_val[160];
+       char            comment[80];
+       concptr            p;
+       COMMAND_CODE code;
+       mind_type       spell;
+       const mind_power      *mind_ptr;
+       bool            flag, redraw;
+       int             use_mind;
+       int menu_line = (use_menu ? 1 : 0);
+
+       switch (p_ptr->pclass)
        {
        case CLASS_MINDCRAFTER:
-         {
-           use_mind = MIND_MINDCRAFTER;
-           p = _("超能力", "mindcraft");
-           break;
-         }
+       {
+               use_mind = MIND_MINDCRAFTER;
+               p = _("超能力", "mindcraft");
+               break;
+       }
        case CLASS_FORCETRAINER:
-         {
-           use_mind = MIND_KI;
-           p = _("練気術", "Force");
-           break;
-         }
+       {
+               use_mind = MIND_KI;
+               p = _("練気術", "Force");
+               break;
+       }
        case CLASS_BERSERKER:
-         {
-           use_mind = MIND_BERSERKER;
-           p = _("技", "brutal power");
-           break;
-         }
+       {
+               use_mind = MIND_BERSERKER;
+               p = _("技", "brutal power");
+               break;
+       }
        case CLASS_MIRROR_MASTER:
-         {
-           use_mind = MIND_MIRROR_MASTER;
-           p = _("鏡魔法", "magic");
-           break;
-         }
+       {
+               use_mind = MIND_MIRROR_MASTER;
+               p = _("鏡魔法", "magic");
+               break;
+       }
        case CLASS_NINJA:
-         {
-           use_mind = MIND_NINJUTSU;
-           p = _("忍術", "ninjutsu");
-           break;
-         }
+       {
+               use_mind = MIND_NINJUTSU;
+               p = _("忍術", "ninjutsu");
+               break;
+       }
        default:
-         {
-           use_mind = 0;
-           p = _("超能力", "mindcraft");
-           break;
-         }
+       {
+               use_mind = 0;
+               p = _("超能力", "mindcraft");
+               break;
        }
-      mind_ptr = &mind_powers[use_mind];
+       }
+       mind_ptr = &mind_powers[use_mind];
 
        /* Assume cancelled */
-      *sn = (-1);
-
-#ifdef ALLOW_REPEAT /* TNB */
+       *sn = (-1);
 
        /* Get the spell, if available */
-       if (repeat_pull(sn))
+
+       if (repeat_pull(&code))
        {
+               *sn = (SPELL_IDX)code;
                /* Hack -- If requested INVEN_FORCE(1111), pull again */
-               if (*sn == INVEN_FORCE) repeat_pull(sn);
+               if (*sn == INVEN_FORCE) repeat_pull(&code);
+               *sn = (SPELL_IDX)code;
 
                /* Verify the spell */
                if (mind_ptr->info[*sn].min_lev <= plev)
@@ -756,8 +753,6 @@ void mindcraft_info(char *p, int use_mind, int power)
                }
        }
 
-#endif /* ALLOW_REPEAT -- TNB */
-
     /* Nothing chosen yet */
     flag = FALSE;
 
@@ -844,21 +839,17 @@ void mindcraft_info(char *p, int use_mind, int power)
 
                                /* Show list */
                                redraw = TRUE;
-
-                               /* Save the screen */
                                if (!only_browse && !use_menu) screen_save();
 
                                /* Display a list of spells */
                                prt("", y, x);
                                put_str(_("名前", "Name"), y, x + 5);
 
-#ifdef JP
-put_str(format("Lv   %s   失率 効果", ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU)) ? "HP" : "MP"), y, x + 35);
-#else
-put_str(format("Lv   %s   Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU)) ? "HP" : "MP"), y, x + 35);
-#endif
-                               has_weapon[0] = buki_motteruka(INVEN_RARM);
-                               has_weapon[1] = buki_motteruka(INVEN_LARM);
+                               put_str(format(_("Lv   %s   失率 効果", "Lv   %s   Fail Info"),
+                                       ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU)) ? "HP" : "MP"), y, x + 35);
+
+                               has_weapon[0] = has_melee_weapon(INVEN_RARM);
+                               has_weapon[1] = has_melee_weapon(INVEN_LARM);
 
                                /* Dump the spells */
                                for (i = 0; i < MAX_MIND_POWERS; i++)
@@ -892,7 +883,7 @@ put_str(format("Lv   %s   Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind
                                                        if (i == 5)
                                                        {
                                                                int j;
-                                                               for (j = 0; j < p_ptr->magic_num1[0] / 50; j++)
+                                                               for (j = 0; j < P_PTR_KI / 50; j++)
                                                                        mana_cost += (j+1) * 3 / 2;
                                                        }
                                                }
@@ -934,16 +925,12 @@ put_str(format("Lv   %s   Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind
                                                else strcpy(psi_desc, "     ");
                                        }
                                        else
-                                               sprintf(psi_desc, "  %c) ",I2A(i));
+                                               sprintf(psi_desc, "  %c) ", I2A(i));
                                        /* Dump the spell --(-- */
                                        strcat(psi_desc,
                                               format("%-30s%2d %4d%s %3d%%%s",
                                                      spell.name, spell.min_lev, mana_cost,
-#ifdef JP
-                                                     (((use_mind == MIND_MINDCRAFTER) && (i == 13)) ? "~" : "  "), 
-#else
-                                                     (((use_mind == MIND_MINDCRAFTER) && (i == 13)) ? "~ " : "  "), 
-#endif
+                                                     (((use_mind == MIND_MINDCRAFTER) && (i == 13)) ? _("~", "~ ") : "  "),
                                                      chance, comment));
                                        prt(psi_desc, y + i + 1, x);
                                }
@@ -957,8 +944,6 @@ put_str(format("Lv   %s   Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind
                        {
                                /* Hide list */
                                redraw = FALSE;
-
-                               /* Restore the screen */
                                screen_load();
                        }
 
@@ -1003,15 +988,10 @@ put_str(format("Lv   %s   Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind
                /* Stop the loop */
                flag = TRUE;
        }
-
-       /* Restore the screen */
        if (redraw && !only_browse) screen_load();
 
-       /* Show choices */
        p_ptr->window |= (PW_SPELL);
-
-       /* Window stuff */
-       window_stuff();
+       handle_stuff();
 
        /* Abort if needed */
        if (!flag) return (FALSE);
@@ -1019,11 +999,7 @@ put_str(format("Lv   %s   Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind
        /* Save the choice */
        (*sn) = i;
 
-#ifdef ALLOW_REPEAT /* TNB */
-
-       repeat_push(*sn);
-
-#endif /* ALLOW_REPEAT -- TNB */
+       repeat_push((COMMAND_CODE)i);
 
        /* Success */
        return (TRUE);
@@ -1039,7 +1015,8 @@ static bool cast_mindcrafter_spell(int spell)
 {
        int             b = 0;
        int             dir;
-       int             plev = p_ptr->lev;
+       TIME_EFFECT t;
+       PLAYER_LEVEL plev = p_ptr->lev;
 
        /* spell code */
        switch (spell)
@@ -1069,7 +1046,7 @@ static bool cast_mindcrafter_spell(int spell)
                }
 
                if ((plev > 24) && (plev < 40))
-                       set_tim_esp(plev, FALSE);
+                       set_tim_esp((TIME_EFFECT)plev, FALSE);
 
                if (!b) msg_print(_("安全な気がする。", "You feel safe."));
 
@@ -1113,12 +1090,12 @@ static bool cast_mindcrafter_spell(int spell)
                break;
        case 6:
                /* Character Armour */
-               set_shield(plev, FALSE);
-               if (plev > 14) set_oppose_acid(plev, FALSE);
-               if (plev > 19) set_oppose_fire(plev, FALSE);
-               if (plev > 24) set_oppose_cold(plev, FALSE);
-               if (plev > 29) set_oppose_elec(plev, FALSE);
-               if (plev > 34) set_oppose_pois(plev, FALSE);
+               set_shield((TIME_EFFECT)plev, FALSE);
+               if (plev > 14) set_oppose_acid((TIME_EFFECT)plev, FALSE);
+               if (plev > 19) set_oppose_fire((TIME_EFFECT)plev, FALSE);
+               if (plev > 24) set_oppose_cold((TIME_EFFECT)plev, FALSE);
+               if (plev > 29) set_oppose_elec((TIME_EFFECT)plev, FALSE);
+               if (plev > 34) set_oppose_pois((TIME_EFFECT)plev, FALSE);
                break;
        case 7:
                /* Psychometry */
@@ -1150,10 +1127,10 @@ static bool cast_mindcrafter_spell(int spell)
                        hp_player(plev);
                }
 
-               b = 10 + randint1((plev * 3) / 2);
-               set_hero(b, FALSE);
+               t = 10 + randint1((plev * 3) / 2);
+               set_hero(t, FALSE);
                /* Haste */
-               (void)set_fast(b, FALSE);
+               (void)set_fast(t, FALSE);
                break;
        case 10:
                /* Telekinesis */
@@ -1180,28 +1157,7 @@ static bool cast_mindcrafter_spell(int spell)
                break;
        case 13:
        {
-               if (world_player)
-               {
-                       msg_print(_("既に時は止まっている。", "Time is already stopped."));
-                       return (FALSE);
-               }
-               world_player = TRUE;
-               msg_print(_("「時よ!」", "You yell 'Time!'"));
-               msg_print(NULL);
-
-               /* Hack */
-               p_ptr->energy_need -= 1000 + (100 + p_ptr->csp - 50)*TURNS_PER_TICK/10;
-
-               /* Redraw map */
-               p_ptr->redraw |= (PR_MAP);
-
-               /* Update monsters */
-               p_ptr->update |= (PU_MONSTERS);
-
-               /* Window stuff */
-               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
-               handle_stuff();
+               time_walk(p_ptr);
                break;
        }
        default:
@@ -1219,9 +1175,9 @@ static bool cast_mindcrafter_spell(int spell)
  */
 static bool cast_force_spell(int spell)
 {
-       int             dir;
-       int             plev = p_ptr->lev;
-       int             boost = p_ptr->magic_num1[0];
+       DIRECTION dir;
+       PLAYER_LEVEL plev = p_ptr->lev;
+       int boost = P_PTR_KI;
 
        if (heavy_armor()) boost /= 2;
 
@@ -1249,12 +1205,12 @@ static bool cast_force_spell(int spell)
                break;
        case 5:
                msg_print(_("気を練った。", "You improved the Force."));
-               p_ptr->magic_num1[0] += (70 + plev);
+               P_PTR_KI += (70 + plev);
                p_ptr->update |= (PU_BONUS);
-               if (randint1(p_ptr->magic_num1[0]) > (plev * 4 + 120))
+               if (randint1(P_PTR_KI) > (plev * 4 + 120))
                {
                        msg_print(_("気が暴走した!", "The Force exploded!"));
-                       fire_ball(GF_MANA, 0, p_ptr->magic_num1[0] / 2, 10);
+                       fire_ball(GF_MANA, 0, P_PTR_KI / 2, 10);
                        take_hit(DAMAGE_LOSELIFE, p_ptr->magic_num1[0] / 2, _("気の暴走", "Explosion of the Force"), -1);
                }
                else return TRUE;
@@ -1263,70 +1219,15 @@ static bool cast_force_spell(int spell)
                set_tim_sh_touki(randint1(plev / 2) + 15 + boost / 7, FALSE);
                break;
        case 7:
-       {
-               int y, x, dam;
-               project_length = 1;
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               y = p_ptr->y + ddy[dir];
-               x = p_ptr->x + ddx[dir];
-               dam = damroll(8 + ((plev - 5) / 4) + boost / 12, 8);
-               fire_beam(GF_MISSILE, dir, dam);
-               if (cave[y][x].m_idx)
-               {
-                       int i;
-                       int ty = y, tx = x;
-                       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 (randint1(r_ptr->level * 3 / 2) > randint0(dam / 2) + dam/2)
-                       {
-                               msg_format(_("%sは飛ばされなかった。", "%^s was not blown away."), m_name);
-                       }
-                       else
-                       {
-                               for (i = 0; i < 5; i++)
-                               {
-                                       y += ddy[dir];
-                                       x += ddx[dir];
-                                       if (cave_empty_bold(y, x))
-                                       {
-                                               ty = y;
-                                               tx = x;
-                                       }
-                                       else break;
-                               }
-                               if ((ty != oy) || (tx != ox))
-                               {
-                                       msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name);
-                                       cave[oy][ox].m_idx = 0;
-                                       cave[ty][tx].m_idx = (s16b)m_idx;
-                                       m_ptr->fy = (byte_hack)ty;
-                                       m_ptr->fx = (byte_hack)tx;
-
-                                       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);
-                               }
-                       }
-               }
+               return shock_power();
                break;
-       }
        case 8:
                if (!get_aim_dir(&dir)) return FALSE;
                fire_ball(GF_MISSILE, dir, damroll(10, 6) + plev * 3 / 2 + boost * 3 / 5, (plev < 30) ? 2 : 3);
                break;
        case 9:
        {
-               int m_idx;
+               MONSTER_IDX m_idx;
 
                if (!target_set(TARGET_KILL)) return FALSE;
                m_idx = cave[target_row][target_col].m_idx;
@@ -1342,7 +1243,7 @@ static bool cast_force_spell(int spell)
                bool success = FALSE;
 
                for (i = 0; i < 1 + boost/100; i++)
-                       if (summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_PHANTOM, PM_FORCE_PET))
+                       if (summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_PHANTOM, PM_FORCE_PET, '\0'))
                                success = TRUE;
                if (success)
                {
@@ -1368,7 +1269,7 @@ static bool cast_force_spell(int spell)
        default:
                msg_print(_("なに?", "Zap?"));
        }
-       p_ptr->magic_num1[0] = 0;
+       P_PTR_KI = 0;
        p_ptr->update |= (PU_BONUS);
 
        return TRUE;
@@ -1379,16 +1280,16 @@ static bool cast_force_spell(int spell)
  * @brief 現在フロアに存在している鏡の数を数える / calculate mirrors
  * @return 鏡の枚数
  */
-static int number_of_mirrors( void )
+static int number_of_mirrors(void)
 {
-  int x,y;
-  int val=0;
-  for( x=0 ; x < cur_wid ; x++ ){
-    for( y=0 ; y < cur_hgt ; y++ ){
-      if (is_mirror_grid(&cave[y][x])) val++;
-    }
-  }
-  return val;
+       POSITION x, y;
+       int val = 0;
+       for (x = 0; x < cur_wid; x++) {
+               for (y = 0; y < cur_hgt; y++) {
+                       if (is_mirror_grid(&cave[y][x])) val++;
+               }
+       }
+       return val;
 }
 
 /*!
@@ -1400,138 +1301,139 @@ static int number_of_mirrors( void )
 static bool cast_mirror_spell(int spell)
 {
        int             dir;
-       int             plev = p_ptr->lev;
+       PLAYER_LEVEL plev = p_ptr->lev;
        int             tmp;
-       int             x,y;
+       TIME_EFFECT t;
+       int             x, y;
 
        /* spell code */
        switch (spell)
        {
-       /* mirror of seeing */
+               /* mirror of seeing */
        case 0:
-         tmp = is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) ? 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);
-         if( plev + tmp > 38 )map_area(DETECT_RAD_MAP);
-         if( tmp == 0 && plev < 5 ){
-           msg_print(_("鏡がなくて集中できなかった!", "You need a mirror to concentrate!"));
-         }
-         break;
-       /* drip of light */
+               tmp = is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) ? 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((TIME_EFFECT)plev, FALSE);
+               if (plev + tmp > 38)map_area(DETECT_RAD_MAP);
+               if (tmp == 0 && plev < 5) {
+                       msg_print(_("鏡がなくて集中できなかった!", "You need a mirror to concentrate!"));
+               }
+               break;
+               /* drip of light */
        case 1:
-         if( number_of_mirrors() < 4 + plev/10 ){
-           place_mirror();
-         }
-         else {
+               if (number_of_mirrors() < 4 + plev / 10) {
+                       place_mirror();
+               }
+               else {
                        msg_format(_("これ以上鏡は制御できない!", "There are too many mirrors to control!"));
-         }
-         break;
+               }
+               break;
        case 2:
-         if (!get_aim_dir(&dir)) return FALSE;
-         if ( plev > 9 && is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) ) {
-           fire_beam(GF_LITE, dir,damroll(3+((plev-1)/5),4));
-         }
-         else {
-           fire_bolt(GF_LITE, dir,damroll(3+((plev-1)/5),4));
-         }
-         break;
-       /* warped mirror */
+               if (!get_aim_dir(&dir)) return FALSE;
+               if (plev > 9 && is_mirror_grid(&cave[p_ptr->y][p_ptr->x])) {
+                       fire_beam(GF_LITE, dir, damroll(3 + ((plev - 1) / 5), 4));
+               }
+               else {
+                       fire_bolt(GF_LITE, dir, damroll(3 + ((plev - 1) / 5), 4));
+               }
+               break;
+               /* warped mirror */
        case 3:
-         teleport_player(10, 0L);
-         break;
-       /* mirror of light */
+               teleport_player(10, 0L);
+               break;
+               /* mirror of light */
        case 4:
-         (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
-         break;
-       /* mirror of wandering */
+               (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
+               break;
+               /* mirror of wandering */
        case 5:
-         teleport_player(plev * 5, 0L);
-         break;
-       /* robe of dust */
+               teleport_player(plev * 5, 0L);
+               break;
+               /* robe of dust */
        case 6:
-         set_dustrobe(20+randint1(20),FALSE);
-         break;
-       /* banishing mirror */
+               set_dustrobe(20 + randint1(20), FALSE);
+               break;
+               /* banishing mirror */
        case 7:
-         if (!get_aim_dir(&dir)) return FALSE;
-         (void)fire_beam(GF_AWAY_ALL, dir , plev);
-         break;
-       /* mirror clashing */
+               if (!get_aim_dir(&dir)) return FALSE;
+               (void)fire_beam(GF_AWAY_ALL, dir, plev);
+               break;
+               /* mirror clashing */
        case 8:
-         if (!get_aim_dir(&dir)) return FALSE;
-         fire_ball(GF_SHARDS, dir, damroll(8 + ((plev - 5) / 4), 8),
-                   (plev > 20 ? (plev - 20) / 8 + 1 : 0));
-         break;
-       /* mirror sleeping */
+               if (!get_aim_dir(&dir)) return FALSE;
+               fire_ball(GF_SHARDS, dir, damroll(8 + ((plev - 5) / 4), 8),
+                       (plev > 20 ? (plev - 20) / 8 + 1 : 0));
+               break;
+               /* mirror sleeping */
        case 9:
-         for(x=0;x<cur_wid;x++){
-           for(y=0;y<cur_hgt;y++){
-             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);
-             }
-           }
-         }
-         break;
-       /* seeker ray */
+               for (x = 0; x < cur_wid; x++) {
+                       for (y = 0; y < cur_hgt; y++) {
+                               if (is_mirror_grid(&cave[y][x])) {
+                                       project(0, 2, y, x, (HIT_POINT)plev, GF_OLD_SLEEP, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
+                               }
+                       }
+               }
+               break;
+               /* seeker ray */
        case 10:
-         if (!get_aim_dir(&dir)) return FALSE;
-         fire_beam(GF_SEEKER,dir, damroll(11+(plev-5)/4,8));
-         break;
-       /* seal of mirror */
+               if (!get_aim_dir(&dir)) return FALSE;
+               fire_beam(GF_SEEKER, dir, damroll(11 + (plev - 5) / 4, 8));
+               break;
+               /* seal of mirror */
        case 11:
-         seal_of_mirror(plev*4+100);
-         break;
-       /* shield of water */
+               seal_of_mirror(plev * 4 + 100);
+               break;
+               /* shield of water */
        case 12:
-         tmp = 20+randint1(20);
-         set_shield(tmp, FALSE);
-         if( plev > 31 )set_tim_reflect(tmp, FALSE);
-         if( plev > 39 )set_resist_magic(tmp,FALSE);
-         break;
-       /* super ray */
+               t = 20 + randint1(20);
+               set_shield(t, FALSE);
+               if (plev > 31)set_tim_reflect(t, FALSE);
+               if (plev > 39)set_resist_magic(t, FALSE);
+               break;
+               /* super ray */
        case 13:
-         if (!get_aim_dir(&dir)) return FALSE;
-         fire_beam(GF_SUPER_RAY,dir, 150+randint1(2*plev));
-         break;
-       /* illusion light */
+               if (!get_aim_dir(&dir)) return FALSE;
+               fire_beam(GF_SUPER_RAY, dir, 150 + randint1(2 * plev));
+               break;
+               /* illusion light */
        case 14:
-         tmp = is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) ? 4 : 3;
-         slow_monsters(plev);
-         stun_monsters(plev*tmp);
-         confuse_monsters(plev*tmp);
-         turn_monsters(plev*tmp);
-         stun_monsters(plev*tmp);
-         stasis_monsters(plev*tmp);
-         break;
-       /* mirror shift */
+               tmp = is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) ? 4 : 3;
+               slow_monsters(plev);
+               stun_monsters(plev*tmp);
+               confuse_monsters(plev*tmp);
+               turn_monsters(plev*tmp);
+               stun_monsters(plev*tmp);
+               stasis_monsters(plev*tmp);
+               break;
+               /* mirror shift */
        case 15:
-         if( !is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) ){
-               msg_print(_("鏡の国の場所がわからない!", "You cannot find out where is the world of mirror!"));
+               if (!is_mirror_grid(&cave[p_ptr->y][p_ptr->x])) {
+                       msg_print(_("鏡の国の場所がわからない!", "You cannot find out where is the world of mirror!"));
+                       break;
+               }
+               alter_reality();
                break;
-         }
-         alter_reality();
-         break;
-       /* mirror tunnel */
+               /* mirror tunnel */
        case 16:
-         msg_print(_("鏡の世界を通り抜け…  ", "Go through the world of mirror..."));
-         return mirror_tunnel();
+               msg_print(_("鏡の世界を通り抜け…  ", "Go through the world of mirror..."));
+               return mirror_tunnel();
 
-       /* mirror of recall */
+               /* mirror of recall */
        case 17:
-               return word_of_recall();
-       /* multi-shadow */
+               return recall_player(p_ptr, randint0(21) + 15);
+               /* multi-shadow */
        case 18:
-         set_multishadow(6+randint1(6),FALSE);
-         break;
-       /* binding field */
+               set_multishadow(6 + randint1(6), FALSE);
+               break;
+               /* binding field */
        case 19:
-         if( !binding_field(plev*11+5) )msg_print(_("適当な鏡を選べなかった!", "You were not able to choose suitable mirrors!"));
-         break;
-       /* mirror of Ruffnor */
+               if (!binding_field(plev * 11 + 5))msg_print(_("適当な鏡を選べなかった!", "You were not able to choose suitable mirrors!"));
+               break;
+               /* mirror of Ruffnor */
        case 20:
-         (void)set_invuln(randint1(4)+4,FALSE);
-         break;
+               (void)set_invuln(randint1(4) + 4, FALSE);
+               break;
        default:
                msg_print(_("なに?", "Zap?"));
 
@@ -1549,8 +1451,8 @@ static bool cast_mirror_spell(int spell)
  */
 static bool cast_berserk_spell(int spell)
 {
-       int y, x;
-       int dir;
+       POSITION y, x;
+       DIRECTION dir;
 
        /* spell code */
        switch (spell)
@@ -1566,7 +1468,7 @@ static bool cast_berserk_spell(int spell)
                        return FALSE;
                }
 
-               if (!get_rep_dir2(&dir)) return FALSE;
+               if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
 
                if (dir == 5) return FALSE;
                y = p_ptr->y + ddy[dir];
@@ -1589,15 +1491,13 @@ static bool cast_berserk_spell(int spell)
                if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
                {
                        msg_print(NULL);
-
-                       /* Move the player */
                        (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
                }
                break;
        }
        case 2:
        {
-               if (!get_rep_dir2(&dir)) return FALSE;
+               if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
                move_player(dir, easy_disarm, TRUE);
@@ -1624,9 +1524,9 @@ static bool cast_berserk_spell(int spell)
  */
 static bool cast_ninja_spell(int spell)
 {
-       int x, y;
-       int dir;
-       int plev = p_ptr->lev;
+       POSITION x = 0, y = 0;
+       DIRECTION dir;
+       PLAYER_LEVEL plev = p_ptr->lev;
 
        /* spell code */
        switch (spell)
@@ -1673,22 +1573,7 @@ static bool cast_ninja_spell(int spell)
        }
        case 5:
        {
-               if (!get_rep_dir(&dir, FALSE)) return FALSE;
-               y = p_ptr->y + ddy[dir];
-               x = p_ptr->x + ddx[dir];
-               if (cave[y][x].m_idx)
-               {
-                       py_attack(y, x, 0);
-                       if (randint0(p_ptr->skill_dis) < 7)
-                               msg_print(_("うまく逃げられなかった。", "You failed to run away."));
-                       else
-                               teleport_player(30, 0L);
-               }
-               else
-               {
-                       msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
-                       msg_print(NULL);
-               }
+               if(!panic_hit()) return FALSE;
                break;
        }
        case 6:
@@ -1705,7 +1590,7 @@ static bool cast_ninja_spell(int spell)
        case 9:
                fire_ball(GF_FIRE, 0, 50+plev, plev/10+2);
                teleport_player(30, 0L);
-               set_oppose_fire(plev, FALSE);
+               set_oppose_fire((TIME_EFFECT)plev, FALSE);
                break;
        case 10:
                return rush_attack(NULL);
@@ -1714,7 +1599,7 @@ static bool cast_ninja_spell(int spell)
                int i;
                for (i = 0; i < 8; i++)
                {
-                       int slot;
+                       OBJECT_IDX slot;
 
                        for (slot = 0; slot < INVEN_PACK; slot++)
                        {
@@ -1722,18 +1607,13 @@ static bool cast_ninja_spell(int spell)
                        }
                        if (slot == INVEN_PACK)
                        {
-#ifdef JP
-                               if (!i) msg_print("くさびを持っていない。");
-                               else msg_print("くさびがなくなった。");
-#else
-                               if (!i) msg_print("You have no Iron Spikes.");
-                               else msg_print("You have no more Iron Spikes.");
-#endif
+                               if (!i) msg_print(_("くさびを持っていない。", "You have no Iron Spikes."));
+                               else msg_print(_("くさびがなくなった。", "You have no more Iron Spikes."));
                                return FALSE;
                        }
 
                        /* Gives a multiplier of 2 at first, up to 3 at 40th */
-                       do_cmd_throw_aux(1, FALSE, slot);
+                       do_cmd_throw(1, FALSE, slot);
 
                        p_ptr->energy_use = 100;
                }
@@ -1742,12 +1622,12 @@ static bool cast_ninja_spell(int spell)
        case 12:
        {
                monster_type *m_ptr;
-               int m_idx;
-               char m_name[80];
+               MONSTER_IDX m_idx;
+               GAME_TEXT m_name[MAX_NLEN];
                int i;
                int path_n;
                u16b path_g[512];
-               int ty,tx;
+               POSITION ty, tx;
 
                if (!target_set(TARGET_KILL)) return FALSE;
                m_idx = cave[target_row][target_col].m_idx;
@@ -1762,8 +1642,8 @@ static bool cast_ninja_spell(int spell)
                ty = target_row, tx = target_col;
                for (i = 1; i < path_n; i++)
                {
-                       int ny = GRID_Y(path_g[i]);
-                       int nx = GRID_X(path_g[i]);
+                       POSITION ny = GRID_Y(path_g[i]);
+                       POSITION nx = GRID_X(path_g[i]);
                        cave_type *c_ptr = &cave[ny][nx];
 
                        if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) &&
@@ -1787,13 +1667,8 @@ static bool cast_ninja_spell(int spell)
                /* Wake the monster up */
                (void)set_monster_csleep(m_idx, 0);
 
-               /* Update the monster (new location) */
-               update_mon(m_idx, TRUE);
-
-               /* Redraw the old grid */
+               update_monster(m_idx, TRUE);
                lite_spot(target_row, target_col);
-
-               /* Redraw the new grid */
                lite_spot(ty, tx);
 
                if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
@@ -1830,11 +1705,11 @@ static bool cast_ninja_spell(int spell)
                break;
        case 16:
                (void)set_kabenuke(randint1(plev/2) + plev/2, FALSE);
-               set_oppose_acid(plev, FALSE);
+               set_oppose_acid((TIME_EFFECT)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_HYPODYNAMIA, 0, 75+plev*2/3, plev/5+2);
                fire_ball(GF_CONFUSION, 0, 75+plev*2/3, plev/5+2);
                teleport_player(30, 0L);
                break;
@@ -1845,7 +1720,7 @@ static bool cast_ninja_spell(int spell)
 
                for (k = 0; k < num; k++)
                {
-                       int typ = one_in_(2) ? GF_FIRE : one_in_(3) ? GF_NETHER : GF_PLASMA;
+                       EFFECT_ID typ = one_in_(2) ? GF_FIRE : one_in_(3) ? GF_NETHER : GF_PLASMA;
                        int attempts = 1000;
 
                        while (attempts--)
@@ -1875,23 +1750,19 @@ static bool cast_ninja_spell(int spell)
  */
 void do_cmd_mind(void)
 {
-       int             n = 0,  b = 0;
+       SPELL_IDX n = 0;
+       int b = 0;
        int             chance;
        int             minfail = 0;
-       int             plev = p_ptr->lev;
+       PLAYER_LEVEL plev = p_ptr->lev;
        int             old_csp = p_ptr->csp;
        mind_type       spell;
        bool            cast;
        int             use_mind, mana_cost;
-       cptr            p;
+       concptr            p;
        bool            on_mirror = FALSE;
 
-       /* not if confused */
-       if (p_ptr->confused)
-       {
-               msg_print(_("混乱していて集中できない!", "You are too confused!"));
-               return;
-       }
+       if (cmd_limit_confused(p_ptr)) return;
 
        /* get power */
        if (!get_mind_power(&n, FALSE)) return;
@@ -1899,22 +1770,22 @@ void do_cmd_mind(void)
 #ifdef JP
        switch(p_ptr->pclass)
        {
-               case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;p = "精神";break;
-               case CLASS_FORCETRAINER:          use_mind = MIND_KI;p = "気";break;
-               case CLASS_BERSERKER:   use_mind = MIND_BERSERKER;p = "怒り";break;
-               case CLASS_MIRROR_MASTER:   use_mind = MIND_MIRROR_MASTER;p = "鏡魔法";break;
-               case CLASS_NINJA:       use_mind = MIND_NINJUTSU;p = "精神";break;
-               default:                use_mind = 0;p = "超能力";break;
+               case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER; p = "精神";break;
+               case CLASS_FORCETRAINER:          use_mind = MIND_KI; p = "気";break;
+               case CLASS_BERSERKER:   use_mind = MIND_BERSERKER; p = "怒り";break;
+               case CLASS_MIRROR_MASTER:   use_mind = MIND_MIRROR_MASTER; p = "鏡魔法";break;
+               case CLASS_NINJA:       use_mind = MIND_NINJUTSU; p = "精神";break;
+               default:                use_mind = 0 ;p = "超能力"; break;
        }
 #else
        switch(p_ptr->pclass)
        {
-               case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
-               case CLASS_FORCETRAINER:          use_mind = MIND_KI;break;
-               case CLASS_BERSERKER:   use_mind = MIND_BERSERKER;break;
-               case CLASS_MIRROR_MASTER:   use_mind = MIND_MIRROR_MASTER;break;
-               case CLASS_NINJA:       use_mind = MIND_NINJUTSU;break;
-               default:                use_mind = 0;break;
+               case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER; break;
+               case CLASS_FORCETRAINER:          use_mind = MIND_KI; break;
+               case CLASS_BERSERKER:   use_mind = MIND_BERSERKER; break;
+               case CLASS_MIRROR_MASTER:   use_mind = MIND_MIRROR_MASTER; break;
+               case CLASS_NINJA:       use_mind = MIND_NINJUTSU; break;
+               default:                use_mind = 0; break;
        }
 #endif
        spell = mind_powers[use_mind].info[n];
@@ -1927,13 +1798,13 @@ void do_cmd_mind(void)
        {
                if (heavy_armor()) chance += 20;
                if (p_ptr->icky_wield[0]) chance += 20;
-               else if (buki_motteruka(INVEN_RARM)) chance += 10;
+               else if (has_melee_weapon(INVEN_RARM)) chance += 10;
                if (p_ptr->icky_wield[1]) chance += 20;
-               else if (buki_motteruka(INVEN_LARM)) chance += 10;
+               else if (has_melee_weapon(INVEN_LARM)) chance += 10;
                if (n == 5)
                {
                        int j;
-                       for (j = 0; j < p_ptr->magic_num1[0] / 50; j++)
+                       for (j = 0; j < P_PTR_KI / 50; j++)
                                mana_cost += (j+1) * 3 / 2;
                }
        }
@@ -2006,10 +1877,10 @@ void do_cmd_mind(void)
 
                if ((use_mind != MIND_BERSERKER) && (use_mind != MIND_NINJUTSU))
                {
-                       if ((use_mind == MIND_KI) && (n != 5) && p_ptr->magic_num1[0])
+                       if ((use_mind == MIND_KI) && (n != 5) && P_PTR_KI)
                        {
                                msg_print(_("気が散ってしまった...", "Your improved Force has gone away..."));
-                               p_ptr->magic_num1[0] = 0;
+                               P_PTR_KI = 0;
                        }
 
                        if (randint1(100) < (chance / 2))
@@ -2111,7 +1982,6 @@ void do_cmd_mind(void)
        }
 
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
        /* teleport from mirror costs small energy */
        if( on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER )
@@ -2152,7 +2022,6 @@ void do_cmd_mind(void)
                if ((p_ptr->csp - mana_cost) < 0) p_ptr->csp_frac = 0;
                p_ptr->csp = MAX(0, p_ptr->csp - mana_cost);
 
-               /* Message */
                msg_format(_("%sを集中しすぎて気を失ってしまった!", "You faint from the effort!"),p);
 
                /* Hack -- Bypass free action */
@@ -2163,18 +2032,13 @@ void do_cmd_mind(void)
                {
                        bool perm = (randint0(100) < 25);
 
-                       /* Message */
                        msg_print(_("自分の精神を攻撃してしまった!", "You have damaged your mind!"));
 
                        /* Reduce constitution */
                        (void)dec_stat(A_WIS, 15 + randint1(10), perm);
                }
        }
-
-       /* Redraw mana */
        p_ptr->redraw |= (PR_MANA);
-
-       /* Window stuff */
        p_ptr->window |= (PW_PLAYER);
        p_ptr->window |= (PW_SPELL);
 }
@@ -2186,7 +2050,7 @@ void do_cmd_mind(void)
  */
 void do_cmd_mind_browse(void)
 {
-       int n = 0;
+       SPELL_IDX n = 0;
        int j, line;
        char temp[62*5];
        int use_mind = 0;