OSDN Git Service

[Refactor] #37353 コメント整理。 / Refactor comments.
[hengband/hengband.git] / src / cmd-activate.c
index badf09e..3808389 100644 (file)
 #include "object-hook.h"
 #include "spells-summon.h"
 #include "sort.h"
+#include "projection.h"
+#include "artifact.h"
+#include "avatar.h"
+#include "spells-status.h"
+#include "realm-hex.h"
+#include "player-status.h"
 
 /*!
 * @brief ペット入りモンスターボールをソートするための比較関数
@@ -86,7 +92,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
                o_ptr = &o_list[0 - item];
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Extract the item level */
        lev = k_info[o_ptr->k_idx].level;
@@ -114,13 +120,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
        if (fail < USE_DEVICE) fail = USE_DEVICE;
        if (chance < USE_DEVICE) chance = USE_DEVICE;
 
-       if (world_player)
-       {
-               if (flush_failure) flush();
-               msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
-               sound(SOUND_FAIL);
-               return;
-       }
+       if(cmd_limit_time_walk(p_ptr)) return;
 
        if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
        else if (chance > fail)
@@ -155,7 +155,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
                ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
        {
                msg_print(_("燃料がない。", "It has no fuel."));
-               p_ptr->energy_use = 0;
+               free_turn(p_ptr);
                return;
        }
 
@@ -368,13 +368,7 @@ void do_cmd_activate(void)
        concptr q, s;
 
        if (p_ptr->wild_mode) return;
-
-       if (p_ptr->inside_arena)
-       {
-               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
-               msg_print(NULL);
-               return;
-       }
+       if (cmd_limit_arena(p_ptr)) return;
 
        if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
        {
@@ -1645,7 +1639,7 @@ bool activate_artifact(object_type *o_ptr)
                        GAME_TEXT m_name[MAX_NLEN];
                        monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
                        msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name);
-                       p_ptr->energy_use = 0;
+                       free_turn(p_ptr);
                        return FALSE;
                }
                set_action(ACTION_FISH);