OSDN Git Service

Revert "Merge branch 'master' of git.osdn.net:/gitroot/hengband/hengband"
[hengband/hengband.git] / src / cmd-usestaff.c
index 64a340a..4ab7403 100644 (file)
@@ -1,20 +1,9 @@
 #include "angband.h"
-#include "util.h"
-
-#include "player-race.h"
+#include "projection.h"
 #include "spells-summon.h"
 #include "avatar.h"
 #include "player-status.h"
-#include "player-effects.h"
-#include "player-class.h"
-#include "spells.h"
 #include "spells-status.h"
-#include "spells-floor.h"
-#include "object-hook.h"
-#include "cmd-basic.h"
-#include "floor.h"
-#include "objectkind.h"
-#include "view-mainwindow.h"
 
 
 
@@ -41,7 +30,7 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
                {
                        if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
                        {
-                               if (set_blind(p_ptr, p_ptr->blind + 3 + randint1(5))) ident = TRUE;
+                               if (set_blind(p_ptr->blind + 3 + randint1(5))) ident = TRUE;
                        }
                        if (unlite_area(10, (powerful ? 6 : 3))) ident = TRUE;
                        break;
@@ -49,7 +38,7 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
 
                case SV_STAFF_SLOWNESS:
                {
-                       if (set_slow(p_ptr, p_ptr->slow + randint1(30) + 15, FALSE)) ident = TRUE;
+                       if (set_slow(p_ptr->slow + randint1(30) + 15, FALSE)) ident = TRUE;
                        break;
                }
 
@@ -64,7 +53,7 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
                        const int times = randint1(powerful ? 8 : 4);
                        for (k = 0; k < times; k++)
                        {
-                               if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
+                               if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
                                {
                                        ident = TRUE;
                                }
@@ -165,7 +154,7 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
                case SV_STAFF_CURING:
                {
                        ident = true_healing(0);
-                       if (set_shero(p_ptr, 0, TRUE)) ident = TRUE;
+                       if (set_shero(0, TRUE)) ident = TRUE;
                        break;
                }
 
@@ -177,9 +166,9 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
 
                case SV_STAFF_THE_MAGI:
                {
-                       if (do_res_stat(p_ptr, A_INT)) ident = TRUE;
+                       if (do_res_stat(A_INT)) ident = TRUE;
                        ident |= restore_mana(FALSE);
-                       if (set_shero(p_ptr, 0, TRUE)) ident = TRUE;
+                       if (set_shero(0, TRUE)) ident = TRUE;
                        break;
                }
 
@@ -197,7 +186,7 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
 
                case SV_STAFF_SPEED:
                {
-                       if (set_fast(p_ptr, randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
+                       if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
                        break;
                }
 
@@ -233,7 +222,7 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
 
                case SV_STAFF_EARTHQUAKES:
                {
-                       if (earthquake(p_ptr->y, p_ptr->x, (powerful ? 15 : 10), 0))
+                       if (earthquake(p_ptr->y, p_ptr->x, (powerful ? 15 : 10)))
                                ident = TRUE;
                        else
                                msg_print(_("ダンジョンが揺れた。", "The dungeon trembles."));
@@ -262,8 +251,8 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
                case SV_STAFF_NOTHING:
                {
                        msg_print(_("何も起らなかった。", "Nothing happen."));
-                       if (PRACE_IS_(p_ptr, RACE_SKELETON) || PRACE_IS_(p_ptr, RACE_GOLEM) ||
-                               PRACE_IS_(p_ptr, RACE_ZOMBIE) || PRACE_IS_(p_ptr, RACE_SPECTRE))
+                       if (prace_is_(RACE_SKELETON) || prace_is_(RACE_GOLEM) ||
+                               prace_is_(RACE_ZOMBIE) || prace_is_(RACE_SPECTRE))
                                msg_print(_("もったいない事をしたような気がする。食べ物は大切にしなくては。", "What a waste.  It's your food!"));
                        break;
                }
@@ -280,7 +269,7 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
  * One charge of one staff disappears.
  * Hack -- staffs of identify can be "cancelled".
  */
-void exe_use_staff(INVENTORY_IDX item)
+void do_cmd_use_staff_aux(INVENTORY_IDX item)
 {
        int         ident, chance, lev;
        object_type *o_ptr;
@@ -293,7 +282,7 @@ void exe_use_staff(INVENTORY_IDX item)
        /* Get the item (in the pack) */
        if (item >= 0)
        {
-               o_ptr = &p_ptr->inventory_list[item];
+               o_ptr = &inventory[item];
        }
 
        /* Get the item (on the floor) */
@@ -313,6 +302,7 @@ void exe_use_staff(INVENTORY_IDX item)
 
        take_turn(p_ptr, 100);
 
+       /* Extract the item level */
        lev = k_info[o_ptr->k_idx].level;
        if (lev > 50) lev = 50 + (lev - 50) / 2;
 
@@ -374,7 +364,7 @@ void exe_use_staff(INVENTORY_IDX item)
        if (ident && !object_is_aware(o_ptr))
        {
                object_aware(o_ptr);
-               gain_exp(p_ptr, (lev + (p_ptr->lev >> 1)) / p_ptr->lev);
+               gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
        }
 
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
@@ -393,6 +383,8 @@ void exe_use_staff(INVENTORY_IDX item)
                object_type forge;
                object_type *q_ptr;
                q_ptr = &forge;
+
+               /* Obtain a local object */
                object_copy(q_ptr, o_ptr);
 
                /* Modify quantity */
@@ -443,9 +435,13 @@ void do_cmd_use_staff(void)
                set_action(ACTION_NONE);
        }
 
+       /* Restrict choices to wands */
+       item_tester_tval = TV_STAFF;
+
        q = _("どの杖を使いますか? ", "Use which staff? ");
        s = _("使える杖がない。", "You have no staff to use.");
-       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), TV_STAFF)) return;
 
-       exe_use_staff(item);
+       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
+
+       do_cmd_use_staff_aux(item);
 }