OSDN Git Service

[Refactor] #38997 gain_exp() に player_type * 引数を追加.
[hengband/hengband.git] / src / cmd-spell.c
index f33a46d..bd10624 100644 (file)
@@ -7,7 +7,9 @@
  */
 
 #include "angband.h"
+#include "core.h"
 #include "util.h"
+#include "cmd-spell.h"
 
 #include "cmd-dump.h"
 #include "selfinfo.h"
@@ -29,6 +31,7 @@
 #include "realm-trump.h"
 #include "mind.h"
 #include "avatar.h"
+#include "player-damage.h"
 #include "player-status.h"
 #include "player-effects.h"
 #include "player-skill.h"
@@ -667,7 +670,7 @@ void do_cmd_browse(void)
        q = _("どの本を読みますか? ", "Browse which book? ");
        s = _("読める本がない。", "You have no books that you can read.");
 
-       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | (p_ptr->pclass == CLASS_FORCETRAINER ? USE_FORCE : 0)));
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | (p_ptr->pclass == CLASS_FORCETRAINER ? USE_FORCE : 0)), item_tester_tval);
        if (!o_ptr)
        {
                if (item == INVEN_FORCE) /* the_force */
@@ -851,7 +854,7 @@ void do_cmd_study(void)
        q = _("どの本から学びますか? ", "Study which book? ");
        s = _("読める本がない。", "You have no books that you can read.");
 
-       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), item_tester_tval);
        if (!o_ptr) return;
 
        /* Access the item's sval */
@@ -1101,13 +1104,10 @@ void do_cmd_cast(void)
 
        prayer = spell_category_name(mp_ptr->spell_book);
 
-       /* Restrict choices to spell books */
-       item_tester_tval = mp_ptr->spell_book;
-
        q = _("どの呪文書を使いますか? ", "Use which book? ");
        s = _("呪文書がない!", "You have no spell books!");
 
-       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | (p_ptr->pclass == CLASS_FORCETRAINER ? USE_FORCE : 0)));
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | (p_ptr->pclass == CLASS_FORCETRAINER ? USE_FORCE : 0)), mp_ptr->spell_book);
        if (!o_ptr)
        {
                if (item == INVEN_FORCE) /* the_force */
@@ -1263,7 +1263,7 @@ void do_cmd_cast(void)
                                take_hit(DAMAGE_LOSELIFE, damroll(o_ptr->sval + 1, 6), _("暗黒魔法の逆流", "a miscast Death spell"), -1);
 
                                if ((spell > 15) && one_in_(6) && !p_ptr->hold_exp)
-                                       lose_exp(spell * 250);
+                                       lose_exp(p_ptr, spell * 250);
                        }
                }
                else if ((o_ptr->tval == TV_MUSIC_BOOK) && (randint1(200) < spell))
@@ -1304,7 +1304,7 @@ void do_cmd_cast(void)
                        }
 
                        /* Gain experience */
-                       gain_exp(e * s_ptr->slevel);
+                       gain_exp(p_ptr, e * s_ptr->slevel);
 
                        /* Redraw object recall */
                        p_ptr->window |= (PW_OBJECT);
@@ -1428,7 +1428,7 @@ void do_cmd_cast(void)
                msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
 
                /* Hack -- Bypass free action */
-               (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
+               (void)set_paralyzed(p_ptr, p_ptr->paralyzed + randint1(5 * oops + 1));
 
                switch (realm)
                {
@@ -1463,7 +1463,7 @@ void do_cmd_cast(void)
                        msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
 
                        /* Reduce constitution */
-                       (void)dec_stat(A_CON, 15 + randint1(10), perm);
+                       (void)dec_stat(p_ptr, A_CON, 15 + randint1(10), perm);
                }
        }