OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / realm-hex.c
index 1c7f9c0..95b1056 100644 (file)
 #include "angband.h"
 #include "cmd-spell.h"
 #include "cmd-quaff.h"
+#include "object-hook.h"
+#include "object-curse.h"
 
 #define MAX_KEEP 4 /*!<呪術の最大詠唱数 */
 
- /*!
- * @brief 呪術領域の武器呪縛の対象にできる武器かどうかを返す。 / An "item_tester_hook" for offer
- * @param o_ptr オブジェクト構造体の参照ポインタ
- * @return 呪縛可能な武器ならばTRUEを返す
- */
-static bool item_tester_hook_weapon_except_bow(object_type *o_ptr)
-{
-       switch (o_ptr->tval)
-       {
-       case TV_SWORD:
-       case TV_HAFTED:
-       case TV_POLEARM:
-       case TV_DIGGING:
-       {
-               return (TRUE);
-       }
-       }
-
-       return (FALSE);
-}
-
-/*!
-* @brief 呪術領域の各処理に使える呪われた装備かどうかを返す。 / An "item_tester_hook" for offer
-* @param o_ptr オブジェクト構造体の参照ポインタ
-* @return 使える装備ならばTRUEを返す
-*/
-static bool item_tester_hook_cursed(object_type *o_ptr)
-{
-       return (bool)(object_is_cursed(o_ptr));
-}
-
 /*!
  * @brief プレイヤーが詠唱中の全呪術を停止する
  * @return なし
@@ -85,20 +56,16 @@ bool stop_hex_spell_all(void)
 bool stop_hex_spell(void)
 {
        int spell;
-       char choice;
+       char choice = 0;
        char out_val[160];
        bool flag = FALSE;
-       int y = 1;
-       int x = 20;
+       TERM_LEN y = 1;
+       TERM_LEN x = 20;
        int sp[MAX_KEEP];
 
        if (!hex_spelling_any())
        {
-#ifdef JP
-               msg_print("呪文を詠唱していません。");
-#else
-               msg_print("You are casting no spell.");
-#endif
+               msg_print(_("呪文を詠唱していません。", "You are casting no spell."));
                return FALSE;
        }
 
@@ -109,13 +76,8 @@ bool stop_hex_spell(void)
        }
        else
        {
-#ifdef JP
-               strnfmt(out_val, 78, "どの呪文の詠唱を中断しますか?(呪文 %c-%c, 'l'全て, ESC)",
+               strnfmt(out_val, 78, _("どの呪文の詠唱を中断しますか?(呪文 %c-%c, 'l'全て, ESC)", "Which spell do you stop casting? (Spell %c-%c, 'l' to all, ESC)"),
                        I2A(0), I2A(CASTING_HEX_NUM(p_ptr) - 1));
-#else
-               strnfmt(out_val, 78, "Which spell do you stop casting? (Spell %c-%c, 'l' to all, ESC)",
-                       I2A(0), I2A(CASTING_HEX_NUM(p_ptr) - 1));
-#endif
 
                screen_save();
 
@@ -123,7 +85,7 @@ bool stop_hex_spell(void)
                {
                        int n = 0;
                        Term_erase(x, y, 255);
-                       prt("     名前", y, x + 5);
+                       prt(_("     名前", "     Name"), y, x + 5);
                        for (spell = 0; spell < 32; spell++)
                        {
                                if (hex_spelling(spell))
@@ -174,7 +136,7 @@ bool stop_hex_spell(void)
 void check_hex(void)
 {
        int spell;
-       s32b need_mana;
+       MANA_POINT need_mana;
        u32b need_mana_frac;
        bool res = FALSE;
 
@@ -229,23 +191,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);
-
-                       /* Window stuff */
                        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
                }
        }
@@ -286,14 +238,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;
 }
 
@@ -424,11 +371,7 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        msg_print(_("気分が良くなってくる。", "You feel better and better."));
                }
-               if (cast || cont)
-               {
-                       hp_player(damroll(1, 10));
-                       set_cut(p_ptr->cut - 10);
-               }
+               if (cast || cont) (void)cure_light_wounds(1, 10);
                break;
 
        case 2:
@@ -577,7 +520,7 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                }
                if (cont)
                {
-                       int rad = 2 + (power / 50);
+                       POSITION rad = 2 + (power / 50);
 
                        HEX_REVENGE_TURN(p_ptr)--;
 
@@ -624,11 +567,7 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        msg_print(_("気分が良くなってくる。", "You feel better and better."));
                }
-               if (cast || cont)
-               {
-                       hp_player(damroll(2, 10));
-                       set_cut((p_ptr->cut / 2) - 10);
-               }
+               if (cast || cont) (void)cure_serious_wounds(2, 10);
                break;
 
        case 10:
@@ -736,13 +675,7 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        msg_print(_("気分が良くなってくる。", "You feel better and better."));
                }
-               if (cast || cont)
-               {
-                       hp_player(damroll(4, 10));
-                       set_stun(0);
-                       set_cut(0);
-                       set_poisoned(0);
-               }
+               if (cast || cont) (void)cure_critical_wounds(damroll(4, 10));
                break;
 
        case 18:
@@ -1146,7 +1079,7 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (HEX_REVENGE_TURN(p_ptr) <= 0)
                        {
-                               int dir;
+                               DIRECTION dir;
 
                                if (power)
                                {