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/race-flags1.h"
7 #include "monster/monster-list.h"
8 #include "system/system-variables.h"
9 #include "term/term-color-types.h"
10 #include "view/display-messages.h"
13 * @brief クエスト情報を表示しつつ処理する。/ Display quest information
14 * @param player_ptr プレーヤーへの参照ポインタ
15 * @param questnum クエストのID
16 * @param do_init クエストの開始処理(TRUE)、結果処理か(FALSE)
19 static void get_questinfo(player_type *player_ptr, IDX questnum, bool do_init)
21 for (int i = 0; i < 10; i++) {
22 quest_text[i][0] = '\0';
27 floor_type *floor_ptr = player_ptr->current_floor_ptr;
28 QUEST_IDX old_quest = floor_ptr->inside_quest;
29 floor_ptr->inside_quest = questnum;
31 init_flags = INIT_SHOW_TEXT;
33 init_flags |= INIT_ASSIGN;
35 parse_fixed_map(player_ptr, "q_info.txt", 0, 0, 0, 0);
36 floor_ptr->inside_quest = old_quest;
38 GAME_TEXT tmp_str[80];
39 sprintf(tmp_str, _("クエスト情報 (危険度: %d 階相当)", "Quest Information (Danger level: %d)"), (int)quest[questnum].level);
41 prt(quest[questnum].name, 7, 0);
43 for (int i = 0; i < 10; i++) {
44 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
49 * @brief クエスト処理のメインルーチン / Request a quest from the Lord.
50 * @param player_ptr プレーヤーへの参照ポインタ
53 void castle_quest(player_type *player_ptr)
56 QUEST_IDX q_index = player_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x].special;
59 put_str(_("今のところクエストはありません。", "I don't have a quest for you at the moment."), 8, 0);
64 q_ptr = &quest[q_index];
65 if (q_ptr->status == QUEST_STATUS_COMPLETED) {
66 q_ptr->status = QUEST_STATUS_REWARDED;
67 get_questinfo(player_ptr, q_index, FALSE);
68 reinit_wilderness = TRUE;
72 if (q_ptr->status == QUEST_STATUS_FAILED) {
73 get_questinfo(player_ptr, q_index, FALSE);
74 q_ptr->status = QUEST_STATUS_FAILED_DONE;
75 reinit_wilderness = TRUE;
79 if (q_ptr->status == QUEST_STATUS_TAKEN) {
80 put_str(_("あなたは現在のクエストを終了させていません!", "You have not completed your current quest yet!"), 8, 0);
81 put_str(_("CTRL-Qを使えばクエストの状態がチェックできます。", "Use CTRL-Q to check the status of your quest."), 9, 0);
82 put_str(_("クエストを終わらせたら戻って来て下さい。", "Return when you have completed your quest."), 12, 0);
86 if (q_ptr->status != QUEST_STATUS_UNTAKEN)
89 q_ptr->status = QUEST_STATUS_TAKEN;
90 reinit_wilderness = TRUE;
91 if (q_ptr->type != QUEST_TYPE_KILL_ANY_LEVEL) {
92 get_questinfo(player_ptr, q_index, TRUE);
96 if (q_ptr->r_idx == 0) {
97 q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level + 4 + randint1(6), 0);
101 r_ptr = &r_info[q_ptr->r_idx];
102 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1)) {
103 q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level + 4 + randint1(6), 0);
104 r_ptr = &r_info[q_ptr->r_idx];
107 if (q_ptr->max_num == 0) {
108 if (randint1(10) > 7)
111 q_ptr->max_num = randint1(3) + 1;
115 concptr name = (r_name + r_ptr->name);
117 msg_format("クエスト: %sを %d体倒す", name, q_ptr->max_num);
119 msg_format("Your quest: kill %d %s", q_ptr->max_num, name);
121 get_questinfo(player_ptr, q_index, TRUE);