OSDN Git Service

[Refactor] #37353 VARTUE_LARGE, VARTUE_SMALL を avatar.h へ移動.
[hengband/hengband.git] / src / cmd-magiceat.c
index 218591a..8b2652e 100644 (file)
@@ -35,8 +35,8 @@
  * 400 item comparisons, but only occasionally.
  *
  * There may be a BIG problem with any "effect" that can cause "changes"
- * to the inventory.  For example, a "scroll of recharging" can cause
- * a wand/staff to "disappear", moving the inventory up.  Luckily, the
+ * to the p_ptr->inventory_list.  For example, a "scroll of recharging" can cause
+ * a wand/staff to "disappear", moving the p_ptr->inventory_list up.  Luckily, the
  * scrolls all appear BEFORE the staffs/wands, so this is not a problem.
  * But, for example, a "staff of recharging" could cause MAJOR problems.
  * In such a case, it will be best to either (1) "postpone" the effect
  */
 
 #include "angband.h"
+#include "util.h"
+#include "term.h"
+
+#include "cmd-basic.h"
 #include "cmd-usestaff.h"
 #include "cmd-zaprod.h"
 #include "cmd-zapwand.h"
-
+#include "cmd-magiceat.h"
+#include "avatar.h"
+#include "player-status.h"
+#include "spells.h"
+#include "player-class.h"
+#include "objectkind.h"
+#include "targeting.h"
 
 /*!
  * @brief 魔道具術師の取り込んだ魔力一覧から選択/閲覧する /
@@ -195,11 +205,10 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
                                                                                        "(*=List, ESC=exit) Browse which power? "));
        else strnfmt(out_val, 78, _("('*'で一覧, ESCで中断) どの魔力を使いますか?",
                                                                "(*=List, ESC=exit) Use which power? "));
-               screen_save();
+       screen_save();
 
        request_list = always_show_list;
 
-       /* Get a spell from the user */
        while (!flag)
        {
                /* Show the list */
@@ -511,17 +520,12 @@ bool do_cmd_magic_eater(bool only_browse, bool powerful)
        OBJECT_SUBTYPE_VALUE sval;
        bool use_charge = TRUE;
 
-       /* Not when confused */
-       if (!only_browse && p_ptr->confused)
-       {
-               msg_print(_("混乱していて唱えられない!", "You are too confused!"));
-               return FALSE;
-       }
+       if (cmd_limit_confused(p_ptr)) return FALSE;
 
        item = select_magic_eater(only_browse);
        if (item == -1)
        {
-               p_ptr->energy_use = 0;
+               free_turn(p_ptr);
                return FALSE;
        }
        if (item >= EATER_EXT*2) {tval = TV_ROD;sval = item - EATER_EXT*2;}
@@ -555,7 +559,7 @@ bool do_cmd_magic_eater(bool only_browse, bool powerful)
                sound(SOUND_FAIL);
                if (randint1(100) >= chance)
                        chg_virtue(V_CHANCE,-1);
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);
 
                return TRUE;
        }
@@ -583,7 +587,7 @@ bool do_cmd_magic_eater(bool only_browse, bool powerful)
                if (randint1(100) < chance)
                        chg_virtue(V_CHANCE,1);
        }
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
        if (tval == TV_ROD) p_ptr->magic_num1[item] += k_info[k_idx].pval * EATER_ROD_CHARGE;
        else p_ptr->magic_num1[item] -= EATER_CHARGE;