OSDN Git Service

[Refactor] #37353 コメント整理。 / Refactor comments.
[hengband/hengband.git] / src / cmd-zaprod.c
index fc9a955..1b88d6e 100644 (file)
@@ -1,20 +1,23 @@
-#include "angband.h"
+#include "angband.h"
+#include "avatar.h"
+#include "spells-status.h"
+#include "player-status.h"
 
 /*!
- * @brief \83\8d\83b\83h\82Ì\8cø\89Ê\82ð\94­\93®\82·\82é
- * @param sval \83I\83u\83W\83F\83N\83g\82Ìsval
- * @param dir \94­\93®\96Ú\95W\82Ì\95û\8cüID
- * @param use_charge \83`\83\83\81[\83W\82ð\8fÁ\94ï\82µ\82½\82©\82Ç\82¤\82©\82ð\95Ô\82·\8eQ\8fÆ\83|\83C\83\93\83^
- * @param powerful \8b­\97Í\94­\93®\8fã\82Ì\8f\88\97\9d\82È\82ç\82ÎTRUE
- * @param magic \96\82\93¹\8bï\8fp\8fã\82Ì\8f\88\97\9d\82È\82ç\82ÎTRUE
- * @return \94­\93®\82É\82æ\82è\8cø\89Ê\93à\97e\82ª\8am\92è\82µ\82½\82È\82ç\82ÎTRUE\82ð\95Ô\82·
+ * @brief ロッドの効果を発動する
+ * @param sval オブジェクトのsval
+ * @param dir 発動目標の方向ID
+ * @param use_charge チャージを消費したかどうかを返す参照ポインタ
+ * @param powerful 強力発動上の処理ならばTRUE
+ * @param magic 魔道具術上の処理ならばTRUE
+ * @return 発動により効果内容が確定したならばTRUEを返す
  */
-int rod_effect(OBJECT_SUBTYPE_VALUE sval, int dir, bool *use_charge, bool powerful, bool magic)
+int rod_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool powerful, bool magic)
 {
        int ident = FALSE;
-       int lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
-       int detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
-       int rad = powerful ? 3 : 2;
+       PLAYER_LEVEL lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
+       POSITION detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
+       POSITION rad = powerful ? 3 : 2;
 
        /* Unused */
        (void)magic;
@@ -49,7 +52,7 @@ int rod_effect(OBJECT_SUBTYPE_VALUE sval, int dir, bool *use_charge, bool powerf
 
        case SV_ROD_RECALL:
        {
-               if (!word_of_recall()) *use_charge = FALSE;
+               if (!recall_player(p_ptr, randint0(21) + 15)) *use_charge = FALSE;
                ident = TRUE;
                break;
        }
@@ -83,12 +86,7 @@ int rod_effect(OBJECT_SUBTYPE_VALUE sval, int dir, bool *use_charge, bool powerf
 
        case SV_ROD_CURING:
        {
-               if (set_blind(0)) ident = TRUE;
-               if (set_poisoned(0)) ident = TRUE;
-               if (set_confused(0)) ident = TRUE;
-               if (set_stun(0)) ident = TRUE;
-               if (set_cut(0)) ident = TRUE;
-               if (set_image(0)) ident = TRUE;
+               if (true_healing(0)) ident = TRUE;
                if (set_shero(0, TRUE)) ident = TRUE;
                break;
        }
@@ -135,7 +133,7 @@ int rod_effect(OBJECT_SUBTYPE_VALUE sval, int dir, bool *use_charge, bool powerf
        case SV_ROD_LITE:
        {
                HIT_POINT dam = damroll((powerful ? 12 : 6), 8);
-               msg_print(_("\90Â\82­\8bP\82­\8cõ\90ü\82ª\95ú\82½\82ê\82½\81B", "A line of blue shimmering light appears."));
+               msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
                (void)lite_line(dir, dam);
                ident = TRUE;
                break;
@@ -246,10 +244,10 @@ int rod_effect(OBJECT_SUBTYPE_VALUE sval, int dir, bool *use_charge, bool powerf
 }
 
 /*!
-* @brief \83\8d\83b\83h\82ð\8eg\82¤\83R\83}\83\93\83h\82Ì\83T\83u\83\8b\81[\83`\83\93 /
+* @brief ロッドを使うコマンドのサブルーチン /
 * Activate (zap) a Rod
-* @param item \8eg\82¤\83I\83u\83W\83F\83N\83g\82Ì\8f\8a\8e\9d\95iID
-* @return \82È\82µ
+* @param item 使うオブジェクトの所持品ID
+* @return なし
 * @details
 * <pre>
 * Unstack fully charged rods as needed.
@@ -258,10 +256,10 @@ int rod_effect(OBJECT_SUBTYPE_VALUE sval, int dir, bool *use_charge, bool powerf
 * pvals are defined for each rod in k_info. -LM-
 * </pre>
 */
-void do_cmd_zap_rod_aux(int item)
+void do_cmd_zap_rod_aux(INVENTORY_IDX item)
 {
        int ident, chance, lev, fail;
-       int dir = 0;
+       DIRECTION dir = 0;
        object_type *o_ptr;
        bool success;
 
@@ -286,7 +284,7 @@ void do_cmd_zap_rod_aux(int item)
        /* Mega-Hack -- refuse to zap a pile from the ground */
        if ((item < 0) && (o_ptr->number > 1))
        {
-               msg_print(_("\82Ü\82¸\82Í\83\8d\83b\83h\82ð\8fE\82í\82È\82¯\82ê\82Î\81B", "You must first pick up the rods."));
+               msg_print(_("まずはロッドを拾わなければ。", "You must first pick up the rods."));
                return;
        }
 
@@ -300,8 +298,7 @@ void do_cmd_zap_rod_aux(int item)
        }
 
 
-       /* Take a turn */
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Extract the item level */
        lev = k_info[o_ptr->k_idx].level;
@@ -318,13 +315,7 @@ void do_cmd_zap_rod_aux(int item)
        if (fail < USE_DEVICE) fail = USE_DEVICE;
        if (chance < USE_DEVICE) chance = USE_DEVICE;
 
-       if (world_player)
-       {
-               if (flush_failure) flush();
-               msg_print(_("\8e~\82Ü\82Á\82½\8e\9e\82Ì\92\86\82Å\82Í\82¤\82Ü\82­\93­\82©\82È\82¢\82æ\82¤\82¾\81B", "Nothing happen. Maybe this rod is freezing too."));
-               sound(SOUND_FAIL);
-               return;
-       }
+       if (cmd_limit_time_walk(p_ptr)) return;
 
        if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
        else if (chance > fail)
@@ -342,7 +333,7 @@ void do_cmd_zap_rod_aux(int item)
        if (!success)
        {
                if (flush_failure) flush();
-               msg_print(_("\82¤\82Ü\82­\83\8d\83b\83h\82ð\8eg\82¦\82È\82©\82Á\82½\81B", "You failed to use the rod properly."));
+               msg_print(_("うまくロッドを使えなかった。", "You failed to use the rod properly."));
                sound(SOUND_FAIL);
                return;
        }
@@ -353,27 +344,24 @@ void do_cmd_zap_rod_aux(int item)
        if ((o_ptr->number == 1) && (o_ptr->timeout))
        {
                if (flush_failure) flush();
-               msg_print(_("\82±\82Ì\83\8d\83b\83h\82Í\82Ü\82¾\96\82\97Í\82ð\8f[\93U\82µ\82Ä\82¢\82é\8dÅ\92\86\82¾\81B", "The rod is still charging."));
+               msg_print(_("このロッドはまだ魔力を充填している最中だ。", "The rod is still charging."));
                return;
        }
        /* A stack of rods lacks enough energy. */
        else if ((o_ptr->number > 1) && (o_ptr->timeout > k_ptr->pval * (o_ptr->number - 1)))
        {
                if (flush_failure) flush();
-               msg_print(_("\82»\82Ì\83\8d\83b\83h\82Í\82Ü\82¾\8f[\93U\92\86\82Å\82·\81B", "The rods are all still charging."));
+               msg_print(_("そのロッドはまだ充填中です。", "The rods are all still charging."));
                return;
        }
 
-       /* Sound */
        sound(SOUND_ZAP);
 
        ident = rod_effect(o_ptr->sval, dir, &use_charge, FALSE, FALSE);
 
        /* Increase the timeout by the rod kind's pval. -LM- */
        if (use_charge) o_ptr->timeout += k_ptr->pval;
-
-       /* Combine / Reorder the pack (later) */
-       p_ptr->notice |= (PN_COMBINE | PN_REORDER);
+       p_ptr->update |= (PU_COMBINE | PU_REORDER);
 
        if (!(object_is_aware(o_ptr)))
        {
@@ -392,18 +380,24 @@ void do_cmd_zap_rod_aux(int item)
                gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
        }
 
-       /* Window stuff */
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
 }
 
 /*!
-* @brief \83\8d\83b\83h\82ð\8eg\82¤\83R\83}\83\93\83h\82Ì\83\81\83C\83\93\83\8b\81[\83`\83\93 /
-* @return \82È\82µ
+* @brief ロッドを使うコマンドのメインルーチン /
+* @return なし
 */
 void do_cmd_zap_rod(void)
 {
        OBJECT_IDX item;
-       cptr q, s;
+       concptr q, s;
+
+       if (p_ptr->wild_mode)
+       {
+               return;
+       }
+
+       if (cmd_limit_arena(p_ptr)) return;
 
        if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
        {
@@ -413,11 +407,10 @@ void do_cmd_zap_rod(void)
        /* Restrict choices to rods */
        item_tester_tval = TV_ROD;
 
-       /* Get an item */
-       q = _("\82Ç\82Ì\83\8d\83b\83h\82ð\90U\82è\82Ü\82·\82©? ", "Zap which rod? ");
-       s = _("\8eg\82¦\82é\83\8d\83b\83h\82ª\82È\82¢\81B", "You have no rod to zap.");
+       q = _("どのロッドを振りますか? ", "Zap which rod? ");
+       s = _("使えるロッドがない。", "You have no rod to zap.");
 
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
+       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
 
        /* Zap the rod */
        do_cmd_zap_rod_aux(item);