home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d190 / nethack.lha / NetHack / een.zoo / sit.c < prev    next >
C/C++ Source or Header  |  1988-07-24  |  5KB  |  237 lines

  1. /*    SCCS Id: @(#)sit.c      2.3     88/02/02
  2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3.  
  4. #include "hack.h"
  5.  
  6. #ifdef NEWCLASS
  7. int    identify();
  8. extern struct monst *makemon();
  9. extern struct permonst *courtmon();
  10.  
  11. dosit() {
  12.     extern struct obj *readobjnam(), *addinv();
  13.     struct     obj    *sobj_at();
  14.     register int    cnt;
  15.  
  16.     if(Levitation)  {
  17.  
  18.         pline("You are floating in the air, you can't sit!");
  19.     } else    if(IS_THRONE(RM_TYP(levl[u.ux][u.uy]))) {
  20.  
  21.         pline("As you sit in the opulent throne");
  22.         if (rnd(6) > 4)  {
  23.  
  24.             switch (rnd(13))  {
  25.  
  26.                 case 1:
  27.                 pline("you feel suddenly weaker.");
  28.                 if(Poison_resistance) {
  29.  
  30.                     losestr(rn1(1,2));
  31.                     losehp(rnd(6), "cursed throne");
  32.                 } else {
  33.  
  34.                     losestr(rn1(4,3));
  35.                     losehp(rnd(10), "cursed throne");
  36.                 }
  37.                 break;
  38.                 case 2:
  39.                 pline("you feel suddenly stronger.");
  40.                 gainstr(0);
  41.                 break;
  42.                 case 3:
  43.                 pline("A%s charge of electricity shoots through your body!",
  44.                       (Shock_resistance) ? "" : " massive");
  45.                 if(Shock_resistance)
  46.                     losehp(rnd(6), "electric chair");
  47.                 else    losehp(rnd(30), "electric chair");
  48.                 break;
  49.                 case 4:
  50.                 pline("you feel much, much better!");
  51.                 if(u.uhp >= (u.uhpmax - 5))  u.uhpmax += 4;
  52.                 u.uhp = u.uhpmax;
  53.                 if (Blinded) Blinded = 1;
  54.                 if (Sick)  Sick = 0;
  55.                 heal_legs();
  56.                 flags.botl = 1;
  57.                 break;
  58.                 case 5:
  59.                 if (u.ugold <= 0)  {
  60.  
  61.                     pline("you feel a strange sensation.");
  62.                 } else {
  63.                     pline("you notice you have no gold!");
  64.                     u.ugold = 0;
  65.                     flags.botl = 1;
  66.                 }
  67.                 break;
  68.                 case 6:
  69.                 if(u.uluck + rn2(5) < 0) {
  70.  
  71.                     pline("you feel your luck is changing.");
  72.                     change_luck(1);
  73.                 } else        makewish();
  74.                 break;
  75.                 case 7:
  76.                 cnt = rnd(10);
  77.                 pline("you hear a voice echo:");
  78.                 pline("Your audience has been summoned, Sire!");
  79.                 while(cnt--)
  80.                     (void) makemon(courtmon(), u.ux, u.uy);
  81.                 break;
  82.                 case 8:
  83.                 if (Confusion != 0)  {
  84.  
  85.                     pline("you hear a voice echo:");
  86.                     pline("By your Imperious order Sire...");
  87.                 }
  88.                 do_genocide();
  89.                 break;
  90.                 case 9:
  91.                 pline("you hear a voice echo:");
  92.                 pline("A curse upon you for sitting upon this most holy throne!");
  93.                 if (u.uluck > 0)  {
  94.  
  95.                     if(!Blind)  pline("a cloud of darkness falls upon you.");
  96.                     Blinded += rn1(100,250);
  97.                     seeoff(0);
  98.                 } else        rndcurse();
  99.                 break;
  100.                 case 10:
  101.                 if (u.uluck < 0)  {
  102.  
  103.                     pline("an image forms in your mind.");
  104.                     do_mapping();
  105.                 } else    {
  106.  
  107.                     pline("your vision clarifies.");
  108.                     HSee_invisible |= INTRINSIC;
  109.                 }
  110.                 break;
  111.                 case 11:
  112.                 if (u.uluck < 0)  {
  113.  
  114.                     pline("you feel threatened.");
  115.                     aggravate();
  116.                 } else    {
  117.  
  118.                     pline("you feel a wrenching sensation.");
  119.                     tele();             /* teleport him */
  120.                 }
  121.                 break;
  122.                 case 12:
  123.                 pline("you are granted a gift of insight!");
  124.                 while (!ggetobj("identify", identify, rn2(5))
  125.                     && invent);
  126.                 break;
  127.                 case 13:
  128.                 pline("your mind turns into a pretzel!");
  129.                 HConfusion += rn1(7,16);
  130.                 break;
  131.                 default:    impossible("throne effect");
  132.                     break;
  133.             }
  134.         } else    pline("you feel somehow out of place...");
  135.  
  136.         if (!rn2(3) && IS_THRONE(RM_TYP(levl[u.ux][u.uy])))    {
  137.  
  138.             pline("The throne vanishes in a puff of logic.");
  139. /*            levl[u.ux][u.uy].scrsym = ROOM_SYM; */
  140.             RM_SET_TYP(levl[u.ux][u.uy], ROOM);
  141.         }
  142.  
  143.     } else    pline("Having fun sitting on the floor???");
  144.     return(1);
  145. }
  146. #endif /* NEWCLASS /**/
  147.  
  148. /* #if defined(NEWCLASS) || defined(PRAYERS) || defined(HARD) */
  149. #ifdef NEWCLASS
  150. # define XXX
  151. #endif
  152. #ifdef PRAYERS
  153. # define XXX
  154. #endif
  155. #ifdef HARD
  156. # define XXX
  157. #endif
  158.  
  159. #ifdef XXX
  160. rndcurse() {                    /* curse a few inventory items at random! */
  161.  
  162.     int    nobj = 0;
  163.     int    cnt, onum;
  164.     struct    obj    *otmp;
  165.  
  166.     for (otmp = invent; otmp; otmp = otmp->nobj)  nobj++;
  167.         for (cnt = rnd(6); cnt > 0; cnt--)  {
  168.  
  169.         onum = rn2(nobj);
  170.         for(otmp = invent; onum != 0; onum--)
  171.             otmp = otmp->nobj;
  172.  
  173.             otmp->cursed++;
  174.         }
  175. }
  176. #endif
  177.  
  178. attrcurse() {                   /* remove a random INTRINSIC ability */
  179.     switch(rnd(10)) {
  180.     case 1 : if (HFire_resistance & INTRINSIC) {
  181.             HFire_resistance &= ~INTRINSIC;
  182.             if (Inhell && !Fire_resistance) {
  183.                 pline("You burn to a crisp.");
  184.                 killer = "gremlin curse";
  185.                 done("died");
  186.             } else pline("You feel warmer!");
  187.             break;
  188.         }
  189.     case 2 : if (HTeleportation & INTRINSIC) {
  190.             HTeleportation &= ~INTRINSIC;
  191.             pline("You don't feel jumpy!");
  192.             break;
  193.         }
  194.     case 3 : if (HPoison_resistance & INTRINSIC) {
  195.             HPoison_resistance &= ~INTRINSIC;
  196.             pline("You feel a little sick!");
  197.             break;
  198.         }
  199.     case 4 : if (HTelepat & INTRINSIC) {
  200.             HTelepat &= ~INTRINSIC;
  201.             pline("Your senses fail!");
  202.             break;
  203.         }
  204.     case 5 : if (HCold_resistance & INTRINSIC) {
  205.             HCold_resistance &= ~INTRINSIC;
  206.             pline("You feel colder!");
  207.             break;
  208.         }
  209.     case 6 : if (HInvis & INTRINSIC) {
  210.             HInvis &= ~INTRINSIC;
  211.             pline("You feel paranoid!");
  212.             break;
  213.         }
  214.     case 7 : if (HSee_invisible & INTRINSIC) {
  215.             HSee_invisible &= ~INTRINSIC;
  216.             pline("You think you see something!");
  217.             break;
  218.         }
  219.     case 8 : if (Fast & INTRINSIC) {
  220.             Fast &= ~INTRINSIC;
  221.             pline("You feel slower!");
  222.             break;
  223.         }
  224.     case 9 : if (Stealth & INTRINSIC) {
  225.             Stealth &= ~INTRINSIC;
  226.             pline("You feel clumsy!");
  227.             break;
  228.         }
  229.     case 10: if (Protection & INTRINSIC) {
  230.             Protection &= ~INTRINSIC;
  231.             pline("You feel vulnerable!");
  232.             break;
  233.         }
  234.     default: break;
  235.     }
  236. }
  237.