OSDN Git Service

[Refactor] #37353 コメント整理。 / Refactor comments.
[hengband/hengband.git] / src / realm-hex.c
index 1c0caa1..7a614eb 100644 (file)
@@ -20,6 +20,7 @@
 #include "cmd-quaff.h"
 #include "object-hook.h"
 #include "object-curse.h"
+#include "projection.h"
 
 #define MAX_KEEP 4 /*!<呪術の最大詠唱数 */
 
@@ -29,7 +30,7 @@
  */
 bool stop_hex_spell_all(void)
 {
-       int i;
+       SPELL_IDX i;
 
        for (i = 0; i < 32; i++)
        {
@@ -39,10 +40,8 @@ bool stop_hex_spell_all(void)
        CASTING_HEX_FLAGS(p_ptr) = 0;
        CASTING_HEX_NUM(p_ptr) = 0;
 
-       /* Print message */
        if (p_ptr->action == ACTION_SPELL) set_action(ACTION_NONE);
 
-       /* Redraw status */
        p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
        p_ptr->redraw |= (PR_EXTRA | PR_HP | PR_MANA);
 
@@ -120,7 +119,6 @@ bool stop_hex_spell(void)
                CASTING_HEX_NUM(p_ptr)--;
        }
 
-       /* Redraw status */
        p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
        p_ptr->redraw |= (PR_EXTRA | PR_HP | PR_MANA);
 
@@ -169,13 +167,11 @@ void check_hex(void)
                }
        }
 
-
        /* Culcurates final mana cost */
        need_mana_frac = 0;
        s64b_div(&need_mana, &need_mana_frac, 0, 3); /* Divide by 3 */
        need_mana += (CASTING_HEX_NUM(p_ptr) - 1);
 
-
        /* Not enough mana */
        if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
        {
@@ -191,22 +187,13 @@ void check_hex(void)
                p_ptr->redraw |= PR_MANA;
                if (res)
                {
-#ifdef JP
-                       msg_print("詠唱を再開した。");
-#else
-                       msg_print("You restart spelling.");
-#endif
+                       msg_print(_("詠唱を再開した。", "You restart spelling."));
+
                        p_ptr->action = ACTION_SPELL;
 
-                       /* Recalculate bonuses */
                        p_ptr->update |= (PU_BONUS | PU_HP);
-
-                       /* Redraw map and status bar */
                        p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
-
-                       /* Update monsters */
                        p_ptr->update |= (PU_MONSTERS);
-
                        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
                }
        }
@@ -247,14 +234,9 @@ void check_hex(void)
 bool hex_spell_fully(void)
 {
        int k_max = 0;
-
        k_max = (p_ptr->lev / 15) + 1;
-
-       /* Paranoia */
        k_max = MIN(k_max, MAX_KEEP);
-
        if (CASTING_HEX_NUM(p_ptr) < k_max) return FALSE;
-
        return TRUE;
 }
 
@@ -341,7 +323,7 @@ bool multiply_barrier(MONSTER_IDX m_idx)
 * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST / SPELL_CONT / SPELL_STOP)
 * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST / SPELL_CONT / SPELL_STOP 時はNULL文字列を返す。
 */
-cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
+concptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -408,7 +390,7 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (info) return info_damage(1, power, 0);
                if (cast || cont)
                {
-                       project_hack(GF_POIS, randint1(power));
+                       project_all_los(GF_POIS, randint1(power));
                }
                break;
 
@@ -427,8 +409,8 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (cast)
                {
                        OBJECT_IDX item;
-                       cptr q, s;
-                       char o_name[MAX_NLEN];
+                       concptr q, s;
+                       GAME_TEXT o_name[MAX_NLEN];
                        object_type *o_ptr;
                        u32b f[TR_FLAG_SIZE];
 
@@ -436,9 +418,9 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        q = _("どれを呪いますか?", "Which weapon do you curse?");
                        s = _("武器を装備していない。", "You wield no weapons.");
 
-                       if (!get_item(&item, q, s, (USE_EQUIP))) return FALSE;
+                       o_ptr = choose_object(&item, q, s, (USE_EQUIP));
+                       if (!o_ptr) return FALSE;
 
-                       o_ptr = &inventory[item];
                        object_desc(o_name, o_ptr, OD_NAME_ONLY);
                        object_flags(o_ptr, f);
 
@@ -604,7 +586,7 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (info) return info_damage(1, power, 0);
                if (cast || cont)
                {
-                       project_hack(GF_HYPODYNAMIA, randint1(power));
+                       project_all_los(GF_HYPODYNAMIA, randint1(power));
                }
                break;
 
@@ -723,8 +705,8 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (cast)
                {
                        OBJECT_IDX item;
-                       cptr q, s;
-                       char o_name[MAX_NLEN];
+                       concptr q, s;
+                       GAME_TEXT o_name[MAX_NLEN];
                        object_type *o_ptr;
                        u32b f[TR_FLAG_SIZE];
 
@@ -732,7 +714,8 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        q = _("どれを呪いますか?", "Which piece of armour do you curse?");
                        s = _("防具を装備していない。", "You wield no piece of armours.");
 
-                       if (!get_item(&item, q, s, (USE_EQUIP))) return FALSE;
+                       o_ptr = choose_object(&item, q, s, (USE_EQUIP));
+                       if (!o_ptr) return FALSE;
 
                        o_ptr = &inventory[item];
                        object_desc(o_name, o_ptr, OD_NAME_ONLY);
@@ -843,7 +826,7 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (info) return info_damage(1, power, 0);
                if (cast || cont)
                {
-                       project_hack(GF_PSI_DRAIN, randint1(power));
+                       project_all_los(GF_PSI_DRAIN, randint1(power));
                }
                break;
 
@@ -892,7 +875,7 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                                flag = TRUE;
                        }
-                       for (i = A_STR; i < 6; i++)
+                       for (i = A_STR; i < A_MAX; i++)
                        {
                                if (p_ptr->stat_cur[i] < p_ptr->stat_max[i])
                                {
@@ -903,8 +886,6 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                                        if (p_ptr->stat_cur[i] > p_ptr->stat_max[i])
                                                p_ptr->stat_cur[i] = p_ptr->stat_max[i];
-
-                                       /* Recalculate bonuses */
                                        p_ptr->update |= (PU_BONUS);
 
                                        flag = TRUE;
@@ -918,7 +899,6 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                if (cont) CASTING_HEX_NUM(p_ptr)--;
                                if (CASTING_HEX_NUM(p_ptr)) p_ptr->action = ACTION_NONE;
 
-                               /* Redraw status */
                                p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
                                p_ptr->redraw |= (PR_EXTRA);
 
@@ -933,7 +913,7 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (cast)
                {
                        OBJECT_IDX item;
-                       cptr s, q;
+                       concptr s, q;
                        u32b f[TR_FLAG_SIZE];
                        object_type *o_ptr;
 
@@ -941,9 +921,9 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        q = _("どの装備品から吸収しますか?", "Which cursed equipment do you drain mana from?");
                        s = _("呪われたアイテムを装備していない。", "You have no cursed equipment.");
 
-                       if (!get_item(&item, q, s, (USE_EQUIP))) return FALSE;
+                       o_ptr = choose_object(&item, q, s, (USE_EQUIP));
+                       if (!o_ptr) return FALSE;
 
-                       o_ptr = &inventory[item];
                        object_flags(o_ptr, f);
 
                        p_ptr->csp += (p_ptr->lev / 5) + randint1(p_ptr->lev / 5);
@@ -1131,7 +1111,6 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (p_ptr->action != ACTION_SPELL) set_action(ACTION_SPELL);
        }
 
-       /* Redraw status */
        if (!info)
        {
                p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);