home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume8 / castle / part03 / monster.c < prev   
Text File  |  1990-02-23  |  19KB  |  734 lines

  1.  
  2.  
  3. /*   This file contains all routines concerning monsters   */
  4.  
  5. # include <stdio.h>
  6. # include <curses.h>
  7.  
  8. # include "INCLUDE/windows.h"
  9. # include "INCLUDE/monst.h"
  10. # include "INCLUDE/items.h"
  11. # include "INCLUDE/castle.h"
  12. /*
  13. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  14. +   Routines in this Module:                                                +
  15. +                                                                           +
  16. +       combat()        - All combat operations run from here.              +
  17. +       show_monst(mon) - Show the appropriate picture for mon.             +
  18. +       monst()         - Set up monster configurations.                    +
  19. +       make_dam(R,M)   - Calculate damages R = rand_max, M = Multplier     +
  20. +       get_monst()     - Choose an appropriate monster for this level.     +
  21. +       monst_att(mon)  - Run monster attack routine.                       +
  22. +       abil_one(mon)   - Have monster hit you for damage.                  +
  23. +       abil_two(mon)   - Monster drains your strength.                     +
  24. +       abil_three(mon) - Monster fries you.                                +
  25. +       abil_four(mon)  - The monster blasts you with an electric sphere.   +
  26. +       abil_five(mon)  - The Creature drains your hitpoints.               +
  27. +       abil_six(mon)   - The Creature chokes you for damage.               +
  28. +       abil_seven(mon) - The Creature burns you for damage.                +
  29. +       abil_eight(mon) - The Creature Breaths fire breath at you.          +
  30. +       abil_nine(mon)  - The Creature Causes you to gasp for air.          +
  31. +       abil_ten(mon)   - The Creature is capable of many of the above.     +
  32. +       abil_twelve(mon)- Does a big hit, not like abil_one which depends   +
  33. +                         on monster level.                                 +
  34. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  35.  
  36.     This is a public domain program, I have no objection to modifications
  37. made on it or use for some other reason so long as this notice remains intact.
  38.  
  39.     
  40.         Part of:  castle     Ted Wisniewski
  41.         Author:            Plymouth State College
  42.                     Plymouth NH,
  43.                             03264
  44.         Copyright() PSC
  45. */
  46. combat()
  47. {
  48.     int mon,hit,Au,test;
  49.     int run_att = FALSE;
  50.     char get;
  51.  
  52.     run_away = FALSE;
  53.     mon = get_monst();    /*  Make more monsters so get_monst       */
  54.     m_killed = FALSE;    /*  can be used.            */
  55.     mon_faced = TRUE;
  56.     if(mon == WIN_CRE)
  57.       run_att = TRUE;
  58.     m_temp.m_hp = m[mon].m_hp;
  59.     show_monst(mon);
  60.     clr_mess_win();
  61.     sprintf(buffer,"You face a %s.",m[mon].monster);
  62.     print_mess(buffer,0,0);
  63.     wrefresh(message_win);
  64.     while(!m_killed && !run_away){
  65.       print_mess("F)ight R)un D)efend C)ast U)se L)ookup ",1,0);
  66.       wrefresh(message_win);
  67.       get = wgetch(message_win);
  68.       wmove(message_win,2,0);
  69.       switch (get){
  70.          case 'f' :
  71.          case 'F' : test = (35 + char_stats.dexterity);
  72.             wclear(message_win);
  73.             if(rand()%50 < test){
  74.               m_temp.m_hp -= hit = make_dam(d_val,d_mod);
  75.               wclear(message_win);    
  76.               sprintf(buffer,"You did %d points of damage.",hit);
  77.               print_mess(buffer,2,0);
  78.             }else
  79.               print_mess("You Missed Him.",2,0);
  80.             wrefresh(message_win);
  81.             sleep(1);
  82.             if(m_temp.m_hp > DEAD)
  83.               monst_att(mon);
  84.          break;
  85.          case 'c' :
  86.          case 'C' : spells();
  87.             if(!run_away)
  88.             if(m_temp.m_hp > DEAD)
  89.               monst_att(mon);
  90.          break;
  91.          case 'r' :
  92.          case 'R' : if(!run_att)
  93.               if(rand()%18 + 3 < char_stats.dexterity)
  94.                run_away = TRUE;
  95.               else{
  96.                run_att = TRUE;
  97.                print_mess("You can\'t get away!",2,0);
  98.                wrefresh(message_win);
  99.               }
  100.          break;
  101.          case 'l' :
  102.          case 'L' :
  103.               exp_spell();
  104.               break;
  105.          case 'u' :
  106.          case 'U' :
  107.               use_it();
  108.               break;
  109.          case 'd' :
  110.          case 'D' : if(m_temp.m_hp > DEAD){
  111.               char_stats.ac += 4;
  112.               monst_att(mon);
  113.               char_stats.ac -= 4;
  114.             }
  115.          break;
  116.          case RE_DRAW:
  117.         redraw();
  118.         show_monst(mon);
  119.          break;
  120.          default :
  121.          break;
  122.             }
  123.       if(m_temp.m_hp < 0)
  124.         m_killed = TRUE;  
  125.       if(char_stats.hitpoints < 0){
  126.         strcpy(tmp.death_by,m[mon].monster);
  127.         death();
  128.       }
  129.     }
  130.     mon_faced = FALSE;
  131.     if(m_killed){
  132.        wclear(message_win);
  133.        sprintf(buffer,"You killed a %s. ",m[mon].monster);
  134.        print_mess(buffer,1,0);
  135.        if(mon == WIN_CRE){
  136.         char_stats.experience += 50000;
  137.         strcpy(tmp.death_by,"Old Age");
  138.         death();
  139.        }
  140.        if(mon == 0)
  141.          mon = 1;
  142.        char_stats.gold += Au = 10 * (rand()%mon + 1);
  143.        sprintf(buffer,"You find %d in Gold. ",Au);
  144.        print_mess(buffer,2,0);
  145.        char_stats.experience += m[mon].m_hp;
  146.        gain_lvl();
  147.        print_stats();
  148.        wrefresh(message_win);
  149.        sleep(1);
  150.     }
  151.     wrefresh(message_win);
  152.     clr_mess_win();
  153.     show_scr();
  154. }
  155.  
  156. show_monst(m_num)    
  157. int m_num;
  158. {
  159.     int row,col;
  160.     
  161.     wmove(view_win,0,0);
  162.     for(row=0;row<=11;row++)
  163.        for(col=0;col<=26;col++)
  164.            wprintw(view_win,"%c",mon_scr[m[m_num].m_scr][row][col]);
  165.     wrefresh(view_win);
  166.     wmove(command_win,0,0);
  167.     wrefresh(command_win);
  168. }
  169.  
  170. monst()
  171. {
  172.               /*   First Level Monsters   */
  173.  
  174.     strcpy(m[0].monster,"Horde");      
  175.     m[0].m_lvl = 1; m[0].ability = 1; m[0].m_hp = 2;  m[0].m_scr  = 3;
  176.     
  177.     strcpy(m[1].monster,"Conjurer 1st");
  178.     m[1].m_lvl = 1; m[1].ability = 1; m[1].m_hp = 4;  m[1].m_scr  = 0;
  179.  
  180.     strcpy(m[2].monster,"Spider");        
  181.     m[2].m_lvl = 1; m[2].ability = 2; m[2].m_hp = 3;  m[2].m_scr  = 1;
  182.  
  183.     strcpy(m[3].monster,"Magician 1st");
  184.     m[3].m_lvl = 1; m[3].ability = 3; m[3].m_hp = 6;  m[3].m_scr  = 0;
  185.  
  186.     strcpy(m[4].monster,"Warrior 1st");        
  187.     m[4].m_lvl = 1; m[4].ability = 1; m[4].m_hp = 8; m[4].m_scr = 4;
  188.  
  189.     strcpy(m[5].monster,"Priest 1st");        
  190.     m[5].m_lvl = 1; m[5].ability = 5; m[5].m_hp = 5; m[5].m_scr = 5;
  191.  
  192.     strcpy(m[6].monster,"Flying Serpent");        
  193.     m[6].m_lvl = 1; m[6].ability = 6; m[6].m_hp = 7; m[6].m_scr = 2;
  194.  
  195.         /*  Second Level Monsters    */
  196.     
  197.     strcpy(m[7].monster,"Cannibal");        
  198.     m[7].m_lvl = 2; m[7].ability = 1; m[7].m_hp = 7; m[7].m_scr = 6;
  199.  
  200.     strcpy(m[8].monster,"Illusionist");        
  201.     m[8].m_lvl = 2; m[8].ability = 3; m[8].m_hp = 11; m[8].m_scr = 0;
  202.  
  203.     strcpy(m[9].monster,"Priest 2nd");        
  204.     m[9].m_lvl = 2; m[9].ability = 5; m[9].m_hp = 12; m[9].m_scr = 5;
  205.  
  206.     strcpy(m[10].monster,"Warrior 2nd");        
  207.     m[10].m_lvl = 2; m[10].ability = 1; m[10].m_hp = 13; m[10].m_scr = 4;
  208.  
  209.     strcpy(m[11].monster,"Stinger");        
  210.     m[11].m_lvl = 2; m[11].ability = 2; m[11].m_hp = 6;  m[11].m_scr  = 1;
  211.     
  212.     /*          Level 3 monsters          */
  213.  
  214.     strcpy(m[12].monster,"Mage 1st");        
  215.     m[12].m_lvl = 3; m[12].ability = 3; m[12].m_hp = 17; m[12].m_scr = 0;
  216.  
  217.     strcpy(m[13].monster,"Fire Lion");        
  218.     m[13].m_lvl = 3; m[13].ability = 7; m[13].m_hp = 21; m[13].m_scr = 7;
  219.  
  220.     strcpy(m[14].monster,"Swordsman");        
  221.     m[14].m_lvl = 3; m[14].ability = 1; m[14].m_hp = 19; m[14].m_scr = 14;
  222.  
  223.     strcpy(m[15].monster,"Brother 1st");        
  224.     m[15].m_lvl = 3; m[15].ability = 5; m[15].m_hp = 18; m[15].m_scr = 5;
  225.  
  226.     strcpy(m[16].monster,"Head Banger");        
  227.     m[16].m_lvl = 3; m[16].ability = 1; m[16].m_hp = 15; m[16].m_scr = 6;
  228.  
  229.     /*      Level 4  monsters        */
  230.  
  231.     strcpy(m[17].monster,"Vapor Cloud");        
  232.     m[17].m_lvl = 4; m[17].ability = 9; m[17].m_hp = 18; m[17].m_scr = 8;
  233.  
  234.     strcpy(m[18].monster,"Minor Demon");        
  235.     m[18].m_lvl = 4; m[18].ability = 8; m[18].m_hp = 22; m[18].m_scr = 9;
  236.  
  237.     strcpy(m[19].monster,"Killer Robot");        
  238.     m[19].m_lvl = 4; m[19].ability = 1; m[19].m_hp = 18; m[19].m_scr = 10;
  239.  
  240.     strcpy(m[20].monster,"Griffon");        
  241.     m[20].m_lvl = 4; m[20].ability = 1; m[20].m_hp = 20; m[20].m_scr = 11;
  242.     
  243.     /*       Level 5 monsters        */
  244.  
  245.     strcpy(m[21].monster,"Electric Knight");
  246.     m[21].m_lvl = 5; m[21].ability = 4; m[21].m_hp = 21;  m[21].m_scr  = 14;
  247.  
  248.     strcpy(m[22].monster,"Red Dragon Fly");
  249.     m[22].m_lvl = 5; m[22].ability = 7; m[22].m_hp = 16; m[22].m_scr  = 2;
  250.  
  251.     strcpy(m[23].monster,"Druid ");
  252.     m[23].m_lvl = 5; m[23].ability = 4; m[23].m_hp = 19; m[23].m_scr  = 12;
  253.  
  254.     strcpy(m[24].monster,"Master Mage");
  255.     m[24].m_lvl = 5; m[24].ability = 3; m[24].m_hp = 26; m[24].m_scr  = 13;
  256.  
  257.     strcpy(m[25].monster,"Wizard");
  258.     m[25].m_lvl = 5; m[25].ability = 10; m[25].m_hp = 34; m[25].m_scr  = 13;
  259.  
  260.     strcpy(m[26].monster,"Phantom");        
  261.     m[26].m_lvl = 5; m[26].ability = 11; m[26].m_hp = 23; m[26].m_scr = 9;
  262.  
  263.         /* level 6 monsters */
  264.  
  265.     strcpy(m[27].monster,"Ninja");
  266.     m[27].m_lvl = 6; m[27].ability = 13;m[27].m_hp = 25;  m[27].m_scr  = 14;
  267.  
  268.     strcpy(m[28].monster,"Head Master");        
  269.     m[28].m_lvl = 6; m[28].ability = 1; m[28].m_hp = 25; m[28].m_scr = 6;
  270.  
  271.     strcpy(m[29].monster,"High Priest");        
  272.     m[29].m_lvl = 6; m[29].ability = 5; m[29].m_hp = 27; m[29].m_scr = 5;
  273.  
  274.         /* level 7 monsters    */
  275.  
  276.     strcpy(m[30].monster,"Thunder Cloud");        
  277.     m[30].m_lvl = 7; m[30].ability = 4; m[30].m_hp = 27; m[30].m_scr = 8;
  278.  
  279.     strcpy(m[31].monster,"Flame Lion");        
  280.     m[31].m_lvl = 7; m[31].ability = 8; m[31].m_hp = 33; m[31].m_scr = 7;
  281.  
  282.     strcpy(m[32].monster,"Smoky Dragon");        
  283.     m[32].m_lvl = 7; m[32].ability = 8; m[32].m_hp = 42; m[32].m_scr = 15;
  284.  
  285.         /* level 8 monsters    */
  286.  
  287.     strcpy(m[33].monster,"Sleepy Dragon");        
  288.     m[33].m_lvl = 8; m[33].ability = 9; m[33].m_hp = 53; m[33].m_scr = 15;
  289.  
  290.     strcpy(m[34].monster,"Wraith");        
  291.     m[34].m_lvl = 8; m[34].ability = 11; m[34].m_hp = 39; m[34].m_scr = 9;
  292.  
  293.         /* level 9 monsters */
  294.     
  295.     strcpy(m[35].monster,"Hungry Dragon");        
  296.     m[35].m_lvl = 8; m[35].ability = 9; m[35].m_hp = 64; m[35].m_scr = 15;
  297.  
  298.         /* level 10 monster  (win creature)  */
  299.  
  300.     strcpy(m[36].monster,"The Wiz");        
  301.     m[36].m_lvl = 10;m[36].ability = 12;m[36].m_hp = 260;m[36].m_scr = 13;
  302.  
  303. /*    Ideas:   Phantasmist, Holy Warder
  304. */
  305. }
  306.  
  307. make_dam(rnd,mult)
  308. int rnd,mult;
  309. {
  310.     int total = 0,x;
  311.  
  312.     for(x=1;x<=mult;x++)
  313.       total += ((rand()%rnd)+1);
  314. return(total);
  315. }
  316.  
  317. int get_monst()
  318. {
  319.     int min,max;
  320.             /* min = First monster in level group */
  321.             /* max = Last monster in level group  */
  322.             /* returns choice from monsters of the*/
  323.             /*        level group.              */
  324.  
  325.     switch (p->level){
  326.     case 1: min = 0;     /* Relatively Easy     */
  327.         max = 7;
  328.     break;                    
  329.     case 2: min = 6;    /* A little Tougher    */
  330.         max = 13;
  331.     break;
  332.     case 3: min = 10;    /* Moderately Tough    */
  333.         max = 20;
  334.     break;
  335.     case 4: min = 16;    /* Difficult           */
  336.         max = 27;
  337.     break;
  338.     case 5: min = 22;    /* Very Difficult      */
  339.         max = 32;
  340.     break;
  341.     case 6: min = 29;
  342.             max = 36;
  343.     break;
  344.     }
  345.     return(rand()%((max + 1) - min) + min);
  346. }
  347.  
  348. lose_lvl()
  349. {
  350.     int hitpt, sppt;
  351.  
  352.     if(char_stats.level < 35)
  353.     if(exp[char_stats.level] > char_stats.experience)
  354.       if(lvl_att[char_stats.level] == TRUE){
  355.          hitpt = rand()%6 + 4;
  356.          sppt  = rand()%2 + 1;
  357.          char_stats.hitpoints  -= hitpt;
  358.          char_stats.max_hp -= hitpt;
  359.          char_stats.spellpoints -= sppt;
  360.          char_stats.max_spt -= sppt;
  361.          char_stats.level--;
  362.          known[char_stats.level+1] = FALSE;
  363.          lvl_att[char_stats.level+1] = FALSE;
  364.          lvl_att[char_stats.level] = TRUE;
  365.          print_stats();
  366.       }
  367. }
  368.  
  369. use_it()
  370. {
  371.     char choice;
  372.  
  373.     start = firstnode;
  374.     do
  375.           {
  376.         wclear(inv_win);
  377.         wmove(inv_win,0,0);
  378.         wprintw(inv_win,"Use which Item?");
  379.         wmove(inv_win,1,0);    
  380.         wprintw(inv_win,"N)ext P)rev S)elect");
  381.         wmove(inv_win,3,0);
  382.         wprintw(inv_win,"%s",start->item);
  383.         wmove(inv_win,1,21);
  384.         wrefresh(inv_win);
  385.         switch(choice = getch()){
  386.         case 'n':
  387.         case 'N': 
  388.             if(start->next != NULL)
  389.                start = start->next;
  390.             break;
  391.         case 'p':
  392.         case 'P':
  393.             if(start->prev != NULL)
  394.                start = start->prev;
  395.             break;
  396.         case 's':
  397.         case 'S':
  398.              switch (start->item_type){
  399.                case 9: 
  400.                  if(start->special > 0){
  401.                    p->compass_on = TRUE;
  402.                    ct_compass = 100;
  403.                    compass();
  404.                    start->special--;
  405.                    choice = ESC;
  406.                  }else{
  407.                    print_mess("Item Has no more charges.",0,0);
  408.                    wrefresh(message_win);
  409.                    sleep(1);
  410.                  }
  411.                      break;
  412.                   case 10:
  413.                  if(start->special > 0){
  414.                    detect_trap();
  415.                    ct_dtrap = 100;
  416.                    detect = ON;
  417.                    start->special--;
  418.                    choice = ESC;
  419.                  }else{
  420.                    print_mess("Item Has no more charges.",0,0);
  421.                    wrefresh(message_win);
  422.                    sleep(1);
  423.                  }
  424.                      break;
  425.                case 11:
  426.                  if(start->special > 0){
  427.                    med_heal();
  428.                    start->special--;
  429.                    choice = ESC;
  430.                  }else{
  431.                    print_mess("Item Has no more charges.",0,0);
  432.                    wrefresh(message_win);
  433.                    sleep(1);
  434.                  }
  435.                      break;
  436.                case 12:
  437.                  if(start->special > 0){
  438.                    flame();
  439.                    start->special--;
  440.                    choice = ESC;
  441.                  }else{
  442.                    print_mess("Item Has no more charges.",0,0);
  443.                    wrefresh(message_win);
  444.                    sleep(1);
  445.                  }
  446.                      break;
  447.                case 13:
  448.                  if(start->special > 0){
  449.                    teleport();
  450.                    start->special--;
  451.                    choice = ESC;
  452.                  }else{
  453.                    print_mess("Item Has no more charges.",0,0);
  454.                    wrefresh(message_win);
  455.                    sleep(1);
  456.                  }
  457.                  break;
  458.                default:
  459.                  print_mess("You cannot Use that!",0,0);
  460.                  wrefresh(message_win);
  461.                  break;
  462.              }
  463.               
  464.            }
  465.     }while(choice != ESC);
  466.     wclear(inv_win);
  467.     wrefresh(inv_win);
  468. }
  469.  
  470. monst_att(mon)
  471. int mon;
  472.     int ability;
  473.  
  474.     ability = m[mon].ability;
  475.     wclear(message_win);    
  476.         wmove(message_win,0,0);
  477.     switch (ability){
  478.         case 0:
  479.         case 1: abil_one(mon);
  480.                 break;
  481.         case 2: abil_two();
  482.                 break;
  483.         case 3: abil_three(mon);
  484.                 break;
  485.         case 4: abil_four(mon); 
  486.                 break;
  487.         case 5: abil_five(mon);
  488.         break;
  489.         case 6: abil_six(mon);
  490.                 break;
  491.         case 7: abil_seven(mon);
  492.         break;
  493.         case 8: abil_eight(mon);
  494.         break;
  495.         case 9: abil_nine(mon); 
  496.         break;
  497.         case 10: abil_ten(mon); 
  498.         break;
  499.         case 11: abil_eleven(mon); 
  500.         break;
  501.         case 12: abil_twelve(mon);
  502.         break;
  503.         case 13: abil_thirteen(mon);
  504.             break;
  505.     }
  506.     wrefresh(message_win);
  507.     sleep(1);
  508. }
  509.  
  510. abil_one(monst)
  511. int monst;
  512. {
  513.    if(rand()%16 > char_stats.ac){
  514.       char_stats.hitpoints -= damag = make_dam(5,m[monst].m_lvl); 
  515.       sprintf(buffer,"He hit you for %d points damage.",damag);
  516.       print_mess(buffer,2,0);
  517.       print_stats();
  518.     }else
  519.       print_mess("He Misses you!",2,0);
  520. }
  521.  
  522. abil_two()
  523. {
  524.    if(rand()%6 > char_stats.ac){
  525.       if(char_stats.strength > MIN_STAT)
  526.         char_stats.strength--;
  527.         print_mess("Your Strength is drained.",2,0);
  528.         print_stats();
  529.       }else
  530.         print_mess("He misses you.",2,0);
  531. }
  532.  
  533. abil_three(monst)
  534. int monst;
  535. {
  536.     switch (rand()%2 ? 1 : 2){
  537.       case 1: if((rand()%18) + 3  > char_stats.constitution){
  538.         char_stats.hitpoints -= damag = make_dam(5,m[monst].m_lvl);
  539.         sprintf(buffer,"You got fried for %d points damage.",damag);
  540.         print_mess(buffer,2,0);
  541.         print_stats();
  542.           }else
  543.         print_mess("You resist the Spell.",2,0);
  544.       break;
  545.       case 2: abil_one(monst);
  546.       break;
  547.    }
  548. }
  549.  
  550. abil_four(mon)
  551. int mon;
  552. {
  553.     switch(rand()%2 ? 1 : 2){
  554.       case 1: if((rand()%18)+6 > char_stats.constitution){
  555.             char_stats.hitpoints -= damag = make_dam(5,4);
  556.             print_mess("You are blasted by an electric",2,0);
  557.             sprintf(buffer,"sphere for %d points damage.",damag);
  558.             print_mess(buffer,3,0);
  559.             print_stats();
  560.           }else{
  561.              print_mess("You resist the spell.",2,0);
  562.              sleep(1);
  563.           }
  564.       break;
  565.       case 2: abil_three(mon);
  566.       break;
  567.     }
  568. }
  569.  
  570. abil_five(mon)
  571. int mon;
  572. {
  573.     switch(rand()%2 ? 1 : 2){
  574.       case 1: if((rand()%18) + 5 > char_stats.constitution){
  575.             damag = make_dam(m[mon].m_lvl,3);
  576.             char_stats.hitpoints -= damag;
  577.             sprintf(buffer,"You are drained for %d ",damag);
  578.             print_mess(buffer,2,0);
  579.             print_mess("points of damage.",3,0);
  580.             m_temp.m_hp += (damag>>1);
  581.             print_stats();
  582.           }else
  583.             print_mess("You resist the affects.",2,0);
  584.               break;
  585.       case 2: abil_one(mon);
  586.               break;
  587.     }
  588. }
  589.  
  590. abil_six(mon)
  591. int mon;
  592. {
  593.     switch (rand()%2 ? 1 : 2){
  594.        case 1: if((rand()%18) + 3 > char_stats.constitution){
  595.              char_stats.hitpoints -= damag = make_dam(5,m[mon].m_lvl);
  596.                  print_mess("You are choked for ",2,0);
  597.              sprintf(buffer,"%d points damage.",damag);
  598.              print_mess(buffer,3,0);
  599.              print_stats();
  600.                  }else
  601.              print_mess("You resist the spell.",2,0);
  602.        break;
  603.        case 2: abil_one(mon);
  604.        break;
  605.    }
  606. }
  607.  
  608. abil_seven(mon)
  609. int mon;
  610. {
  611.     switch(rand()%2 ? 1 : 2){
  612.       case 1: if((rand()%18) + 3 > char_stats.intelligence){
  613.             char_stats.hitpoints -= damag = make_dam(5,m[mon].m_lvl);
  614.             sprintf(buffer,"You are burnt for %d ",damag);
  615.             print_mess(buffer,2,0);
  616.             print_mess("points damage.",3,0);
  617.             print_stats();
  618.           }else
  619.             print_mess("The spell does not affect you.",2,0);
  620.           break;
  621.       case 2: abil_one(mon);
  622.       break;
  623.     }
  624. }
  625.  
  626. abil_eight(monst)
  627. int monst;
  628. {
  629.     switch(rand()%2 ? 1 : 2){
  630.       case 1: if((rand()%18)+3 > char_stats.constitution){
  631.             char_stats.hitpoints -= damag = make_dam(8,3);
  632.             print_mess("He Breathes and burns you ",2,0);
  633.                sprintf(buffer,"for %d points damage.",damag);
  634.             print_mess(buffer,3,0);
  635.             print_stats();
  636.           }else
  637.             print_mess("The Spell does not Affect you.",2,0);
  638.       break;
  639.       case 2: abil_one(monst);
  640.       break;
  641.     }
  642. }
  643.  
  644. abil_nine(monst)
  645. int monst;
  646. {
  647.     int tmp;
  648.  
  649.     switch(rand()%2 ? 1 : 2){
  650.       case 1: abil_six(monst);
  651.       break;
  652.       case 2: if((rand()%18)+3 > char_stats.strength){
  653.             tmp = (m[monst].m_lvl + 2);
  654.             char_stats.hitpoints -= damag = (10 + make_dam(5,tmp));
  655.             sprintf(buffer,"You gasp, and take %d points ",damag);
  656.             print_mess(buffer,2,0);
  657.             print_mess("damage due to lack of air.",3,0);
  658.             print_stats();
  659.           }else
  660.             print_mess("You resist the affects.");
  661.       break;
  662.     }
  663. }
  664.  
  665. abil_ten(monst)
  666. int monst;
  667. {
  668.     switch(rand()%3){
  669.       case 0: abil_three(monst);
  670.       break;
  671.       case 1: abil_four(monst);
  672.       break;
  673.       case 2: abil_seven(monst);
  674.       break;
  675.     }
  676. }
  677.     
  678. abil_eleven(monst)
  679. int monst;
  680. {
  681.     switch(rand()%3){
  682.     case 0:
  683.       if(char_stats.ac + 75 < rand()%100){
  684.         char_stats.experience -= (m[monst].m_lvl * 10);
  685.         print_mess("He touches you and drains experience.",2,0);
  686.         lose_lvl();
  687.         print_stats();
  688.       }else
  689.         print_mess("He reaches toward you but misses.",2,0);
  690.     break;
  691.     case 1: abil_five(monst);
  692.         break;
  693.     case 2: abil_one(monst);
  694.         break;
  695.           }
  696. }
  697.     
  698. abil_twelve(monst)
  699. int monst;
  700. {
  701.     switch(rand()%3){
  702.       case 0: abil_thirteen(monst);
  703.       break;
  704.       case 1: char_stats.hitpoints -= damag = make_dam(5,8);
  705.           sprintf(buffer,"He did %d points damage.",damag);
  706.           print_mess(buffer,2,0);
  707.           wrefresh(message_win);
  708.           print_stats();
  709.       break;
  710.       case 2: abil_nine(monst);
  711.       break;
  712.     }
  713. }
  714.  
  715. abil_thirteen(monst)
  716. int monst;
  717. {
  718.    if(rand()%100 > 85){
  719.      char_stats.hitpoints -= damag = (rand()%10) + 10;
  720.      char_stats.dexterity -= 3;
  721.      char_stats.m_dex  -= 1;
  722.      sprintf(buffer,"He hit for %d points of damage",damag);
  723.      print_mess(buffer,2,0);
  724.      print_mess("and he also damaged your dexterity.",3,0);
  725.    }else{
  726.      char_stats.hitpoints -= damag = (rand()%10) + 15;
  727.      sprintf(buffer,"You are hit for %d points damage.",damag);
  728.      print_mess(buffer,2,0);
  729.    }
  730.    print_stats();
  731.    wrefresh(message_win);
  732. }
  733.