OSDN Git Service

[Refactor] #37353 混乱時のコマンド制限処理を cmd_limit_confused() に統合。 / Integrate command limitat...
[hengband/hengband.git] / src / mspells3.c
index c56fcfd..c31fcc6 100644 (file)
  */
 
 #include "angband.h"
+#include "spells-summon.h"
+#include "projection.h"
+#include "avatar.h"
+#include "spells-status.h"
+#include "cmd-spell.h"
 
 #define pseudo_plev() (((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 130) /*!< モンスター魔法をプレイヤーが使用する場合の換算レベル */
 
 
 /*!
 * @brief 文字列に青魔導師の呪文の攻撃力を加える
-* @param r_idx モンスターの種族ID
 * @param SPELL_NUM 呪文番号
+* @param plev プレイヤーレベル
 * @param msg 表示する文字列
 * @param tmp 返すメッセージを格納する配列
 * @return なし
 */
-void set_bluemage_damage(int SPELL_NUM, int plev, cptr msg, char* tmp)
+void set_bluemage_damage(int SPELL_NUM, PLAYER_LEVEL plev, concptr msg, char* tmp)
 {
     int base_damage = monspell_bluemage_damage(SPELL_NUM, plev, BASE_DAM);
     int dice_num = monspell_bluemage_damage(SPELL_NUM, plev, DICE_NUM);
@@ -32,7 +37,7 @@ void set_bluemage_damage(int SPELL_NUM, int plev, cptr msg, char* tmp)
     int dice_div = monspell_bluemage_damage(SPELL_NUM, plev, DICE_DIV);
     char dmg_str[80];
     dice_to_string(base_damage, dice_num, dice_side, dice_mult, dice_div, dmg_str);
-    sprintf(tmp, msg, dmg_str);
+    sprintf(tmp, " %s %s", msg, dmg_str);
 }
 
 /*!
@@ -43,20 +48,7 @@ void set_bluemage_damage(int SPELL_NUM, int plev, cptr msg, char* tmp)
  */
 static void learned_info(char *p, int power)
 {
-       int plev = pseudo_plev();
-       int hp = p_ptr->chp;
-
-#ifdef JP
-       cptr s_dam = " 損傷:%s";
-       cptr s_dur = "期間:";
-       cptr s_range = "範囲:";
-       cptr s_heal = " 回復:%s";
-#else
-       cptr s_dam = " dam %s";
-       cptr s_dur = "dur ";
-       cptr s_range = "range ";
-       cptr s_heal = " heal %s";
-#endif
+       PLAYER_LEVEL plev = pseudo_plev();
 
        strcpy(p, "");
 
@@ -101,7 +93,7 @@ static void learned_info(char *p, int power)
         case MS_BALL_MANA:
         case MS_BALL_DARK:
         case MS_STARBURST: 
-            set_bluemage_damage((power), plev, s_dam, p); break;
+            set_bluemage_damage((power), plev, KWD_DAM, p); break;
                case MS_DISPEL:
                        break;
         case MS_ROCKET:
@@ -137,9 +129,9 @@ static void learned_info(char *p, int power)
         case MS_BALL_POIS:
         case MS_BALL_NETHER:
         case MS_BALL_WATER:
-            set_bluemage_damage((power), plev, s_dam, p); break;
+            set_bluemage_damage((power), plev, KWD_DAM, p); break;
         case MS_DRAIN_MANA:
-            set_bluemage_damage((power), plev, s_heal, p); break;
+            set_bluemage_damage((power), plev, KWD_HEAL, p); break;
         case MS_MIND_BLAST:
         case MS_BRAIN_SMASH:
         case MS_CAUSE_1:
@@ -156,26 +148,26 @@ static void learned_info(char *p, int power)
         case MS_BOLT_PLASMA:
         case MS_BOLT_ICE: 
         case MS_MAGIC_MISSILE: 
-            set_bluemage_damage((power), plev, s_dam, p); break;
+            set_bluemage_damage((power), plev, KWD_DAM, p); break;
                case MS_SPEED:
-                       sprintf(p, " %sd%d+%d", s_dur, 20+plev, plev);
+                       sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
                        break;
         case MS_HEAL:
-            set_bluemage_damage((power), plev, s_heal, p); break;
+            set_bluemage_damage((power), plev, KWD_HEAL, p); break;
                case MS_INVULNER:
-                       sprintf(p, " %sd7+7", s_dur);
+                       sprintf(p, " %sd7+7", KWD_DURATION);
                        break;
                case MS_BLINK:
-                       sprintf(p, " %s10", s_range);
+                       sprintf(p, " %s10", KWD_SPHERE);
                        break;
                case MS_TELEPORT:
-                       sprintf(p, " %s%d", s_range, plev * 5);
+                       sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
                        break;
         case MS_PSY_SPEAR:
-            set_bluemage_damage((power), plev, s_dam, p); break;
+            set_bluemage_damage((power), plev, KWD_DAM, p); break;
                        break;
                case MS_RAISE_DEAD:
-                       sprintf(p, " %s5", s_range);
+                       sprintf(p, " %s5", KWD_SPHERE);
                        break;
                default:
                        break;
@@ -200,28 +192,24 @@ static void learned_info(char *p, int power)
  * when you run it. It's probably easy to fix but I haven't tried,\n
  * sorry.\n
  */
-static int get_learned_power(int *sn)
+static bool get_learned_power(SPELL_IDX *sn)
 {
        int             i = 0;
        int             num = 0;
-       int             y = 1;
-       int             x = 18;
-       int             minfail = 0;
-       int             plev = p_ptr->lev;
-       int             chance = 0;
+       TERM_LEN y = 1;
+       TERM_LEN x = 18;
+       PERCENTAGE minfail = 0;
+       PLAYER_LEVEL plev = p_ptr->lev;
+       PERCENTAGE chance = 0;
        int             ask = TRUE, mode = 0;
        int             spellnum[MAX_MONSPELLS];
        char            ch;
        char            choice;
        char            out_val[160];
        char            comment[80];
-       s32b            f4 = 0, f5 = 0, f6 = 0;
-#ifdef JP
-cptr            p = "魔法";
-#else
-       cptr            p = "magic";
-#endif
-
+       BIT_FLAGS f4 = 0L, f5 = 0L, f6 = 0L;
+       concptr p = _("魔法", "magic");
+       COMMAND_CODE code;
        monster_power   spell;
        bool            flag, redraw;
        int menu_line = (use_menu ? 1 : 0);
@@ -235,38 +223,27 @@ cptr            p = "魔法";
        /* No redraw yet */
        redraw = FALSE;
 
-#ifdef ALLOW_REPEAT /* TNB */
-
        /* Get the spell, if available */
-       if (repeat_pull(sn))
+       
+       if (repeat_pull(&code))
        {
-               /* Success */
+               *sn = (SPELL_IDX)code;
                return (TRUE);
        }
 
-#endif /* ALLOW_REPEAT -- TNB */
-
        if (use_menu)
        {
                screen_save();
 
                while(!mode)
                {
-#ifdef JP
-                       prt(format(" %s ボルト", (menu_line == 1) ? "》" : "  "), 2, 14);
-                       prt(format(" %s ボール", (menu_line == 2) ? "》" : "  "), 3, 14);
-                       prt(format(" %s ブレス", (menu_line == 3) ? "》" : "  "), 4, 14);
-                       prt(format(" %s 召喚", (menu_line == 4) ? "》" : "  "), 5, 14);
-                       prt(format(" %s その他", (menu_line == 5) ? "》" : "  "), 6, 14);
-                       prt("どの種類の魔法を使いますか?", 0, 0);
-#else
-                       prt(format(" %s bolt", (menu_line == 1) ? "> " : "  "), 2, 14);
-                       prt(format(" %s ball", (menu_line == 2) ? "> " : "  "), 3, 14);
-                       prt(format(" %s breath", (menu_line == 3) ? "> " : "  "), 4, 14);
-                       prt(format(" %s sommoning", (menu_line == 4) ? "> " : "  "), 5, 14);
-                       prt(format(" %s others", (menu_line == 5) ? "> " : "  "), 6, 14);
-                       prt("use which type of magic? ", 0, 0);
-#endif
+                       prt(format(_(" %s ボルト", " %s bolt"), (menu_line == 1) ? _("》", "> ") : "  "), 2, 14);
+                       prt(format(_(" %s ボール", " %s ball"), (menu_line == 2) ? _("》", "> ") : "  "), 3, 14);
+                       prt(format(_(" %s ブレス", " %s breath"), (menu_line == 3) ? _("》", "> ") : "  "), 4, 14);
+                       prt(format(_(" %s 召喚", " %s sommoning"), (menu_line == 4) ? _("》", "> ") : "  "), 5, 14);
+                       prt(format(_(" %s その他", " %s others"), (menu_line == 5) ? _("》", "> ") : "  "), 6, 14);
+                       prt(_("どの種類の魔法を使いますか?", "use which type of magic? "), 0, 0);
+
                        choice = inkey();
                        switch(choice)
                        {
@@ -297,11 +274,7 @@ cptr            p = "魔法";
        }
        else
        {
-#ifdef JP
-       sprintf(comment, "[A]ボルト, [B]ボール, [C]ブレス, [D]召喚, [E]その他:");
-#else
-       sprintf(comment, "[A] bolt, [B] ball, [C] breath, [D] summoning, [E] others:");
-#endif
+       sprintf(comment, _("[A]ボルト, [B]ボール, [C]ブレス, [D]召喚, [E]その他:", "[A] bolt, [B] ball, [C] breath, [D] summoning, [E] others:"));
        while (TRUE)
        {
                if (!get_com(comment, &ch, TRUE))
@@ -360,22 +333,13 @@ cptr            p = "魔法";
        }
        if (i == num)
        {
-#ifdef JP
-               msg_print("その種類の魔法は覚えていない!");
-#else
-               msg_print("You don't know any spell of this type.");
-#endif
+               msg_print(_("その種類の魔法は覚えていない!", "You don't know any spell of this type."));
                return (FALSE);
        }
 
        /* Build a prompt (accept all spells) */
-       (void)strnfmt(out_val, 78, 
-#ifdef JP
-                     "(%c-%c, '*'で一覧, ESC) どの%sを唱えますか?",
-#else
-                     "(%c-%c, *=List, ESC=exit) Use which %s? ",
-#endif
-                     I2A(0), I2A(num - 1), p);
+       (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sを唱えますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
+               I2A(0), I2A(num - 1), p);
 
        if (use_menu) screen_save();
 
@@ -459,23 +423,12 @@ cptr            p = "魔法";
 
                                /* Show list */
                                redraw = TRUE;
-
-                               /* Save the screen */
                                if (!use_menu) screen_save();
 
                                /* Display a list of spells */
                                prt("", y, x);
-#ifdef JP
-put_str("名前", y, x + 5);
-#else
-                               put_str("Name", y, x + 5);
-#endif
-
-#ifdef JP
-put_str("MP 失率 効果", y, x + 33);
-#else
-                               put_str("SP Fail Info", y, x + 32);
-#endif
+                               put_str(_("名前", "Name"), y, x + 5);
+                               put_str(_("MP 失率 効果", "SP Fail Info"), y, x + 33);
 
 
                                /* Dump the spells */
@@ -528,11 +481,7 @@ put_str("MP 失率 効果", y, x + 33);
 
                                        if (use_menu)
                                        {
-#ifdef JP
-                                               if (i == (menu_line-1)) strcpy(psi_desc, "  》");
-#else
-                                               if (i == (menu_line-1)) strcpy(psi_desc, "  > ");
-#endif
+                                               if (i == (menu_line-1)) strcpy(psi_desc, _("  》", "  > "));
                                                else strcpy(psi_desc, "    ");
                                        }
                                        else sprintf(psi_desc, "  %c)", I2A(i));
@@ -553,8 +502,6 @@ put_str("MP 失率 効果", y, x + 33);
                        {
                                /* Hide list */
                                redraw = FALSE;
-
-                               /* Restore the screen */
                                screen_load();
                        }
 
@@ -568,7 +515,7 @@ put_str("MP 失率 効果", y, x + 33);
                        ask = isupper(choice);
 
                        /* Lowercase */
-                       if (ask) choice = tolower(choice);
+                       if (ask) choice = (char)tolower(choice);
 
                        /* Extract request */
                        i = (islower(choice) ? A2I(choice) : -1);
@@ -590,12 +537,7 @@ put_str("MP 失率 効果", y, x + 33);
                        char tmp_val[160];
 
                        /* Prompt */
-#ifdef JP
-                       (void) strnfmt(tmp_val, 78, "%sの魔法を唱えますか?", monster_powers[spellnum[i]].name);
-#else
-                       (void)strnfmt(tmp_val, 78, "Use %s? ", monster_powers[spellnum[i]].name);
-#endif
-
+                       (void) strnfmt(tmp_val, 78, _("%sの魔法を唱えますか?", "Use %s? "), monster_powers[spellnum[i]].name);
 
                        /* Belay that order */
                        if (!get_check(tmp_val)) continue;
@@ -604,15 +546,10 @@ put_str("MP 失率 効果", y, x + 33);
                /* Stop the loop */
                flag = TRUE;
        }
-
-       /* Restore the screen */
        if (redraw) screen_load();
 
-       /* Show choices */
        p_ptr->window |= (PW_SPELL);
-
-       /* Window stuff */
-       window_stuff();
+       handle_stuff();
 
        /* Abort if needed */
        if (!flag) return (FALSE);
@@ -620,11 +557,7 @@ put_str("MP 失率 効果", y, x + 33);
        /* Save the choice */
        (*sn) = spellnum[i];
 
-#ifdef ALLOW_REPEAT /* TNB */
-
-       repeat_push(*sn);
-
-#endif /* ALLOW_REPEAT -- TNB */
+       repeat_push((COMMAND_CODE)spellnum[i]);
 
        /* Success */
        return (TRUE);
@@ -640,14 +573,13 @@ put_str("MP 失率 効果", y, x + 33);
  */
 static bool cast_learned_spell(int spell, bool success)
 {
-       int             dir;
-       int             plev = pseudo_plev();
-       int     summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2);
-       int             hp = p_ptr->chp;
-       int             damage = 0;
-       bool   pet = success;
-       bool   no_trump = FALSE;
-       u32b p_mode, u_mode = 0L, g_mode;
+       DIRECTION dir;
+       PLAYER_LEVEL plev = pseudo_plev();
+       PLAYER_LEVEL summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2);
+       HIT_POINT damage = 0;
+       bool pet = success;
+       bool no_trump = FALSE;
+       BIT_FLAGS p_mode, u_mode = 0L, g_mode;
 
        if (pet)
        {
@@ -673,13 +605,13 @@ static bool cast_learned_spell(int spell, bool success)
                break;
        case MS_DISPEL:
        {
-               int m_idx;
+               MONSTER_IDX m_idx;
 
                if (!target_set(TARGET_KILL)) return FALSE;
                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;
+               if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
                dispel_monster_status(m_idx);
                break;
        }
@@ -692,8 +624,6 @@ static bool cast_learned_spell(int spell, bool success)
                break;
        case MS_SHOOT:
        {
-               object_type *o_ptr = NULL;
-
                if (!get_aim_dir(&dir)) return FALSE;
                
         msg_print(_("矢を放った。", "You fire an arrow."));
@@ -712,140 +642,140 @@ static bool cast_learned_spell(int spell, bool success)
 
         msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
         damage = monspell_bluemage_damage((MS_BR_ACID), plev, DAM_ROLL);
-               fire_ball(GF_ACID, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_ACID, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_ELEC:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
         damage = monspell_bluemage_damage((MS_BR_ELEC), plev, DAM_ROLL);
-               fire_ball(GF_ELEC, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_ELEC, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_FIRE:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
         damage = monspell_bluemage_damage((MS_BR_FIRE), plev, DAM_ROLL);
-               fire_ball(GF_FIRE, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_FIRE, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_COLD:
         if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
         damage = monspell_bluemage_damage((MS_BR_COLD), plev, DAM_ROLL);
-               fire_ball(GF_COLD, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_COLD, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_POIS:
         if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
         damage = monspell_bluemage_damage((MS_BR_POIS), plev, DAM_ROLL);
-               fire_ball(GF_POIS, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_POIS, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_NETHER:
         if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
         damage = monspell_bluemage_damage((MS_BR_NETHER), plev, DAM_ROLL);
-               fire_ball(GF_NETHER, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_NETHER, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_LITE:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
         damage = monspell_bluemage_damage((MS_BR_LITE), plev, DAM_ROLL);
-               fire_ball(GF_LITE, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_LITE, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_DARK:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
         damage = monspell_bluemage_damage((MS_BR_DARK), plev, DAM_ROLL);
-               fire_ball(GF_DARK, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_DARK, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_CONF:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
         damage = monspell_bluemage_damage((MS_BR_CONF), plev, DAM_ROLL);
-               fire_ball(GF_CONFUSION, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_CONFUSION, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_SOUND:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
         damage = monspell_bluemage_damage((MS_BR_SOUND), plev, DAM_ROLL);
-               fire_ball(GF_SOUND, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_SOUND, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_CHAOS:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
         damage = monspell_bluemage_damage((MS_BR_CHAOS), plev, DAM_ROLL);
-               fire_ball(GF_CHAOS, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_CHAOS, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_DISEN:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
         damage = monspell_bluemage_damage((MS_BR_DISEN), plev, DAM_ROLL);
-               fire_ball(GF_DISENCHANT, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_DISENCHANT, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_NEXUS:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
         damage = monspell_bluemage_damage((MS_BR_NEXUS), plev, DAM_ROLL);
-               fire_ball(GF_NEXUS, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_NEXUS, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_TIME:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
         damage = monspell_bluemage_damage((MS_BR_TIME), plev, DAM_ROLL);
-               fire_ball(GF_TIME, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_TIME, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_INERTIA:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
         damage = monspell_bluemage_damage((MS_BR_INERTIA), plev, DAM_ROLL);
-               fire_ball(GF_INERTIA, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_INERTIAL, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_GRAVITY:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
         damage = monspell_bluemage_damage((MS_BR_GRAVITY), plev, DAM_ROLL);
-               fire_ball(GF_GRAVITY, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_GRAVITY, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_SHARDS:
         if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
         damage = monspell_bluemage_damage((MS_BR_SHARDS), plev, DAM_ROLL);
-               fire_ball(GF_SHARDS, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_SHARDS, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_PLASMA:
         if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
         damage = monspell_bluemage_damage((MS_BR_PLASMA), plev, DAM_ROLL);
-               fire_ball(GF_PLASMA, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_PLASMA, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_FORCE:
         if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
         damage = monspell_bluemage_damage((MS_BR_FORCE), plev, DAM_ROLL);
-               fire_ball(GF_FORCE, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_FORCE, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BR_MANA:
                if (!get_aim_dir(&dir)) return FALSE;
 
         msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
         damage = monspell_bluemage_damage((MS_BR_MANA), plev, DAM_ROLL);
-               fire_ball(GF_MANA, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_MANA, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BALL_NUKE:
                if (!get_aim_dir(&dir)) return FALSE;
@@ -859,7 +789,7 @@ static bool cast_learned_spell(int spell, bool success)
 
         msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
         damage = monspell_bluemage_damage((MS_BR_NUKE), plev, DAM_ROLL);
-               fire_ball(GF_NUKE, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_NUKE, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BALL_CHAOS:
                if (!get_aim_dir(&dir)) return FALSE;
@@ -873,7 +803,7 @@ static bool cast_learned_spell(int spell, bool success)
 
         msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
         damage = monspell_bluemage_damage((MS_BR_DISI), plev, DAM_ROLL);
-               fire_ball(GF_DISINTEGRATE, dir, damage, (plev > 40 ? -3 : -2));
+               fire_breath(GF_DISINTEGRATE, dir, damage, (plev > 40 ? 3 : 2));
                break;
        case MS_BALL_ACID:
                if (!get_aim_dir(&dir)) return FALSE;
@@ -1109,23 +1039,7 @@ static bool cast_learned_spell(int spell, bool success)
                teleport_player(plev * 5, 0L);
                break;
        case MS_WORLD:
-        world_player = TRUE;
-        msg_print(_("「時よ!」", "'Time!'"));
-               msg_print(NULL);
-
-               /* Hack */
-               p_ptr->energy_need -= 1000 + (100 + randint1(200)+200)*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();
+               (void)time_walk(p_ptr);
                break;
        case MS_SPECIAL:
                break;
@@ -1133,12 +1047,12 @@ static bool cast_learned_spell(int spell, bool success)
        {
                monster_type *m_ptr;
                monster_race *r_ptr;
-               char m_name[80];
+               GAME_TEXT m_name[MAX_NLEN];
 
                if (!target_set(TARGET_KILL)) return FALSE;
                if (!cave[target_row][target_col].m_idx) break;
                if (!player_has_los_bold(target_row, target_col)) break;
-               if (!projectable(py, px, target_row, target_col)) break;
+               if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
                m_ptr = &m_list[cave[target_row][target_col].m_idx];
                r_ptr = &r_info[m_ptr->r_idx];
                monster_desc(m_name, m_ptr, 0);
@@ -1158,7 +1072,7 @@ static bool cast_learned_spell(int spell, bool success)
                        }
                }
         msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
-               teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100, TELEPORT_PASSIVE);
+               teleport_monster_to(cave[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
                break;
        }
        case MS_TELE_AWAY:
@@ -1166,31 +1080,11 @@ static bool cast_learned_spell(int spell, bool success)
 
                (void)fire_beam(GF_AWAY_ALL, dir, 100);
                break;
-       case MS_TELE_LEVEL:
-       {
-               int target_m_idx;
-               monster_type *m_ptr;
-               monster_race *r_ptr;
-               char m_name[80];
-
-               if (!target_set(TARGET_KILL)) return FALSE;
-               target_m_idx = cave[target_row][target_col].m_idx;
-               if (!target_m_idx) break;
-               if (!player_has_los_bold(target_row, target_col)) break;
-               if (!projectable(py, px, target_row, target_col)) break;
-               m_ptr = &m_list[target_m_idx];
-               r_ptr = &r_info[m_ptr->r_idx];
-               monster_desc(m_name, m_ptr, 0);
-        msg_format(_("%^sの足を指さした。", "You gesture at %^s's feet."), m_name);
 
-               if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) ||
-                       (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
-               {
-            msg_format(_("しかし効果がなかった!", "%^s is unaffected!"), m_name);
-               }
-               else teleport_level(target_m_idx);
+       case MS_TELE_LEVEL:
+               return teleport_level_other(p_ptr);
                break;
-       }
+
        case MS_PSY_SPEAR:
                if (!get_aim_dir(&dir)) return FALSE;
 
@@ -1214,7 +1108,7 @@ static bool cast_learned_spell(int spell, bool success)
                break;
     case MS_RAISE_DEAD:
         msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
-               (void)animate_dead(0, py, px);
+               (void)animate_dead(0, p_ptr->y, p_ptr->x);
                break;
        case MS_S_KIN:
        {
@@ -1223,7 +1117,7 @@ static bool cast_learned_spell(int spell, bool success)
         msg_print(_("援軍を召喚した。", "You summon minions."));
                for (k = 0;k < 1; k++)
                {
-                       if (summon_kin_player(summon_lev, py, px, (pet ? PM_FORCE_PET : 0L)))
+                       if (summon_kin_player(summon_lev, p_ptr->y, p_ptr->x, (pet ? PM_FORCE_PET : 0L)))
                        {
                                if (!pet) msg_print(_("召喚された仲間は怒っている!", "Summoned fellows are angry!"));
                        }
@@ -1240,7 +1134,7 @@ static bool cast_learned_spell(int spell, bool success)
 
         msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!"));
                for (k = 0 ;k < 1 ; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_CYBER, p_mode))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_CYBER, p_mode, '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!"));
@@ -1256,7 +1150,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("仲間を召喚した。", "You summon help."));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, p_mode))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, p_mode, '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!"));
@@ -1272,7 +1166,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("モンスターを召喚した!", "You summon monsters!"));
                for (k = 0;k < plev / 15 + 2; k++)
-                       if(summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, (p_mode | u_mode)))
+                       if(summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, (p_mode | u_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!"));
@@ -1287,8 +1181,8 @@ static bool cast_learned_spell(int spell, bool success)
        {
                int k;
         msg_print(_("アリを召喚した。", "You summon ants."));
-               for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode)))
+               for (k = 0; k < 1; k++)
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!"));
@@ -1304,7 +1198,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!"));
@@ -1320,7 +1214,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("ハウンドを召喚した。", "You summon hounds."));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!"));
@@ -1336,7 +1230,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("ヒドラを召喚した。", "You summon a hydras."));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HYDRA, (g_mode | p_mode)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HYDRA, (g_mode | p_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!"));
@@ -1352,7 +1246,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("天使を召喚した!", "You summon an angel!"));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANGEL, (g_mode | p_mode)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANGEL, (g_mode | p_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚された天使は怒っている!", "Summoned angels are angry!"));
@@ -1368,7 +1262,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DEMON, (g_mode | p_mode)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DEMON, (g_mode | p_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚されたデーモンは怒っている!", "Summoned demons are angry!"));
@@ -1384,7 +1278,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚されたアンデッドは怒っている!", "Summoned undeads are angry!"));
@@ -1400,7 +1294,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DRAGON, (g_mode | p_mode)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DRAGON, (g_mode | p_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚されたドラゴンは怒っている!", "Summoned dragons are angry!"));
@@ -1416,7 +1310,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!"));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
@@ -1432,7 +1326,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!"));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚された古代ドラゴンは怒っている!", "Summoned ancient dragons are angry!"));
@@ -1448,7 +1342,7 @@ static bool cast_learned_spell(int spell, bool success)
                int k;
         msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!"));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode), '\0'))
                        {
                 if (!pet)
                     msg_print(_("召喚されたアンバーの王族は怒っている!", "Summoned Lords of Amber are angry!"));
@@ -1462,20 +1356,20 @@ static bool cast_learned_spell(int spell, bool success)
        case MS_S_UNIQUE:
        {
                int k, count = 0;
-        msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!"));
+               msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!"));
                for (k = 0;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE), '\0'))
                        {
                                count++;
-                if (!pet)
-                    msg_print(_("召喚されたユニーク・モンスターは怒っている!", "Summoned special opponents are angry!"));
+                               if (!pet)
+                                       msg_print(_("召喚されたユニーク・モンスターは怒っている!", "Summoned special opponents are angry!"));
                        }
                for (k = count;k < 1; k++)
-                       if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
+                       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE), '\0'))
                        {
                                count++;
-                if (!pet)
-                    msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
+                               if (!pet)
+                                       msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
                        }
                if (!count)
                {
@@ -1501,26 +1395,15 @@ static bool cast_learned_spell(int spell, bool success)
  */
 bool do_cmd_cast_learned(void)
 {
-       int             n = 0;
-       int             chance;
-       int             minfail = 0;
-       int             plev = p_ptr->lev;
-       monster_power   spell;
-       bool            cast;
-       int             need_mana;
-
+       SPELL_IDX n = 0;
+       PERCENTAGE chance;
+       PERCENTAGE minfail = 0;
+       PLAYER_LEVEL plev = p_ptr->lev;
+       monster_power spell;
+       bool cast;
+       MANA_POINT need_mana;
 
-       /* not if confused */
-       if (p_ptr->confused)
-       {
-#ifdef JP
-msg_print("混乱していて唱えられない!");
-#else
-               msg_print("You are too confused!");
-#endif
-
-               return TRUE;
-       }
+       if (cmd_limit_confused(p_ptr)) return FALSE;
 
        /* get power */
        if (!get_learned_power(&n)) return FALSE;
@@ -1533,22 +1416,12 @@ msg_print("混乱していて唱えられない!");
        if (need_mana > p_ptr->csp)
        {
                /* Warning */
-#ifdef JP
-msg_print("MPが足りません。");
-#else
-               msg_print("You do not have enough mana to use this power.");
-#endif
-
+               msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
 
                if (!over_exert) return FALSE;
 
                /* Verify */
-#ifdef JP
-if (!get_check("それでも挑戦しますか? ")) return FALSE;
-#else
-               if (!get_check("Attempt it anyway? ")) return FALSE;
-#endif
-
+               if (!get_check(_("それでも挑戦しますか? ", "Attempt it anyway? "))) return FALSE;
        }
 
        /* Spell failure chance */
@@ -1588,11 +1461,7 @@ if (!get_check("それでも挑戦しますか? ")) return FALSE;
        if (randint0(100) < chance)
        {
                if (flush_failure) flush();
-#ifdef JP
-msg_print("魔法をうまく唱えられなかった。");
-#else
-               msg_print("You failed to concentrate hard enough!");
-#endif
+               msg_print(_("魔法をうまく唱えられなかった。", "You failed to concentrate hard enough!"));
 
                sound(SOUND_FAIL);
 
@@ -1624,13 +1493,7 @@ msg_print("魔法をうまく唱えられなかった。");
                p_ptr->csp = 0;
                p_ptr->csp_frac = 0;
 
-               /* Message */
-#ifdef JP
-msg_print("精神を集中しすぎて気を失ってしまった!");
-#else
-               msg_print("You faint from the effort!");
-#endif
-
+               msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
 
                /* Hack -- Bypass free action */
                (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
@@ -1642,26 +1505,17 @@ msg_print("精神を集中しすぎて気を失ってしまった!");
                {
                        bool perm = (randint0(100) < 25);
 
-                       /* Message */
-#ifdef JP
-msg_print("体を悪くしてしまった!");
-#else
-                       msg_print("You have damaged your health!");
-#endif
-
+                       msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
 
                        /* Reduce constitution */
                        (void)dec_stat(A_CON, 15 + randint1(10), perm);
                }
        }
 
-       /* Take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
-       /* Window stuff */
        p_ptr->redraw |= (PR_MANA);
-       p_ptr->window |= (PW_PLAYER);
-       p_ptr->window |= (PW_SPELL);
+       p_ptr->window |= (PW_PLAYER | PW_SPELL);
 
        return TRUE;
 }
@@ -1680,14 +1534,9 @@ void learn_spell(int monspell)
        if (randint1(p_ptr->lev + 70) > monster_powers[monspell].level + 40)
        {
                p_ptr->magic_num2[monspell] = 1;
-#ifdef JP
-               msg_format("%sを学習した!", monster_powers[monspell].name);
-#else
-               msg_format("You have learned %s!", monster_powers[monspell].name);
-#endif
+               msg_format(_("%sを学習した!", "You have learned %s!"), monster_powers[monspell].name);
                gain_exp(monster_powers[monspell].level * monster_powers[monspell].smana);
 
-               /* Sound */
                sound(SOUND_STUDY);
 
                new_mane = TRUE;
@@ -1707,7 +1556,7 @@ void learn_spell(int monspell)
  */
 /*
  */
-void set_rf_masks(s32b *f4, s32b *f5, s32b *f6, int mode)
+void set_rf_masks(BIT_FLAGS *f4, BIT_FLAGS *f5, BIT_FLAGS *f6, BIT_FLAGS mode)
 {
        switch (mode)
        {