OSDN Git Service

[modify](2.2.1.1 #37582) GF_OLD_DRAINをGF_HYPODYNAMIAに改名。使い手のHP回復や滋養度回復を伴わない同魔法効果を...
[hengband/hengband.git] / src / snipe.c
index 398b16e..b0e1c00 100644 (file)
@@ -1,8 +1,19 @@
+/*!
+ * @file snipe.c
+ * @brief スナイパー技能の実装 / Sniping
+ * @date 2014/01/18
+ * @author
+ * 2014 Deskull rearranged comment for Doxygen.\n
+ */
+
 #include "angband.h"
 
 #define MAX_SNIPE_POWERS 16
 
+/*! スナイパー技能情報のtypedef */
 typedef struct snipe_power snipe_power;
+
+/*! スナイパー技能情報の構造体 */
 struct snipe_power
 {
        int     min_lev;
@@ -10,25 +21,26 @@ struct snipe_power
        const char *name;
 };
 
-static const char *snipe_tips[MAX_SNIPE_POWERS] =
+/*! スナイパー技能の解説メッセージ */
+static cptr const snipe_tips[MAX_SNIPE_POWERS] =
 {
 #ifdef JP
-       "Àº¿À¤ò½¸Ã椹¤ë¡£¼Í·â¤Î°ÒÎÏ¡¢ÀºÅÙ¤¬¾å¤¬¤ê¡¢¹âÅ٤ʼͷâ½Ñ¤¬»ÈÍѤǤ­¤ë¤è¤¦¤Ë¤Ê¤ë¡£",
-       "¸÷¤ëÌð¤òÊü¤Ä¡£¸÷¤Ë¼å¤¤¥â¥ó¥¹¥¿¡¼¤Ë°ÒÎϤòȯ´ø¤¹¤ë¡£",
-       "¼Í·â¤ò¹Ô¤Ã¤¿¸å¡¢Ã»µ÷Î¥¤Î½Ö´Ö°ÜÆ°¤ò¹Ô¤¦¡£",
-       "µ°Æ»¾å¤Î櫤ò¤¹¤Ù¤Æ̵¸ú¤Ë¤¹¤ëÄã¶õÈô¹Ô¤ÎÌð¤òÊü¤Ä¡£",
-       "²Ð±ê°À­¤ÎÌð¤òÊü¤Ä¡£",
-       "ÊɤòÊ´ºÕ¤¹¤ëÌð¤òÊü¤Ä¡£´ä¤Ç¤Ç¤­¤¿¥â¥ó¥¹¥¿¡¼¤È̵À¸Êª¤Î¥â¥ó¥¹¥¿¡¼¤Ë°ÒÎϤòȯ´ø¤¹¤ë¡£",
-       "Î䵤°À­¤ÎÌð¤òÊü¤Ä¡£",
-       "Ũ¤òÆͤ­Èô¤Ð¤¹Ìð¤òÊü¤Ä¡£",
-       "Ê£¿ô¤ÎŨ¤ò´ÓÄ̤¹¤ëÌð¤òÊü¤Ä¡£",
-       "Á±Îɤʥâ¥ó¥¹¥¿¡¼¤Ë°ÒÎϤòȯ´ø¤¹¤ëÌð¤òÊü¤Ä¡£",
-       "¼Ù°­¤Ê¥â¥ó¥¹¥¿¡¼¤Ë°ÒÎϤòȯ´ø¤¹¤ëÌð¤òÊü¤Ä¡£",
-       "Åö¤¿¤ë¤ÈÇúȯ¤¹¤ëÌð¤òÊü¤Ä¡£",
-       "2²ó¼Í·â¤ò¹Ô¤¦¡£",
-       "ÅÅ·â°À­¤ÎÌð¤òÊü¤Ä¡£",
-       "Ũ¤ÎµÞ½ê¤Ë¤á¤¬¤±¤ÆÌð¤òÊü¤Ä¡£À®¸ù¤¹¤ë¤ÈŨ¤ò°ì·â»à¤µ¤»¤ë¡£¼ºÇÔ¤¹¤ë¤È1¥À¥á¡¼¥¸¡£",
-       "Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤Ë¹â°ÒÎϤòȯ´ø¤¹¤ëÌð¤òÊü¤Ä¡£È¿Æ°¤Ë¤è¤ëÉû¼¡¸ú²Ì¤ò¼õ¤±¤ë¡£",
+       "精神を集中する。射撃の威力、精度が上がり、高度な射撃術が使用できるようになる。",
+       "光る矢を放つ。光に弱いモンスターに威力を発揮する。",
+       "射撃を行った後、短距離の瞬間移動を行う。",
+       "軌道上の罠をすべて無効にする低空飛行の矢を放つ。",
+       "火炎属性の矢を放つ。",
+       "壁を粉砕する矢を放つ。岩でできたモンスターと無生物のモンスターに威力を発揮する。",
+       "冷気属性の矢を放つ。",
+       "敵を突き飛ばす矢を放つ。",
+       "複数の敵を貫通する矢を放つ。",
+       "善良なモンスターに威力を発揮する矢を放つ。",
+       "邪悪なモンスターに威力を発揮する矢を放つ。",
+       "当たると爆発する矢を放つ。",
+       "2回射撃を行う。",
+       "電撃属性の矢を放つ。",
+       "敵の急所にめがけて矢を放つ。成功すると敵を一撃死させる。失敗すると1ダメージ。",
+       "全てのモンスターに高威力を発揮する矢を放つ。反動による副次効果を受ける。",
 #else
        "Concentrate your mind fot shooting.",
        "Shot an allow with brightness.",
@@ -49,26 +61,27 @@ static const char *snipe_tips[MAX_SNIPE_POWERS] =
 #endif
 };
 
-snipe_power snipe_powers[MAX_SNIPE_POWERS] =
+/*! スナイパー技能テーブル */
+static snipe_power const snipe_powers[MAX_SNIPE_POWERS] =
 {
        /* Level gained,  cost,  name */
 #ifdef JP
-       {  1,  0,  "Àº¿À½¸Ãæ" },
-       {  2,  1,  "¥Õ¥é¥Ã¥·¥å¥¢¥í¡¼" },
-       {  3,  1,  "¥·¥å¡¼¥È¡õ¥¢¥¦¥§¥¤" },
-       {  5,  1,  "²ò½ü¤ÎÌð" },
-       {  8,  2,  "²Ð±ê¤ÎÌð" },
-       { 10,  2,  "´äºÕ¤­" },
-       { 13,  2,  "Î䵤¤ÎÌð" },
-       { 18,  2,  "ÎõÉ÷ÃÆ"},
-       { 22,  3,  "´ÓÄÌÃÆ" },
-       { 25,  4,  "¼ÙÇ°ÃÆ"},
-       { 26,  4,  "ÇËËâÌð" },
-       { 30,  3,  "Çúȯ¤ÎÌð"},
-       { 32,  4,  "¥À¥Ö¥ë¥·¥ç¥Ã¥È" },
-       { 36,  3,  "¥×¥é¥º¥Þ¥Ü¥ë¥È" },
-       { 40,  3,  "¥Ë¡¼¥É¥ë¥·¥ç¥Ã¥È" },
-       { 48,  7,  "¥»¥¤¥ó¥È¥¹¥¿¡¼¥¢¥í¡¼" },
+       {  1,  0,  "精神集中" },
+       {  2,  1,  "ã\83\95ã\83©ã\83\83ã\82·ã\83¥ã\82¢ã\83­ã\83¼" },
+       {  3,  1,  "ã\82·ã\83¥ã\83¼ã\83\88ï¼\86ã\82¢ã\82¦ã\82§ã\82¤" },
+       {  5,  1,  "解除の矢" },
+       {  8,  2,  "火炎の矢" },
+       { 10,  2,  "岩砕き" },
+       { 13,  2,  "冷気の矢" },
+       { 18,  2,  "烈風弾"},
+       { 22,  3,  "貫通弾" },
+       { 25,  4,  "邪念弾"},
+       { 26,  4,  "破魔矢" },
+       { 30,  3,  "爆発の矢"},
+       { 32,  4,  "ダブルショット" },
+       { 36,  3,  "プラズマボルト" },
+       { 40,  3,  "ニードルショット" },
+       { 48,  7,  "ã\82»ã\82¤ã\83³ã\83\88ã\82¹ã\82¿ã\83¼ã\82¢ã\83­ã\83¼" },
 #else
        {  1,  0,  "Concentration" },
        {  2,  1,  "Flush Arrow" },
@@ -89,17 +102,15 @@ snipe_power snipe_powers[MAX_SNIPE_POWERS] =
 #endif
 };
 
-
+/*! 
+ * @brief スナイパーの集中度加算
+ * @return 常にTRUEを返す
+ */
 static bool snipe_concentrate(void)
 {
        if ((int)p_ptr->concent < (2 + (p_ptr->lev + 5) / 10)) p_ptr->concent++;
 
-#ifdef JP
-       msg_format("½¸Ã椷¤¿¡£(½¸ÃæÅÙ %d)", p_ptr->concent);
-#else
-       msg_format("You concentrate deeply. (lvl %d)", p_ptr->concent);
-#endif
-
+       msg_format(_("集中した。(集中度 %d)", "You concentrate deeply. (lvl %d)"), p_ptr->concent);
        reset_concent = FALSE;
 
        /* Recalculate bonuses */
@@ -113,15 +124,16 @@ static bool snipe_concentrate(void)
        return (TRUE);
 }
 
+/*! 
+ * @brief スナイパーの集中度リセット
+ * @param msg TRUEならばメッセージを表示する
+ * @return なし
+ */
 void reset_concentration(bool msg)
 {
        if (msg)
        {
-#ifdef JP
-               msg_print("½¸ÃæÎϤ¬ÅÓÀÚ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
-#else
-               msg_print("Stop concentrating.");
-#endif
+               msg_print(_("集中力が途切れてしまった。", "Stop concentrating."));
        }
 
        p_ptr->concent = 0;
@@ -136,6 +148,11 @@ void reset_concentration(bool msg)
        p_ptr->update |= (PU_MONSTERS);
 }
 
+/*! 
+ * @brief スナイパーの集中度によるダメージボーナスを加算する
+ * @param tdam 算出中のダメージ
+ * @return 集中度修正を加えたダメージ
+ */
 int boost_concentration_damage(int tdam)
 {
        tdam *= (10 + p_ptr->concent);
@@ -144,6 +161,10 @@ int boost_concentration_damage(int tdam)
        return (tdam);
 }
 
+/*! 
+ * @brief スナイパーの技能リストを表示する
+ * @return なし
+ */
 void display_snipe_list(void)
 {
        int             i;
@@ -156,7 +177,7 @@ void display_snipe_list(void)
        /* Display a list of spells */
        prt("", y, x);
 #ifdef JP
-       put_str("̾Á°", y, x + 5);
+       put_str("名前", y, x + 5);
        put_str("Lv   MP", y, x + 35);
 #else
        put_str("Name", y, x + 5);
@@ -181,23 +202,27 @@ void display_snipe_list(void)
 }
 
 
-/*
- * Allow user to choose a mindcrafter power.
- *
- * If a valid spell is chosen, saves it in '*sn' and returns TRUE
- * If the user hits escape, returns FALSE, and set '*sn' to -1
- * If there are no legal choices, returns FALSE, and sets '*sn' to -2
- *
- * The "prompt" should be "cast", "recite", or "study"
- * The "known" should be TRUE for cast/pray, FALSE for study
- *
- * nb: This function has a (trivial) display bug which will be obvious
- * when you run it. It's probably easy to fix but I haven't tried,
- * sorry.
+/*! 
+ * @brief スナイパー技能を選択する
+ * @param sn 選択した特殊技能ID、キャンセルの場合-1、不正な選択の場合-2を返す
+ * @param only_browse 一覧を見るだけの場合TRUEを返す
+ * @return 発動可能な魔法を選択した場合TRUE、キャンセル処理か不正な選択が行われた場合FALSEを返す。
+ * Allow user to choose a mindcrafter power.\n
+ *\n
+ * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
+ * If the user hits escape, returns FALSE, and set '*sn' to -1\n
+ * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n
+ *\n
+ * The "prompt" should be "cast", "recite", or "study"\n
+ * The "known" should be TRUE for cast/pray, FALSE for study\n
+ *\n
+ * nb: This function has a (trivial) display bug which will be obvious\n
+ * when you run it. It's probably easy to fix but I haven't tried,\n
+ * sorry.\n
  */
-static int get_snipe_power(int *sn, bool only_browse)
+static int get_snipe_power(COMMAND_CODE *sn, bool only_browse)
 {
-       int             i;
+       COMMAND_CODE i;
        int             num = 0;
        int             y = 1;
        int             x = 20;
@@ -205,11 +230,7 @@ static int get_snipe_power(int *sn, bool only_browse)
        int             ask;
        char            choice;
        char            out_val[160];
-#ifdef JP
-       cptr            p = "¼Í·â½Ñ";
-#else
-       cptr            p = "power";
-#endif
+       cptr            p = _("射撃術", "power");
        snipe_power     spell;
        bool            flag, redraw;
 
@@ -252,21 +273,15 @@ static int get_snipe_power(int *sn, bool only_browse)
        /* Build a prompt (accept all spells) */
        if (only_browse)
        {
-#ifdef JP
-               (void)strnfmt(out_val, 78, "(%^s %c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤Ë¤Ä¤¤¤ÆÃΤê¤Þ¤¹¤«¡©",
-#else
-               (void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
-#endif
-                             p, I2A(0), I2A(num), p);
+               (void)strnfmt(out_val, 78, 
+                                       _("(%^s %c-%c, '*'で一覧, ESC) どの%sについて知りますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
+                                       p, I2A(0), I2A(num), p);
        }
        else
        {
-#ifdef JP
-               (void)strnfmt(out_val, 78, "(%^s %c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤ò»È¤¤¤Þ¤¹¤«¡©",
-#else
-               (void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
-#endif
-                         p, I2A(0), I2A(num), p);
+               (void)strnfmt(out_val, 78, 
+                                       _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
+                                       p, I2A(0), I2A(num), p);
        }
 
        /* Get a spell from the user */
@@ -293,8 +308,8 @@ static int get_snipe_power(int *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);
+                               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);
@@ -341,7 +356,7 @@ static int get_snipe_power(int *sn, bool only_browse)
                ask = isupper(choice);
 
                /* Lowercase */
-               if (ask) choice = tolower(choice);
+               if (ask) choice = (char)tolower(choice);
 
                /* Extract request */
                i = (islower(choice) ? A2I(choice) : -1);
@@ -363,11 +378,7 @@ static int get_snipe_power(int *sn, bool only_browse)
                        char tmp_val[160];
 
                        /* Prompt */
-#ifdef JP
-                       (void) strnfmt(tmp_val, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡©", snipe_powers[i].name);
-#else
-                       (void)strnfmt(tmp_val, 78, "Use %s? ", snipe_powers[i].name);
-#endif
+                       (void) strnfmt(tmp_val, 78, _("%sを使いますか?", "Use %s? "), snipe_powers[i].name);
 
                        /* Belay that order */
                        if (!get_check(tmp_val)) continue;
@@ -402,8 +413,14 @@ static int get_snipe_power(int *sn, bool only_browse)
        return (TRUE);
 }
 
-
-int tot_dam_aux_snipe (int mult, monster_type *m_ptr)
+/*!
+ * @brief スナイバー技能のスレイ倍率計算を行う /
+ * Calcurate magnification of snipe technics
+ * @param mult スナイバー技能のスレイ効果以前に算出している多要素の倍率(/10倍)
+ * @param m_ptr 目標となるモンスターの構造体参照ポインタ
+ * @return スレイの倍率(/10倍)
+ */
+int tot_dam_aux_snipe(int mult, monster_type *m_ptr)
 {
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
        bool seen = is_seen(m_ptr);
@@ -494,9 +511,12 @@ int tot_dam_aux_snipe (int mult, monster_type *m_ptr)
        return (mult);
 }
 
-/*
- * do_cmd_cast calls this function if the player's class
- * is 'mindcrafter'.
+
+/*!
+ * @brief スナイパー技能の発動 /
+ * do_cmd_cast calls this function if the player's class is 'snipe'.
+ * @param spell 発動する特殊技能のID
+ * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
  */
 static bool cast_sniper_spell(int spell)
 {
@@ -504,11 +524,7 @@ static bool cast_sniper_spell(int spell)
 
        if (o_ptr->tval != TV_BOW)
        {
-#ifdef JP
-               msg_print("µÝ¤òÁõÈ÷¤·¤Æ¤¤¤Ê¤¤¡ª");
-#else
-               msg_print("You wield no bow!");
-#endif
+               msg_print(_("弓を装備していない!", "You wield no bow!"));
                return (FALSE);
        }
 
@@ -517,7 +533,7 @@ static bool cast_sniper_spell(int spell)
        {
        case 0: /* Concentration */
                if (!snipe_concentrate()) return (FALSE);
-               energy_use = 100;
+               p_ptr->energy_use = 100;
                return (TRUE);
        case 1: snipe_type = SP_LITE; break;
        case 2: snipe_type = SP_AWAY; break;
@@ -535,11 +551,7 @@ static bool cast_sniper_spell(int spell)
        case 14: snipe_type = SP_NEEDLE; break;
        case 15: snipe_type = SP_FINAL; break;
        default:
-#ifdef JP
-               msg_print("¤Ê¤Ë¡©");
-#else
-               msg_print("Zap?");
-#endif
+               msg_print(_("なに?", "Zap?"));
        }
 
        command_cmd = 'f';
@@ -549,47 +561,34 @@ static bool cast_sniper_spell(int spell)
        return (is_fired);
 }
 
-
-/*
- * do_cmd_cast calls this function if the player's class
- * is 'mindcrafter'.
+/*!
+ * @brief スナイパー技能コマンドのメインルーチン /
+ * @return なし
  */
 void do_cmd_snipe(void)
 {
-       int             n = 0;
+       COMMAND_CODE n = 0;
        bool            cast;
 
 
        /* not if confused */
        if (p_ptr->confused)
        {
-#ifdef JP
-               msg_print("º®Í𤷤Ƥ¤¤Æ½¸Ãæ¤Ç¤­¤Ê¤¤¡ª");
-#else
-               msg_print("You are too confused!");
-#endif
+               msg_print(_("混乱していて集中できない!", "You are too confused!"));
                return;
        }
 
        /* not if hullucinated */
        if (p_ptr->image)
        {
-#ifdef JP
-               msg_print("¸¸³Ð¤¬¸«¤¨¤Æ½¸Ãæ¤Ç¤­¤Ê¤¤¡ª");
-#else
-               msg_print("You are too hallucinated!");
-#endif
+               msg_print(_("幻覚が見えて集中できない!", "You are too hallucinated!"));
                return;
        }
 
        /* not if stuned */
        if (p_ptr->stun)
        {
-#ifdef JP
-               msg_print("Ƭ¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ½¸Ãæ¤Ç¤­¤Ê¤¤¡ª");
-#else
-               msg_print("You are too stuned!");
-#endif
+               msg_print(_("頭が朦朧としていて集中できない!", "You are too stuned!"));
                return;
        }
 
@@ -604,7 +603,7 @@ void do_cmd_snipe(void)
        if (!cast) return;
 #if 0
        /* Take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 #endif
        /* Redraw mana */
        p_ptr->redraw |= (PR_HP | PR_MANA);
@@ -614,13 +613,13 @@ void do_cmd_snipe(void)
        p_ptr->window |= (PW_SPELL);
 }
 
-/*
- * do_cmd_cast calls this function if the player's class
- * is 'mindcrafter'.
+/*!
+ * @brief スナイパー技能コマンドの表示 /
+ * @return なし
  */
 void do_cmd_snipe_browse(void)
 {
-       int n = 0;
+       COMMAND_CODE n = 0;
        int j, line;
        char temp[62 * 4];