/* 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; }
/* act_remove_gems Remove gems from a throne. arg is zero if there is a gnome king associated with the throne Assumes that cursors() has been called previously, and that a check has been made that the throne actually has gems. */ void act_remove_gems(int arg) { int i, k ; k = rnd(101); if (k < 25) { for (i = 0; i < rnd(4); i++) { /* gems pop ohf the throne */ creategem(); } item[playerx][playery]=ODEADTHRONE; know[playerx][playery]=0; } else if (k < 40 && arg == 0) { createmonster(GNOMEKING); item[playerx][playery] = OTHRONE2; know[playerx][playery] = 0; } else { lprcat("\nNothing happens"); } }
/* * ******* * OTHRONE * ******* * */ void othrone(int arg) { int i,k; lprcat("\nDo you (p) pry off jewels, (s) sit down"); iopts(); while (1) { while (1) switch(getcharacter()) { case 'p': lprcat(" pry off"); k=rnd(101); if (k<25) { for (i=0; i<rnd(4); i++) creategem(); /*gems pop off the throne*/ item[playerx][playery]=ODEADTHRONE; know[playerx][playery]=0; } else if (k<40 && arg==0) { createmonster(GNOMEKING); item[playerx][playery]=OTHRONE2; know[playerx][playery]=0; } else lprcat("\nNothing happens."); return; case 's': lprcat(" sit down"); k=rnd(101); if (k<30 && arg==0) { createmonster(GNOMEKING); item[playerx][playery]=OTHRONE2; know[playerx][playery]=0; } else if (k<35) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); } else lprcat("\nNothing happens."); return; case 'i': case ESC: ignore(); return; }; } /* NOTREACHED */ }
/* * ****** * 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 */ }
/* ============================================================================= * FUNCTION: oopenchest */ void oopenchest(void) { int i; int k; if (item[playerx][playery] != OCHEST) { return; } k = rnd(101); if (k < 40) { Print("The chest explodes as you open it."); UlarnBeep(); i = rnd(10); if (i > c[HP]) i = c[HP]; Printf("You suffer %d hit point%s damage!", (long)i, plural(i)); losehp(DIED_EXPLODING_CHEST, i); UpdateStatus(); switch (rnd(10)) { case 1: c[ITCHING]+= rnd(1000)+100; Print("You feel an irritation spread over your skin!"); UlarnBeep(); break; case 2: c[CLUMSINESS]+= rnd(1600)+200; Print("You begin to lose hand-eye co-ordination!"); UlarnBeep(); break; case 3: c[HALFDAM]+= rnd(1600)+200; Print("You suddenly feel sick and BARF all over your shoes!"); UlarnBeep(); break; } /* Remove the chest */ item[playerx][playery] = ONOTHING; /* create the items in the chest */ if (rnd(100)<69) { /* gems from the chest */ creategem(); } dropgold(rnd(110 * iarg[playerx][playery] + 200)); for (i=0; i<rnd(4); i++) { something(playerx, playery, iarg[playerx][playery]+2); } } else { Print("Nothing happens."); } }