OSDN Git Service

[Refactor] #37353 盲目時のコマンド制限処理を cmd_limit_confused() に統合。 / Integrate command limitat...
[hengband/hengband.git] / src / cmd-read.c
index 2d359d5..5fa9e06 100644 (file)
@@ -8,8 +8,15 @@
 \r
 #include "angband.h"\r
 #include "object-hook.h"\r
-#include "spells-summon.h"\r
 #include "artifact.h"\r
+#include "avatar.h"\r
+#include "player-status.h"\r
+#include "rumor.h"\r
+#include "realm-hex.h"\r
+\r
+#include "spells-object.h"\r
+#include "spells-summon.h"\r
+#include "spells-status.h"\r
 \r
 /*!\r
  * @brief 巻物を読むコマンドのサブルーチン\r
@@ -42,16 +49,8 @@ void do_cmd_read_scroll_aux(INVENTORY_IDX item, bool known)
                o_ptr = &o_list[0 - item];\r
        }\r
 \r
-\r
-       p_ptr->energy_use = 100;\r
-\r
-       if (world_player)\r
-       {\r
-               if (flush_failure) flush();\r
-               msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen."));\r
-               sound(SOUND_FAIL);\r
-               return;\r
-       }\r
+       take_turn(p_ptr, 100);;\r
+       if (cmd_limit_time_walk(p_ptr)) return;\r
 \r
        if (p_ptr->pclass == CLASS_BERSERKER)\r
        {\r
@@ -105,12 +104,12 @@ void do_cmd_read_scroll_aux(INVENTORY_IDX item, bool known)
                case SV_SCROLL_CURSE_WEAPON:\r
                {\r
                        k = 0;\r
-                       if (buki_motteruka(INVEN_RARM))\r
+                       if (has_melee_weapon(INVEN_RARM))\r
                        {\r
                                k = INVEN_RARM;\r
-                               if (buki_motteruka(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;\r
+                               if (has_melee_weapon(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;\r
                        }\r
-                       else if (buki_motteruka(INVEN_LARM)) k = INVEN_LARM;\r
+                       else if (has_melee_weapon(INVEN_LARM)) k = INVEN_LARM;\r
                        if (k && curse_weapon(FALSE, k)) ident = TRUE;\r
                        break;\r
                }\r
@@ -553,8 +552,6 @@ void do_cmd_read_scroll_aux(INVENTORY_IDX item, bool known)
                used_up=FALSE;\r
        }\r
 \r
-\r
-       /* Combine / Reorder the pack (later) */\r
        p_ptr->update |= (PU_COMBINE | PU_REORDER);\r
 \r
        if (!(object_is_aware(o_ptr)))\r
@@ -618,35 +615,15 @@ void do_cmd_read_scroll(void)
                return;\r
        }\r
 \r
-       if (p_ptr->inside_arena)\r
-       {\r
-               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));\r
-               msg_print(NULL);\r
-               return;\r
-       }\r
+       if (cmd_limit_arena(p_ptr)) return;\r
 \r
        if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))\r
        {\r
                set_action(ACTION_NONE);\r
        }\r
 \r
-       /* Check some conditions */\r
-       if (p_ptr->blind)\r
-       {\r
-               msg_print(_("目が見えない。", "You can't see anything."));\r
-               return;\r
-       }\r
-       if (no_lite())\r
-       {\r
-               msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));\r
-               return;\r
-       }\r
-       if (p_ptr->confused)\r
-       {\r
-               msg_print(_("混乱していて読めない。", "You are too confused!"));\r
-               return;\r
-       }\r
-\r
+       if (cmd_limit_blind(p_ptr)) return;\r
+       if (cmd_limit_confused(p_ptr)) return;\r
 \r
        /* Restrict choices to scrolls */\r
        item_tester_hook = item_tester_hook_readable;\r