2 #include "floor-events.h"
7 * @brief クエストを達成状態にする /
8 * @param quest_num 達成状態にしたいクエストのID
11 void complete_quest(QUEST_IDX quest_num)
13 quest_type* const q_ptr = &quest[quest_num];
17 case QUEST_TYPE_RANDOM:
18 if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_C, quest_num, NULL);
21 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, quest_num, NULL);
25 q_ptr->status = QUEST_STATUS_COMPLETED;
26 q_ptr->complev = p_ptr->lev;
28 q_ptr->comptime = playtime;
30 if (!(q_ptr->flags & QUEST_FLAG_SILENT))
32 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_QUEST_CLEAR);
33 msg_print(_("クエストを達成した!", "You just completed your quest!"));
41 * @brief 特定の敵を倒した際にクエスト達成処理 /
42 * Check for "Quest" completion when a quest monster is killed or charmed.
43 * @param m_ptr 撃破したモンスターの構造体参照ポインタ
46 void check_quest_completion(monster_type *m_ptr)
51 bool create_stairs = FALSE;
61 quest_num = p_ptr->inside_quest;
63 /* Search for an active quest on this dungeon level */
68 for (i = max_q_idx - 1; i > 0; i--)
70 quest_type* const q_ptr = &quest[i];
72 /* Quest is not active */
73 if (q_ptr->status != QUEST_STATUS_TAKEN)
76 /* Quest is not a dungeon quest */
77 if (q_ptr->flags & QUEST_FLAG_PRESET)
80 /* Quest is not on this level */
81 if ((q_ptr->level != dun_level) &&
82 (q_ptr->type != QUEST_TYPE_KILL_ANY_LEVEL))
85 /* Not a "kill monster" quest */
86 if ((q_ptr->type == QUEST_TYPE_FIND_ARTIFACT) ||
87 (q_ptr->type == QUEST_TYPE_FIND_EXIT))
90 /* Interesting quest */
91 if ((q_ptr->type == QUEST_TYPE_KILL_NUMBER) ||
92 (q_ptr->type == QUEST_TYPE_TOWER) ||
93 (q_ptr->type == QUEST_TYPE_KILL_ALL))
96 /* Interesting quest */
97 if (((q_ptr->type == QUEST_TYPE_KILL_LEVEL) ||
98 (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL) ||
99 (q_ptr->type == QUEST_TYPE_RANDOM)) &&
100 (q_ptr->r_idx == m_ptr->r_idx))
107 /* Handle the current quest */
108 if (quest_num && (quest[quest_num].status == QUEST_STATUS_TAKEN))
111 quest_type* const q_ptr = &quest[quest_num];
115 case QUEST_TYPE_KILL_NUMBER:
119 if (q_ptr->cur_num >= q_ptr->num_mon)
121 complete_quest(quest_num);
127 case QUEST_TYPE_KILL_ALL:
129 if (!is_hostile(m_ptr)) break;
131 if (count_all_hostile_monsters() == 1)
133 if (q_ptr->flags & QUEST_FLAG_SILENT)
135 q_ptr->status = QUEST_STATUS_FINISHED;
139 complete_quest(quest_num);
144 case QUEST_TYPE_KILL_LEVEL:
145 case QUEST_TYPE_RANDOM:
147 /* Only count valid monsters */
148 if (q_ptr->r_idx != m_ptr->r_idx)
153 if (q_ptr->cur_num >= q_ptr->max_num)
155 complete_quest(quest_num);
157 if (!(q_ptr->flags & QUEST_FLAG_PRESET))
159 create_stairs = TRUE;
160 p_ptr->inside_quest = 0;
163 /* Finish the two main quests without rewarding */
164 if ((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT))
166 q_ptr->status = QUEST_STATUS_FINISHED;
169 if (q_ptr->type == QUEST_TYPE_RANDOM)
172 q_ptr->status = QUEST_STATUS_FINISHED;
177 case QUEST_TYPE_KILL_ANY_LEVEL:
180 if (q_ptr->cur_num >= q_ptr->max_num)
182 complete_quest(quest_num);
187 case QUEST_TYPE_TOWER:
189 if (!is_hostile(m_ptr)) break;
191 if (count_all_hostile_monsters() == 1)
193 q_ptr->status = QUEST_STATUS_STAGE_COMPLETED;
195 if ((quest[QUEST_TOWER1].status == QUEST_STATUS_STAGE_COMPLETED) &&
196 (quest[QUEST_TOWER2].status == QUEST_STATUS_STAGE_COMPLETED) &&
197 (quest[QUEST_TOWER3].status == QUEST_STATUS_STAGE_COMPLETED))
200 complete_quest(QUEST_TOWER1);
208 /* Create a magical staircase */
214 while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT))
216 /* Pick a location */
217 scatter(&ny, &nx, y, x, 1, 0);
223 /* Explain the staircase */
224 msg_print(_("魔法の階段が現れた...", "A magical staircase appears..."));
226 /* Create stairs down */
227 cave_set_feat(y, x, feat_down_stair);
229 /* Remember to update everything */
230 p_ptr->update |= (PU_FLOW);
240 for (i = 0; i < (dun_level / 15) + 1; i++)
245 /* Make a great object */
246 make_object(o_ptr, AM_GOOD | AM_GREAT);
247 (void)drop_near(o_ptr, -1, y, x);
253 * @brief 特定のアーティファクトを入手した際のクエスト達成処理 /
254 * Check for "Quest" completion when a quest monster is killed or charmed.
255 * @param o_ptr 入手したオブジェクトの構造体参照ポインタ
258 void check_find_art_quest_completion(object_type *o_ptr)
261 /* Check if completed a quest */
262 for (i = 0; i < max_q_idx; i++)
264 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) &&
265 (quest[i].status == QUEST_STATUS_TAKEN) &&
266 (quest[i].k_idx == o_ptr->name1))