Beispiel #1
0
/*
    Performs the act of opening a chest.  

    Parameters:   x,y location of the chest to open.
    Assumptions:  cursors() has been called previously
*/
void act_open_chest(int x, int y)
{
    int i,k;

    k=rnd(101);
    if (k<40)
        {
        lprcat("\nThe chest explodes as you open it");
        i = rnd(10);  lastnum=281;  /* in case he dies */
        lprintf("\nYou suffer %d hit points damage!",(long)i);
        checkloss(i);
        switch(rnd(10)) /* see if he gets a curse */
            {
            case 1: c[ITCHING]+= rnd(1000)+100;
                    lprcat("\nYou feel an irritation spread over your skin!");
                    break;

            case 2: c[CLUMSINESS]+= rnd(1600)+200;
                    lprcat("\nYou begin to lose hand to eye coordination!");
                    break;

            case 3: c[HALFDAM]+= rnd(1600)+200;
                    lprcat("\nA sickness engulfs you!");    break;
            };
    item[x][y]=know[x][y]=0;    /* destroy the chest */
        if (rnd(100)<69) creategem(); /* gems from the chest */
    dropgold(rnd(110*iarg[playerx][playery]+200));
        for (i=0; i<rnd(4); i++) something(iarg[playerx][playery]+2);
        }
    else
        lprcat("\nNothing happens");
    return;
}
Beispiel #2
0
/*
 *	******
 *	OCHEST
 *	******
 *
 */
void ochest()
{
	int i,k;

	lprcat("\nDo you (t) take it, (o) try to open it"); 
	iopts();
	while (1) {
		while (1) switch(getcharacter()) {
		case 'o':	
			lprcat(" open it.");  
			k=rnd(101);
			if (k<40) {
				lprcat("\nThe chest explodes as you open it."); 
				beep();
				i = rnd(10);
				if (i > c[HP]) i = c[HP];
				lastnum=281;  /* in case he dies */
				lprintf("\nYou suffer %d hit point%s damage!", (long)i,
						i==1?"":"s");
				checkloss(i);
				switch(rnd(10))	{
				case 1:	
					c[ITCHING]+= rnd(1000)+100;
					lprcat("\nYou feel an irritation spread over your skin!");
					beep();
					break;

				case 2:	
					c[CLUMSINESS]+= rnd(1600)+200;
					lprcat("\nYou begin to lose hand-eye co-ordination!");
					beep();
					break;

				case 3:	
					c[HALFDAM]+= rnd(1600)+200;
					lprcat("\nYou suddenly feel sick and BARF all over your "
						   "shoes!");
					beep();
					break;
				};
				item[playerx][playery]=know[playerx][playery]=0;
				if (rnd(100)<69) 
					creategem(); /* gems from the chest */
				dropgold(rnd(110*iarg[playerx][playery]+200));
				for (i=0; i<rnd(4); i++) 
					something(playerx, playery, iarg[playerx][playery]+2);
			}
			else lprcat("\nNothing happens.");
			return;

		case 't':	
			lprcat(" take");
			if (take(OCHEST,iarg[playerx][playery])==0)
				item[playerx][playery]=know[playerx][playery]=0;
			return;

		case 'i':
		case ESC: 
			ignore(); 
			return;
		};
	} /* NOTREACHED */
}