Esempio n. 1
0
/*
  QUIT intransitive only. Verify intent and exit if that's what he wants
*/
void ivquit()
{
    gaveup = yes(22, 54, 54);
    if (gaveup)
	normend();
    return;
}
Esempio n. 2
0
/*
  Routine to handle the passing on of one
  of the player's incarnations...
*/
void death()
{
    int yea, j;

    if (!g.closing) {
        if (g.limit < 0) {
            rspeak(185);
            normend();
            return;
        }
        yea = yes(81 + g.numdie * 2, 82 + g.numdie * 2, 54);
        if (++g.numdie >= MAXDIE || !yea)
            normend();
        if (g.chase) {
            g.chase = FALSE;
            g.prop[WUMPUS] = 0;
            move(WUMPUS, 174);
        }
        if (toting(LAMP))
            g.prop[LAMP] = 0;
        for (j = 1; j < MAXOBJ; ++j) {
            if (toting(j))
                drop(j, j == LAMP ? 1 : g.oldloc2);
            if (wearng(j)) {
                g.prop[j] = 0;
                bitoff(j, WEARBT);
            }
        }
        g.newloc = 3;
        g.oldloc = g.loc;
        g.health = 100;
        return;
    }
    /* Closing -- no resurrection... */
    rspeak(131);
    ++g.numdie;
    normend();
    return;
}
Esempio n. 3
0
/*
	BLAST etc.
*/
vblast()
{
	if (prop[ROD2] < 0 || !closed)
		actspk(verb);
	else {
		bonus = 133;
		if (loc == 115)
			bonus = 134;
		if (here(ROD2))
			bonus = 135;
		rspeak(bonus);
		normend();
	}
}
Esempio n. 4
0
/*
  BLAST etc.
*/
void ivblast()
{
    if (!g.closed)
	actspk(verb);
    else {
	g.bonus = 135;
	if (g.place[ROD2] == 212 && g.loc == 116)
	    g.bonus = 133;
	if (g.place[ROD2] == 116 && g.loc != 116)
	    g.bonus = 134;
	rspeak(g.bonus);
	normend();
    }
    return;
}
Esempio n. 5
0
/*
  special time limit stuff...
*/
int stimer()
{
    int i, spk;
    static int clock3;

    g.foobar = g.foobar > 0 ? -g.foobar : 0;
    g.combo = g.combo > 0 ? -g.combo : 0;
    if (g.turns > 310 && g.abbnum != 10000 && !g.terse)
        rspeak(273);

    /* Bump all the right clocks for reconning battery life and closing */
    if (g.closed) {
        clock3--;
        if (clock3 == 0) {
            g.prop[PHONE] = 0;
            g.prop[BOOTH] = 0;
            rspeak(284);
        } else if (clock3 < -7) {
            rspeak(254);
            normend();
            return (TRUE);
        }
    }
    if (g.tally == 0 && inside(g.loc) && g.loc != Y2)
        --g.clock;
    if (g.clock == 0) {
        /* Start closing the cave */
        g.prop[GRATE] = 0;
        biton(GRATE, LOCKBT);
        bitoff(GRATE, OPENBT);
        g.prop[FISSURE] = 0;
        g.prop[TDOOR] = 0;
        biton(TDOOR, LOCKBT);
        bitoff(TDOOR, OPENBT);
        g.prop[TDOOR2] = 0;
        biton(TDOOR2, LOCKBT);
        bitoff(TDOOR2, OPENBT);
        for (i = 1; i <= DWARFMAX; ++i) {
            g.dseen[i] = FALSE;
            g.dloc[i] = 0;
        }
        move(TROLL, 0);
        move((TROLL + MAXOBJ), 0);
        move(TROLL2, plac[TROLL]);
        move((TROLL2 + MAXOBJ), fixd[TROLL]);
        juggle(CHASM);
        if (g.prop[BEAR] != 3)
            destroy(BEAR);
        g.prop[CHAIN] = 0;
        g.fixed[CHAIN] = 0;
        g.prop[AXE] = 0;
        g.fixed[AXE] = 0;
        rspeak(129);
        g.clock = -1;
        g.closing = TRUE;
        return (FALSE);
    }
    if (g.clock < 0)
        --g.clock2;
    if (g.clock2 == 0) {
        /* Set up storage room... and close the cave... */
        g.prop[BOTTLE] = put(BOTTLE, 115, 8);
        g.holder[BOTTLE] = WATER;
        g.place[WATER] = -BOTTLE;
        g.hlink[WATER] = 0;
        bitoff(BOTTLE, OPENBT);
        g.prop[PLANT] = put(PLANT, 115, 0);
        g.prop[OYSTER] = put(OYSTER, 115, 0);
        g.prop[LAMP] = put(LAMP, 115, 0);
        g.prop[ROD] = put(ROD, 115, 0);
        g.prop[DWARF] = put(DWARF, 115, 0);
        g.loc = 115;
        g.oldloc = 115;
        g.newloc = 115;
        /* Leave the grate with normal (non-negative property). */
        put(GRATE, 116, 0);
        biton(GRATE, LOCKBT);
        bitoff(GRATE, OPENBT);
        g.prop[SNAKE] = put(SNAKE, 116, 1);
        g.prop[BIRD] = put(BIRD, 116, 1);
        g.prop[CAGE] = put(CAGE, 116, 0);
        g.prop[ROD2] = put(ROD2, 116, 0);
        g.prop[PILLOW] = put(PILLOW, 116, 0);

        g.prop[BOOTH] = put(BOOTH, 116, -3);
        g.fixed[BOOTH] = 115;
        g.prop[PHONE] = put(PHONE, 212, -4);

        g.prop[MIRROR] = put(MIRROR, 115, 0);
        g.fixed[MIRROR] = 116;
        g.prop[BOOK2] = put(BOOK2, 115, 0);

        for (i = 1; i < MAXOBJ; ++i) {
            if (toting(i) && enclosed(i))
                extract(i);
            if (toting(i))
                destroy(i);
        }
        rspeak(132);
        g.closed = TRUE;
        clock3 = 20 + ranz(20);
        newtravel = TRUE;
        return (TRUE);
    }
    if (g.prop[LAMP] == 1)
        --g.limit;
    if (g.limit == 0) {
        --g.limit;
        g.prop[LAMP] = 0;
        if (here(LAMP))
            rspeak(184);
        return (FALSE);
    }
    if (g.limit < 0 && outside(g.loc)) {
        rspeak(185);
        normend();
        return (TRUE);
    }
    if (g.limit <= 40) {
        if (g.lmwarn || !here(LAMP))
            return (FALSE);
        g.lmwarn = TRUE;
        spk = 187;
        if (g.prop[BATTERIES] == 1)
            spk = 323;
        if (g.place[BATTERIES] == 0)
            spk = 183;
        if (g.prop[VEND] == 1)
            spk = 189;
        rspeak(spk);
        return (FALSE);
    }
    return (FALSE);
}
Esempio n. 6
0
/*
  Routine to handle player's demise via
  waking up the dwarves...
*/
void dwarfend()
{
    rspeak(136);
    normend();
    return;
}
Esempio n. 7
0
/*
  Routines to process intransitive verbs
*/
void itverb()
{
    int i;

    newtravel = FALSE;
    switch (verb) {
    case DROP:
    case SAY:
    case WAVE:
    case CALM:
    case RUB:
    case THROW:
    case FIND:
    case FEED:
    case BREAK:
    case WAKE:
    case WEAR:
    case HIT:
    case DIAL:
    case PLAY:
    case PICK:
    case PUT:
    case TURN:		needobj();	break;
    case TAKE:
    case YANK:
    case GET:
    case INSRT:
    case REMOVE:
    case BURN:		ivtake();	break;
    case OPEN:
    case CLOSE:
    case LOCK:
    case UNLOCK:	ivopen();	break;
    case NOTHING:	rspeak(54);	break;
    case ON:
    case OFF:		trverb();	break;
    case WALK:		actspk(verb);	break;
    case KILL:		ivkill();	break;
    case POUR:		ivpour();	break;
    case EAT:		iveat();	break;
    case DRINK:		ivdrink();	break;
    case QUIT:		ivquit();	break;
    case INVENTORY:	inventory();	break;
    case FILL:		ivfill();	break;
    case BLAST:		ivblast();	break;
    case SCORE:		score(TRUE);	break;
    case FOO:		ivfoo();	break;
    case BRIEF:		ivbrief();	break;
    case READ:		ivread();	break;
    case SUSPEND:
	if (g.closing)
	    rspeak(378);
	else
	    saveadv("advent.sav");
	break;
    case RESTORE:	restore("advent.sav");	break;
    case ANSWER:
	if ((g.loc != 189) || (g.prop[PHONE] != 0))
	    needobj();
	else {
	    object = PHONE;
	    itverb();
	}
	break;
    case BLOW:		rspeak(268);	break;
	/* Action verb 'LEAVE' has no object */
    case LEAVE:		bug(29);	break;
	/* Call if no phone is handy, yell. */
    case YELL:
	if (!here(PHONE))
	    needobj();
	else if (!g.closed)
	    rspeak(271);
	else {
	    rspeak(283);
	    normend();
	}
	break;
	/* Health. give him a diagnosis. */
    case HEALTH:
	if (g.numdie)
	    fprintf(stdout, "You have been killed %d times otherwise\n",
		    g.numdie);
	if (g.health >= 95) {
	    if (pct(50))
		rspeak(348);
	    else
		rspeak(349);
	} else {
	    fprintf(stdout,
	       "Your health rating is %2d out of a possible 100.\n",
		    g.health);
	    rspeak(381 + (100 - g.health) / 20);
	}
	break;
    case LOOK:		ivlook();	break;
    case COMBO:
	if (at(SAFE))
	    ivcombo();
	break;
    case SWEEP:
	/* Dust/sweep */
	if (!at(CARVNG) || !athand(BRUSH) || (g.prop[CARVNG] == 1))
	    rspeak(342);
	else {
	    g.prop[CARVNG] = 1;
	    rspeak(363);
	    rspeak(372);
	}
	break;
    case TERSE:
	/* Terse/unterse. supress all long_form descriptions. */
	g.terse = !g.terse;
	g.detail = 3;
	rspeak(54);
	break;
    case WIZ:
	is_wiz = !is_wiz;
    case MAP:
	rspeak(54);
	break;
    case GATE:
	if (is_wiz) {
	    static char buf[INPUTBUFLEN];
	    sscanf(ask("Location ? ", buf, sizeof(buf)), "%d", &g.loc);
	}
	rspeak(54);
	break;
    case PIRLOC:
	if (is_wiz) {
	    fprintf(stdout, "The dwarfs are at locations:\n");
	    for (i = 1; i < DWARFMAX; i++)
		fprintf(stdout, "  %4d", g.dloc[i]);
	    fprintf(stdout, "\nThe pirate is at location %4d\n",
		    g.dloc[DWARFMAX]);
	}
	rspeak(54);
	break;
    default:
	printf("This intransitive not implemented yet\n");
    }
    return;
}