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