home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / ABERMUD.ZIP / NEW1.C < prev    next >
C/C++ Source or Header  |  1989-07-08  |  32KB  |  1,469 lines

  1. struct player_res
  2. {
  3.     char *p_name;
  4.     long p_loc;
  5.     long p_str;
  6.     long p_sex;
  7.     long p_lev;
  8. };
  9.  
  10. typedef struct player_res PLAYER;
  11.  
  12.  /*
  13.  Extensions section 1
  14.  */
  15.  
  16. #include <stdio.h>
  17.  
  18. extern FILE * openuaf();
  19. extern FILE * openlock();
  20. extern char * oname();
  21. extern char * pname();
  22. extern FILE * openroom();
  23. extern char globme[];
  24. extern char wordbuf[];
  25.  
  26.  bouncecom()
  27.     {
  28.     sillycom("\001s%s\001%s bounces around\n\001");
  29.     bprintf("B O I N G !!!!\n");
  30.     }
  31.  
  32.  sighcom()
  33.     {
  34.     if(chkdumb()) return;
  35.     sillycom("\001P%s\001\001d sighs loudly\n\001");
  36.     bprintf("You sigh\n");
  37.     }
  38.  
  39.  screamcom()
  40.     {
  41.     if(chkdumb()) return;
  42.     sillycom("\001P%s\001\001d screams loudly\n\001");
  43.     bprintf("ARRRGGGGHHHHHHHHHHHH!!!!!!\n");
  44.     }
  45.  
  46.  /* Door is 6 panel 49
  47.  */
  48.  
  49.  ohereandget(onm)
  50.  long *onm;
  51.     {
  52.     long b;
  53.     extern char wordbuf[];
  54.     if(brkword()==-1)
  55.        {
  56.        bprintf("Tell me more ?\n");
  57.        return(-1);
  58.        }
  59.     openworld();
  60.     *onm=fobna(wordbuf);
  61.     if(*onm==-1)
  62.        {
  63.        bprintf("There isn't one of those here\n");
  64.        return(-1);
  65.        }
  66.     return(1);
  67.     }
  68.  
  69.  state(ob)
  70.     {
  71.     extern long objinfo[];
  72.     return(objinfo[4*ob+1]);
  73.     }
  74.  
  75.  
  76.  opencom()
  77.     {
  78.     extern long mynum,curch;
  79.     long a,b;
  80.     b=ohereandget(&a);
  81.     if(b==-1) return;
  82.     switch(a)
  83.        {
  84.        case 21:if(state(21)==0) bprintf("It is\n");
  85.      else bprintf("It seems to be magically closed\n");
  86. break;
  87.        case 1:
  88.           if(state(1)==1)
  89.              {
  90.              bprintf("It is!\n");
  91.              }
  92.           else
  93.              {
  94.              setstate(1,1);
  95.              bprintf("The Umbrella Opens\n");
  96.              }
  97.           break;
  98.        case 20:
  99.           bprintf("You can't shift the door from this side!!!!\n");break;
  100.        default:
  101.           if(otstbit(a,2)==0)
  102.              {
  103.              bprintf("You can't open that\n");
  104.              return;
  105.              }
  106.           if(state(a)==0)
  107.              {
  108.              bprintf("It already is\n");
  109.              return;
  110.              }
  111.           if(state(a)==2)
  112.              {
  113.              bprintf("It's locked!\n");
  114.              return;
  115.              }
  116.           setstate(a,0);bprintf("Ok\n");
  117.  
  118.           }
  119.     }
  120.  
  121.  setstate(o,v)
  122.     {
  123.     extern long objinfo[];
  124.     objinfo[4*o+1]=v;
  125.     if(otstbit(o,1)) objinfo[4*(o^1)+1]=v;
  126.  
  127.     }
  128.  
  129.  closecom()
  130.     {
  131.     long a,b;
  132.     b=ohereandget(&a);
  133.     if(b==-1) return;
  134.     switch(a)
  135.        {
  136.        case 1:
  137.           if(state(1)==0) bprintf("It is closed, silly!\n");
  138.           else
  139.              {
  140.              bprintf("Ok\n");
  141.              setstate(1,0);
  142.              }
  143.              break;
  144.        default:
  145.           if(otstbit(a,2)==0)
  146.              {
  147.              bprintf("You can't close that\n");
  148.              return;
  149.              }
  150.           if(state(a)!=0)
  151.              {
  152.              bprintf("It is open already\n");
  153.              return;
  154.              }
  155.           setstate(a,1);
  156.           bprintf("Ok\n");
  157.           }
  158.     }
  159.  
  160.  lockcom()
  161.     {
  162.     long a,b;
  163.     extern long mynum;
  164.     b=ohereandget(&a);
  165.     if(b==-1) return;
  166.     if(!ohany((1<<11)))
  167.        {
  168.        bprintf("You haven't got a key\n");
  169.        return;
  170.        }
  171.     switch(a)
  172.        {
  173.        default:
  174.           if(!otstbit(a,3))
  175.              {
  176.              bprintf("You can't lock that!\n");
  177.              return;
  178.              }
  179.           if(state(a)==2)
  180.              {
  181.              bprintf("It's already locked\n");
  182.              return;
  183.              }
  184.           setstate(a,2);
  185.           bprintf("Ok\n");
  186.           }
  187.     }
  188.  
  189.  unlockcom()
  190.     {
  191.     long a,b;
  192.     extern long mynum;
  193.     b=ohereandget(&a);
  194.     if(b==-1) return;
  195.     if(!ohany(1<<11))
  196.        {
  197.        bprintf("You have no keys\n");
  198.        return;
  199.        }
  200.     switch(a)
  201.        {
  202.        default:
  203.           if(!otstbit(a,3))
  204.              {
  205.              bprintf("You can't unlock that\n");
  206.              return;
  207.              }
  208.           if(state(a)!=2)
  209.              {
  210.              bprintf("Its not locked!\n");
  211.              return;
  212.              }
  213.           printf("Ok...\n");
  214.           setstate(a,1);
  215.           return;
  216.           }
  217.     }
  218.  
  219.  
  220.  wavecom()
  221.     {
  222.     extern long curch;
  223.     long a,b;
  224.     b=ohereandget(&a);
  225.     if(b==-1) return;
  226.     switch(a)
  227.        {
  228.        case 136:
  229.           if((state(151)==1)&&(oloc(151)==curch))
  230.              {
  231.              setstate(150,0);
  232.              bprintf("The drawbridge is lowered!\n");
  233.              return;
  234.              }
  235. break ;
  236.        case 158:
  237.           bprintf("You are teleported!\n");
  238.           teletrap(-114);
  239.           return;
  240.           }
  241.     bprintf("Nothing happens\n");
  242.     }
  243.  
  244.  blowcom()
  245.     {
  246.     extern long my_sco;
  247.     long a,b;
  248.     b=ohereandget(&a);
  249.     if(b== -1) return;
  250.     bprintf("You can't blow that\n");
  251.     }
  252.  
  253.  
  254.  putcom()
  255.     {
  256.     long a,b;
  257.     extern long my_sco;
  258.     char ar[128];
  259.     extern char wordbuf[];
  260.     long c;
  261.     b=ohereandget(&a);
  262.     if(b== -1) return;
  263.     if(brkword()== -1)
  264.        {
  265.        bprintf("where ?\n");
  266.        return;
  267.        }
  268.     if((!strcmp(wordbuf,"on"))||(!strcmp(wordbuf,"in")))
  269.        {
  270.        if(brkword()== -1)
  271.           {
  272.           bprintf("What ?\n");
  273.           return;
  274.           }
  275.        }
  276.     c=fobna(wordbuf);
  277.     if(c== -1)
  278.        {
  279.        bprintf("There isn't one of those here.\n");
  280.        return;
  281.        }
  282.     if(c==10)
  283.        {
  284.        if((a<4)||(a>6))
  285.           {
  286.           bprintf("You can't do that\n");
  287.           return;
  288.           }
  289.        if(state(10)!=2)
  290.           {
  291.           bprintf("There is already a candle in it!\n");
  292.           return;
  293.           }
  294.        bprintf("The candle fixes firmly into the candlestick\n");
  295.        my_sco+=50;
  296.        destroy(a);
  297.        osetbyte(10,1,a);
  298.        osetbit(10,9);
  299.        osetbit(10,10);
  300.        if(otstbit(a,13))
  301.           {
  302.           osetbit(10,13);
  303.           setstate(10,0);
  304.           return;
  305.           }
  306.        else
  307.           {
  308.           setstate(10,1);
  309.           oclearbit(10,13);
  310.           }
  311.        return;
  312.        }
  313.     if(c==137)
  314.        {
  315.        if(state(c)==0)
  316.           {
  317.           setoloc(a,-162,0);
  318.           bprintf("ok\n");
  319.       return;
  320.           }
  321.        destroy(a);
  322.        bprintf("It dissappears with a fizzle into the slime\n");
  323.        if(a==108)
  324.           {
  325.           bprintf("The soap dissolves the slime away!\n");
  326.           setstate(137,0);
  327.           }
  328.        return;
  329.        }
  330.     if(c==193)
  331.     {
  332.         bprintf("You can't do that, the chute leads up from here!\n");
  333.         return;
  334.     }
  335.     if(c==192)
  336.     {
  337.         if(a==32)
  338.         {
  339.             bprintf("You can't let go of it!\n");
  340.             return;
  341.         }
  342.         bprintf("It vanishes down the chute....\n");
  343.         sprintf(ar,"The %s comes out of the chute!\n",oname(a));
  344.         sendsys("","",-10000,oloc(193),ar);
  345.         setoloc(a,oloc(193),0);
  346.         return;
  347.     }
  348.         
  349.     if(c==23)
  350.        {
  351.        if((a==19)&&(state(21)==1))
  352.           {
  353.           bprintf("The door clicks open!\n");
  354.           setstate(20,0);
  355.           return;
  356.           }
  357.        bprintf("Nothing happens\n");
  358.        return;
  359.        }
  360.     if(c==a)
  361.     {
  362.         bprintf("What do you think this is, the goon show ?\n");
  363.     return;
  364.     }
  365.     if(otstbit(c,14)==0) {bprintf("You can't do that\n");return;}
  366.     if(state(c)!=0){bprintf("That's not open\n");return;}
  367.     if(oflannel(a))
  368.     {
  369.         bprintf("You can't take that !\n");
  370.         return;
  371.     }
  372.     if(dragget()) return;
  373.     if(a==32)
  374.     {
  375.         bprintf("You can't let go of it!\n");
  376.         return;
  377.     }
  378.     setoloc(a,c,3);
  379.     bprintf("Ok.\n");
  380.     sendsys(globme,globme,-10000,curch,ar);
  381.     if(otstbit(a,12)) setstate(a,0);
  382.     if(curch==-1081) 
  383.     {
  384.     setstate(20,1);
  385.     bprintf("The door clicks shut....\n");
  386.     }    
  387. }
  388.  
  389.  lightcom()
  390.     {
  391.     extern long mynum,curch;
  392.     long a,b;
  393.     b=ohereandget(&a);
  394.     if(b== -1) return;
  395.     if(!ohany(1<<13))
  396.        {
  397.        bprintf("You have nothing to light things from\n");
  398.        return;
  399.        }
  400.     switch(a)
  401.        {
  402.        default:
  403.           if(!otstbit(a,9))
  404.              {
  405.              bprintf("You can't light that!\n");
  406.              return;
  407.              }
  408.           if(state(a)==0)
  409.              {
  410.              bprintf("It is lit\n");
  411.              return;
  412.              }
  413.           setstate(a,0);
  414.           osetbit(a,13);
  415.           bprintf("Ok\n");
  416.           }
  417.     }
  418.  
  419.  extinguishcom()
  420.     {
  421.     long a,b;
  422.     b=ohereandget(&a);
  423.     if(b== -1) return;
  424.     switch(a)
  425.        {
  426.        default:
  427.           if(!otstbit(a,13))
  428.              {
  429.              bprintf("That isn't lit\n");
  430.              return;
  431.              }
  432.           if(!otstbit(a,10))
  433.              {
  434.              bprintf("You can't extinguish that!\n");
  435.              return;
  436.              }
  437.           setstate(a,1);
  438.           oclearbit(a,13);
  439.           bprintf("Ok\n");
  440.           }
  441.     }
  442.  
  443.  pushcom()
  444.     {
  445.     extern long curch;
  446.     extern char wordbuf[];
  447.     long fil;
  448.     long x;
  449.     if(brkword()== -1)
  450.        {
  451.        bprintf("Push what ?\n");
  452.        return;
  453.        }
  454.     nbutt:    x=fobna(wordbuf);
  455.     if(x== -1)
  456.        {
  457.        bprintf("That is not here\n");
  458.        return;
  459.        }
  460.     switch(x)
  461.        {
  462.        case 126:
  463.           broad("\001dYou hear a thud and a squelch in the distance.\n\001");
  464.           loseme();
  465.           crapup("             S   P    L      A         T           !");
  466. case 162:bprintf("A trapdoor opens at your feet and you plumment downwards!\n");
  467. curch= -140;trapch(curch);
  468. return;
  469.        case 130:
  470.           if(state(132)==1)
  471.              {
  472.              setstate(132,0);
  473.              bprintf("A secret panel opens in the east wall!\n");
  474.              break;
  475.              }
  476.           bprintf("Nothing happens\n");
  477.           break;
  478.        case 131:
  479.           if(state(134)==1)
  480.              {
  481.              bprintf("Uncovering a hole behind it.\n");
  482.              setstate(134,0);
  483.              }
  484.           break;
  485.        case 138:
  486.           if(state(137)==0)
  487.              {
  488.              bprintf("Ok...\n");
  489.              break;
  490.              }
  491.           else
  492.              {
  493.              bprintf("You hear a gurgling noise and then silence.\n");
  494.              setstate(137,0);
  495.              }
  496.           break;
  497.        case 146:
  498.           ;
  499.        case 147:
  500.           setstate(146,1-state(146));
  501.           bprintf("Ok...\n");
  502.           break;
  503.        case 30:
  504.           setstate(28,1-state(28));
  505.           if(state(28))
  506.              {
  507.              sendsys("","",-10000,oloc(28),"\001cThe portcullis falls\n\001");
  508.              sendsys("","",-10000,oloc(29),"\001cThe portcullis falls\n\001");
  509.              }
  510.           else
  511.              {
  512.              sendsys("","",-10000,oloc(28),"\001cThe portcullis rises\n\001");
  513.              sendsys("","",-10000,oloc(29),"\001cThe portcullis rises\n\001");
  514.              }
  515.           break;
  516.        case 149:
  517.           setstate(150,1-state(150));
  518.           if(state(150))
  519.              {
  520.              sendsys("","",-10000,oloc(150),"\001cThe drawbridge rises\n\001");
  521.  
  522.              sendsys("","",-10000,oloc(151),"\001cThe drawbridge rises\n\001");
  523.              }
  524.           else
  525.              {
  526.              }
  527.           break;
  528.        case 24:
  529.           if(state(26)==1)
  530.              {
  531.              setstate(26,0);
  532.              bprintf("A secret door slides quietly open in the south wall!!!\n");
  533.              }
  534.           else
  535.              bprintf("It moves but nothing seems to happen\n");
  536.           return;
  537.        case 49:
  538.           broad("\001dChurch bells ring out around you\n\001");break;
  539.        case 104:if(ptothlp(mynum)==-1)
  540.     {
  541.         bprintf("You can't shift it alone, maybe you need help\n");
  542.         break;
  543.     }
  544.     /* ELSE RUN INTO DEFAULT */
  545.     goto def2;
  546.        default:;
  547.              def2:
  548.           if(otstbit(x,4))
  549.              {
  550.              setstate(x,0);
  551.              oplong(x);
  552.              return;
  553.              }
  554.           if(otstbit(x,5))
  555.              {
  556.              setstate(x,1-state(x));
  557.              oplong(x);
  558.              return;
  559.              }
  560.           bprintf("Nothing happens\n");
  561.           }
  562.     }
  563.  
  564.  cripplecom()
  565.     {
  566.     long a,b;
  567.     extern char globme[];
  568.     extern long mynum,curch;
  569.     b=victim(&a);
  570.     if(b== -1) return;
  571.     sendsys(pname(a),globme,-10101,curch,"");
  572.     }
  573.  
  574.  curecom()
  575.     {
  576.     long a,b;
  577.     extern char globme[];
  578.     extern long mynum,curch;
  579.     b=vichfb(&a);
  580.     if(b== -1) return;
  581.     sendsys(pname(a),globme,-10100,curch,"");
  582.     }
  583.  
  584.  dumbcom()
  585.     {
  586.     long a,b;
  587.     extern long mynum,curch;
  588.     extern char globme[];
  589.     b=victim(&a);
  590.     if(b== -1) return;
  591.     sendsys(pname(a),globme,-10102,curch,"");
  592.     }
  593.  
  594.  forcecom()
  595.     {
  596.     long a,b;
  597.     extern long mynum,curch;
  598.     extern char globme[];
  599.     char z[128];
  600.     b=victim(&a);
  601.     if(b== -1) return;
  602.     getreinput(z);
  603.     sendsys(pname(a),globme,-10103,curch,z);
  604.     }
  605.  
  606.  missilecom()
  607.     {
  608.     long a,b;
  609.     extern long mynum,curch;
  610.     extern char globme[];
  611.     extern long my_lev;
  612.     extern long fighting,in_fight;
  613.     long ar[8];
  614.     b=vichfb(&a);
  615.     if(b== -1) return;
  616.     sprintf(ar,"%d",my_lev*2);
  617.     sendsys(pname(a),globme,-10106,curch,ar);
  618.     if(pstr(a)-2*my_lev<0)    
  619.     {
  620.     bprintf("Your last spell did the trick\n");
  621.     if(pstr(a)>=0)
  622.     {
  623.     /* Bonus ? */
  624.         if(a<16) my_sco+=(plev(a)*plev(a)*100);
  625.         else my_sco+=10*damof(a);
  626.     }
  627.     setpstr(a,-1); /* MARK ALREADY DEAD */
  628.     in_fight=0;
  629.     fighting= -1;
  630.     }
  631.     if(a>15) woundmn(a,2*my_lev);
  632. }
  633.  
  634.  changecom()
  635.     {
  636.     long a,b;
  637.     extern long mynum,curch;
  638.     extern char globme[];
  639.     extern char wordbuf[];
  640.     if(brkword()== -1)
  641.        {
  642.        bprintf("change what (Sex ?) ?\n");
  643.        return;
  644.        }
  645.     if(!!strcmp(wordbuf,"sex"))
  646.        {
  647.        bprintf("I don't know how to change that\n");
  648.        return;
  649.        }
  650.     b=victim(&a);
  651.     if(b== -1) return;
  652.     sendsys(pname(a),globme,-10107,curch,"");
  653.     if(a<16) return;
  654.     setpsex(a,1-psex(a));
  655.     }
  656.  
  657.  fireballcom()
  658.     {
  659.     long a,b;
  660.     extern long mynum,curch;
  661.     extern long fighting,in_fight;    
  662.     extern char globme[];
  663.     extern long my_lev;
  664.     long ar[2];
  665.     b=vichfb(&a);
  666.     if(b== -1) return;
  667.     if(mynum==a)
  668.        {
  669.        bprintf("Seems rather dangerous to me....\n");
  670.        return;
  671.        }
  672.     sprintf(ar,"%d",2*my_lev);
  673.     if(pstr(a)-(a==fpbns("yeti")?6:2)*my_lev<0)
  674.     {
  675.     bprintf("Your last spell did the trick\n");
  676.     if(pstr(a)>=0)
  677.     {
  678.     /* Bonus ? */
  679.         if(a<16) my_sco+=(plev(a)*plev(a)*100);
  680.         else my_sco+=10*damof(a);
  681.     }
  682.     setpstr(a,-1); /* MARK ALREADY DEAD */
  683.     in_fight=0;
  684.     fighting= -1;
  685.     }    
  686.     sendsys(pname(a),globme,-10109,curch,ar);
  687.     if(a==fpbns("yeti")) {woundmn(a,6*my_lev);return;}
  688.     if(a>15) woundmn(a,2*my_lev);
  689.     }
  690.  
  691.  shockcom()
  692.     {
  693.     long a,b;
  694.     extern long mynum,curch;
  695.     extern char globme[];
  696.     extern long my_lev;
  697.     extern long fighting,in_fight;    
  698.     long ar[2];
  699.     b=vichfb(&a);
  700.     if(b== -1) return;
  701.     if(a==mynum)
  702.        {
  703.        bprintf("You are supposed to be killing other people not yourself\n");
  704.        return;
  705.        }
  706.        if(pstr(a)-2*my_lev<0)
  707.     {
  708.     bprintf("Your last spell did the trick\n");
  709.     if(pstr(a)>=0)
  710.     {
  711.     /* Bonus ? */
  712.         if(a<16) my_sco+=(plev(a)*plev(a)*100);
  713.         else my_sco+=10*damof(a);
  714.     }
  715.     setpstr(a,-1); /* MARK ALREADY DEAD */
  716.     in_fight=0;
  717.     fighting= -1;
  718.     }       
  719.     sprintf(ar,"%d",my_lev*2);
  720.     sendsys(pname(a),globme,-10110,curch,ar);
  721.     if(a>15) woundmn(a,2*my_lev);
  722.     }
  723.  
  724.  starecom()
  725.     {
  726.     extern long mynum;
  727.     long a,b;
  728.     b=vichere(&a);
  729.     if(b== -1) return;
  730.     if(a==mynum)
  731.        {
  732.        bprintf("That is pretty neat if you can do it!\n");
  733.        return;
  734.        }
  735.     sillytp(a,"stares deep into your eyes\n");
  736.     bprintf("You stare at \001p%s\001\n",pname(a));
  737.     }
  738.  
  739.  gropecom()
  740.     {
  741.     extern long mynum;
  742.     long a,b;
  743.     extern long isforce;
  744.     if(isforce){bprintf("You can't be forced to do that\n");return;}
  745.     b=vichere(&a);
  746.     if(b== -1) return;
  747.     if(a==mynum)
  748.        {
  749.        loseme();
  750.        crapup("Bye....... LINE TERMINATED - MORALITY REASONS");
  751.        }
  752.     sillytp(a,"gropes you");
  753.     bprintf("<Well what sort of noise do you want here ?>\n");
  754.     }
  755.  squeezecom()
  756.     {
  757.     extern long mynum;
  758.     long a,b;
  759.     b=vichere(&a);
  760.     if(a==mynum)
  761.        {
  762.        bprintf("Ok....\n");
  763.        return;
  764.        }
  765.     if(a== -1) return;
  766.     sillytp(a,"gives you a squeeze\n");
  767.     bprintf("You give them a squeeze\n");
  768.     return;
  769.  
  770.     }
  771.  kisscom()
  772.     {
  773.     extern long mynum;
  774.     long a,b;
  775.     b=vichere(&a);
  776.     if(b== -1) return;
  777.     if(a==mynum)
  778.        {
  779.        bprintf("Weird!\n");
  780.        return;
  781.        }
  782.     sillytp(a,"kisses you");
  783.     bprintf("Slurp!\n");
  784.     }
  785.  
  786.  cuddlecom()
  787.     {
  788.     extern long mynum;
  789.     long a,b;
  790.     b=vichere(&a);
  791.     if(b== -1) return;
  792.     if(mynum==a)
  793.        {
  794.        bprintf("You aren't that lonely are you ?\n");
  795.        return;
  796.        }
  797.     sillytp(a,"cuddles you");
  798.     }
  799.  hugcom()
  800.     {
  801.     extern long mynum;
  802.     long a,b;
  803.     b=vichere(&a);
  804.     if(b== -1) return;
  805.     if(mynum==a)
  806.        {
  807.        bprintf("Ohhh flowerr!\n");
  808.        return;
  809.        }
  810.     sillytp(a,"hugs you");
  811.     }
  812.  
  813.  slapcom()
  814.     {
  815.     extern long mynum;
  816.     long a,b;
  817.     b=vichere(&a);
  818.     if(b== -1) return;
  819.     if(mynum==a)
  820.        {
  821.        bprintf("You slap yourself\n");
  822.        return;
  823.        }
  824.     sillytp(a,"slaps you");
  825.     }
  826.  
  827.  ticklecom()
  828.     {
  829.     extern long mynum;
  830.     long a,b;
  831.     b=vichere(&a);
  832.     if(b== -1) return;
  833.     if(a==mynum)
  834.        {
  835.        bprintf("You tickle yourself\n");
  836.        return;
  837.        }
  838.     sillytp(a,"tickles you");
  839.     }
  840.  
  841.  /* This one isnt for magic */
  842.  
  843.  vicbase(x)
  844.  long *x;
  845.     {
  846.     long a,b;
  847.     extern char wordbuf[];
  848.     a0:if(brkword()== -1)
  849.        {
  850.        bprintf("Who ?\n");
  851.        return(-1);
  852.        }
  853.     b=openworld();
  854.     if(!strcmp(wordbuf,"at")) goto a0; /* STARE AT etc */
  855.     a=fpbn(wordbuf);
  856.     if(a== -1)
  857.        {
  858.        bprintf("Who ?\n");
  859.        return(-1);
  860.        }
  861.     *x=a;
  862.     return(b);
  863.     }
  864.  
  865.  vichere(x)
  866. long *x;
  867.     {
  868.     extern long curch;
  869.     long a;
  870.     a=vicbase(x);
  871.     if(a== -1) return(a);
  872.     if(ploc(*x)!=curch)
  873.        {
  874.        bprintf("They are not here\n");
  875.        return(-1);
  876.        }
  877.     return(a);
  878.     }
  879.  
  880.  
  881.  vicf2(x,f1)
  882. long *x;
  883.     {
  884.     extern long mynum;
  885.     long a;
  886.     extern long my_str,my_lev;
  887.     extern long curch;
  888.     long b,i;
  889.     a=vicbase(x);
  890.     if(a== -1) return(-1);
  891.     if(my_str<10)
  892.        {
  893.        bprintf("You are too weak to cast magic\n");
  894.        return(-1);
  895.        }
  896.     if(my_lev<10) my_str-=2;
  897. i=5;
  898. if(iscarrby(111,mynum)) i++;
  899. if(iscarrby(121,mynum)) i++;
  900. if(iscarrby(163,mynum)) i++;
  901.     if((my_lev<10)&&(randperc()>i*my_lev))
  902.        {
  903.        bprintf("You fumble the magic\n");
  904.        if(f1==1){*x=mynum;bprintf("The spell reflects back\n");}
  905.        else
  906.           {
  907.           return(-1);
  908.           }
  909.        return(a);
  910.        }
  911.  
  912.     else
  913.        {
  914.        if(my_lev<10)bprintf("The spell succeeds!!\n");
  915.        return(a);
  916.        }
  917.     }
  918.  
  919.  vicfb(x)
  920.  long *x;
  921.     {
  922.     return(vicf2(x,0));
  923.     }
  924.  vichfb(x)
  925.  long *x;
  926.     {
  927.     long a;
  928.     extern long curch;
  929.     a=vicfb(x);
  930.     if(a== -1) return(-1);
  931.     if(ploc(*x)!=curch)
  932.        {
  933.        bprintf("They are not here\n");
  934.        return(-1);
  935.        }
  936.     return(a);
  937.     }
  938.  
  939.  victim(x)
  940.         long *x;
  941.     {
  942.     return(vicf2(x,1));
  943.     }
  944.  
  945.  sillytp(per,msg)
  946.  char *msg;
  947.     {
  948.     extern long curch;
  949.     extern char globme[];
  950.     char bk[256];
  951.     if(strncmp(msg,"star",4)==0) 
  952.     else
  953.        sprintf(bk,"%s%s%s%s%s","\001p",globme,"\001 ",msg,"\n");
  954.     sendsys(pname(per),globme,-10111,curch,bk);
  955.     }
  956.  
  957. long ail_dumb=0;
  958. long  ail_crip=0;
  959. long  ail_blind=0;
  960. long  ail_deaf=0;
  961.  
  962.  
  963.  new1rcv(isme,chan,to,from,code,text)
  964.  char *to,*from,*text;
  965.     {
  966.     extern long mynum,my_lev,ail_dumb,ail_crip;
  967.     extern long ail_deaf,ail_blind;
  968.     extern long curch,my_sex;
  969.     extern char globme[];
  970.     switch(code)
  971.        {
  972.        case -10100:
  973.           if(isme==1) {
  974.              bprintf("All your ailments have been cured\n");
  975.              ail_dumb=0;
  976.              ail_crip=0;
  977.              ail_blind=0;ail_deaf=0;
  978.              }
  979.           break;
  980.        case -10101:
  981.           if(isme==1)
  982.              {
  983.              if(my_lev<10)
  984.                 {
  985.                 bprintf("You have been magically crippled\n");
  986.                 ail_crip=1;
  987.                 }
  988.  
  989.              else
  990.                 bprintf("\001p%s\001 tried to cripple you\n",from);
  991.              }
  992.           break;
  993.        case -10102:
  994.           if(isme==1)
  995.              {
  996.              if(my_lev<10)
  997.                 {
  998.                 bprintf("You have been struck magically dumb\n");
  999.                 ail_dumb=1;
  1000.                 }
  1001.  
  1002.              else
  1003.                 bprintf("\001p%s\001 tried to dumb you\n",from);
  1004.              }
  1005.           break;
  1006.        case -10103:
  1007.           if(isme==1)
  1008.              {
  1009.              if(my_lev<10)
  1010.                 {
  1011.                 bprintf("\001p%s\001 has forced you to %s\n",from,text);
  1012.                 addforce(text);
  1013.                 }
  1014.  
  1015.              else
  1016.                 bprintf("\001p%s\001 tried to force you to %s\n",from,text);
  1017.              }
  1018.           else
  1019.           break;
  1020.        case -10104:
  1021.           if(isme!=1)bprintf("\001p%s\001 shouts '%s'\n",from,text);
  1022.           break;
  1023.        case -10105:
  1024.           if(isme==1)
  1025.              {
  1026.              if(my_lev<10)
  1027.                 {
  1028.                 bprintf("You have been struck magically blind\n");
  1029.                 ail_blind=1;
  1030.                 }
  1031.  
  1032.              else
  1033.                 bprintf("\001p%s\001 tried to blind you\n",from);
  1034.              }
  1035.           break;
  1036.        case -10106:
  1037.           if(iam(from))break;
  1038.           if(curch==chan)
  1039.              {
  1040.              bprintf("Bolts of fire leap from the fingers of \001p%s\001\n",from);
  1041.              if(isme==1)
  1042.                 {
  1043.                 bprintf("You are struck!\n");
  1044.                 wounded(numarg(text));
  1045.                 }
  1046.  
  1047.              else
  1048.                 bprintf("\001p%s\001 is struck\n",to);
  1049.              }
  1050.           break;
  1051.        case -10107:
  1052.           if(isme==1)
  1053.              {
  1054.              bprintf("Your sex has been magically changed!\n");
  1055.              my_sex=1-my_sex;
  1056.              bprintf("You are now ");
  1057.              if(my_sex)bprintf("Female\n");
  1058.  
  1059.              else
  1060.                 bprintf("Male\n");
  1061.              calibme();
  1062.              }
  1063.           break;
  1064.        case -10109:
  1065.           if(iam(from)) break;
  1066.           if(curch==chan)
  1067.              {
  1068.              bprintf("\001p%s\001 casts a fireball\n",from);
  1069.              if(isme==1)
  1070.                 {
  1071.                 bprintf("You are struck!\n");
  1072.                 wounded(numarg(text));
  1073.                 }
  1074.  
  1075.              else
  1076.                 bprintf("\001p%s\001 is struck\n",to);
  1077.              }
  1078.           break;
  1079.        case -10110:
  1080.           if(iam(from)) break;
  1081.           if(isme==1)
  1082.              {
  1083.              wounded(numarg(text));
  1084.              }
  1085.           break;
  1086.        case -10111:
  1087.           if(isme==1)bprintf("%s\n",text);
  1088.           break;
  1089.        case -10113:
  1090.           if(my_lev>9)bprintf("%s",text);
  1091.           break;
  1092.        case -10120:
  1093.           if(isme==1)
  1094.              {
  1095.              if(my_lev>9)
  1096.                 {
  1097.                 bprintf("\001p%s\001 tried to deafen you\n",from);
  1098.                 break;
  1099.                 }
  1100.              bprintf("You have been magically deafened\n");
  1101.              ail_deaf=1;
  1102.              break;
  1103.              }
  1104.           }
  1105.     }
  1106.  
  1107.  destroy(ob)
  1108.     {
  1109.     osetbit(ob,0);
  1110.     }
  1111.  
  1112.  tscale()
  1113.     {
  1114.     long a,b;
  1115.     a=0;
  1116.     b=0;
  1117.     while(b<16)
  1118.        {
  1119.        if(!!strlen(pname(b))) a++;
  1120.        b++;
  1121.        }
  1122.     switch(a)
  1123.        {
  1124.        case 1:
  1125.           return(2);
  1126.        case 2:
  1127.           return(3);
  1128.        case 3:
  1129.           return(3);
  1130.        case 4:
  1131.           return(4);
  1132.        case 5:
  1133.           return(4);
  1134.        case 6:
  1135.           return(5);
  1136.        case 7:
  1137.           return(6);
  1138.        default:
  1139.           return(7);
  1140.           }
  1141.     }
  1142.  
  1143.  chkdumb()
  1144.     {
  1145.     extern long ail_dumb;
  1146.     if(!ail_dumb) return(0);
  1147.     bprintf("You are dumb...\n");
  1148.     return(1);
  1149.     }
  1150.  
  1151.  chkcrip()
  1152.     {
  1153.     extern long ail_crip;
  1154.     if(!ail_crip) return(0);
  1155.     bprintf("You are crippled\n");
  1156.     return(1);
  1157.     }
  1158.  chkblind()
  1159.     {
  1160.     extern long ail_blind;
  1161.     if(!ail_blind) return(0);
  1162.     bprintf("You are blind, you cannot see\n");
  1163.     return(1);
  1164.     }
  1165.  
  1166.  chkdeaf()
  1167.     {
  1168.     extern long ail_deaf;
  1169.     if(!ail_deaf) return(0);
  1170.     return(1);
  1171.     }
  1172.  
  1173.  wounded(n)
  1174.     {
  1175.     extern long my_str,my_lev,curch;
  1176.     extern long me_cal;
  1177.     extern long zapped;
  1178.     extern char globme[];
  1179.     char ms[128];
  1180.     if(my_lev>9) return;
  1181.     my_str-=n;
  1182.     me_cal=1;
  1183.     if(my_str>=0) return;
  1184.     closeworld();
  1185.     syslog("%s slain magically",globme);
  1186.     delpers(globme);
  1187.     zapped=1;
  1188.     openworld();
  1189.     dumpitems();
  1190.     loseme();
  1191.     sprintf(ms,"%s has just died\n",globme);
  1192.     sendsys(globme,globme,-10000,curch,ms);
  1193.     sprintf(ms,"[ %s has just died ]\n",globme);
  1194.     sendsys(globme,globme,-10113,curch,ms);
  1195.     crapup("Oh dear you just died\n");
  1196.     }
  1197.  
  1198.  woundmn(mon,am)
  1199.     {
  1200.     extern long mynum;
  1201.     extern char globme[];
  1202.     long a;
  1203.     long b;
  1204.     char ms[128];
  1205.     a=pstr(mon)-am;
  1206.     setpstr(mon,a);
  1207.  
  1208.     if(a>=0){mhitplayer(mon,mynum);}
  1209.  
  1210.     else
  1211.        {
  1212.        dumpstuff(mon,ploc(mon));
  1213.        sprintf(ms,"%s has just died\n",pname(mon));
  1214.        sendsys(" "," ",-10000,ploc(mon),ms);
  1215.        sprintf(ms,"[ %s has just died ]\n",pname(mon));
  1216.        pname(mon)[0]=0;
  1217.        sendsys(globme,globme,-10113,ploc(mon),ms);
  1218.        }
  1219.     }
  1220.  
  1221.  
  1222.  mhitplayer(mon,mn)
  1223.     {
  1224.     extern long curch,my_lev,mynum;
  1225.     long a,b,x[4];
  1226.     extern char globme[];
  1227.     if(ploc(mon)!=curch) return;
  1228.     if((mon<0)||(mon>47)) return;
  1229.     a=randperc();
  1230.     b=3*(15-my_lev)+20;
  1231. if((iswornby(89,mynum))||(iswornby(113,mynum))||(iswornby(114,mynum)))
  1232.        b-=10;
  1233.     if(a<b)
  1234.        {
  1235.        x[0]=mon;
  1236.        x[1]=randperc()%damof(mon);
  1237.        x[2]= -1;
  1238.        sendsys(globme,pname(mon),-10021,ploc(mon),(char *)x);
  1239.        }
  1240.  
  1241.     else
  1242.        {
  1243.  
  1244.        x[0]=mon;
  1245.        x[2]= -1;
  1246.        x[1]= -1;
  1247.        sendsys(globme,pname(mon),-10021,ploc(mon),x) ;
  1248.        }
  1249.     }
  1250.  
  1251.  resetplayers()
  1252.     {
  1253.     extern PLAYER pinit[];
  1254.     long a,b,c;
  1255.     a=16;
  1256.     c=0;
  1257.     while(a<35)
  1258.        {
  1259.        strcpy(pname(a),pinit[c].p_name);
  1260.        setploc(a,pinit[c].p_loc);
  1261.        setpstr(a,pinit[c].p_str);
  1262.        setpsex(a,pinit[c].p_sex);
  1263.        setpwpn(a,-1);
  1264.        setpvis(a,0);
  1265.        setplev(a,pinit[c].p_lev);
  1266.        a++;c++;
  1267.        }
  1268.     while(a<48)
  1269.        {
  1270.        strcpy(pname(a),"");
  1271.        a++;
  1272.        }
  1273.     }
  1274.  
  1275. PLAYER pinit[48]=
  1276.     { "The Wraith",-1077,60,0,-2,"Shazareth",-1080,99,0,-30,"Bomber",-308,50,0,-10,
  1277.     "Owin",-311,50,0,-11,"Glowin",-318,50,0,-12,
  1278.     "Smythe",-320,50,0,-13
  1279.     ,"Dio",-332,50,0,-14
  1280.     ,"The Dragon",-326,500,0,-2,"The Zombie",-639,20,0,-2
  1281.     ,"The Golem",-1056,90,0,-2,"The Haggis",-341,50,0,-2,"The Piper"
  1282.     ,-630,50,0,-2,"The Rat",-1064,20,0,-2
  1283.     ,"The Ghoul",-129,40,0,-2,"The Figure",-130,90,0,-2,
  1284.     "The Ogre",-144,40,0,-2,"Riatha",-165,50,0,-31,
  1285.     "The Yeti",-173,80,0,-2,"The Guardian",-197,50,0,-2
  1286.     ,"Prave",-201,60,0,-400,"Wraith",-350,60,0,-2
  1287.     ,"Bath",-1,70,0,-401,"Ronnie",-809,40,0,-402,"The Mary",-1,50,0,-403,
  1288.     "The Cookie",-126,70,0,-404,"MSDOS",-1,50,0,-405,
  1289.     "The Devil",-1,70,0,-2,"The Copper"
  1290.     ,-1,40,0,-2
  1291.     };
  1292.  
  1293.  
  1294.  
  1295.  wearcom()
  1296.     {
  1297.     long a,b;
  1298.     extern long mynum;
  1299.     b=ohereandget(&a);
  1300.     if(b== -1) return(-1);
  1301.     if(!iscarrby(a,mynum))
  1302.        {
  1303.        bprintf("You are not carrying this\n");
  1304.        return;
  1305.        }
  1306.     if(iswornby(a,mynum))
  1307.        {
  1308.        bprintf("You are wearing this\n");
  1309.        return;
  1310.        }
  1311.     if(((iswornby(89,mynum))||(iswornby(113,mynum))||(iswornby(114,mynum)))&&
  1312.          ((a==89)||(a==113)||(a==114)))
  1313.          {
  1314.              bprintf("You can't use TWO shields at once...\n");
  1315.              return;
  1316.         }
  1317.     if(!canwear(a))
  1318.        {
  1319.        bprintf("Is this a new fashion ?\n");
  1320.        return;
  1321.        }
  1322.     setcarrf(a,2);
  1323.     bprintf("OK\n");
  1324.     }
  1325.  
  1326.  removecom()
  1327.     {
  1328.     long a,b;
  1329.     extern long mynum;
  1330.     b=ohereandget(&a);
  1331.     if(b== -1) return;
  1332.     if(!iswornby(a,mynum))
  1333.        {
  1334.        bprintf("You are not wearing this\n");
  1335.        }
  1336.     setcarrf(a,1);
  1337.     }
  1338.  
  1339.  setcarrf(o,n)
  1340.     {
  1341.     extern long objinfo[];
  1342.     objinfo[4*o+3]=n;
  1343.     }
  1344.  
  1345.  iswornby(item,chr)
  1346.     {
  1347.     if(!iscarrby(item,chr)) return(0);
  1348.     if(ocarrf(item)!=2) return(0);
  1349.     return(1);
  1350.     }
  1351.  addforce(x)
  1352.  char *x;
  1353.     {
  1354.     extern char acfor[];
  1355.     extern long forf;
  1356.     if(forf==1)bprintf("The compulsion to %s is overridden\n",acfor);
  1357.     forf=1;
  1358.     strcpy(acfor,x);
  1359.     }
  1360.  
  1361. long forf=0;
  1362. char acfor[128];
  1363.  
  1364.  forchk()
  1365.     {
  1366.     extern long forf;
  1367.     extern char acfor[];
  1368.     extern long isforce;
  1369.     isforce=1;
  1370.     if(forf==1) gamecom(acfor);
  1371.     isforce=0;
  1372.     forf=0;
  1373.     }
  1374.  
  1375. long isforce=0;
  1376.  damof(n)
  1377.     {
  1378.     switch(n)
  1379.        {
  1380.        case 20:
  1381. case 18:;
  1382. case 19:;
  1383. case 21:;
  1384. case 22:;
  1385.           return(6);
  1386.        case 23:
  1387.           return(32);
  1388.        case 24:
  1389.           return(8);
  1390.        case 28:
  1391.           return(6);
  1392. case 30:return(20);
  1393. case 31:return(14);
  1394. case 32:return(15);
  1395. case 33:return(10);
  1396.        default:
  1397.           return(10);
  1398.           }
  1399.     }
  1400.  canwear(a)
  1401.     {
  1402.     switch(a)
  1403.        {
  1404.        default:
  1405.           if(otstbit(a,8)) return(1);
  1406.           return(0);
  1407.           }
  1408.     }
  1409.  iam(x)
  1410.  char *x;
  1411.     {
  1412.     char a[64],b[64];
  1413.     extern char globme[];
  1414.     strcpy(a,x);
  1415.     strcpy(b,globme);
  1416.     lowercase(a);
  1417.     lowercase(b);
  1418.     if(!strcmp(a,b)) return(1);
  1419.     if(strncmp(b,"the ",4)==0)
  1420.        {
  1421.        if(!strcmp(a,b+4)) return(1);
  1422.        }
  1423.     return(0);
  1424.     }
  1425.  deafcom()
  1426.     {
  1427.     long a,b;
  1428.     extern long mynum,curch;
  1429.     extern char globme[64];
  1430.     b=victim(&a);
  1431.     if(b== -1) return;
  1432.     sendsys(pname(a),globme,-10120,curch,"");
  1433.     }
  1434.  
  1435. blindcom()
  1436.     {
  1437.     long a,b;
  1438.     extern long mynum,curch;
  1439.     extern char globme[64];
  1440.     b=victim(&a);
  1441.     if(b== -1) return;
  1442.     sendsys(pname(a),globme,-10105,curch,"");
  1443.     }
  1444.  
  1445. teletrap(newch)
  1446. long newch;
  1447. {
  1448.        char block[200];
  1449.        sendsys(globme,globme,-10000,curch,block);
  1450.        curch=newch;
  1451.        sendsys(globme,globme,-10000,newch,block);
  1452.        trapch(curch);
  1453. }
  1454.  
  1455. on_flee_event()
  1456. {
  1457.     extern long  numobs;
  1458.     extern long mynum;
  1459.     long ct=0;
  1460.     while(ct<numobs)
  1461.     {
  1462.         if((iscarrby(ct,mynum))&&(!iswornby(ct,mynum)))
  1463.         {
  1464.             setoloc(ct,ploc(mynum),0);
  1465.         }
  1466.         ct++;
  1467.     }
  1468. }
  1469.