1 #include "market/building-quest.h"
2 #include "cmd-building/cmd-building.h"
3 #include "core/asking-player.h"
4 #include "dungeon/quest.h"
6 #include "info-reader/fixed-map-parser.h"
7 #include "market/building-util.h"
8 #include "monster-race/monster-race.h"
9 #include "monster-race/race-flags1.h"
10 #include "monster/monster-list.h"
11 #include "system/floor-type-definition.h"
12 #include "system/system-variables.h"
13 #include "term/screen-processor.h"
14 #include "term/term-color-types.h"
15 #include "view/display-messages.h"
18 * @brief クエスト情報を処理しつつ取得する。/ Process and get quest information
19 * @param player_ptr プレーヤーへの参照ポインタ
20 * @param questnum クエストのID
21 * @param do_init クエストの開始処理か(TRUE)、結果処理か(FALSE)
24 static void get_questinfo(player_type *player_ptr, IDX questnum, bool do_init)
26 for (int i = 0; i < 10; i++) {
27 quest_text[i][0] = '\0';
32 floor_type *floor_ptr = player_ptr->current_floor_ptr;
33 QUEST_IDX old_quest = floor_ptr->inside_quest;
34 floor_ptr->inside_quest = questnum;
36 init_flags = INIT_SHOW_TEXT;
38 init_flags = static_cast<init_flags_type>(init_flags | INIT_ASSIGN);
40 parse_fixed_map(player_ptr, "q_info.txt", 0, 0, 0, 0);
41 floor_ptr->inside_quest = old_quest;
45 * @brief クエスト情報を処理しつつ表示する。/ Process and display quest information
46 * @param player_ptr プレーヤーへの参照ポインタ
47 * @param questnum クエストのID
48 * @param do_init クエストの開始処理か(TRUE)、結果処理か(FALSE)
51 void print_questinfo(player_type *player_ptr, IDX questnum, bool do_init)
53 get_questinfo(player_ptr, questnum, do_init);
55 GAME_TEXT tmp_str[80];
56 sprintf(tmp_str, _("クエスト情報 (危険度: %d 階相当)", "Quest Information (Danger level: %d)"), (int)quest[questnum].level);
58 prt(quest[questnum].name, 7, 0);
60 for (int i = 0; i < 10; i++) {
61 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
66 * @brief クエスト処理のメインルーチン / Request a quest from the Lord.
67 * @param player_ptr プレーヤーへの参照ポインタ
70 void castle_quest(player_type *player_ptr)
73 QUEST_IDX q_index = player_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x].special;
76 put_str(_("今のところクエストはありません。", "I don't have a quest for you at the moment."), 8, 0);
81 q_ptr = &quest[q_index];
82 if (q_ptr->status == QUEST_STATUS_COMPLETED) {
83 q_ptr->status = QUEST_STATUS_REWARDED;
84 print_questinfo(player_ptr, q_index, FALSE);
85 reinit_wilderness = TRUE;
89 if (q_ptr->status == QUEST_STATUS_TAKEN) {
90 put_str(_("あなたは現在のクエストを終了させていません!", "You have not completed your current quest yet!"), 8, 0);
91 put_str(_("CTRL-Qを使えばクエストの状態がチェックできます。", "Use CTRL-Q to check the status of your quest."), 9, 0);
93 get_questinfo(player_ptr, q_index, true);
94 put_str(format(_("現在のクエスト「%s」", "Current quest is '%s'."), q_ptr->name), 11, 0);
96 if (q_ptr->type != QUEST_TYPE_KILL_LEVEL || q_ptr->dungeon == 0) {
97 put_str(_("クエストを終わらせたら戻って来て下さい。", "Return when you have completed your quest."), 12, 0);
101 put_str(_("このクエストは放棄することができます。", "You can give up this quest."), 12, 0);
103 if (!get_check(_("二度と受けられなくなりますが放棄しますか?", "Are you sure to give up this quest?")))
107 msg_print(_("放棄しました。", "You gave up."));
109 record_quest_final_status(q_ptr, player_ptr->lev, QUEST_STATUS_FAILED);
112 if (q_ptr->status == QUEST_STATUS_FAILED) {
113 print_questinfo(player_ptr, q_index, FALSE);
114 q_ptr->status = QUEST_STATUS_FAILED_DONE;
115 reinit_wilderness = TRUE;
119 if (q_ptr->status != QUEST_STATUS_UNTAKEN)
122 q_ptr->status = QUEST_STATUS_TAKEN;
123 reinit_wilderness = TRUE;
124 if (q_ptr->type != QUEST_TYPE_KILL_ANY_LEVEL) {
125 print_questinfo(player_ptr, q_index, TRUE);
129 if (q_ptr->r_idx == 0) {
130 q_ptr->r_idx = get_mon_num(player_ptr, 0, q_ptr->level + 4 + randint1(6), 0);
134 r_ptr = &r_info[q_ptr->r_idx];
135 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1)) {
136 q_ptr->r_idx = get_mon_num(player_ptr, 0, q_ptr->level + 4 + randint1(6), 0);
137 r_ptr = &r_info[q_ptr->r_idx];
140 if (q_ptr->max_num == 0) {
141 if (randint1(10) > 7)
144 q_ptr->max_num = randint1(3) + 1;
148 concptr name = r_ptr->name.c_str();
150 msg_format("クエスト: %sを %d体倒す", name, q_ptr->max_num);
152 msg_format("Your quest: kill %d %s", q_ptr->max_num, name);
154 print_questinfo(player_ptr, q_index, TRUE);