OSDN Git Service

[Refactor] #39068 エンバグを修正しつつ,add_essence() の item_tester_tval グローバル参照をローカル引数に収める.
[hengband/hengband.git] / src / snipe.c
index 644de8d..73c7ac1 100644 (file)
@@ -7,7 +7,15 @@
  */
 
 #include "angband.h"
+#include "core.h"
+#include "util.h"
+#include "term.h"
+
 #include "player-status.h"
+#include "cmd-basic.h"
+#include "snipe.h"
+#include "monsterrace.h"
+#include "view-mainwindow.h"
 
 #define MAX_SNIPE_POWERS 16
 
@@ -17,8 +25,8 @@ typedef struct snipe_power snipe_power;
 /*! スナイパー技能情報の構造体 */
 struct snipe_power
 {
-       int     min_lev;
-       int     mana_cost;
+       PLAYER_LEVEL min_lev;
+       MANA_POINT mana_cost;
        concptr name;
 };
 
@@ -112,7 +120,7 @@ static bool snipe_concentrate(void)
        if ((int)p_ptr->concent < (2 + (p_ptr->lev + 5) / 10)) p_ptr->concent++;
 
        msg_format(_("集中した。(集中度 %d)", "You concentrate deeply. (lvl %d)"), p_ptr->concent);
-       reset_concent = FALSE;
+       p_ptr->reset_concent = FALSE;
 
        p_ptr->update |= (PU_BONUS | PU_MONSTERS);
        p_ptr->redraw |= (PR_STATUS);
@@ -132,7 +140,7 @@ void reset_concentration(bool msg)
        }
 
        p_ptr->concent = 0;
-       reset_concent = FALSE;
+       p_ptr->reset_concent = FALSE;
 
        p_ptr->update |= (PU_BONUS | PU_MONSTERS);
        p_ptr->redraw |= (PR_STATUS);
@@ -169,7 +177,6 @@ void display_snipe_list(void)
        put_str(_("名前", "Name"), y, x + 5);
        put_str(_("Lv   MP", "Lv Mana"), y, x + 35);
 
-       /* Dump the spells */
        for (i = 0; i < MAX_SNIPE_POWERS; i++)
        {
                /* Access the available spell */
@@ -177,7 +184,6 @@ void display_snipe_list(void)
                if (spell.min_lev > plev) continue;
                if (spell.mana_cost > (int)p_ptr->concent) continue;
 
-               /* Dump the spell */
                sprintf(psi_desc, "  %c) %-30s%2d %4d",
                        I2A(i), spell.name, spell.min_lev, spell.mana_cost);
 
@@ -265,7 +271,6 @@ static int get_snipe_power(COMMAND_CODE *sn, bool only_browse)
                                        p, I2A(0), I2A(num), p);
        }
 
-       /* Get a spell from the user */
        choice = always_show_list ? ESCAPE : 1;
        while (!flag)
        {
@@ -284,13 +289,8 @@ static int get_snipe_power(COMMAND_CODE *sn, bool only_browse)
 
                                /* Display a list of spells */
                                prt("", y, x);
-#ifdef JP
-                               put_str("名前", y, x + 5);
-                               if (only_browse) put_str("Lv   集中度", y, x + 35);
-#else
-                               put_str("Name", y, x + 5);
-                               if (only_browse) put_str("Lv Pow", y, x + 35);
-#endif
+                               put_str(_("名前", "Name"), y, x + 5);
+                               if (only_browse) put_str(_("Lv   集中度", "Lv Pow"), y, x + 35);
 
                                /* Dump the spells */
                                for (i = 0; i < MAX_SNIPE_POWERS; i++)
@@ -486,7 +486,7 @@ MULTIPLY tot_dam_aux_snipe(MULTIPLY mult, monster_type *m_ptr, SPELL_IDX snipe_t
  */
 static bool cast_sniper_spell(int spell)
 {
-       object_type *o_ptr = &inventory[INVEN_BOW];
+       object_type *o_ptr = &p_ptr->inventory_list[INVEN_BOW];
        SPELL_IDX snipe_type = SP_NONE;
 
        if (o_ptr->tval != TV_BOW)
@@ -524,7 +524,7 @@ static bool cast_sniper_spell(int spell)
        command_cmd = 'f';
        do_cmd_fire(snipe_type);
 
-       return (is_fired);
+       return (p_ptr->is_fired);
 }
 
 /*!
@@ -534,7 +534,7 @@ static bool cast_sniper_spell(int spell)
 void do_cmd_snipe(void)
 {
        COMMAND_CODE n = 0;
-       bool            cast;
+       bool cast;
 
        if(cmd_limit_confused(p_ptr)) return;
        if(cmd_limit_image(p_ptr)) return;
@@ -543,13 +543,10 @@ void do_cmd_snipe(void)
        if (!get_snipe_power(&n, FALSE)) return;
 
        sound(SOUND_SHOOT);
-
-       /* Cast the spell */
        cast = cast_sniper_spell(n);
 
        if (!cast) return;
        p_ptr->redraw |= (PR_HP | PR_MANA);
-
        p_ptr->window |= (PW_PLAYER);
        p_ptr->window |= (PW_SPELL);
 }