OSDN Git Service

[Refactor] #38862 Moved monster*.c/h to monster/ except for monster-spell.c/h
[hengband/hengband.git] / src / quest.c
index 593d3bf..3cb266a 100644 (file)
@@ -1,23 +1,25 @@
 #include "angband.h"
 #include "util.h"
+#include "main/music-definitions-table.h"
 
-#include "core.h"
-#include "dungeon.h"
-#include "floor.h"
-#include "floor-save.h"
-#include "floor-events.h"
+#include "core/system-variables.h"
+#include "dungeon/dungeon.h"
+#include "floor/floor.h"
+#include "floor/floor-save.h"
+#include "floor/floor-events.h"
 #include "grid.h"
 #include "quest.h"
-#include "monsterrace-hook.h"
-#include "monster.h"
-#include "player-status.h"
-#include "player-personality.h"
+#include "monster/monsterrace-hook.h"
+#include "monster/monster.h"
+#include "player/player-status.h"
+#include "player/player-personality.h"
 #include "artifact.h"
 #include "feature.h"
-#include "world.h"
-#include "cmd-dump.h"
+#include "world/world.h"
+#include "io/write-diary.h"
+#include "cmd/cmd-dump.h"
 #include "english.h"
-#include "view-mainwindow.h"
+#include "view/display-main-window.h"
 
 quest_type *quest; /*!< Quest info */
 QUEST_IDX max_q_idx; /*!< Maximum number of quests */
@@ -43,9 +45,9 @@ static concptr find_quest[] =
  * @param q_ptr クエスト構造体の参照ポインタ
  * @return なし
  */
-void determine_random_questor(quest_type *q_ptr)
+void determine_random_questor(player_type *player_ptr, quest_type *q_ptr)
 {
-       get_mon_num_prep(mon_hook_quest, NULL);
+       get_mon_num_prep(player_ptr, mon_hook_quest, NULL);
 
        MONRACE_IDX r_idx;
        while (TRUE)
@@ -54,7 +56,7 @@ void determine_random_questor(quest_type *q_ptr)
                 * Random monster 5 - 10 levels out of depth
                 * (depending on level)
                 */
-               r_idx = get_mon_num(q_ptr->level + 5 + randint1(q_ptr->level / 10));
+               r_idx = get_mon_num(player_ptr, q_ptr->level + 5 + randint1(q_ptr->level / 10), GMN_ARENA);
                monster_race *r_ptr;
                r_ptr = &r_info[r_idx];
 
@@ -90,10 +92,10 @@ void complete_quest(player_type *player_ptr, QUEST_IDX quest_num)
        switch (q_ptr->type)
        {
        case QUEST_TYPE_RANDOM:
-               if (record_rand_quest) exe_write_diary(player_ptr, NIKKI_RAND_QUEST_C, quest_num, NULL);
+               if (record_rand_quest) exe_write_diary(player_ptr, DIARY_RAND_QUEST_C, quest_num, NULL);
                break;
        default:
-               if (record_fix_quest) exe_write_diary(player_ptr, NIKKI_FIX_QUEST_C, quest_num, NULL);
+               if (record_fix_quest) exe_write_diary(player_ptr, DIARY_FIX_QUEST_C, quest_num, NULL);
                break;
        }
 
@@ -356,15 +358,16 @@ void quest_discovery(QUEST_IDX q_idx)
 
        if (q_num != 1)
        {
-#ifndef JP
+#ifdef JP
+#else
                plural_aux(name);
 #endif
                msg_format(_("注意しろ!この階は%d体の%sによって守られている!", "Be warned, this level is guarded by %d %s!"), q_num, name);
                return;
        }
 
-       bool is_random_quest_skipped = (r_ptr->flags1 & RF1_UNIQUE);
-       is_random_quest_skipped &= 0 == r_ptr->max_num;
+       bool is_random_quest_skipped = (r_ptr->flags1 & RF1_UNIQUE) != 0;
+       is_random_quest_skipped &= r_ptr->max_num == 0;
        if (!is_random_quest_skipped)
        {
                msg_format(_("注意せよ!この階は%sによって守られている!", "Beware, this level is protected by %s!"), name);
@@ -445,7 +448,7 @@ void leave_quest_check(player_type *player_ptr)
        quest_type* const q_ptr = &quest[leaving_quest];
        bool is_one_time_quest = ((q_ptr->flags & QUEST_FLAG_ONCE) || (q_ptr->type == QUEST_TYPE_RANDOM)) &&
                (q_ptr->status == QUEST_STATUS_TAKEN);
-       if (is_one_time_quest) return;
+       if (!is_one_time_quest) return;
 
        q_ptr->status = QUEST_STATUS_FAILED;
        q_ptr->complev = player_ptr->lev;
@@ -474,12 +477,12 @@ void leave_quest_check(player_type *player_ptr)
        if (q_ptr->type == QUEST_TYPE_RANDOM)
        {
                if (record_rand_quest)
-                       exe_write_diary(player_ptr, NIKKI_RAND_QUEST_F, leaving_quest, NULL);
+                       exe_write_diary(player_ptr, DIARY_RAND_QUEST_F, leaving_quest, NULL);
                return;
        }
 
        if (record_fix_quest)
-               exe_write_diary(player_ptr, NIKKI_FIX_QUEST_F, leaving_quest, NULL);
+               exe_write_diary(player_ptr, DIARY_FIX_QUEST_F, leaving_quest, NULL);
 }
 
 
@@ -519,10 +522,10 @@ void do_cmd_quest(player_type *player_ptr)
                msg_print(_("ここにはクエストの入口はない。", "You see no quest level here."));
                return;
        }
-       
+
        msg_print(_("ここにはクエストへの入口があります。", "There is an entry of a quest."));
        if (!get_check(_("クエストに入りますか?", "Do you enter? "))) return;
-       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) msg_print("『全滅してやるぞ!』");