OSDN Git Service

[Refactor] #39964 Removed the dependency from read-pref-file to autopick-pref-processor
[hengband/hengband.git] / src / player-damage.c
index b61079d..ad98771 100644 (file)
@@ -1,10 +1,16 @@
 #include "angband.h"
 #include "core.h"
 #include "util.h"
-#include "term.h"
+#include "main/music-definitions-table.h"
+#include "main/sound-definitions-table.h"
+#include "gameterm.h"
 
 #include "avatar.h"
-#include "cmd-dump.h"
+#include "market/building.h"
+#include "io/write-diary.h"
+#include "autopick/autopick-pref-processor.h"
+#include "cmd/cmd-process-screen.h"
+#include "market/arena-info-table.h"
 #include "realm-song.h"
 #include "floor.h"
 #include "artifact.h"
 #include "player-status.h"
 #include "player-effects.h"
 #include "player-class.h"
+#include "player-race.h"
 #include "monster-spell.h"
 #include "world.h"
-#include "view-mainwindow.h"
+#include "view/display-main-window.h"
 #include "quest.h"
 #include "report.h"
 #include "wild.h"
 #include "save.h"
 #include "files.h"
 
-
 /*!
-* todo 元々「破損したアイテムの数」をreturnしていました
-* しかし調査の結果、どの関数も戻り値を使用していませんでした
-* よって戻りをvoidとし、破損したアイテム数を計上しているローカル変数を削除しました
-* 確認後、問題がなければ本コメントを削除の上コミット願います
-* そして英語のコメントにある「stealing」とは一体…詳細不明につき残しました
-* なお「toryを省略する必要はないじゃろ」との独断により関数名を変更しました
-* 気に入らなければ元に戻して下さい。。。 by Hourier
-* ***
-* @brief アイテムを指定確率で破損させる /
-* Destroys a type of item on a given percent chance
-* @param player_ptr プレーヤーへの参照ポインタ
-* @param typ 破損判定関数ポインタ
-* @param perc 基本確率
-* @return なし
-* @details
-* Note that missiles are no longer necessarily all destroyed
-* Destruction taken from "melee.c" code for "stealing".
-* New-style wands and rods handled correctly. -LM-
-*/
+ * @brief アイテムを指定確率で破損させる /
+ * Destroys a type of item on a given percent chance
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @param typ 破損判定関数ポインタ
+ * @param perc 基本確率
+ * @return なし
+ * @details
+ * Note that missiles are no longer necessarily all destroyed
+ * Destruction taken from "melee.c" code for "stealing".
+ * New-style wands and rods handled correctly. -LM-
+ */
 void inventory_damage(player_type *player_ptr, inven_func typ, int perc)
 {
        INVENTORY_IDX i;
@@ -77,7 +75,7 @@ void inventory_damage(player_type *player_ptr, inven_func typ, int perc)
                /* Some casualities */
                if (!amt) continue;
                
-               object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
+               object_desc(player_ptr, o_name, o_ptr, OD_OMIT_PREFIX);
 
                msg_format(_("%s(%c)が%s壊れてしまった!", "%sour %s (%c) %s destroyed!"),
 #ifdef JP
@@ -89,7 +87,7 @@ void inventory_damage(player_type *player_ptr, inven_func typ, int perc)
 #endif
 
 #ifdef JP
-               if ((player_ptr->pseikaku == SEIKAKU_COMBAT) || (player_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
+               if (IS_ECHIZEN(player_ptr))
                        msg_print("やりやがったな!");
                else if ((player_ptr->pseikaku == SEIKAKU_CHARGEMAN))
                {
@@ -101,7 +99,7 @@ void inventory_damage(player_type *player_ptr, inven_func typ, int perc)
                /* Potions smash open */
                if (object_is_potion(o_ptr))
                {
-                       (void)potion_smash_effect(0, player_ptr->y, player_ptr->x, o_ptr->k_idx);
+                       (void)potion_smash_effect(player_ptr, 0, player_ptr->y, player_ptr->x, o_ptr->k_idx);
                }
 
                /* Reduce the charges of rods/wands */
@@ -144,12 +142,12 @@ static bool acid_minus_ac(player_type *creature_ptr)
        if (!o_ptr->k_idx) return FALSE;
        if (!object_is_armour(o_ptr)) return FALSE;
 
-       object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+       object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
        object_flags(o_ptr, flgs);
        /* No damage left to be done */
        if (o_ptr->ac + o_ptr->to_a <= 0)
        {
-               msg_format(_("%sは既にボロボロだ!", "is already fully corroded!"), o_name);
+               msg_format(_("%sは既にボロボロだ!", "Your %s is already fully corroded!"), o_name);
                return FALSE;
        }
 
@@ -381,7 +379,6 @@ HIT_POINT cold_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
  * the game when he dies, since the "You die." message is shown before
  * setting the player to "dead".
  */
-
 int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concptr hit_from, int monspell)
 {
        int old_chp = creature_ptr->chp;
@@ -435,7 +432,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
                        }
                        else if (damage_type == DAMAGE_ATTACK)
                        {
-                               msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
+                               msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, but you are unharmed!"));
                                return 0;
                        }
                }
@@ -484,7 +481,8 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
        {
                bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
 
-#ifdef JP       /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
+#ifdef JP
+               /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
                if (!cheat_save)
                        if (!save_player(creature_ptr)) msg_print("セーブ失敗!");
 #endif
@@ -504,7 +502,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
                        concptr m_name = r_name + r_info[arena_info[creature_ptr->arena_number].r_idx].name;
                        msg_format(_("あなたは%sの前に敗れ去った。", "You are beaten by %s."), m_name);
                        msg_print(NULL);
-                       if (record_arena) exe_write_diary(creature_ptr, NIKKI_ARENA, -1 - creature_ptr->arena_number, m_name);
+                       if (record_arena) exe_write_diary(creature_ptr, DIARY_ARENA, -1 - creature_ptr->arena_number, m_name);
                }
                else
                {
@@ -516,7 +514,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
 
 #ifdef WORLD_SCORE
                        /* Make screen dump */
-                       screen_dump = make_screen_dump(creature_ptr);
+                       screen_dump = make_screen_dump(creature_ptr, process_autopick_file_command);
 #endif
 
                        /* Note cause of death */
@@ -543,7 +541,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
 
                        if (winning_seppuku)
                        {
-                               exe_write_diary(creature_ptr, NIKKI_BUNSHOU, 0, _("勝利の後切腹した。", "did Seppuku after the winning."));
+                               exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, _("勝利の後切腹した。", "committed seppuku after the winning."));
                        }
                        else
                        {
@@ -560,17 +558,17 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
                                        sprintf(buf, _("%d階", "level %d"), (int)creature_ptr->current_floor_ptr->dun_level);
 
                                sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, creature_ptr->died_from);
-                               exe_write_diary(creature_ptr, NIKKI_BUNSHOU, 0, tmp);
+                               exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, tmp);
                        }
 
-                       exe_write_diary(creature_ptr, NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "--------   Game  Over   --------"));
-                       exe_write_diary(creature_ptr, NIKKI_BUNSHOU, 1, "\n\n\n\n");
+                       exe_write_diary(creature_ptr, DIARY_GAMESTART, 1, _("-------- ゲームオーバー --------", "--------   Game  Over   --------"));
+                       exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, "\n\n\n\n");
 
                        flush();
 
                        if (get_check_strict(_("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
                        {
-                               do_cmd_save_screen(creature_ptr);
+                               do_cmd_save_screen(creature_ptr, handle_stuff, process_autopick_file_command);
                        }
 
                        flush();
@@ -667,7 +665,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
                                        flush();
 #ifdef WORLD_SCORE
                                        /* Make screen dump */
-                                       screen_dump = make_screen_dump(creature_ptr);
+                                       screen_dump = make_screen_dump(creature_ptr, process_autopick_file_command);
 #endif
 
                                        /* Wait a key press */
@@ -698,8 +696,8 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
                        if (creature_ptr->image && damage_type == DAMAGE_ATTACK)
                                hit_from = _("何か", "something");
 
-                       sprintf(tmp, _("%sによってピンチに陥った。", "A critical situation because of %s."), hit_from);
-                       exe_write_diary(creature_ptr, NIKKI_BUNSHOU, 0, tmp);
+                       sprintf(tmp, _("%sによってピンチに陥った。", "was in a critical situation because of %s."), hit_from);
+                       exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, tmp);
                }
 
                if (auto_more)