/* obj: quest artifact; possibly null if carrying Amulet */ void finish_quest(struct obj *obj) { struct obj *otmp; if (Uhave_amulet) { /* unlikely but not impossible */ qt_pager(QT_HASAMULET); /* leader IDs the real amulet but ignores any fakes */ if ((otmp = carrying(AMULET_OF_YENDOR)) != 0) fully_identify_obj(otmp); } else { qt_pager(!Qstat(got_thanks) ? QT_OFFEREDIT : QT_OFFEREDIT2); /* should have obtained bell during quest; if not, suggest returning for it now */ if ((otmp = carrying(BELL_OF_OPENING)) == 0) com_pager(5); } Qstat(got_thanks) = TRUE; if (obj) { u.uevent.qcompleted = 1; /* you did it! */ historic_event(FALSE, FALSE, "completed the quest!"); /* behave as if leader imparts sufficient info about the quest artifact */ fully_identify_obj(obj); update_inventory(); } }
void newgame() { fobj = invent = level.buriedobjlist = migrating_objs = (struct obj *)0; fmon = migrating_mons = (struct monst *)0; ftrap = 0; flags.ident = 1; if(wiz1_level.dlevel == 0) init_dungeons(); init_objects(); /* must be before u_init() */ u_init(); init_artifacts(); /* must be after u_init() */ #ifndef NO_SIGNAL (void) signal(SIGINT, (SIG_RET_TYPE) done1); #endif #ifdef NEWS if(flags.news) display_file(NEWS, FALSE); #endif #ifdef MULDGN load_qtlist(); /* load up the quest text info */ quest_init(); if(flags.legacy && moves == 1) com_pager(1); #endif mklev(); u_on_upstairs(); check_special_room(FALSE); vision_reset(); /* set up internals for level (after mklev) */ flags.botlx = 1; /* Move the monster from under you or else * makedog() will fail when it calls makemon(). * - ucsfcgl!kneller */ if(MON_AT(u.ux, u.uy)) mnexto(m_at(u.ux, u.uy)); #ifdef CLIPPING cliparound(u.ux, u.uy); #endif (void) makedog(); docrt(); #ifdef INSURANCE save_currentstate(); #endif return; }
void newgame() { int i; #ifdef MFLOPPY gameDiskPrompt(); #endif flags.ident = 1; for (i = 0; i < NUMMONS; i++) mvitals[i].mvflags = mons[i].geno & G_NOCORPSE; init_objects(); /* must be before u_init() */ flags.pantheon = -1; /* role_init() will reset this */ role_init(); /* must be before init_dungeons(), u_init(), * and init_artifacts() */ init_dungeons(); /* must be before u_init() to avoid rndmonst() * creating odd monsters for any tins and eggs * in hero's initial inventory */ init_artifacts(); /* before u_init() in case $WIZKIT specifies * any artifacts */ u_init(); #ifndef NO_SIGNAL (void) signal(SIGINT, (SIG_RET_TYPE) done1); #endif #ifdef NEWS if(iflags.news) display_file(NEWS, FALSE); #endif load_qtlist(); /* load up the quest text info */ /* quest_init();*/ /* Now part of role_init() */ mklev(); u_on_upstairs(); vision_reset(); /* set up internals for level (after mklev) */ check_special_room(FALSE); flags.botlx = 1; /* Move the monster from under you or else * makedog() will fail when it calls makemon(). * - ucsfcgl!kneller */ if(MON_AT(u.ux, u.uy)) mnexto(m_at(u.ux, u.uy)); (void) makedog(); docrt(); if (flags.legacy) { flush_screen(1); com_pager(1); } #ifdef INSURANCE save_currentstate(); #endif program_state.something_worth_saving++; /* useful data now exists */ #if defined(RECORD_REALTIME) || defined(REALTIME_ON_BOTL) /* Start the timer here */ realtime_data.realtime = (time_t)0L; #if defined(BSD) && !defined(POSIX_TYPES) (void) time((long *)&realtime_data.restoretime); #else (void) time(&realtime_data.restoretime); #endif #endif /* RECORD_REALTIME || REALTIME_ON_BOTL */ /* Success! */ welcome(TRUE); return; }
static void chat_with_leader(void) { /* Rule 0: Cheater checks. */ if (Uhave_questart && !Qstat(met_nemesis)) Qstat(cheater) = TRUE; /* It is possible for you to get the amulet without completing * the quest. If so, try to induce the player to quest. */ if (Qstat(got_thanks)) { /* Rule 1: You've gone back with/without the amulet. */ if (Uhave_amulet) finish_quest(NULL); /* Rule 2: You've gone back before going for the amulet. */ else qt_pager(QT_POSTHANKS); } /* Rule 3: You've got the artifact and are back to return it. */ else if (Uhave_questart) { struct obj *otmp; for (otmp = invent; otmp; otmp = otmp->nobj) if (is_quest_artifact(otmp)) break; finish_quest(otmp); /* Rule 4: You haven't got the artifact yet. */ } else if (Qstat(got_quest)) { qt_pager(rn1(10, QT_ENCOURAGE)); /* Rule 5: You aren't yet acceptable - or are you? */ } else { if (!Qstat(met_leader)) { qt_pager(QT_FIRSTLEADER); Qstat(met_leader) = TRUE; Qstat(not_ready) = 0; } else qt_pager(QT_NEXTLEADER); /* the quest leader might have passed through the portal into the regular dungeon; none of the remaining make sense there */ if (!on_level(&u.uz, &qstart_level)) return; if ((is_pure(FALSE) > 0) && (u.ulevelmax < 2) && ((!challengemode) || !(u.uconduct[conduct_killer]))) { qt_pager(QT_LOWLEVEL); if (yn_function("Confirm your readiness and start the quest?", "yn", 'n') == 'y') { pline("\"Go on then.\""); Qstat(got_quest) = TRUE; /* TODO: levelport the player straight to Quest 2? */ historic_event(FALSE, FALSE, "embarked upon an epic quest."); } else { qt_pager(QT_BADLEVEL); expulsion(FALSE); } return; } if (not_capable()) { qt_pager(QT_BADLEVEL); expulsion(FALSE); } else if (is_pure(TRUE) < 0) { com_pager(QT_BANISHED); expulsion(TRUE); } else if (is_pure(FALSE) == 0) { qt_pager(QT_BADALIGN); if (Qstat(not_ready) == MAX_QUEST_TRIES) { qt_pager(QT_LASTLEADER); expulsion(TRUE); } else { Qstat(not_ready)++; expulsion(FALSE); } } else { /* You are worthy! */ qt_pager(QT_ASSIGNQUEST); Qstat(got_quest) = TRUE; historic_event(FALSE, FALSE, "embarked upon an epic quest."); } } }
static void chat_with_leader(void) { /* Rule 0: Cheater checks. */ if (u.uhave.questart && !Qstat(met_nemesis)) Qstat(cheater) = TRUE; /* It is possible for you to get the amulet without completing * the quest. If so, try to induce the player to quest. */ if (Qstat(got_thanks)) { /* Rule 1: You've gone back with/without the amulet. */ if (u.uhave.amulet) finish_quest(NULL); /* Rule 2: You've gone back before going for the amulet. */ else qt_pager(QT_POSTHANKS); } /* Rule 3: You've got the artifact and are back to return it. */ else if (u.uhave.questart) { struct obj *otmp; for (otmp = invent; otmp; otmp = otmp->nobj) if (is_quest_artifact(otmp)) break; finish_quest(otmp); /* Rule 4: You haven't got the artifact yet. */ } else if (Qstat(got_quest)) { qt_pager(rn1(10, QT_ENCOURAGE)); /* Rule 5: You aren't yet acceptable - or are you? */ } else { if (!Qstat(met_leader)) { qt_pager(QT_FIRSTLEADER); Qstat(met_leader) = TRUE; Qstat(not_ready) = 0; } else qt_pager(QT_NEXTLEADER); /* the quest leader might have passed through the portal into the regular dungeon; none of the remaining make sense there */ if (!on_level(&u.uz, &qstart_level)) return; if (not_capable()) { qt_pager(QT_BADLEVEL); exercise(A_WIS, TRUE); expulsion(FALSE); } else if (is_pure(TRUE) < 0) { com_pager(QT_BANISHED); expulsion(TRUE); } else if (is_pure(TRUE) == 0) { qt_pager(QT_BADALIGN); if (Qstat(not_ready) == MAX_QUEST_TRIES) { qt_pager(QT_LASTLEADER); expulsion(TRUE); } else { Qstat(not_ready)++; exercise(A_WIS, TRUE); expulsion(FALSE); } } else { /* You are worthy! */ qt_pager(QT_ASSIGNQUEST); exercise(A_WIS, TRUE); Qstat(got_quest) = TRUE; historic_event(FALSE, "embarked upon an epic quest."); } } }
static void newgame(void) { int i; flags.ident = 1; for (i = 0; i < NUMMONS; i++) mvitals[i].mvflags = mons[i].geno & G_NOCORPSE; init_objects(); /* must be before u_init() */ flags.pantheon = -1;/* role_init() will reset this */ role_init(); /* must be before init_dungeons(), u_init(), * and init_artifacts() */ init_dungeons(); /* must be before u_init() to avoid rndmonst() * creating odd monsters for any tins and eggs * in hero's initial inventory */ init_artifacts(); u_init(); /* struct you must have some basic data for mklev to work right */ load_qtlist(); /* load up the quest text info */ level = mklev(&u.uz); u_init_inv_skills();/* level must be valid to create items */ u_on_upstairs(); vision_reset(); /* set up internals for level (after mklev) */ check_special_room(FALSE); iflags.botl = 1; /* Move the monster from under you or else * makedog() will fail when it calls makemon(). * - ucsfcgl!kneller */ if (MON_AT(level, u.ux, u.uy)) mnexto(m_at(level, u.ux, u.uy)); makedog(); doredraw(); if (Role_if(PM_CONVICT)) { setworn(mkobj(level, CHAIN_CLASS, TRUE), W_CHAIN); setworn(mkobj(level, BALL_CLASS, TRUE), W_BALL); uball->spe = 1; /* attach the ball to the hero */ placebc(); } /* help the window port get it's display charset/tiles sorted out */ notify_levelchange(NULL); if (flags.legacy) { flush_screen(); com_pager(Role_if(PM_CONVICT) ? 199 : 1); } /* Stop autoexplore revisiting the entrance stairs (or position). */ level->locations[u.ux][u.uy].mem_stepped = 1; program_state.something_worth_saving++; /* useful data now exists */ historic_event(FALSE, "entered the Dungeons of Doom to retrieve the Amulet of Yendor!"); /* Success! */ welcome(TRUE); maybe_tutorial(); /* Prepare for the first move. */ flags.move = 0; set_wear(); pickup(1); log_command_result(); program_state.game_running = TRUE; youmonst.movement = NORMAL_SPEED; /* give the hero some movement points */ realtime_tasks(); post_init_tasks(); return; }