OSDN Git Service

[Refactor] #37353 混乱時のコマンド制限処理を cmd_limit_confused() に統合。 / Integrate command limitat...
[hengband/hengband.git] / src / cmd2.c
index b65b05c..b8a2597 100644 (file)
 #include "object-hook.h"
 #include "projection.h"
 #include "spells-summon.h"
+#include "spells-status.h"
 #include "monster-status.h"
 #include "quest.h"
 #include "artifact.h"
 #include "avatar.h"
 #include "player-status.h"
+#include "realm-hex.h"
 
 /*!
  * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理
@@ -51,6 +53,40 @@ bool confirm_leave_level(bool down_stair)
        return FALSE;
 }
 
+
+bool cmd_limit_confused(player_type *creature_ptr)
+{
+       if (p_ptr->confused)
+       {
+               msg_print(_("混乱していてできない!", "You are too confused!"));
+               return TRUE;
+       }
+       return FALSE;
+}
+
+bool cmd_limit_arena(player_type *creature_ptr)
+{
+       if (p_ptr->inside_arena)
+       {
+               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
+               msg_print(NULL);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+bool cmd_limit_time_walk(player_type *creature_ptr)
+{
+       if (world_player)
+       {
+               if (flush_failure) flush();
+               msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
+               sound(SOUND_FAIL);
+               return TRUE;
+       }
+       return FALSE;
+}
+
 /*!
  * @brief 階段を使って階層を昇る処理 / Go up one level
  * @return なし
@@ -502,18 +538,6 @@ static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
 }
 
 /*!
- * @brief 地形は開くものであって、かつ開かれているかを返す /
- * Attempt to open the given chest at the given location
- * @param feat 地形ID
- * @return 開いた地形である場合TRUEを返す /  Return TRUE if the given feature is an open door
- */
-static bool is_open(IDX feat)
-{
-       return have_flag(f_info[feat].flags, FF_CLOSE) && (feat != feat_state(feat, FF_CLOSE));
-}
-
-
-/*!
  * @brief プレイヤーの周辺9マスに該当する地形がいくつあるかを返す /
  * Attempt to open the given chest at the given location
  * @param y 該当する地形の中から1つのY座標を返す参照ポインタ
@@ -2050,13 +2074,7 @@ void do_cmd_walk(bool pickup)
 void do_cmd_run(void)
 {
        DIRECTION dir;
-
-       /* Hack -- no running when confused */
-       if (p_ptr->confused)
-       {
-               msg_print(_("混乱していて走れない!", "You are too confused!"));
-               return;
-       }
+       if (cmd_limit_confused(p_ptr)) return;
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {