OSDN Git Service

[Refactor] #40236 Separated write-diary.c/h from cmd-dump.c/h
[hengband/hengband.git] / src / patron.c
index aacecaa..5554e1c 100644 (file)
@@ -2,7 +2,8 @@
 #include "angband.h"
 #include "util.h"
 
-#include "cmd-dump.h"
+#include "io/write-diary.h"
+#include "cmd/cmd-dump.h"
 #include "patron.h"
 #include "cmd-pet.h"
 #include "object-curse.h"
@@ -334,7 +335,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声がささやいた:", "The voice of %s whispers:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「我が与えし物を賢明に使うべし。」", "'Use my gift wisely.'"));
 
-                       acquirement(creature_ptr->y, creature_ptr->x, 1, FALSE, FALSE, FALSE);
+                       acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, 1, FALSE, FALSE, FALSE);
                        reward = _("上質なアイテムを手に入れた。", "a good item");
                        break;
 
@@ -343,7 +344,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「我が与えし物を賢明に使うべし。」", "'Use my gift wisely.'"));
 
-                       acquirement(creature_ptr->y, creature_ptr->x, 1, TRUE, FALSE, FALSE);
+                       acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, 1, TRUE, FALSE, FALSE);
                        reward = _("高級品のアイテムを手に入れた。", "an excellent item");
                        break;
 
@@ -359,7 +360,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「汝の行いは貴き報いに値せり。」", "'Thy deed hath earned thee a worthy reward.'"));
 
-                       acquirement(creature_ptr->y, creature_ptr->x, randint1(2) + 1, FALSE, FALSE, FALSE);
+                       acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, randint1(2) + 1, FALSE, FALSE, FALSE);
                        reward = _("上質なアイテムを手に入れた。", "good items");
                        break;
 
@@ -368,7 +369,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「下僕よ、汝の献身への我が惜しみ無き報いを見るがよい。」", "'Behold, mortal, how generously I reward thy loyalty.'"));
 
-                       acquirement(creature_ptr->y, creature_ptr->x, randint1(2) + 1, TRUE, FALSE, FALSE);
+                       acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, randint1(2) + 1, TRUE, FALSE, FALSE);
                        reward = _("高級品のアイテムを手に入れた。", "excellent items");
                        break;
 
@@ -376,7 +377,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が轟き渡った:", "The voice of %s thunders:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「下僕よ、汝傲慢なり。」", "'Thou art growing arrogant, mortal.'"));
 
-                       (void)activate_ty_curse(FALSE, &count);
+                       (void)activate_ty_curse(creature_ptr, FALSE, &count);
                        reward = _("禍々しい呪いをかけられた。", "cursing");
                        break;
 
@@ -387,7 +388,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
 
                        for (dummy = 0; dummy < randint1(5) + 1; dummy++)
                        {
-                               (void)summon_specific(0, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+                               (void)summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                        }
                        reward = _("モンスターを召喚された。", "summoning hostile monsters");
                        break;
@@ -398,7 +399,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「汝、より強き敵を必要とせり!」", "'Thou needst worthier opponents!'"));
 
-                       activate_hi_summon(creature_ptr->y, creature_ptr->x, FALSE);
+                       activate_hi_summon(creature_ptr, creature_ptr->y, creature_ptr->x, FALSE);
                        reward = _("モンスターを召喚された。", "summoning many hostile monsters");
                        break;
 
@@ -407,7 +408,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「死と破壊こそ我が喜びなり!」", "'Death and destruction! This pleaseth me!'"));
 
-                       call_chaos();
+                       call_chaos(creature_ptr);
                        reward = _("カオスの力が渦巻いた。", "calling chaos");
                        break;
 
@@ -475,8 +476,8 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「苦しむがよい、無能な愚か者よ!」", "'Suffer, pathetic fool!'"));
 
-                       fire_ball(GF_DISINTEGRATE, 0, creature_ptr->lev * 4, 4);
-                       take_hit(p_ptr, DAMAGE_NOESCAPE, creature_ptr->lev * 4, wrath_reason, -1);
+                       fire_ball(creature_ptr, GF_DISINTEGRATE, 0, creature_ptr->lev * 4, 4);
+                       take_hit(creature_ptr, DAMAGE_NOESCAPE, creature_ptr->lev * 4, wrath_reason, -1);
                        reward = _("分解の球が発生した。", "generating disintegration ball");
                        break;
 
@@ -484,25 +485,25 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
 
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        (void)restore_level(creature_ptr);
-                       (void)restore_all_status();
-                       (void)true_healing(5000);
+                       (void)restore_all_status(creature_ptr);
+                       (void)true_healing(creature_ptr, 5000);
                        reward = _("体力が回復した。", "healing");
                        break;
 
                case REW_CURSE_WP:
 
-                       if (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM)) break;
+                       if (!has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM)) break;
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「汝、武器に頼ることなかれ。」", "'Thou reliest too much on thy weapon.'"));
 
                        dummy = INVEN_RARM;
-                       if (has_melee_weapon(INVEN_LARM))
+                       if (has_melee_weapon(creature_ptr, INVEN_LARM))
                        {
                                dummy = INVEN_LARM;
-                               if (has_melee_weapon(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
+                               if (has_melee_weapon(creature_ptr, INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
                        }
-                       object_desc(o_name, &creature_ptr->inventory_list[dummy], OD_NAME_ONLY);
-                       (void)curse_weapon(FALSE, dummy);
+                       object_desc(creature_ptr, o_name, &creature_ptr->inventory_list[dummy], OD_NAME_ONLY);
+                       (void)curse_weapon_object(creature_ptr, FALSE, &creature_ptr->inventory_list[dummy]);
                        reward = format(_("%sが破壊された。", "destroying %s"), o_name);
                        break;
 
@@ -512,8 +513,8 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「汝、防具に頼ることなかれ。」", "'Thou reliest too much on thine equipment.'"));
 
-                       object_desc(o_name, &creature_ptr->inventory_list[INVEN_BODY], OD_NAME_ONLY);
-                       (void)curse_armor();
+                       object_desc(creature_ptr, o_name, &creature_ptr->inventory_list[INVEN_BODY], OD_NAME_ONLY);
+                       (void)curse_armor(creature_ptr);
                        reward = format(_("%sが破壊された。", "destroying %s"), o_name);
                        break;
 
@@ -525,32 +526,32 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        switch (randint1(4))
                        {
                        case 1:
-                               (void)activate_ty_curse(FALSE, &count);
+                               (void)activate_ty_curse(creature_ptr, FALSE, &count);
                                reward = _("禍々しい呪いをかけられた。", "cursing");
                                break;
                        case 2:
-                               activate_hi_summon(creature_ptr->y, creature_ptr->x, FALSE);
+                               activate_hi_summon(creature_ptr, creature_ptr->y, creature_ptr->x, FALSE);
                                reward = _("モンスターを召喚された。", "summoning hostile monsters");
                                break;
                        case 3:
                                if (one_in_(2))
                                {
-                                       if (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM)) break;
+                                       if (!has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM)) break;
                                        dummy = INVEN_RARM;
-                                       if (has_melee_weapon(INVEN_LARM))
+                                       if (has_melee_weapon(creature_ptr, INVEN_LARM))
                                        {
                                                dummy = INVEN_LARM;
-                                               if (has_melee_weapon(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
+                                               if (has_melee_weapon(creature_ptr, INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
                                        }
-                                       object_desc(o_name, &creature_ptr->inventory_list[dummy], OD_NAME_ONLY);
-                                       (void)curse_weapon(FALSE, dummy);
+                                       object_desc(creature_ptr, o_name, &creature_ptr->inventory_list[dummy], OD_NAME_ONLY);
+                                       (void)curse_weapon_object(creature_ptr, FALSE, &creature_ptr->inventory_list[dummy]);
                                        reward = format(_("%sが破壊された。", "destroying %s"), o_name);
                                }
                                else
                                {
                                        if (!creature_ptr->inventory_list[INVEN_BODY].k_idx) break;
-                                       object_desc(o_name, &creature_ptr->inventory_list[INVEN_BODY], OD_NAME_ONLY);
-                                       (void)curse_armor();
+                                       object_desc(creature_ptr, o_name, &creature_ptr->inventory_list[INVEN_BODY], OD_NAME_ONLY);
+                                       (void)curse_armor(creature_ptr);
                                        reward = format(_("%sが破壊された。", "destroying %s"), o_name);
                                }
                                break;
@@ -569,27 +570,27 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が轟き渡った:", "The voice of %s thunders:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「死ぬがよい、下僕よ!」", "'Die, mortal!'"));
 
-                       take_hit(p_ptr, DAMAGE_LOSELIFE, creature_ptr->lev * 4, wrath_reason, -1);
+                       take_hit(creature_ptr, DAMAGE_LOSELIFE, creature_ptr->lev * 4, wrath_reason, -1);
                        for (dummy = 0; dummy < A_MAX; dummy++)
                        {
                                (void)dec_stat(creature_ptr, dummy, 10 + randint1(15), FALSE);
                        }
-                       activate_hi_summon(creature_ptr->y, creature_ptr->x, FALSE);
-                       (void)activate_ty_curse(FALSE, &count);
+                       activate_hi_summon(creature_ptr, creature_ptr->y, creature_ptr->x, FALSE);
+                       (void)activate_ty_curse(creature_ptr, FALSE, &count);
                        if (one_in_(2))
                        {
                                dummy = 0;
 
-                               if (has_melee_weapon(INVEN_RARM))
+                               if (has_melee_weapon(creature_ptr, INVEN_RARM))
                                {
                                        dummy = INVEN_RARM;
-                                       if (has_melee_weapon(INVEN_LARM) && one_in_(2)) dummy = INVEN_LARM;
+                                       if (has_melee_weapon(creature_ptr, INVEN_LARM) && one_in_(2)) dummy = INVEN_LARM;
                                }
-                               else if (has_melee_weapon(INVEN_LARM)) dummy = INVEN_LARM;
+                               else if (has_melee_weapon(creature_ptr, INVEN_LARM)) dummy = INVEN_LARM;
 
-                               if (dummy) (void)curse_weapon(FALSE, dummy);
+                               if (dummy) (void)curse_weapon_object(creature_ptr, FALSE, &creature_ptr->inventory_list[dummy]);
                        }
-                       if (one_in_(2)) (void)curse_armor();
+                       if (one_in_(2)) (void)curse_armor(creature_ptr);
                        break;
 
                case REW_DESTRUCT:
@@ -597,7 +598,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「死と破壊こそ我が喜びなり!」", "'Death and destruction! This pleaseth me!'"));
 
-                       (void)destroy_area(creature_ptr->y, creature_ptr->x, 25, FALSE);
+                       (void)destroy_area(creature_ptr, creature_ptr->y, creature_ptr->x, 25, FALSE);
                        reward = _("ダンジョンが*破壊*された。", "*destruct*ing dungeon");
                        break;
 
@@ -605,7 +606,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
 
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「我、汝の敵を抹殺せん!」", "'Let me relieve thee of thine oppressors!'"));
-                       (void)symbol_genocide(0, FALSE);
+                       (void)symbol_genocide(creature_ptr, 0, FALSE);
                        reward = _("モンスターが抹殺された。", "genociding monsters");
                        break;
 
@@ -614,14 +615,14 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                        msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[creature_ptr->chaos_patron]);
                        msg_print(_("「我、汝の敵を抹殺せん!」", "'Let me relieve thee of thine oppressors!'"));
 
-                       (void)mass_genocide(0, FALSE);
+                       (void)mass_genocide(creature_ptr, 0, FALSE);
                        reward = _("モンスターが抹殺された。", "genociding nearby monsters");
                        break;
 
                case REW_DISPEL_C:
 
                        msg_format(_("%sの力が敵を攻撃するのを感じた!", "You can feel the power of %s assault your enemies!"), chaos_patrons[creature_ptr->chaos_patron]);
-                       (void)dispel_monsters(creature_ptr->lev * 4);
+                       (void)dispel_monsters(creature_ptr, creature_ptr->lev * 4);
                        break;
 
                case REW_IGNORE:
@@ -633,7 +634,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
 
                        msg_format(_("%sは褒美として悪魔の使いをよこした!", "%s rewards you with a demonic servant!"), chaos_patrons[creature_ptr->chaos_patron]);
 
-                       if (!summon_specific(-1, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, PM_FORCE_PET))
+                       if (!summon_specific(creature_ptr, -1, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, PM_FORCE_PET))
                                msg_print(_("何も現れなかった...", "Nobody ever turns up..."));
                        else
                                reward = _("悪魔がペットになった。", "a demonic servant");
@@ -643,7 +644,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                case REW_SER_MONS:
                        msg_format(_("%sは褒美として使いをよこした!", "%s rewards you with a servant!"), chaos_patrons[creature_ptr->chaos_patron]);
 
-                       if (!summon_specific(-1, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, 0, PM_FORCE_PET))
+                       if (!summon_specific(creature_ptr, -1, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, 0, PM_FORCE_PET))
                                msg_print(_("何も現れなかった...", "Nobody ever turns up..."));
                        else
                                reward = _("モンスターがペットになった。", "a servant");
@@ -653,7 +654,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
                case REW_SER_UNDE:
                        msg_format(_("%sは褒美としてアンデッドの使いをよこした。", "%s rewards you with an undead servant!"), chaos_patrons[creature_ptr->chaos_patron]);
 
-                       if (!summon_specific(-1, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD, PM_FORCE_PET))
+                       if (!summon_specific(creature_ptr, -1, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, PM_FORCE_PET))
                                msg_print(_("何も現れなかった...", "Nobody ever turns up..."));
                        else
                                reward = _("アンデッドがペットになった。", "an undead servant");
@@ -668,7 +669,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward)
        }
        if (reward)
        {
-               do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format(_("パトロンの報酬で%s", "The patron rewards you with %s."), reward));
+               exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, format(_("パトロンの報酬で%s", "The patron rewards you with %s."), reward));
        }
 }