#include "angband.h"
+#include "floor.h"
#include "floor-events.h"
#include "quest.h"
#include "monsterrace-hook.h"
q_ptr->status = QUEST_STATUS_COMPLETED;
q_ptr->complev = p_ptr->lev;
update_playtime();
- q_ptr->comptime = playtime;
+ q_ptr->comptime = current_world_ptr->play_time;
if (!(q_ptr->flags & QUEST_FLAG_SILENT))
{
continue;
/* Quest is not on this level */
- if ((q_ptr->level != dun_level) &&
+ if ((q_ptr->level != current_floor_ptr->dun_level) &&
(q_ptr->type != QUEST_TYPE_KILL_ANY_LEVEL))
continue;
POSITION ny, nx;
/* Stagger around */
- while (cave_perma_bold(y, x) || grid_array[y][x].o_idx || (grid_array[y][x].info & CAVE_OBJECT))
+ while (cave_perma_bold(y, x) || current_floor_ptr->grid_array[y][x].o_idx || (current_floor_ptr->grid_array[y][x].info & CAVE_OBJECT))
{
/* Pick a location */
scatter(&ny, &nx, y, x, 1, 0);
{
int i;
- for (i = 0; i < (dun_level / 15) + 1; i++)
+ for (i = 0; i < (current_floor_ptr->dun_level / 15) + 1; i++)
{
o_ptr = &forge;
object_wipe(o_ptr);
quest[q_idx].status = QUEST_STATUS_FINISHED;
q_ptr->complev = 0;
update_playtime();
- q_ptr->comptime = playtime;
+ q_ptr->comptime = current_world_ptr->play_time;
}
else
{
return 0;
}
+
+/*!
+ * @brief クエスト階層から離脱する際の処理
+ * @return なし
+ */
+void leave_quest_check(void)
+{
+ /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
+ leaving_quest = p_ptr->inside_quest;
+
+ /* Leaving an 'only once' quest marks it as failed */
+ if (leaving_quest)
+ {
+ quest_type* const q_ptr = &quest[leaving_quest];
+
+ if (((q_ptr->flags & QUEST_FLAG_ONCE) || (q_ptr->type == QUEST_TYPE_RANDOM)) &&
+ (q_ptr->status == QUEST_STATUS_TAKEN))
+ {
+ q_ptr->status = QUEST_STATUS_FAILED;
+ q_ptr->complev = p_ptr->lev;
+ update_playtime();
+ q_ptr->comptime = current_world_ptr->play_time;
+
+ /* Additional settings */
+ switch (q_ptr->type)
+ {
+ case QUEST_TYPE_TOWER:
+ quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
+ quest[QUEST_TOWER1].complev = p_ptr->lev;
+ break;
+ case QUEST_TYPE_FIND_ARTIFACT:
+ a_info[q_ptr->k_idx].gen_flags &= ~(TRG_QUESTITEM);
+ break;
+ case QUEST_TYPE_RANDOM:
+ r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
+
+ /* Floor of random quest will be blocked */
+ prepare_change_floor_mode(CFM_NO_RETURN);
+ break;
+ }
+
+ /* Record finishing a quest */
+ if (q_ptr->type == QUEST_TYPE_RANDOM)
+ {
+ if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
+ }
+ else
+ {
+ if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
+ }
+ }
+ }
+}
+
+/*!
+ * @brief 「塔」クエストの各階層から離脱する際の処理
+ * @return なし
+ */
+void leave_tower_check(void)
+{
+ leaving_quest = p_ptr->inside_quest;
+ /* Check for Tower Quest */
+ if (leaving_quest &&
+ (quest[leaving_quest].type == QUEST_TYPE_TOWER) &&
+ (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))
+ {
+ if (quest[leaving_quest].type == QUEST_TYPE_TOWER)
+ {
+ quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
+ quest[QUEST_TOWER1].complev = p_ptr->lev;
+ update_playtime();
+ quest[QUEST_TOWER1].comptime = current_world_ptr->play_time;
+ }
+ }
+}