예제 #1
0
파일: quest.c 프로젝트: FredrIQ/nhfourk
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.");
        }
    }
}
예제 #2
0
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.");
        }
    }
}