1 #include "market/building-quest.h"
2 #include "cmd-building/cmd-building.h"
3 #include "info-reader/fixed-map-parser.h"
4 #include "dungeon/quest.h"
6 #include "market/building-util.h"
7 #include "monster-race/monster-race.h"
8 #include "monster-race/race-flags1.h"
9 #include "monster/monster-list.h"
10 #include "system/floor-type-definition.h"
11 #include "system/system-variables.h"
12 #include "term/screen-processor.h"
13 #include "term/term-color-types.h"
14 #include "view/display-messages.h"
17 * @brief クエスト情報を表示しつつ処理する。/ Display quest information
18 * @param player_ptr プレーヤーへの参照ポインタ
19 * @param questnum クエストのID
20 * @param do_init クエストの開始処理(TRUE)、結果処理か(FALSE)
23 static void get_questinfo(player_type *player_ptr, IDX questnum, bool do_init)
25 for (int i = 0; i < 10; i++) {
26 quest_text[i][0] = '\0';
31 floor_type *floor_ptr = player_ptr->current_floor_ptr;
32 QUEST_IDX old_quest = floor_ptr->inside_quest;
33 floor_ptr->inside_quest = questnum;
35 init_flags = INIT_SHOW_TEXT;
37 init_flags |= INIT_ASSIGN;
39 parse_fixed_map(player_ptr, "q_info.txt", 0, 0, 0, 0);
40 floor_ptr->inside_quest = old_quest;
42 GAME_TEXT tmp_str[80];
43 sprintf(tmp_str, _("クエスト情報 (危険度: %d 階相当)", "Quest Information (Danger level: %d)"), (int)quest[questnum].level);
45 prt(quest[questnum].name, 7, 0);
47 for (int i = 0; i < 10; i++) {
48 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
53 * @brief クエスト処理のメインルーチン / Request a quest from the Lord.
54 * @param player_ptr プレーヤーへの参照ポインタ
57 void castle_quest(player_type *player_ptr)
60 QUEST_IDX q_index = player_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x].special;
63 put_str(_("今のところクエストはありません。", "I don't have a quest for you at the moment."), 8, 0);
68 q_ptr = &quest[q_index];
69 if (q_ptr->status == QUEST_STATUS_COMPLETED) {
70 q_ptr->status = QUEST_STATUS_REWARDED;
71 get_questinfo(player_ptr, q_index, FALSE);
72 reinit_wilderness = TRUE;
76 if (q_ptr->status == QUEST_STATUS_FAILED) {
77 get_questinfo(player_ptr, q_index, FALSE);
78 q_ptr->status = QUEST_STATUS_FAILED_DONE;
79 reinit_wilderness = TRUE;
83 if (q_ptr->status == QUEST_STATUS_TAKEN) {
84 put_str(_("あなたは現在のクエストを終了させていません!", "You have not completed your current quest yet!"), 8, 0);
85 put_str(_("CTRL-Qを使えばクエストの状態がチェックできます。", "Use CTRL-Q to check the status of your quest."), 9, 0);
86 put_str(_("クエストを終わらせたら戻って来て下さい。", "Return when you have completed your quest."), 12, 0);
90 if (q_ptr->status != QUEST_STATUS_UNTAKEN)
93 q_ptr->status = QUEST_STATUS_TAKEN;
94 reinit_wilderness = TRUE;
95 if (q_ptr->type != QUEST_TYPE_KILL_ANY_LEVEL) {
96 get_questinfo(player_ptr, q_index, TRUE);
100 if (q_ptr->r_idx == 0) {
101 q_ptr->r_idx = get_mon_num(player_ptr, 0, q_ptr->level + 4 + randint1(6), 0);
105 r_ptr = &r_info[q_ptr->r_idx];
106 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1)) {
107 q_ptr->r_idx = get_mon_num(player_ptr, 0, q_ptr->level + 4 + randint1(6), 0);
108 r_ptr = &r_info[q_ptr->r_idx];
111 if (q_ptr->max_num == 0) {
112 if (randint1(10) > 7)
115 q_ptr->max_num = randint1(3) + 1;
119 concptr name = (r_name + r_ptr->name);
121 msg_format("クエスト: %sを %d体倒す", name, q_ptr->max_num);
123 msg_format("Your quest: kill %d %s", q_ptr->max_num, name);
125 get_questinfo(player_ptr, q_index, TRUE);