OSDN Git Service

[Refactor] #37917 word_of_recall() と recall_player() を整理。 / Refactor word_of_recall...
[hengband/hengband.git] / src / racial.c
index df571b0..90e67c6 100644 (file)
@@ -136,19 +136,9 @@ static bool do_cmd_archer(void)
 
                q = _("どのアイテムから作りますか? ", "Convert which item? ");
                s = _("材料を持っていない。", "You have no item to convert.");
-               if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
+               q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+               if (!q_ptr) return FALSE;
 
-               /* Get the item (in the pack) */
-               if (item >= 0)
-               {
-                       q_ptr = &inventory[item];
-               }
-
-               /* Get the item (on the floor) */
-               else
-               {
-                       q_ptr = &o_list[0 - item];
-               }
                q_ptr = &forge;
 
                /* Hack -- Give the player some small firestones */
@@ -192,19 +182,10 @@ static bool do_cmd_archer(void)
 
                q = _("どのアイテムから作りますか? ", "Convert which item? ");
                s = _("材料を持っていない。", "You have no item to convert.");
-               if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
 
-               /* Get the item (in the pack) */
-               if (item >= 0)
-               {
-                       q_ptr = &inventory[item];
-               }
+               q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+               if (!q_ptr) return FALSE;
 
-               /* Get the item (on the floor) */
-               else
-               {
-                       q_ptr = &o_list[0 - item];
-               }
                q_ptr = &forge;
 
                /* Hack -- Give the player some small firestones */
@@ -259,19 +240,8 @@ bool gain_magic(void)
        q = _("どのアイテムの魔力を取り込みますか? ", "Gain power of which item? ");
        s = _("魔力を取り込めるアイテムがない。", "You have nothing to gain power.");
 
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+       if (!o_ptr) return (FALSE);
 
        if (o_ptr->tval == TV_STAFF && o_ptr->sval == SV_STAFF_NOTHING)
        {
@@ -279,7 +249,6 @@ bool gain_magic(void)
                return FALSE;
        }
 
-
        if (!object_is_known(o_ptr))
        {
                msg_print(_("鑑定されていないと取り込めない。", "You need to identify before absorbing."));
@@ -745,7 +714,7 @@ static bool cmd_racial_power_aux(s32b command)
                        int i;
                        cave_type *c_ptr;
 
-                       for (i = 0; i < 6; i++)
+                       for (i = 0; i < A_MAX; i++)
                        {
                                dir = randint0(8);
                                y = p_ptr->y + ddy_ddd[dir];
@@ -1085,7 +1054,7 @@ static bool cmd_racial_power_aux(s32b command)
                }
                case CLASS_BERSERKER:
                {
-                       if (!word_of_recall()) return FALSE;
+                       if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
                        break;
                }
                case CLASS_SMITH:
@@ -1550,6 +1519,7 @@ void do_cmd_racial_power(void)
        char            out_val[160];
        int menu_line = (use_menu ? 1 : 0);
 
+       if (p_ptr->wild_mode) return;
 
        for (num = 0; num < 36; num++)
        {