home *** CD-ROM | disk | FTP | other *** search
/ Assassins - Ultimate CD Games Collection 4 / Assassins 4 (1999)(Weird Science).iso / misc / omega / source / effect1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-02  |  20.0 KB  |  761 lines

  1. /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
  2. /* effect1.c */
  3.  
  4. #include "glob.h"
  5.  
  6.  
  7. /* enchant */
  8. void enchant(delta)
  9. int delta;
  10. {
  11.   int i,used = FALSE;
  12.   long change_cash;
  13.  
  14.   if (delta < 0) {
  15.     i = random_item();
  16.     if (i == ABORT || Player.possessions[i]->usef == I_NOTHING ||
  17.     Player.possessions[i]->usef == I_NO_OP ||
  18.     Player.possessions[i]->usef == I_NORMAL_ARMOR ||
  19.     Player.possessions[i]->usef == I_NORMAL_WEAPON ||
  20.     Player.possessions[i]->usef == I_NORMAL_SHIELD ||
  21.     Player.possessions[i]->objchar == FOOD ||
  22.     Player.possessions[i]->objchar == MISSILEWEAPON) {
  23.       print1("You feel fortunate.");
  24.       morewait();
  25.     }
  26.     else if (Player.possessions[i]->blessing < 0 ||
  27.       (Player.possessions[i]->objchar == ARTIFACT && random_range(3))) {
  28.     if (Player.possessions[i]->uniqueness == COMMON)
  29.       print1("Your ");
  30.     nprint1(itemid(Player.possessions[i]));
  31.     nprint1(" glows, but the glow flickers out...");
  32.     morewait();
  33.     }
  34.     else {
  35.       used = (Player.possessions[i]->used);
  36.       if (used) {
  37.     Player.possessions[i]->used = FALSE;
  38.     item_use(Player.possessions[i]);
  39.       } 
  40.       if (Player.possessions[i]->uniqueness == COMMON)
  41.     print1("Your ");
  42.       nprint1(itemid(Player.possessions[i]));
  43.       nprint1(" radiates an aura of mundanity!");
  44.       morewait();
  45.       Player.possessions[i]->plus = 0;
  46.       Player.possessions[i]->charge = -1;
  47.       Player.possessions[i]->usef = I_NOTHING;
  48.       if (used) {
  49.     Player.possessions[i]->used = TRUE;
  50.     item_use(Player.possessions[i]);      
  51.       }
  52.     }
  53.   }
  54.   else {
  55.     i = getitem(CASH);
  56.     if (i == ABORT) {
  57.       print1("You feel unlucky.");
  58.       morewait();
  59.     }
  60.     else if (i == CASHVALUE) {
  61.       print1("You enchant your money.... What a concept!");
  62.       change_cash = Player.cash*(random_range(7) - 3)/6;
  63.       if (change_cash > 0) print2("Seems to have been a good idea!");
  64.       else print2("Maybe it wasn't such a good idea....");
  65.       Player.cash += change_cash;
  66.       morewait();
  67.     }
  68.     else if (Player.possessions[i]->objchar == ARTIFACT) {
  69.       if (Player.possessions[i]->usef !=
  70.     Objects[Player.possessions[i]->id].usef) {
  71.     print1("It re-acquires its magical aura!");
  72.     Player.possessions[i]->usef = Objects[Player.possessions[i]->id].usef;
  73.       }
  74.       else {
  75.     print1("The enchantment spell enfolds the ");
  76.     nprint1(itemid(Player.possessions[i]));
  77.     print2("and the potent enchantment of the Artifact causes a backlash!");
  78.     morewait();
  79.     clearmsg();
  80.     manastorm(Player.x,Player.y,Player.possessions[i]->level*5);
  81.       }
  82.     }
  83.     else {
  84.       if (Player.possessions[i]->plus > random_range(20)+1) {
  85.     print1("Uh-oh, the force of the enchantment was too much!");
  86.     print2("There is a loud explosion!");
  87.     morewait();
  88.     manastorm(Player.x,Player.y,Player.possessions[i]->plus*5);
  89.     dispose_lost_objects(1,Player.possessions[i]);
  90.       }
  91.       else {
  92.     used = (Player.possessions[i]->used);
  93.     if (used) {
  94.       setgamestatus(SUPPRESS_PRINTING);
  95.       Player.possessions[i]->used = FALSE;
  96.       item_use(Player.possessions[i]);
  97.       resetgamestatus(SUPPRESS_PRINTING);
  98.     }
  99.     print1("The item shines!");
  100.     morewait();
  101.     Player.possessions[i]->plus += delta+1;
  102.     if (Player.possessions[i]->charge > -1)
  103.       Player.possessions[i]->charge += 
  104.         ((delta+1) * (random_range(10) + 1));
  105.     if (used) {
  106.       setgamestatus(SUPPRESS_PRINTING);
  107.       Player.possessions[i]->used = TRUE;
  108.       item_use(Player.possessions[i]);      
  109.       resetgamestatus(SUPPRESS_PRINTING);
  110.     }
  111.       }
  112.     }
  113.     calc_melee();
  114.   }
  115. }
  116.  
  117. /* bless */
  118. void bless(blessing)
  119. int blessing;
  120. {
  121.   int index,used;
  122.  
  123.   if (blessing < 0) {
  124.     index = random_item();
  125.     if (index == ABORT) {
  126.       print1("You feel fortunate.");
  127.       morewait();
  128.     }
  129.     else {
  130.       print1("A foul odor arises from ");
  131.       if (Player.possessions[index]->uniqueness == COMMON)
  132.     nprint1("your ");
  133.       nprint1(itemid(Player.possessions[index]));
  134.       morewait();
  135.       used = (Player.possessions[index]->used);
  136.       if (used) {
  137.     setgamestatus(SUPPRESS_PRINTING);
  138.     Player.possessions[index]->used = FALSE;
  139.     item_use(Player.possessions[index]);
  140.     resetgamestatus(SUPPRESS_PRINTING);
  141.       }
  142.       Player.possessions[index]->blessing -= 2;
  143.       if (Player.possessions[index]->blessing < 0) 
  144.     Player.possessions[index]->plus =
  145.       abs(Player.possessions[index]->plus) - 1;
  146.       if (used) {
  147.     setgamestatus(SUPPRESS_PRINTING);
  148.     Player.possessions[index]->used = TRUE;
  149.     item_use(Player.possessions[index]);      
  150.     resetgamestatus(SUPPRESS_PRINTING);
  151.       }
  152.     }
  153.   }
  154.   else {
  155.     index = getitem(NULL_ITEM);
  156.     if (index == CASHVALUE) {
  157.       print1("Blessing your money has no effect.");
  158.       morewait();
  159.     }
  160.     else if (index != ABORT) {
  161.       used = (Player.possessions[index]->used == TRUE);
  162.       if (used) {
  163.     setgamestatus(SUPPRESS_PRINTING);
  164.     Player.possessions[index]->used = FALSE;
  165.     item_use(Player.possessions[index]);      
  166.     resetgamestatus(SUPPRESS_PRINTING);
  167.       }
  168.       print1("A pure white light surrounds the item... ");
  169.       if (Player.possessions[index]->blessing < 0-(blessing+1)) {
  170.     print2("which is evil enough to resist the effect of the blessing!");
  171.         morewait();
  172.       }
  173.       else if (Player.possessions[index]->blessing < -1) {
  174.     print2("which disintegrates under the influence of the holy aura!");
  175.         morewait();
  176.     Player.itemweight -=  Player.possessions[index]->weight;
  177.     dispose_lost_objects(1,Player.possessions[index]);
  178.       }
  179.       else if (Player.possessions[index]->blessing < blessing+1) {
  180.     print2("which now seems affected by afflatus!");
  181.     morewait();
  182.     Player.possessions[index]->blessing++;
  183.     Player.possessions[index]->plus =
  184.       abs(Player.possessions[index]->plus)+1;
  185.       }
  186.       else {
  187.         print2("The hierolux fades without any appreciable effect....");
  188.         morewait();
  189.       }
  190.       if (used && (Player.possessions[index] != NULL)) {
  191.     setgamestatus(SUPPRESS_PRINTING);
  192.     Player.possessions[index]->used = TRUE;
  193.     item_use(Player.possessions[index]);     
  194.     resetgamestatus(SUPPRESS_PRINTING);
  195.       } 
  196.     }
  197.   }
  198.   calc_melee();
  199. }
  200.  
  201.  
  202.  
  203. void heal(amount)
  204. int amount;
  205. {
  206.   if (amount > -1) {
  207.     mprint("You feel better.");
  208.     Player.hp += random_range(10*amount)+1;
  209.     Player.status[BLINDED] = 0;
  210.     if (Player.hp > Player.maxhp)
  211.       Player.hp = Player.maxhp + amount;
  212.   }
  213.   else {
  214.     mprint("You feel unwell.");
  215.     Player.hp -= random_range(10*abs(amount)+1);
  216.     if (Player.hp < 0)
  217.       p_death("magical disruption");
  218.   }
  219.   dataprint();
  220. }
  221.  
  222.  
  223. void fbolt(fx,fy,tx,ty,hit,dmg)
  224. int fx,fy,tx,ty,hit,dmg;
  225. {
  226.   bolt(fx,fy,tx,ty,hit,dmg,FLAME);
  227. }
  228.  
  229. void lbolt(fx,fy,tx,ty,hit,dmg)
  230. int fx,fy,tx,ty,hit,dmg;
  231. {
  232.   bolt(fx,fy,tx,ty,hit,dmg,ELECTRICITY);
  233. }
  234.  
  235. void nbolt(fx,fy,tx,ty,hit,dmg)
  236. int fx,fy,tx,ty,hit,dmg;
  237. {
  238.   bolt(fx,fy,tx,ty,hit,dmg,NORMAL_DAMAGE);
  239. }
  240.  
  241.  
  242. /* from f to t */
  243. void bolt(fx,fy,tx,ty,hit,dmg,dtype)
  244. int fx,fy,tx,ty,hit,dmg,dtype;
  245. {
  246.   int xx,yy;
  247.   struct monster *target;
  248.   short boltchar;
  249.   xx = fx; yy = fy;
  250.   
  251.   switch(dtype) {
  252.     case FLAME:boltchar=('*' | COL_LIGHT_RED);break;
  253.     case ELECTRICITY:boltchar = ('^' | COL_LIGHT_BLUE);break;
  254.     case NORMAL_DAMAGE:boltchar = ('!' | COL_BROWN);break;
  255.   }
  256.   clearmsg();
  257.  
  258.   do_los(boltchar,&xx,&yy,tx,ty);
  259.  
  260.   if ((xx == Player.x) && (yy == Player.y)) {
  261.     if (Player.status[DEFLECTION] > 0) 
  262.       mprint("The bolt just missed you!");
  263.     else {
  264.       switch (dtype) {
  265.       case FLAME:
  266.     mprint("You were blasted by a firebolt!");
  267.     p_damage(random_range(dmg),dtype,"a firebolt");
  268.     break;
  269.       case ELECTRICITY:
  270.     mprint("You were zapped by lightning!");
  271.     p_damage(random_range(dmg),dtype,"a bolt of lightning");
  272.     break;
  273.       case NORMAL_DAMAGE:
  274.     mprint("You were hit by a missile!");
  275.     p_damage(random_range(dmg),dtype,"a missile");
  276.     break;
  277.       }
  278.     }
  279.   }
  280.   else if (NULL != (target = Level->site[xx][yy].creature)) {
  281.     if (hitp(hit,target->ac)) {
  282.       if (target->uniqueness == COMMON) {
  283.     strcpy(Str1,"The ");
  284.     strcat(Str1,target->monstring);
  285.       }
  286.       else strcpy(Str1,target->monstring);
  287.       switch (dtype) {
  288.       case FLAME:strcat(Str1," was blasted by a firebolt!");break;
  289.       case ELECTRICITY:strcat(Str1," was zapped by lightning!");break;
  290.       case NORMAL_DAMAGE:strcat(Str1," was hit by a missile!"); break;
  291.       }
  292.       mprint(Str1);
  293.       m_status_set(target,HOSTILE);
  294.       m_damage(target,random_range(dmg),dtype);
  295.     }
  296.     else {
  297.       if (target->uniqueness == COMMON) {
  298.     strcpy(Str1,"The ");
  299.     strcat(Str1,target->monstring);
  300.       }
  301.       else strcpy(Str1,target->monstring);
  302.       switch (dtype) {
  303.       case FLAME:strcat(Str1," was missed by a firebolt!");break;
  304.       case ELECTRICITY:strcat(Str1," was missed by lightning!");break;
  305.       case NORMAL_DAMAGE:strcat(Str1," was missed by a missile!"); break;
  306.       }
  307.       mprint(Str1);
  308.     }
  309.   }
  310.   else if (Level->site[xx][yy].locchar == HEDGE)
  311.     if (Level->site[xx][yy].p_locf != L_TRIFID) {
  312.       if ((dtype == FLAME)||(dtype == ELECTRICITY)) {
  313.     mprint("The hedge is blasted away!");
  314.     Level->site[xx][yy].p_locf = L_NO_OP;
  315.     Level->site[xx][yy].locchar = FLOOR;
  316.     plotspot(xx, yy, TRUE);
  317.     lset(xx, yy, CHANGED);
  318.       }
  319.       else mprint("The hedge is unaffected.");
  320.     }
  321.     else mprint("The trifid absorbs the energy and laughs!");
  322.   else if (Level->site[xx][yy].locchar == WATER)
  323.     if (dtype == FLAME) {
  324.       mprint("The water is vaporised!");
  325.       Level->site[xx][yy].p_locf = L_NO_OP;
  326.       Level->site[xx][yy].locchar = FLOOR;
  327.       lset(xx, yy, CHANGED);
  328.     }
  329. }
  330.  
  331.  
  332. void lball(fx,fy,tx,ty,dmg)
  333. int fx,fy,tx,ty,dmg;
  334. {
  335.   ball(fx,fy,tx,ty,dmg,ELECTRICITY);
  336. }
  337.  
  338. void manastorm(x,y,dmg)
  339. int x,y,dmg;
  340. {
  341.   ball(x,y,x,y,dmg,UNSTOPPABLE);
  342. }
  343.  
  344. void snowball(fx,fy,tx,ty,dmg)
  345. int fx,fy,tx,ty,dmg;
  346. {
  347.   ball(fx,fy,tx,ty,dmg,COLD);
  348. }
  349.  
  350. void fball(fx,fy,tx,ty,dmg)
  351. int fx,fy,tx,ty,dmg;
  352. {
  353.   ball(fx,fy,tx,ty,dmg,FLAME);
  354. }
  355.  
  356.  
  357. /* from f to t */
  358. void ball(fx,fy,tx,ty,dmg,dtype)
  359. int fx,fy,tx,ty,dmg,dtype;
  360. {
  361.   int xx,yy,ex,ey,i;
  362.   struct monster *target;
  363.   short expchar=('@' | COL_LIGHT_PURPLE);
  364.  
  365.   xx = fx; yy = fy;
  366.  
  367.   switch(dtype){
  368.     case FLAME:expchar=('*' | COL_LIGHT_RED);break;
  369.     case COLD:expchar=('o' | COL_WHITE);break;
  370.     case ELECTRICITY:expchar=('^' | COL_LIGHT_BLUE);break;
  371.   }
  372.  
  373.   do_los(expchar,&xx,&yy,tx,ty);
  374.   draw_explosion(expchar,xx,yy);
  375.   for(i=0;i<9;i++) {
  376.     ex = xx + Dirs[0][i];
  377.     ey = yy + Dirs[1][i];
  378.     
  379.     if ((ex == Player.x) && (ey == Player.y)) {
  380.       switch(dtype) {
  381.     case FLAME:mprint("You were blasted by a fireball!");
  382.       p_damage(random_range(dmg),FLAME,"a fireball");
  383.       break;
  384.     case COLD:mprint("You were blasted by a snowball!");
  385.       p_damage(random_range(dmg),COLD,"a snowball");
  386.       break;
  387.     case ELECTRICITY:mprint("You were blasted by ball lightning!");
  388.       p_damage(random_range(dmg),ELECTRICITY,"ball lightning");
  389.       break;
  390.     case UNSTOPPABLE:mprint("Oh No! Manastorm!");
  391.       p_damage(random_range(dmg),UNSTOPPABLE,"a manastorm!");
  392.       break;
  393.       }
  394.     }
  395.     if (NULL != (target = Level->site[ex][ey].creature)) {
  396.       if (los_p(Player.x,Player.y,target->x,target->y)) {
  397.       if (target->uniqueness == COMMON) {
  398.     strcpy(Str1,"The ");
  399.     strcat(Str1,target->monstring);
  400.       }
  401.       else strcpy(Str1,target->monstring);
  402.     switch(dtype) {
  403.       case FLAME:strcat(Str1," was zorched by a fireball!"); break;
  404.       case COLD:strcat(Str1," was blasted by a snowball!"); break;
  405.       case ELECTRICITY:strcat(Str1," was zapped by ball lightning!");break;
  406.       case UNSTOPPABLE:strcat(Str1," was nuked by a manastorm!");break;
  407.     }
  408.     mprint(Str1);
  409.       }
  410.       m_status_set(target,HOSTILE);
  411.       m_damage(target,random_range(dmg),dtype);
  412.     }
  413.     if (Level->site[ex][ey].locchar == HEDGE)
  414.       if (Level->site[ex][ey].p_locf != L_TRIFID) {
  415.     if ((dtype == FLAME)||(dtype == ELECTRICITY)) {
  416.       mprint("The hedge is blasted away!");
  417.       Level->site[ex][ey].p_locf = L_NO_OP;
  418.       Level->site[ex][ey].locchar = FLOOR;
  419.       plotspot(ex,ey,TRUE);
  420.       lset(ex, ey, CHANGED);
  421.     }
  422.     else mprint("The hedge is unaffected.");
  423.       }
  424.       else mprint("The trifid absorbs the energy and laughs!");
  425.     else if (Level->site[ex][ey].locchar == WATER)
  426.       if (dtype == FLAME) {
  427.     mprint("The water is vaporised!");
  428.     Level->site[ex][ey].p_locf = L_NO_OP;
  429.     Level->site[ex][ey].locchar = FLOOR;
  430.     plotspot(ex,ey,TRUE);
  431.     lset(ex, ey, CHANGED);
  432.       }
  433.   }
  434. }
  435.  
  436.  
  437.  
  438.  
  439. void mondet(blessing)
  440. int blessing;    
  441. {
  442.   pml ml;
  443.   for (ml=Level->mlist;ml!=NULL;ml=ml->next) 
  444.     if (ml->m->hp > 0)
  445.       plotmon(blessing > -1 ? ml->m : &(Monsters[random_range(NUMMONSTERS)]));
  446.   levelrefresh();
  447.   morewait();
  448.   show_screen();
  449. }
  450.  
  451.  
  452. void objdet(blessing)
  453. int blessing;     
  454. {
  455.   int i,j;
  456.   for (i=0;i<WIDTH;i++)
  457.     for (j=0;j<LENGTH;j++) 
  458.       if (Level->site[i][j].things != NULL) {
  459.     if (blessing < 0)
  460.       putspot(random_range(WIDTH),
  461.           random_range(LENGTH),
  462.           Level->site[i][j].things->thing->objchar);
  463.     else putspot(i,j,Level->site[i][j].things->thing->objchar);
  464.       }
  465.   levelrefresh();
  466.   morewait();
  467.   show_screen();
  468. }
  469.  
  470. void identify(blessing)
  471. int blessing;
  472. {
  473.   int index;
  474.  
  475.   clearmsg();
  476.  
  477.   if (blessing == 0) {
  478.     print1("Identify:");
  479.     index = getitem(NULL_ITEM);
  480.     if (index == CASHVALUE) print3("Your money is really money.");
  481.     else if (index == ABORT)
  482.       setgamestatus(SKIP_MONSTERS);
  483.     else {
  484.       if (Player.possessions[index]->objchar == FOOD)
  485.     Player.possessions[index]->known = 1;
  486.       else {
  487.     Player.possessions[index]->known = 2;
  488.     Objects[Player.possessions[index]->id].known = 1;
  489.       }
  490.       print1("Identified: ");
  491.       mprint(itemid(Player.possessions[index]));
  492.     }
  493.   }
  494.   else if (blessing < 0) {
  495.     print2("You feel forgetful.");
  496.     for (index=0;index<MAXITEMS;index++) 
  497.       if (Player.possessions[index] != NULL) {
  498.     Player.possessions[index]->known = 0;
  499.     Objects[Player.possessions[index]->id].known = 0;
  500.       }
  501.   }
  502.   else {
  503.     print2("You feel encyclopaedic.");
  504.     for (index=0;index<MAXITEMS;index++)
  505.       if (Player.possessions[index] != NULL) {
  506.     if (Player.possessions[index]->objchar == FOOD)
  507.       Player.possessions[index]->known = 1;
  508.     else {
  509.       Player.possessions[index]->known = 2;
  510.       Objects[Player.possessions[index]->id].known = 1;
  511.     }
  512.       }
  513.     for (index=0;index<Player.packptr;index++)
  514.       if (Player.pack[index] != NULL) {
  515.     if (Player.pack[index]->objchar == FOOD)
  516.       Player.pack[index]->known = 1;
  517.     else {
  518.       Player.pack[index]->known = 2;
  519.       Objects[Player.pack[index]->id].known = 1;
  520.     }
  521.       }
  522.   }
  523.   calc_melee();
  524. }
  525.  
  526.  
  527.  
  528.  
  529. /* returns index of random item, ABORT if player carrying none */
  530. int random_item()
  531. {
  532.   int item = ABORT,tries=0;
  533.   int number = 0;
  534.  
  535.   for(tries=0; tries<MAXITEMS; tries++)
  536.     if (Player.possessions[tries] != NULL) {
  537.       number++;
  538.       if (random_range(number) == 0)
  539.     item = tries;
  540.     }
  541.   return(item);
  542. }
  543.  
  544.   
  545. /* various kinds of wishes */
  546. void wish(blessing)
  547. int blessing;
  548. {
  549.   int i;
  550.   char wishstr[80];
  551.   clearmsg();
  552.   print1("What do you wish for? ");
  553.   if (blessing < 0)
  554.     deathprint();
  555.   else
  556.     strcpy(wishstr,msgscanstring());
  557.   if (blessing < 0 || strcmp(wishstr,"Death")==0) {
  558.     print2("As you wish, so shall it be.");
  559.     p_death("a deathwish");
  560.   }
  561.   if (strcmp(wishstr,"Power")==0) {
  562.     print2("You feel a sudden surge of energy");
  563.     Player.mana=calcmana()*10;
  564.   }
  565.   else if (strcmp(wishstr,"Skill")==0) {
  566.     print2("You feel more competent.");
  567.     if (gamestatusp(CHEATED))
  568.       gain_experience(10000);
  569.     else
  570.       gain_experience(min(10000,Player.xp));
  571.   }
  572.   else if (strcmp(wishstr,"Wealth")==0) {
  573.     print2("You are submerged in shower of gold pieces!");
  574.     Player.cash += 10000;
  575.   }
  576.   else if (strcmp(wishstr,"Balance")==0) {
  577.     print2("You feel neutral.");
  578.     Player.alignment = 0;
  579.   }
  580.   else if (strcmp(wishstr,"Chaos")==0) {
  581.     print2("You feel chaotic.");
  582.     Player.alignment -= 25;
  583.   }
  584.   else if (strcmp(wishstr,"Law")==0) {
  585.     print2("You feel lawful.");
  586.     Player.alignment += 25;
  587.   }
  588.   else if (strcmp(wishstr,"Location")==0)
  589.     strategic_teleport(1);
  590.   else if (strcmp(wishstr,"Knowledge")==0) {
  591.     print2("You feel more knowledgeable.");
  592.     i = random_range(NUMSPELLS);
  593.     if (Spells[i].known) 
  594.       Spells[i].powerdrain =
  595.     (max(1,Spells[i].powerdrain/2));
  596.     else Spells[i].known = TRUE;
  597.   }
  598.   else if (strcmp(wishstr,"Health")==0) {
  599.     print2("You feel vigorous");
  600.     Player.hp = Player.maxhp;
  601.     Player.status[DISEASED] = 0;
  602.     Player.status[POISONED] = 0;
  603.   }
  604.   else if (strcmp(wishstr,"Destruction")==0)
  605.     annihilate(gamestatusp(CHEATED));
  606.   else if (strcmp(wishstr,"Acquisition")==0)
  607.     acquire(gamestatusp(CHEATED));
  608.   else if (strcmp(wishstr,"Summoning")==0)
  609.     summon(gamestatusp(CHEATED),-1);
  610.   else if (strcmp(wishstr,"Stats") == 0 && gamestatusp(CHEATED))
  611.   {
  612.     Player.str = Player.maxstr = Player.con = Player.maxcon = 
  613.       Player.agi = Player.maxagi = Player.dex = Player.maxdex = 
  614.       Player.iq = Player.maxiq = Player.pow = Player.maxpow = 200;
  615.     calc_melee();
  616.   }
  617.   else print2("You feel stupid.");
  618.   dataprint();
  619.   showflags();
  620. }
  621.  
  622. /* gain for an item */
  623. void acquire(blessing)
  624. int blessing;
  625. {
  626.   char otype;
  627.   int index,id = ABORT;
  628.   pob newthing;
  629.  
  630.   if (blessing < 0) {
  631.     index = random_item();
  632.     if (index == ABORT)
  633.       mprint("You feel fortunate.");
  634.     else {
  635.       print1("Smoke drifts out of your pack.... ");
  636.       print2("Destroyed: ");
  637.       nprint2(itemid(Player.possessions[index]));
  638.       morewait();
  639.       dispose_lost_objects(1,Player.possessions[index]);
  640.     }
  641.   }
  642.   else {
  643.     newthing = ((pob) checkmalloc(sizeof(objtype)));
  644.     newthing->id = -1;
  645.     if (gamestatusp(CHEATED))
  646.       print1("Acquire which kind of item: !?][}{)/=%%\\& ");
  647.     else
  648.       print1("Acquire which kind of item: !?][}{)/=%%\\ ");
  649.     otype = mgetc();
  650.     switch (otype) {
  651.     case (POTION&0xff): 
  652.       if (blessing > 0)
  653.     id = itemlist(POTIONID,NUMPOTIONS);
  654.       else
  655.     id = random_range(NUMPOTIONS);
  656.       if (id < 0) print2("You feel stupid."); 
  657.       else make_potion(newthing,id); 
  658.       break;
  659.     case (SCROLL&0xff):
  660.       if (blessing > 0)
  661.     id = itemlist(SCROLLID,NUMSCROLLS);
  662.       else
  663.     id = random_range(NUMSCROLLS);
  664.       if (id < 0) print2("You feel stupid."); 
  665.       else make_scroll(newthing,id); 
  666.       break;
  667.     case (RING&0xff): 
  668.       if (blessing > 0)
  669.     id = itemlist(RINGID,NUMRINGS);
  670.       else
  671.     id = random_range(NUMRINGS);
  672.       if (id < 0) print2("You feel stupid."); 
  673.       else make_ring(newthing,id); 
  674.       break;
  675.     case (STICK&0xff):
  676.       if (blessing > 0)
  677.     id = itemlist(STICKID,NUMSTICKS);
  678.       else
  679.     id = random_range(NUMSTICKS);
  680.       if (id < 0) print2("You feel stupid."); 
  681.       else make_stick(newthing,id); 
  682.       break;
  683.     case (ARMOR&0xff): 
  684.       if (blessing > 0)
  685.     id = itemlist(ARMORID,NUMARMOR);
  686.       else
  687.     id = random_range(NUMARMOR);
  688.       if (id < 0) print2("You feel stupid."); 
  689.       else make_armor(newthing,id); 
  690.       break;
  691.     case (SHIELD&0xff):
  692.       if (blessing > 0)
  693.     id = itemlist(SHIELDID,NUMSHIELDS);
  694.       else
  695.     id = random_range(NUMSHIELDS);
  696.       if (id < 0) print2("You feel stupid."); 
  697.       else make_shield(newthing,id); 
  698.       break;
  699.     case (WEAPON&0xff):
  700.       if (blessing > 0)
  701.     id = itemlist(WEAPONID,NUMWEAPONS);
  702.       else
  703.     id = random_range(NUMWEAPONS);
  704.       if (id < 0) print2("You feel stupid."); 
  705.       else make_weapon(newthing,id); 
  706.       break;
  707.     case (BOOTS&0xff):
  708.       if (blessing > 0)
  709.     id = itemlist(BOOTID,NUMBOOTS);
  710.       else
  711.     id = random_range(NUMBOOTS);
  712.       if (id < 0) print2("You feel stupid."); 
  713.       else make_boots(newthing,id); 
  714.       break;
  715.     case (CLOAK&0xff): 
  716.       if (blessing > 0)
  717.     id = itemlist(CLOAKID,NUMCLOAKS);
  718.       else
  719.     id = random_range(NUMCLOAKS);
  720.       if (id < 0) print2("You feel stupid."); 
  721.       else make_cloak(newthing,id); 
  722.       break;
  723.     case (FOOD&0xff): 
  724.       if (blessing > 0)
  725.     id = itemlist(FOODID,NUMFOODS);
  726.       else
  727.     id = random_range(NUMFOODS);
  728.       if (id < 0) print2("You feel stupid."); 
  729.       else make_food(newthing,id); 
  730.       break;
  731.     case (THING&0xff):
  732.       if (blessing > 0)
  733.     id = itemlist(THINGID,NUMTHINGS);
  734.       else
  735.     id = random_range(NUMTHINGS);
  736.       if (id < 0) print2("You feel stupid."); 
  737.       else make_thing(newthing,id); 
  738.       break;
  739.     case (ARTIFACT&0xff):
  740.       if (gamestatusp(CHEATED))
  741.     id = itemlist(ARTIFACTID,NUMARTIFACTS);
  742.       else
  743.     id = -1;
  744.       if (id < 0) print2("You feel stupid."); 
  745.       else make_artifact(newthing,id); 
  746.       break;
  747.     default:
  748.       print2("You feel stupid."); 
  749.     }
  750.     xredraw();
  751.     if (id != ABORT) {
  752.       if (blessing > 0) {
  753.     newthing->known = 2;
  754.     Objects[id].known = 1;
  755.       }
  756.       newthing->used = FALSE;
  757.       gain_item(newthing);
  758.     }
  759.   }
  760. }
  761.