Example #1
0
/* called from check_special_room() when the player enters the temple room */
void
intemple(int roomno)
{
    struct monst *priest = findpriest((char)roomno);
    boolean tended = (priest != NULL);
    boolean sanctum, can_speak;
    xchar shrined;
    const char *msg1, *msg2;

    if (In_mines(&u.uz) && !historysearch("entered the Minetown temple", TRUE))
        historic_event(FALSE, TRUE, "entered the Minetown temple");

    if (!temple_occupied(u.urooms0)) {
        if (tended) {
            shrined = has_shrine(priest);
            sanctum = (priest->data == &mons[PM_HIGH_PRIEST] &&
                       (shrined & AM_SANCTUM));
            can_speak = (priest->mcanmove && !priest->msleeping &&
                         canhear());
            if (can_speak) {
                unsigned save_priest = priest->ispriest;

                /* don't reveal the altar's owner upon temple entry in the
                   endgame; for the Sanctum, the next message names Moloch so
                   suppress the "of Moloch" for him here too */
                if (sanctum && !Hallucination)
                    priest->ispriest = 0;
                pline("%s intones:",
                      canseemon(priest) ? Monnam(priest) : "A nearby voice");
                priest->ispriest = save_priest;
            }
            msg2 = 0;
            if (sanctum && CONST_EPRI(priest)->shralign == A_NONE) {
                if (priest->mpeaceful) {
                    msg1 = "Infidel, you have entered Moloch's Sanctum!";
                    msg2 = "Be gone!";
                    msethostility(priest, TRUE, TRUE);
                } else
                    msg1 = "You desecrate this place by your presence!";
            } else {
                msg1 = msgprintf("Pilgrim, you enter a %s place!",
                                 !shrined ? "desecrated" : "sacred");
            }
            if (can_speak) {
                verbalize("%s", msg1);
                if (msg2)
                    verbalize("%s", msg2);
            }
            if (!sanctum) {
                /* !tended -> !shrined */
                if (!shrined || !p_coaligned(priest) ||
                    u.ualign.record <= ALGN_SINNED)
                    pline("You have a%s forbidding feeling...",
                          (!shrined) ? "" : " strange");
                else
                    pline("You experience a strange sense of peace.");
            }
        } else {
            switch (rn2(3)) {
            case 0:
                pline("You have an eerie feeling...");
                break;
            case 1:
                pline("You feel like you are being watched.");
                break;
            default:
                pline("A shiver runs down your %s.", body_part(SPINE));
                break;
            }
            if (!rn2(5)) {
                struct monst *mtmp;

                if (!((mtmp = makemon(&mons[PM_GHOST], level, 
                                      u.ux, u.uy, NO_MM_FLAGS))))
                    return;
                if (!Blind || sensemon(mtmp))
                    pline("An enormous ghost appears next to you!");
                else
                    pline("You sense a presence close by!");
                msethostility(mtmp, TRUE, TRUE);
                if (flags.verbose)
                    pline("You are frightened to death, and unable to move.");
                helpless(3, hr_afraid, "frightened to death",
                         "You regain your composure.");
            }
        }
    }
}
Example #2
0
static void
lcmd(int type)
{
	switch(curChar) {
		case '0':
			gotobegin();
			return;
		case '$':
			gotoend();
			return;
		case 'A':
			gotoend();
			putchar(*curPos++);
			lMode = INSERT;
			return;
		case 'a':
			if (curPos != startOfLine)
				putchar(*curPos++);
			lMode = INSERT;
			return;
		case 'i':
			lMode = INSERT;
			return;
		case 'D':
			delete_to_end();
			return;
		case 'd':
			delete_something();
			return;
		case 'c':
			delete_something();
			lMode = INSERT;
			return;
		case 'x':
			ldelete();
			return;
		case ' ':
		case 'l':
			if (curPos < startOfLine+lineLen-1) {
				putchar(*curPos);
				curPos++;
			}
			return;
		case '\b':
		case 'h':
			if (curPos > startOfLine) {
				putchar('\b');
				curPos--;
			}
			return;
		case 'r':
			lMode = EDIT1;
			return;
		case 'R':
			lMode = EDIT;
			return;
	}

	/* The remaining commands should only be processed if we are editing
	 * a command line.  For editing a line in a file, the commands that
	 * relate to command line history are not applicable and should be
	 * blocked.
	 */
	if (type == EDITCMDLINE) {
		switch(curChar) {
			case '/':
				putchar('/');
				historysearch();
				return;
			case '+':
			case 'j':
				shownext();
				return;
			case '-':
			case 'k':
				showprev();
				return;
		}
	}

	/* Beep to indicate an error. */
	putchar(0x07);
}