home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume7 / omega3 / part18 / oitemf2.c < prev    next >
C/C++ Source or Header  |  1989-07-20  |  12KB  |  582 lines

  1. /* omega copyright (C) 1987,1988,1989 by Laurence Raphael Brothers */
  2. /* oitemf2.c */
  3.  
  4. /* mostly ring, armor, and weapon functions */
  5.  
  6. #include "oglob.h"
  7.  
  8.  
  9.  
  10.  
  11. /* ring functions */
  12. void i_perm_knowledge(o)
  13. pob o;
  14. {
  15.   if (o->known < 1)
  16.     o->known = 1;
  17.   if (o->blessing > -1)
  18.     Objects[o->id].known = 1;
  19.   if (o->used) 
  20.     knowledge(o->blessing);
  21. }
  22.  
  23. void i_perm_strength(o)
  24. pob o;
  25. {
  26.   if (o->known < 1) o->known = 1;
  27.   Objects[o->id].known = 1;
  28.   if (o->used){
  29.     if (o->blessing > -1)
  30.       Player.str += abs(o->plus)+1;
  31.     else
  32.       Player.str -= abs(o->plus)+1;
  33.   }
  34.   else {
  35.     if (o->blessing > -1)
  36.       Player.str -= abs(o->plus)+1;
  37.     else
  38.       Player.str += abs(o->plus)+1;
  39.   }
  40.   calc_melee();
  41. }
  42.  
  43.  
  44.  
  45. void i_perm_burden(o)
  46. pob o;
  47. {
  48.   int i;
  49.   
  50.   if (o->used) {
  51.     o->weight = 1000;
  52.     mprint("You feel heavier.");
  53.   }
  54.   else {
  55.     o->weight = 1;
  56.     mprint("Phew. What a relief.");
  57.   }
  58.   Player.itemweight = 0;
  59.   for (i=0;i<MAXITEMS;i++) {
  60.     if (Player.possessions[i] != NULL)
  61.       Player.itemweight += 
  62.     (Player.possessions[i]->weight*Player.possessions[i]->number);
  63.   }
  64. }
  65.  
  66. void i_perm_gaze_immune(o)
  67. pob o;
  68. {
  69.   if (o->used) Player.immunity[GAZE]++;
  70.   else Player.immunity[GAZE]--;
  71. }
  72.  
  73. void i_perm_fire_resist(o)
  74. pob o;
  75. {
  76.   if (o->used) Player.immunity[FLAME]++;
  77.   else Player.immunity[FLAME]--;
  78. }
  79.  
  80. void i_perm_poison_resist(o)
  81. pob o;
  82. {
  83.   if (o->used) {
  84.     if (o->blessing < 0) {
  85.       Player.immunity[POISON] = 0;
  86.       p_poison(100);
  87.     }
  88.     else {
  89.       Player.immunity[POISON]++;
  90.       if (Player.status[POISONED] > 0) {
  91.     mprint("You feel much better now.");
  92.     Player.status[POISONED] = 0;
  93.       }
  94.     }
  95.   }
  96.   else {
  97.     Player.status[POISONED] = 0;
  98.     Player.immunity[POISON]--;
  99.   }
  100. }
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107. void i_perm_regenerate(o)
  108. pob o;
  109. {
  110.   if (o->known < 1)  o->known = 1;
  111.   if (o->blessing > -1)
  112.     Objects[o->id].known = 1;
  113.   if (o->used) {
  114.     mprint("You seem abnormally healthy.");
  115.     Player.status[REGENERATING] += 1500;
  116.   }
  117.   else {
  118.     Player.status[REGENERATING] -= 1500;
  119.     if (Player.status[REGENERATING] < 1) {
  120.       mprint("Your vitality is back to normal");
  121.       Player.status[REGENERATING] = 0;
  122.     }
  123.   }
  124. }
  125.  
  126.  
  127.  
  128.  
  129. /* armor functions */
  130.  
  131.  
  132. void i_normal_armor(o)
  133. pob o;
  134. {
  135.   if (o->used) mprint("You put on your suit of armor.");
  136. }
  137.  
  138. void i_perm_energy_resist(o)
  139. pob o;
  140. {
  141.   if (o->used){
  142.     Player.immunity[FLAME]++;
  143.     Player.immunity[COLD]++;
  144.     Player.immunity[ELECTRICITY]++;
  145.   }
  146.   else {
  147.     Player.immunity[FLAME]--;
  148.     Player.immunity[COLD]--;
  149.     Player.immunity[ELECTRICITY]--;
  150.   }
  151. }
  152.  
  153.  
  154.  
  155. void i_perm_fear_resist(o)
  156. pob o;
  157. {
  158.   if (o->used){
  159.     Player.immunity[FEAR]++;
  160.     if (o->blessing < 0) {
  161.       Player.status[BERSERK] += 1500;
  162.       mprint("You feel blood-simple!");
  163.     }
  164.   }
  165.   else {
  166.     Player.immunity[FEAR]--;
  167.     if (o->blessing < 0) {
  168.       Player.status[BERSERK] -= 1500;
  169.       if (Player.status[BERSERK] < 1) {
  170.     mprint("You feel less rabid now.");
  171.       Player.status[BERSERK] = 0;
  172.       }
  173.     }
  174.   }
  175. }    
  176.  
  177.  
  178.  
  179. void i_perm_breathing(o)
  180. pob o;
  181. {
  182.   if (o->known < 1)  o->known = 1;
  183.   if (o->blessing > -1)
  184.     Objects[o->id].known = 1;
  185.  
  186.   if (o->blessing > -1) {
  187.     if (o->used) {
  188.       mprint("Your breath is energized!");
  189.       Player.status[BREATHING] += 1500;
  190.     }
  191.     else  {
  192.       Player.status[BREATHING] -= 1500;
  193.       if (Player.status[BREATHING] < 1) {
  194.     mprint("Your breathing is back to normal.");
  195.     Player.status[BREATHING] = 0;
  196.       }
  197.     }
  198.   }
  199.   else if (o->used) {
  200.     Player.status[BREATHING] = 0;
  201.     p_drown();
  202.   }
  203. }
  204.  
  205.  
  206.  
  207. /* weapons functions */
  208.  
  209. void weapon_acidwhip(dmgmod,o,m)
  210. int dmgmod;
  211. pob o;
  212. struct monster *m;
  213. {
  214.   if ((random_range(2) == 1) && (! m_immunityp(m,NORMAL_DAMAGE))) {
  215.     mprint("You entangle the monster!");
  216.     m_status_reset(m,MOBILE);
  217.   }
  218.   p_hit(m,Player.dmg+dmgmod,ACID);
  219.  
  220. }
  221.  
  222. void weapon_scythe(dmgmod,o,m)
  223. int dmgmod;
  224. pob o;
  225. struct monster *m;
  226. {
  227.   mprint("Slice!");
  228.   m_death(m);
  229.   if (! Player.rank[ADEPT]) {
  230.     mprint("Ooops!");
  231.     mprint("You accidentally touch yourself on the backswing....");
  232.     p_death("the Scythe of Death");
  233.   }
  234. }
  235.  
  236. void weapon_demonblade(dmgmod,o,m)
  237. int dmgmod;
  238. pob o;
  239. struct monster *m;
  240.   if (o->blessing > -1) {
  241.     mprint("Demonblade disintegrates with a soft sigh.");
  242.     mprint("You stop foaming at the mouth.");
  243.     Player.status[BERSERK] = 0;
  244.     conform_lost_object(o);
  245.   }
  246.   else if (m->specialf == M_SP_DEMON) {
  247.     mprint("The demon flees in terror before your weapon!");
  248.     m_vanish(m);
  249.   }
  250.   else if (m->meleef != M_MELEE_SPIRIT) {
  251.     if (m->level > random_range(10)) {
  252.       Player.hp = min(Player.maxhp,Player.hp+m->hp);
  253.       Player.str++;
  254.       Player.pow = min(Player.maxpow,Player.pow+m->level);
  255.       m_death(m);
  256.       mprint("You feel a surge of raw power from Demonblade!");
  257.     }
  258.     else p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
  259.  
  260.   }
  261.   else {
  262.     mprint("Demonblade howls as it strikes the spirit!");
  263.     if (random_range(10) == 1) {
  264.       mprint("... and shatters into a thousand lost fragments!");
  265.       p_damage(50,UNSTOPPABLE,"Demonblade exploding");
  266.       conform_lost_object(o);
  267.     }
  268.     else {
  269.       mprint("You feel your lifeforce draining....");
  270.       p_damage(25,UNSTOPPABLE,"a backlash of negative energies");
  271.       Player.str -= 3;
  272.       Player.con -= 3;
  273.     }
  274.   }
  275. }
  276.  
  277. void weapon_lightsabre(dmgmod,o,m)
  278. int dmgmod;
  279. pob o;
  280. struct monster *m;
  281. {
  282.   if (! o->known) {
  283.     mprint("Fumbling with the cylinder, you press the wrong stud....");
  284.     p_damage(100,UNSTOPPABLE,"fumbling with a lightsabre");
  285.     o->known = 1;
  286.   }
  287.   else {
  288.     /* test prevents confusing immunity messages.... */
  289.     if (! m_immunityp(m,NORMAL_DAMAGE)) {
  290.       mprint("Vzzzzmmm!");
  291.       m_damage(m,20,NORMAL_DAMAGE);
  292.     }
  293.     if ((m->hp>0) && (! m_immunityp(m,FLAME))) {
  294.       mprint("Zzzzap!");
  295.       m_damage(m,20,FLAME);
  296.     }
  297.   }
  298. }
  299.  
  300. void weapon_tangle(dmgmod,o,m)
  301. int dmgmod;
  302. pob o;
  303. struct monster *m;
  304. {
  305.   if ((random_range(2) == 1) && (! m_immunityp(m,NORMAL_DAMAGE))) {
  306.     mprint("You entangle the monster!");
  307.     m_status_reset(m,MOBILE);
  308.   }
  309.   p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
  310. }
  311.  
  312. /* if wielding a bow, add bow damage to arrow damage */
  313. void weapon_arrow(dmgmod,o,m)
  314. int dmgmod;
  315. pob o;
  316. struct monster *m;
  317. {
  318.   if ((Player.possessions[O_WEAPON_HAND] != NULL) &&
  319.       (Player.possessions[O_WEAPON_HAND]->id == WEAPONID+26)) /* ie, using a bow */
  320.     p_hit(m,Player.dmg+o->plus+o->dmg+dmgmod,NORMAL_DAMAGE);
  321.   else p_hit(m,o->plus+o->dmg+dmgmod,NORMAL_DAMAGE);
  322. }
  323.  
  324. /* if wielding a crossbow, add bow damage to arrow damage */
  325. void weapon_bolt(dmgmod,o,m)
  326. pob o;
  327. struct monster *m;
  328. {
  329.   if ((Player.possessions[O_WEAPON_HAND] != NULL) &&
  330.       (Player.possessions[O_WEAPON_HAND]->id == WEAPONID+27) && /*ie using a crossbow */
  331.       (Player.possessions[O_WEAPON_HAND]->aux==LOADED)) {
  332.     p_hit(m,Player.dmg+o->plus+o->dmg+dmgmod,NORMAL_DAMAGE);
  333.     Player.possessions[O_WEAPON_HAND]->aux = UNLOADED;
  334.       }
  335.   else p_hit(m,o->plus+o->dmg,NORMAL_DAMAGE);
  336. }
  337.  
  338.  
  339. void weapon_mace_disrupt(dmgmod,o,m)
  340. int dmgmod;
  341. pob o;
  342. struct monster *m;
  343. {
  344.   if (m->meleef == M_MELEE_SPIRIT) {
  345.     mprint("The monster crumbles away to dust!");
  346.     m_death(m);
  347.   }
  348.   else p_hit(m,Player.dmg+dmgmod,UNSTOPPABLE);
  349. }
  350.  
  351. void weapon_normal_hit(dmgmod,o,m)
  352. int dmgmod;
  353. pob o;
  354. struct monster *m;
  355. {
  356.   p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
  357. }
  358.  
  359.  
  360. /* will be updated eventually */
  361. void weapon_bare_hands(dmgmod,m)
  362. int dmgmod;
  363. struct monster *m;
  364. {
  365.   p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
  366. }
  367.  
  368.  
  369. void i_demonblade(o)
  370. pob o;
  371. {
  372.   if (o->used) {
  373.     o->known = 2;
  374.     mprint("Demonblade's fangs open and bury themselves in your wrist!");
  375.     mprint("You hear evil laughter in the distance....");
  376.     mprint("You begin to foam at the mouth!");
  377.     Player.status[BERSERK] = 1500;
  378.   }
  379.   else {
  380.     mprint("You hear a sound like a demon cursing.");
  381.     mprint("You feel less like biting your shield.");
  382.     Player.status[BERSERK] = 0;
  383.   }
  384. }
  385.  
  386. void i_normal_weapon(o)
  387. pob o;
  388. {
  389.   if (o->used) mprint("You ready your weapon for battle.");
  390. }
  391.  
  392. void i_lightsabre(o)
  393. pob o;
  394. {
  395.   if (o->used) mprint("You feel one with the Force.");
  396.   else mprint("You feel out of touch with the Force.");
  397. }
  398.  
  399. void i_mace_disrupt(o)
  400. pob o;
  401. {
  402.   mprint("That's a damned heavy mace!");
  403. }
  404.  
  405.  
  406.  
  407. void weapon_vorpal(dmgmod,o,m)
  408. int dmgmod;
  409. pob o;
  410. struct monster *m;
  411. {
  412.   if ((random_range(10) < 3) && (! m_immunityp(m,NORMAL_DAMAGE))) {
  413.     o->known = 2;
  414.     if (random_range(2) == 1)
  415.       mprint("One Two! One Two! And through and through!");
  416.     else mprint("Your vorpal blade goes snicker-snack!");
  417.     m_death(m);
  418.   }
  419.   else weapon_normal_hit(dmgmod,o,m);
  420. }
  421.  
  422. void weapon_desecrate(dmgmod,o,m)
  423. int dmgmod;
  424. pob o;
  425. struct monster *m;
  426. {
  427.   o->known = 2;
  428.   if (Player.alignment < 0) {
  429.     mprint("Your opponent screams in agony!");
  430.     p_hit(m,Player.dmg+dmgmod,UNSTOPPABLE);
  431.     Player.alignment--;
  432.     if (Player.hp < Player.maxhp) {
  433.       mprint("You feel a thrill of power surging up your blade!");
  434.       Player.hp = min(Player.maxhp,Player.hp+Player.dmg+dmgmod);
  435.     }
  436.   }
  437.   else {
  438.     mprint("Your blade turns in your hands and hits you!");
  439.     mprint("You hear evil laughter....");
  440.     level_drain(Player.dmg,"the sword Desecrator");
  441.     Player.alignment-=10;
  442.     mprint("A strange force spreads from the wound throughout your body...");
  443.     mprint("You feel much more chaotic now.");
  444.   }
  445. }
  446.  
  447.  
  448.  
  449. void weapon_firestar(dmgmod,o,m)
  450. int dmgmod;
  451. pob o;
  452. struct monster *m;
  453. {
  454.   if (random_range(3) == 1) {
  455.     o->known = 2;
  456.     fball(Player.x,Player.y,Player.x,Player.y,max(Player.dmg,25));
  457.   }
  458.   if (m->hp > 0) weapon_normal_hit(dmgmod,o,m);
  459. }
  460.  
  461. void weapon_defend(dmgmod,o,m)
  462. pob o;
  463. struct monster *m;
  464. {
  465.   if ((Player.alignment < 0) && (o->blessing > 0)) {
  466.       mprint("The Holy Defender screams in your hands....");
  467.       mprint("You stagger before the sound of its rage....");
  468.       p_damage(50,UNSTOPPABLE,"a pissed-off Holy Defender");
  469.       mprint("The weapon finally quiets. It seems less holy now.");
  470.       o->truename = o->cursestr;
  471.       Player.status[PROTECTION] -= (o->hit);
  472.       o->plus = 0-abs(o->plus);
  473.       o->blessing = -1;
  474.     }
  475.   if ((o->blessing > 0) &&
  476.       ((m->specialf == M_SP_DEMON) ||
  477.        (m->meleef == M_MELEE_SPIRIT))) {
  478.     mprint("Your opponent shies back before your holy weapon!");
  479.     m->hit = 0;
  480.     m->speed *=2;
  481.   }
  482.   weapon_normal_hit(dmgmod,o,m);
  483. }
  484.  
  485. void weapon_victrix(dmgmod,o,m)
  486. int dmgmod;
  487. pob o;
  488. struct monster *m;
  489. {
  490.   if (m->meleef == M_MELEE_SPIRIT) {
  491.     mprint("Your opponent dissipates in a harmless cloud of vapors...");
  492.     m_death(m);
  493.   }
  494.   else weapon_normal_hit(dmgmod,o,m);
  495. }
  496.  
  497. void i_defend(o)
  498. pob o;
  499. {
  500.   o->known = 2;
  501.   if (o->used) {
  502.     mprint("You feel under an aegis!");
  503.     Player.status[PROTECTION] += o->hit;
  504.   }
  505.   else Player.status[PROTECTION] -= o->hit;
  506. }
  507.  
  508.  
  509. void i_victrix(o)
  510. pob o;
  511. {
  512.   o->known = 2;
  513.   o->blessing = abs(o->blessing);
  514.   if (o->used) {
  515.     Player.immunity[POISON]++;
  516.     Player.immunity[FEAR]++;
  517.     Player.immunity[INFECTION]++;
  518.   }
  519.   else {
  520.     Player.immunity[POISON]--;
  521.     Player.immunity[FEAR]--;
  522.     Player.immunity[INFECTION]--;
  523.   }
  524. }    
  525.  
  526.  
  527. void i_desecrate(o)
  528. pob o;
  529. {
  530.   if (o->known < 1)  o->known = 2;
  531.   if (o->blessing > 0) {
  532.     mprint("How weird, a blessed desecrator... ");
  533.     mprint("The structure of reality cannot permit such a thing....");
  534.     dispose_lost_objects(1,o);
  535.   }
  536.   else if (Level->site[Player.x][Player.y].locchar == ALTAR)
  537.     sanctify(-1);
  538. }
  539.  
  540.  
  541. /* shield functions */
  542. void i_normal_shield(o)
  543. pob o;
  544. {
  545.   if (o->used) mprint("You sling your shield across a forearm.");
  546. }
  547.  
  548.  
  549. void i_perm_deflect(o)
  550. pob o;
  551. {
  552.   if (o->known < 1)  o->known = 2;
  553.   if (o->blessing > -1) {
  554.     if (o->used) {
  555.       mprint("You feel buffered.");
  556.       Player.status[DEFLECTION] += 1500;
  557.     }
  558.     else {
  559.       Player.status[DEFLECTION] -= 1500;
  560.       if (Player.status[DEFLECTION] < 1) {
  561.     mprint("You feel less defended");
  562.     Player.status[DEFLECTION] = 0;
  563.       }
  564.     }
  565.   }
  566.   else {
  567.     if (o->used) {
  568.       mprint("You feel naked.");
  569.       Player.status[VULNERABLE] += 1500;
  570.       Player.status[DEFLECTION] = 0;
  571.     }
  572.     else {
  573.       Player.status[VULNERABLE] -= 1500;
  574.       if (Player.status[VULNERABLE] < 1) {
  575.     mprint("You feel less vulnerable");
  576.     Player.status[VULNERABLE] = 0;
  577.       }
  578.     }
  579.   }
  580. }
  581.