home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / d / d-linux.zip / dm-dist / magic.c < prev    next >
C/C++ Source or Header  |  1991-03-01  |  36KB  |  1,529 lines

  1. /* ************************************************************************
  2. *  file: magic.c , Implementation of spells.              Part of DIKUMUD *
  3. *  Usage : The actual effect of magic.                                    *
  4. *  Copyright (C) 1990, 1991 - see 'license.doc' for complete information. *
  5. ************************************************************************* */
  6.  
  7. #include <stdio.h>
  8. #include <assert.h>
  9. #include "structs.h"
  10. #include "utils.h"
  11. #include "comm.h"
  12. #include "spells.h"
  13. #include "handler.h"
  14. #include "limits.h"
  15.  
  16. /* Extern structures */
  17. extern struct room_data *world;
  18. extern struct obj_data  *object_list;
  19. extern struct char_data *character_list;
  20.  
  21. /* Extern procedures */
  22.  
  23. void damage(struct char_data *ch, struct char_data *victim,
  24.             int damage, int weapontype);
  25. bool saves_spell(struct char_data *ch, sh_int spell);
  26. void weight_change_object(struct obj_data *obj, int weight);
  27. char *strdup(char *source);
  28. int dice(int number, int size);
  29.  
  30.  
  31. /* Offensive Spells */
  32.  
  33. void spell_magic_missile(byte level, struct char_data *ch,
  34.   struct char_data *victim, struct obj_data *obj)
  35. {
  36.   int dam;
  37.     int dam_each[] = 
  38.         {0,  3,3,4,4,5, 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6,
  39.              6,6,6,6,6, 6,6,6,6,6};
  40.  
  41.   assert(victim && ch);
  42.   assert((level >= 1) && (level <= 30)); 
  43.  
  44.   dam = number(dam_each[level]>>1, dam_each[level]<<1);
  45.  
  46.   if ( saves_spell(victim, SAVING_SPELL) )
  47.     dam >>= 1;
  48.  
  49.   damage(ch, victim, dam, SPELL_MAGIC_MISSILE);
  50. }
  51.  
  52.  
  53.  
  54. void spell_chill_touch(byte level, struct char_data *ch,
  55.   struct char_data *victim, struct obj_data *obj)
  56. {
  57.   struct affected_type af;
  58.   int dam;
  59.     int dam_each[] = 
  60.         {0,  0,0,8,7,9, 9,12,13,13,13, 13,13,13,13,13, 13,13,13,13,13,
  61.              13,13,13,13,13, 13,13,13,13,13};
  62.  
  63.   assert(victim && ch);
  64.   assert((level >= 3) && (level <= 30)); 
  65.  
  66.   dam = number(dam_each[level]>>1, dam_each[level]<<1);
  67.  
  68.   if ( !saves_spell(victim, SAVING_SPELL) )
  69.   {
  70.     af.type      = SPELL_CHILL_TOUCH;
  71.     af.duration  = 6;
  72.     af.modifier  = -1;
  73.     af.location  = APPLY_STR;
  74.     af.bitvector = 0;
  75.     affect_join(victim, &af, TRUE, FALSE);
  76.   } else {
  77.     dam >>= 1;
  78.   }
  79.   damage(ch, victim, dam, SPELL_CHILL_TOUCH);
  80. }
  81.  
  82.  
  83.  
  84. void spell_burning_hands(byte level, struct char_data *ch,
  85.   struct char_data *victim, struct obj_data *obj)
  86. {
  87.   int dam;
  88.     int dam_each[] = 
  89.         {0,  0,0,0,0,19, 17,20,19,19,19, 19,19,19,19,19, 19,19,19,19,19,
  90.              19,19,19,19,19, 19,19,19,19,19};
  91.  
  92.  
  93.   assert(victim && ch);
  94.   assert((level >= 5) && (level <= 30));
  95.  
  96.   dam = number(dam_each[level]>>1, dam_each[level]<<1);
  97.  
  98.   if ( saves_spell(victim, SAVING_SPELL) )
  99.     dam >>= 1;
  100.  
  101.   damage(ch, victim, dam, SPELL_BURNING_HANDS);
  102. }
  103.  
  104.  
  105.  
  106. void spell_shocking_grasp(byte level, struct char_data *ch,
  107.   struct char_data *victim, struct obj_data *obj)
  108. {
  109.   int dam;
  110.     int dam_each[] = 
  111.         {0,  0,0,0,0,0, 0,41,33,29,27, 25,25,25,25,25, 25,25,25,25,25,
  112.              25,25,25,25,25, 25,25,25,25,25};
  113.  
  114.   assert(victim && ch);
  115.   assert((level >= 7) && (level <= 30)); 
  116.  
  117.   dam = number(dam_each[level]>>1, dam_each[level]<<1);
  118.  
  119.   if ( saves_spell(victim, SAVING_SPELL) )
  120.     dam >>= 1;
  121.  
  122.   damage(ch, victim, dam, SPELL_SHOCKING_GRASP);
  123. }
  124.  
  125.  
  126.  
  127. void spell_lightning_bolt(byte level, struct char_data *ch,
  128.   struct char_data *victim, struct obj_data *obj)
  129. {
  130.   int dam;
  131.     int dam_each[] = 
  132.         {0,  0,0,0,0,0, 0,0,0,59,46, 39,35,38,36,36, 36,36,36,36,36,
  133.              36,36,36,36,36, 36,36,36,36,36};
  134.  
  135.   assert(victim && ch);
  136.   assert((level >= 9) && (level <= 30)); 
  137.  
  138.   dam = number(dam_each[level]>>1, dam_each[level]<<1);
  139.  
  140.   if ( saves_spell(victim, SAVING_SPELL) )
  141.     dam >>= 1;
  142.  
  143.   damage(ch, victim, dam, SPELL_LIGHTNING_BOLT);
  144. }
  145.  
  146.  
  147.  
  148. void spell_colour_spray(byte level, struct char_data *ch,
  149.   struct char_data *victim, struct obj_data *obj)
  150. {
  151.   int dam;
  152.     int dam_each[] = 
  153.         {0,  0,0,0,0,0, 0,0,0,0,0, 79,60,57,51,47, 44,44,44,44,44,
  154.              44,44,44,44,44, 44,44,44,44,44};
  155.  
  156.  
  157.     assert(victim && ch);
  158.     assert((level >= 11) && (level <= 30));
  159.  
  160.   dam = number(dam_each[level]-20, dam_each[level]+20);
  161.  
  162.   if ( saves_spell(victim, SAVING_SPELL) )
  163.     dam >>= 1;
  164.  
  165.   damage(ch, victim, dam, SPELL_COLOUR_SPRAY);
  166. }
  167.  
  168.  
  169. /* Drain XP, MANA, HP - caster gains HP and MANA */
  170. void spell_energy_drain(byte level, struct char_data *ch,
  171.   struct char_data *victim, struct obj_data *obj)
  172. {
  173.   int dam, xp, mana;
  174.  
  175.   void set_title(struct char_data *ch);
  176.     void gain_exp(struct char_data *ch, int gain);
  177.  
  178.   assert(victim && ch);
  179.   assert((level >= 13) && (level <=  30));
  180.  
  181.   if ( !saves_spell(victim, SAVING_SPELL) ) {
  182.         GET_ALIGNMENT(ch) = MIN(-1000, GET_ALIGNMENT(ch)-200);
  183.     if (GET_LEVEL(victim) <= 2) {
  184.       damage(ch, victim, 100, SPELL_ENERGY_DRAIN); /* Kill the sucker */
  185.     } else {
  186.             xp = number(level>>1,level)*1000;
  187.             gain_exp(victim, -xp);
  188.  
  189.             dam = dice(1,10);
  190.  
  191.             mana = GET_MANA(victim)>>1;
  192.             GET_MOVE(victim) >>= 1;
  193.             GET_MANA(victim) = mana;
  194.  
  195.             GET_MANA(ch) += mana>>1;
  196.             GET_HIT(ch) += dam;
  197.  
  198.       send_to_char("Your life energy is drained!\n\r", victim);
  199.  
  200.       damage(ch, victim, dam, SPELL_ENERGY_DRAIN);
  201.       }
  202.   } else {
  203.     damage(ch, victim, 0, SPELL_ENERGY_DRAIN); /* Miss */
  204.   }
  205. }
  206.  
  207.  
  208.  
  209. void spell_fireball(byte level, struct char_data *ch,
  210.   struct char_data *victim, struct obj_data *obj)
  211. {
  212.   int dam;
  213.     int dam_each[] = 
  214.         {0,  0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,143, 105,88,77,71,71,
  215.              71,71,71,71,71, 71,71,71,71,71};
  216.  
  217.   assert(victim && ch);
  218.   assert((level >= 15) && (level <= 30)); 
  219.  
  220.   dam = number(dam_each[level]-20, dam_each[level]+20);
  221.  
  222.   if ( saves_spell(victim, SAVING_SPELL) )
  223.     dam >>= 1;
  224.  
  225.   damage(ch, victim, dam, SPELL_FIREBALL);
  226. }
  227.  
  228.  
  229.  
  230.  
  231. void spell_earthquake(byte level, struct char_data *ch,
  232.   struct char_data *victim, struct obj_data *obj)
  233. {
  234.   int dam;
  235.   struct char_data *tmp_victim, *temp;
  236.  
  237.   assert(ch);
  238.   assert((level >= 7) && (level <= 30)); 
  239.  
  240.     dam =  dice(1,8)+level;
  241.  
  242.   send_to_char("The earth trembles beneath your feet!\n\r", ch);
  243.   act("$n makes the earth tremble and shiver\n\rYou fall, and hit yourself!",
  244.       FALSE, ch, 0, 0, TO_ROOM);
  245.  
  246.  
  247.   for(tmp_victim = character_list; tmp_victim; tmp_victim = temp)
  248.   {
  249.     temp = tmp_victim->next;
  250.     if ( (ch->in_room == tmp_victim->in_room) && (ch != tmp_victim) ) {
  251.             damage(ch, tmp_victim, dam, SPELL_EARTHQUAKE);
  252.     } else
  253.       if (world[ch->in_room].zone == world[tmp_victim->in_room].zone)
  254.         send_to_char("The earth trembles and shiver", tmp_victim);
  255.   }
  256.  
  257. }
  258.  
  259.  
  260.  
  261. void spell_dispel_evil(byte level, struct char_data *ch,
  262.   struct char_data *victim, struct obj_data *obj)
  263. {
  264.   int dam;
  265.  
  266.     assert(ch && victim);
  267.     assert((level >= 10) && (level<=30));
  268.  
  269.     if (IS_EVIL(ch))
  270.         victim = ch;
  271.     else
  272.       if (IS_GOOD(victim)) {
  273.             act("God protects $N.", FALSE, ch, 0, victim, TO_CHAR);
  274.         return;
  275.         }
  276.  
  277.   if ((GET_LEVEL(victim) < level) || (victim == ch))
  278.     dam = 100;
  279.   else {
  280.     dam = dice(level,4);
  281.  
  282.       if ( saves_spell(victim, SAVING_SPELL) )
  283.         dam >>= 1;
  284.     }
  285.  
  286.   damage(ch, victim, dam, SPELL_DISPEL_EVIL);
  287. }
  288.  
  289.  
  290.  
  291. void spell_call_lightning(byte level, struct char_data *ch,
  292.   struct char_data *victim, struct obj_data *obj)
  293. {
  294.   int dam;
  295.  
  296.   extern struct weather_data weather_info;
  297.  
  298.   assert(victim && ch);
  299.   assert((level >= 12) && (level <= 30));
  300.  
  301.     dam = dice(MIN(level,15), 8);
  302.  
  303.   if (OUTSIDE(ch) && (weather_info.sky>=SKY_RAINING)) {
  304.  
  305.       if ( saves_spell(victim, SAVING_SPELL) )
  306.         dam >>= 1;
  307.   
  308.       damage(ch, victim, dam, SPELL_CALL_LIGHTNING);
  309.     }
  310. }
  311.  
  312.  
  313.  
  314. void spell_harm(byte level, struct char_data *ch,
  315.   struct char_data *victim, struct obj_data *obj)
  316. {
  317.   int dam;
  318.  
  319.     assert(victim && ch);
  320.     assert((level >= 15) && (level <= 30));
  321.  
  322.     dam = GET_HIT(victim) - dice(1,4);
  323.  
  324.     if (dam < 0)
  325.         dam = 0; /* Kill the suffering bastard */
  326.     else {
  327.       if ( saves_spell(victim, SAVING_SPELL) )
  328.             dam = MIN(50, dam/2);
  329.     }
  330.  
  331.   damage(ch, victim, dam, SPELL_HARM);
  332. }
  333.  
  334.  
  335.  
  336. /* spells2.c - Not directly offensive spells */
  337.  
  338. void spell_armor(byte level, struct char_data *ch,
  339.   struct char_data *victim, struct obj_data *obj)
  340. {
  341.   struct affected_type af;
  342.  
  343.   assert(victim);
  344.   assert((level >= 0) && (level <= 30));
  345.  
  346.     if (!affected_by_spell(victim, SPELL_ARMOR)) {
  347.       af.type      = SPELL_ARMOR;
  348.       af.duration  = 24;
  349.       af.modifier  = -20;
  350.       af.location  = APPLY_AC;
  351.       af.bitvector = 0;
  352.  
  353.       affect_to_char(victim, &af);
  354.         send_to_char("You feel someone protecting you.\n\r", victim);
  355.     }
  356. }
  357.  
  358.  
  359.  
  360. void spell_teleport(byte level, struct char_data *ch,
  361.   struct char_data *victim, struct obj_data *obj)
  362. {
  363.     int to_room;
  364.     extern int top_of_world;      /* ref to the top element of world */
  365.  
  366.     assert(ch);
  367.  
  368.     do {
  369.         to_room = number(0, top_of_world);
  370.     } while (IS_SET(world[to_room].room_flags, PRIVATE));
  371.  
  372.   act("$n slowly fade out of existence.", FALSE, ch,0,0,TO_ROOM);
  373.     char_from_room(ch);
  374.     char_to_room(ch, to_room);
  375.   act("$n slowly fade in to existence.", FALSE, ch,0,0,TO_ROOM);
  376.  
  377.     do_look(ch, "", 0);
  378.  
  379.     if (IS_SET(world[to_room].room_flags, DEATH) && GET_LEVEL(ch) < 21) {
  380.     death_cry(ch);
  381.     extract_char(ch);
  382.   }
  383. }
  384.  
  385.  
  386.  
  387. void spell_bless(byte level, struct char_data *ch,
  388.   struct char_data *victim, struct obj_data *obj)
  389. {
  390.   struct affected_type af;
  391.  
  392.   assert(ch && (victim || obj));
  393.     assert((level >= 0) && (level <= 30));
  394.  
  395.   if (obj) {
  396.     if ( (5*GET_LEVEL(ch) > GET_OBJ_WEIGHT(obj)) &&
  397.          (GET_POS(ch) != POSITION_FIGHTING) &&
  398.          !IS_OBJ_STAT(obj, ITEM_EVIL)) {
  399.         SET_BIT(obj->obj_flags.extra_flags, ITEM_BLESS);
  400.             act("$p briefly glows.",FALSE,ch,obj,0,TO_CHAR);
  401.         }
  402.     } else {
  403.  
  404.         if ((GET_POS(victim) != POSITION_FIGHTING) &&
  405.             (!affected_by_spell(victim, SPELL_BLESS))) {
  406.  
  407.             send_to_char("You feel righteous.\n\r", victim);
  408.             af.type      = SPELL_BLESS;
  409.         af.duration  = 6;
  410.         af.modifier  = 1;
  411.         af.location  = APPLY_HITROLL;
  412.         af.bitvector = 0;
  413.         affect_to_char(victim, &af);
  414.  
  415.         af.location = APPLY_SAVING_SPELL;
  416.         af.modifier = -1;                 /* Make better */
  417.         affect_to_char(victim, &af);
  418.         }
  419.     }
  420. }
  421.  
  422.  
  423.  
  424. void spell_blindness(byte level, struct char_data *ch,
  425.   struct char_data *victim, struct obj_data *obj)
  426. {
  427.   struct affected_type af;
  428.  
  429.   assert(ch && victim);
  430.   assert((level >= 0) && (level <= 30));
  431.  
  432.  
  433.   if (saves_spell(victim, SAVING_SPELL) ||
  434.        affected_by_spell(victim, SPELL_BLINDNESS))
  435.         return;
  436.  
  437.   act("$n seems to be blinded!", TRUE, victim, 0, 0, TO_ROOM);
  438.   send_to_char("You have been blinded!\n\r", victim);
  439.  
  440.   af.type      = SPELL_BLINDNESS;
  441.   af.location  = APPLY_HITROLL;
  442.   af.modifier  = -4;  /* Make hitroll worse */
  443.   af.duration  = 1;
  444.   af.bitvector = AFF_BLIND;
  445.   affect_to_char(victim, &af);
  446.  
  447.  
  448.   af.location = APPLY_AC;
  449.   af.modifier = +40; /* Make AC Worse! */
  450.   affect_to_char(victim, &af);
  451. }
  452.  
  453.  
  454.  
  455. void spell_clone(byte level, struct char_data *ch,
  456.   struct char_data *victim, struct obj_data *obj)
  457. {
  458.  
  459.   assert(ch && (victim || obj));
  460.   assert((level >= 0) && (level <= 30));
  461.  
  462.     send_to_char("Clone is not ready yet.", ch);
  463.  
  464.   if (obj) {
  465.  
  466.     } else {
  467.         /* clone_char(victim); */
  468.     }
  469. }
  470.  
  471.  
  472.  
  473. void spell_control_weather(byte level, struct char_data *ch,
  474.   struct char_data *victim, struct obj_data *obj)
  475. {
  476.    /* Control Weather is not possible here!!! */
  477.    /* Better/Worse can not be transferred     */
  478. }
  479.  
  480.  
  481.  
  482. void spell_create_food(byte level, struct char_data *ch,
  483.   struct char_data *victim, struct obj_data *obj)
  484. {
  485.   struct obj_data *tmp_obj;
  486.  
  487.   assert(ch);
  488.   assert((level >= 0) && (level <= 30));
  489.  
  490.   CREATE(tmp_obj, struct obj_data, 1);
  491.   clear_object(tmp_obj);
  492.  
  493.   tmp_obj->name = strdup("mushroom");
  494.   tmp_obj->short_description = strdup("A Magic Mushroom");
  495.   tmp_obj->description = strdup("A really delicious looking magic mushroom lies here.");
  496.  
  497.   tmp_obj->obj_flags.type_flag = ITEM_FOOD;
  498.   tmp_obj->obj_flags.wear_flags = ITEM_TAKE | ITEM_HOLD;
  499.   tmp_obj->obj_flags.value[0] = 5+level;
  500.   tmp_obj->obj_flags.weight = 1;
  501.   tmp_obj->obj_flags.cost = 10;
  502.   tmp_obj->obj_flags.cost_per_day = 1;
  503.  
  504.   tmp_obj->next = object_list;
  505.   object_list = tmp_obj;
  506.  
  507.   obj_to_room(tmp_obj,ch->in_room);
  508.  
  509.   tmp_obj->item_number = -1;
  510.  
  511.     act("$p suddenly appears.",TRUE,ch,tmp_obj,0,TO_ROOM);
  512.     act("$p suddenly appears.",TRUE,ch,tmp_obj,0,TO_CHAR);
  513. }
  514.  
  515.  
  516.  
  517. void spell_create_water(byte level, struct char_data *ch,
  518.   struct char_data *victim, struct obj_data *obj)
  519. {
  520.     int water;
  521.  
  522.   extern struct weather_data weather_info;
  523.     void name_to_drinkcon(struct obj_data *obj,int type);
  524.     void name_from_drinkcon(struct obj_data *obj);
  525.  
  526.   assert(ch && obj);
  527.  
  528.     if (GET_ITEM_TYPE(obj) == ITEM_DRINKCON) {
  529.         if ((obj->obj_flags.value[2] != LIQ_WATER)
  530.              && (obj->obj_flags.value[1] != 0)) {
  531.  
  532.             name_from_drinkcon(obj);
  533.             obj->obj_flags.value[2] = LIQ_SLIME;
  534.             name_to_drinkcon(obj, LIQ_SLIME);
  535.  
  536.         } else {
  537.  
  538.             water = 2*level * ((weather_info.sky >= SKY_RAINING) ? 2 : 1);
  539.  
  540.             /* Calculate water it can contain, or water created */
  541.             water = MIN(obj->obj_flags.value[0]-obj->obj_flags.value[1], water);
  542.  
  543.             if (water > 0) {
  544.               obj->obj_flags.value[2] = LIQ_WATER;
  545.                 obj->obj_flags.value[1] += water;
  546.  
  547.                 weight_change_object(obj, water);
  548.  
  549.                 name_from_drinkcon(obj);
  550.                 name_to_drinkcon(obj, LIQ_WATER);
  551.                 act("$p is filled.", FALSE, ch,obj,0,TO_CHAR);
  552.             }
  553.         }
  554.     }
  555. }
  556.  
  557.  
  558.  
  559. void spell_cure_blind(byte level, struct char_data *ch,
  560.   struct char_data *victim, struct obj_data *obj)
  561. {
  562.   assert(victim);
  563.   assert((level >= 0) && (level <= 30));
  564.  
  565.     if (affected_by_spell(victim, SPELL_BLINDNESS)) {
  566.       affect_from_char(victim, SPELL_BLINDNESS);
  567.  
  568.       send_to_char("Your vision returns!\n\r", victim);
  569.     }
  570. }
  571.  
  572.  
  573.  
  574. void spell_cure_critic(byte level, struct char_data *ch,
  575.   struct char_data *victim, struct obj_data *obj)
  576. {
  577.   int healpoints;
  578.  
  579.   assert(victim);
  580.   assert((level >= 0) && (level <= 30));
  581.  
  582.   healpoints = dice(3,8)+3;
  583.  
  584.   if ( (healpoints + GET_HIT(victim)) > hit_limit(victim) )
  585.     GET_HIT(victim) = hit_limit(victim);
  586.   else
  587.     GET_HIT(victim) += healpoints;
  588.  
  589.   send_to_char("You feel better!\n\r", victim);
  590.  
  591.   update_pos(victim);
  592. }
  593.  
  594.  
  595.  
  596. void spell_cure_light(byte level, struct char_data *ch,
  597.   struct char_data *victim, struct obj_data *obj)
  598. {
  599.   int healpoints;
  600.  
  601.   assert(ch && victim);
  602.   assert((level >= 0) && (level <= 30));
  603.  
  604.   healpoints = dice(1,8);
  605.  
  606.   if ( (healpoints+GET_HIT(victim)) > hit_limit(victim) )
  607.     GET_HIT(victim) = hit_limit(victim);
  608.   else
  609.     GET_HIT(victim) += healpoints;
  610.  
  611.   update_pos( victim );
  612.  
  613.   send_to_char("You feel better!\n\r", victim);
  614. }
  615.  
  616.  
  617.  
  618. void spell_curse(byte level, struct char_data *ch,
  619.   struct char_data *victim, struct obj_data *obj)
  620. {
  621.   struct affected_type af;
  622.  
  623.   assert(victim || obj);
  624.   assert((level >= 0) && (level <= 30));
  625.  
  626.   if (obj) {
  627.     SET_BIT(obj->obj_flags.extra_flags, ITEM_EVIL);
  628.     SET_BIT(obj->obj_flags.extra_flags, ITEM_NODROP);
  629.  
  630.     /* LOWER ATTACK DICE BY -1 */
  631.     if(obj->obj_flags.type_flag == ITEM_WEAPON)
  632.       obj->obj_flags.value[2]--;
  633.         act("$p glows red.", FALSE, ch, obj, 0, TO_CHAR);
  634.     } else {
  635.     if ( saves_spell(victim, SAVING_SPELL) ||
  636.            affected_by_spell(victim, SPELL_CURSE))
  637.       return;
  638.  
  639.     af.type      = SPELL_CURSE;
  640.     af.duration  = 24*7;       /* 7 Days */
  641.     af.modifier  = -1;
  642.     af.location  = APPLY_HITROLL;
  643.     af.bitvector = AFF_CURSE;
  644.     affect_to_char(victim, &af);
  645.  
  646.     af.location = APPLY_SAVING_PARA;
  647.     af.modifier = 1; /* Make worse */
  648.     affect_to_char(victim, &af);
  649.  
  650.     act("$n briefly reveal a red aura!", FALSE, victim, 0, 0, TO_ROOM);
  651.         act("You feel very uncomfortable.",FALSE,victim,0,0,TO_CHAR);
  652.     }
  653. }
  654.  
  655.  
  656.  
  657. void spell_detect_evil(byte level, struct char_data *ch,
  658.   struct char_data *victim, struct obj_data *obj)
  659. {
  660.   struct affected_type af;
  661.  
  662.     assert(victim);
  663.     assert((level >= 0) && (level <= 30));
  664.  
  665.     if ( affected_by_spell(victim, SPELL_DETECT_EVIL) )
  666.         return;
  667.  
  668.   af.type      = SPELL_DETECT_EVIL;
  669.   af.duration  = level*5;
  670.   af.modifier  = 0;
  671.   af.location  = APPLY_NONE;
  672.   af.bitvector = AFF_DETECT_EVIL;
  673.  
  674.   affect_to_char(victim, &af);
  675.  
  676.   send_to_char("Your eyes tingle.\n\r", victim);
  677. }
  678.  
  679.  
  680.  
  681. void spell_detect_invisibility(byte level, struct char_data *ch,
  682.   struct char_data *victim, struct obj_data *obj)
  683. {
  684.   struct affected_type af;
  685.  
  686.   assert(victim);
  687.   assert((level >= 0) && (level <= 30));
  688.  
  689.   if ( affected_by_spell(victim, SPELL_DETECT_INVISIBLE) )
  690.         return;
  691.  
  692.   af.type      = SPELL_DETECT_INVISIBLE;
  693.   af.duration  = level*5;
  694.   af.modifier  = 0;
  695.   af.location  = APPLY_NONE;
  696.   af.bitvector = AFF_DETECT_INVISIBLE;
  697.  
  698.   affect_to_char(victim, &af);
  699.  
  700.   send_to_char("Your eyes tingle.\n\r", victim);
  701. }
  702.  
  703.  
  704.  
  705. void spell_detect_magic(byte level, struct char_data *ch,
  706.   struct char_data *victim, struct obj_data *obj)
  707. {
  708.   struct affected_type af;
  709.  
  710.   assert(victim);
  711.   assert((level >= 0) && (level <= 30));
  712.  
  713.   if ( affected_by_spell(victim, SPELL_DETECT_MAGIC) )
  714.         return;
  715.  
  716.   af.type      = SPELL_DETECT_MAGIC;
  717.   af.duration  = level*5;
  718.   af.modifier  = 0;
  719.   af.location  = APPLY_NONE;
  720.   af.bitvector = AFF_DETECT_MAGIC;
  721.  
  722.   affect_to_char(victim, &af);
  723.   send_to_char("Your eyes tingle.\n\r", victim);
  724. }
  725.  
  726.  
  727.  
  728. void spell_detect_poison(byte level, struct char_data *ch,
  729.   struct char_data *victim, struct obj_data *obj)
  730. {
  731.     assert(ch && (victim || obj));
  732.  
  733.   if (victim) {
  734.     if (victim == ch)
  735.       if (IS_AFFECTED(victim, AFF_POISON))
  736.         send_to_char("You can sense poison in your blood.\n\r", ch);
  737.       else
  738.         send_to_char("You feel healthy.\n\r", ch);
  739.     else
  740.       if (IS_AFFECTED(victim, AFF_POISON)) {
  741.         act("You sense that $E is poisoned.",FALSE,ch,0,victim,TO_CHAR);
  742.       } else {
  743.         act("You sense that $E is healthy.",FALSE,ch,0,victim,TO_CHAR);
  744.       }
  745.   } else { /* It's an object */
  746.     if ((obj->obj_flags.type_flag == ITEM_DRINKCON) ||
  747.         (obj->obj_flags.type_flag == ITEM_FOOD)) {
  748.       if (obj->obj_flags.value[3])
  749.         act("Poisonous fumes are revealed.",FALSE, ch, 0, 0, TO_CHAR);
  750.       else
  751.         send_to_char("It looks very delicious.\n\r", ch);
  752.     }
  753.   }
  754. }
  755.  
  756.  
  757.  
  758. void spell_enchant_weapon(byte level, struct char_data *ch,
  759.   struct char_data *victim, struct obj_data *obj)
  760. {
  761.     int i;
  762.  
  763.     assert(ch && obj);
  764.     assert(MAX_OBJ_AFFECT >= 2);
  765.  
  766.     if ((GET_ITEM_TYPE(obj) == ITEM_WEAPON) &&
  767.        !IS_SET(obj->obj_flags.extra_flags, ITEM_MAGIC)) {
  768.  
  769.         for (i=0; i < MAX_OBJ_AFFECT; i++)
  770.             if (obj->affected[i].location != APPLY_NONE)
  771.                 return;
  772.  
  773.         SET_BIT(obj->obj_flags.extra_flags, ITEM_MAGIC);
  774.  
  775.         obj->affected[0].location = APPLY_HITROLL;
  776.         obj->affected[0].modifier = 1 + (level >= 18);
  777.  
  778.         obj->affected[1].location = APPLY_DAMROLL;
  779.         obj->affected[1].modifier = 1 + (level >= 20);
  780.  
  781.         if (IS_GOOD(ch)) {
  782.             SET_BIT(obj->obj_flags.extra_flags, ITEM_ANTI_EVIL);
  783.             act("$p glows blue.",FALSE,ch,obj,0,TO_CHAR);
  784.         } else if (IS_EVIL(ch)) {
  785.       SET_BIT(obj->obj_flags.extra_flags, ITEM_ANTI_GOOD);
  786.       act("$p glows red.",FALSE,ch,obj,0,TO_CHAR);
  787.     } else {
  788.       act("$p glows yellow.",FALSE,ch,obj,0,TO_CHAR);
  789.         }
  790.     }
  791. }
  792.  
  793.  
  794.  
  795. void spell_heal(byte level, struct char_data *ch,
  796.   struct char_data *victim, struct obj_data *obj)
  797. {
  798.     assert(victim);
  799.  
  800.     spell_cure_blind(level, ch, victim, obj);
  801.  
  802.     GET_HIT(victim) += 100;
  803.  
  804.     if (GET_HIT(victim) >= hit_limit(victim))
  805.         GET_HIT(victim) = hit_limit(victim)-dice(1,4);
  806.  
  807.   update_pos( victim );
  808.  
  809.   send_to_char("A warm feeling fills your body.\n\r", victim);
  810. }
  811.  
  812.  
  813. void spell_invisibility(byte level, struct char_data *ch,
  814.   struct char_data *victim, struct obj_data *obj)
  815. {
  816.   struct affected_type af;
  817.  
  818.     assert((ch && obj) || victim);
  819.  
  820.   if (obj) {
  821.     if ( !IS_SET(obj->obj_flags.extra_flags, ITEM_INVISIBLE) ) {
  822.             act("$p turns invisible.",FALSE,ch,obj,0,TO_CHAR);
  823.             act("$p turns invisible.",TRUE,ch,obj,0,TO_ROOM);
  824.       SET_BIT(obj->obj_flags.extra_flags, ITEM_INVISIBLE);
  825.         }
  826.   } else {              /* Then it is a PC | NPC */
  827.         if (!affected_by_spell(victim, SPELL_INVISIBLE)) {
  828.  
  829.           act("$n slowly fade out of existence.", TRUE, victim,0,0,TO_ROOM);
  830.         send_to_char("You vanish.\n\r", victim);
  831.  
  832.         af.type      = SPELL_INVISIBLE;
  833.         af.duration  = 24;
  834.         af.modifier  = -40;
  835.         af.location  = APPLY_AC;
  836.         af.bitvector = AFF_INVISIBLE;
  837.         affect_to_char(victim, &af);
  838.       }
  839.     }
  840. }
  841.  
  842.  
  843. void spell_locate_object(byte level, struct char_data *ch,
  844.   struct char_data *victim, struct obj_data *obj)
  845. {
  846.   struct obj_data *i;
  847.   char name[256];
  848.   char buf[MAX_STRING_LENGTH];
  849.   int j;
  850.  
  851.     assert(ch);
  852.  
  853.     strcpy(name, fname(obj->name));
  854.  
  855.     j=level>>1;
  856.  
  857.     for (i = object_list; i && (j>0); i = i->next)
  858.     if (isname(name, i->name)) {
  859.       if(i->carried_by) {
  860.         sprintf(buf,"%s carried by %s.\n\r",
  861.           i->short_description,PERS(i->carried_by,ch));
  862.         send_to_char(buf,ch);
  863.       } else if (i->in_obj) {
  864.         sprintf(buf,"%s in %s.\n\r",i->short_description,
  865.           i->in_obj->short_description);
  866.         send_to_char(buf,ch);
  867.       } else {
  868.         sprintf(buf,"%s in %s.\n\r",i->short_description,
  869.           (i->in_room == NOWHERE ? "Used but uncertain." : world[i->in_room].name));
  870.         send_to_char(buf,ch);
  871.       j--;
  872.       }
  873.     }
  874.  
  875.   if(j==0)
  876.     send_to_char("You are very confused.\n\r",ch);
  877.   if(j==level>>1)
  878.     send_to_char("No such object.\n\r",ch);
  879. }
  880.  
  881.  
  882. void spell_poison(byte level, struct char_data *ch,
  883.   struct char_data *victim, struct obj_data *obj)
  884. {
  885.     struct affected_type af;
  886.  
  887.     assert(victim || obj);
  888.  
  889.   if (victim) {
  890.     if(!saves_spell(victim, SAVING_PARA))
  891.     {
  892.       af.type = SPELL_POISON;
  893.       af.duration = level*2;
  894.       af.modifier = -2;
  895.       af.location = APPLY_STR;
  896.       af.bitvector = AFF_POISON;
  897.  
  898.       affect_join(victim, &af, FALSE, FALSE);
  899.  
  900.       send_to_char("You feel very sick.\n\r", victim);
  901.     }
  902.  
  903.   } else { /* Object poison */
  904.     if ((obj->obj_flags.type_flag == ITEM_DRINKCON) ||
  905.         (obj->obj_flags.type_flag == ITEM_FOOD)) {
  906.       obj->obj_flags.value[3] = 1;
  907.     }
  908.   }
  909. }
  910.  
  911.  
  912. void spell_protection_from_evil(byte level, struct char_data *ch,
  913.   struct char_data *victim, struct obj_data *obj)
  914. {
  915.   struct affected_type af;
  916.  
  917.     assert(victim);
  918.  
  919.   if (!affected_by_spell(victim, SPELL_PROTECT_FROM_EVIL) ) {
  920.     af.type      = SPELL_PROTECT_FROM_EVIL;
  921.     af.duration  = 24;
  922.     af.modifier  = 0;
  923.     af.location  = APPLY_NONE;
  924.     af.bitvector = AFF_PROTECT_EVIL;
  925.     affect_to_char(victim, &af);
  926.         send_to_char("You have a righteous feeling!\n\r", victim);
  927.     }
  928. }
  929.  
  930.  
  931. void spell_remove_curse(byte level, struct char_data *ch,
  932.   struct char_data *victim, struct obj_data *obj)
  933. {
  934.     struct affected_type af;
  935.  
  936.     assert(ch && (victim || obj));
  937.  
  938.     if (obj) {
  939.  
  940.         if ( IS_SET(obj->obj_flags.extra_flags, ITEM_EVIL) ||
  941.              IS_SET(obj->obj_flags.extra_flags, ITEM_NODROP)) {
  942.             act("$p briefly glows blue.", TRUE, ch, obj, 0, TO_CHAR);
  943.  
  944.             REMOVE_BIT(obj->obj_flags.extra_flags, ITEM_EVIL);
  945.             REMOVE_BIT(obj->obj_flags.extra_flags, ITEM_NODROP);
  946.         }
  947.     } else {      /* Then it is a PC | NPC */
  948.         if (affected_by_spell(victim, SPELL_CURSE) ) {
  949.             act("$n briefly glows red, then blue.",FALSE,victim,0,0,TO_ROOM);
  950.             act("You feel better.",FALSE,victim,0,0,TO_CHAR);
  951.       affect_from_char(victim, SPELL_CURSE);
  952.     }
  953.     }
  954. }
  955.  
  956.  
  957. void spell_remove_poison(byte level, struct char_data *ch,
  958.   struct char_data *victim, struct obj_data *obj)
  959. {
  960.  
  961.     assert(ch && (victim || obj));
  962.  
  963.   if (victim) {
  964.     if(affected_by_spell(victim,SPELL_POISON)) {
  965.       affect_from_char(victim,SPELL_POISON);
  966.       act("A warm feeling runs through your body.",FALSE,victim,0,0,TO_CHAR);
  967.             act("$N looks better.",FALSE,ch,0,victim,TO_ROOM);
  968.     }
  969.     } else {
  970.     if ((obj->obj_flags.type_flag == ITEM_DRINKCON) ||
  971.         (obj->obj_flags.type_flag == ITEM_FOOD)) {
  972.       obj->obj_flags.value[3] = 0;
  973.             act("The $p steams briefly.",FALSE,ch,obj,0,TO_CHAR);
  974.         }
  975.     }
  976. }
  977.  
  978.  
  979.  
  980. void spell_sanctuary(byte level, struct char_data *ch,
  981.   struct char_data *victim, struct obj_data *obj)
  982. {
  983.   struct affected_type af;
  984.  
  985.   if (!affected_by_spell(victim, SPELL_SANCTUARY) ) {
  986.  
  987.     act("$n is surrounded by a white aura.",TRUE,victim,0,0,TO_ROOM);
  988.         act("You start glowing.",TRUE,victim,0,0,TO_CHAR);
  989.  
  990.     af.type      = SPELL_SANCTUARY;
  991.     af.duration  = (level<21) ? 3 : level;
  992.     af.modifier  = 0;
  993.         af.location  = APPLY_NONE;
  994.         af.bitvector = AFF_SANCTUARY;
  995.     affect_to_char(victim, &af);
  996.   }
  997. }
  998.  
  999.  
  1000.  
  1001. void spell_sleep(byte level, struct char_data *ch,
  1002.   struct char_data *victim, struct obj_data *obj)
  1003. {
  1004.   struct affected_type af;
  1005.  
  1006.     assert(victim);
  1007.  
  1008.   if ( !saves_spell(victim, SAVING_SPELL) )
  1009.   {
  1010.     af.type      = SPELL_SLEEP;
  1011.     af.duration  = 4+level;
  1012.     af.modifier  = 0;
  1013.     af.location  = APPLY_NONE;
  1014.     af.bitvector = AFF_SLEEP;
  1015.     affect_join(victim, &af, FALSE, FALSE);
  1016.  
  1017.     if (GET_POS(victim)>POSITION_SLEEPING)
  1018.     {
  1019.       act("You feel very sleepy ..... zzzzzz",FALSE,victim,0,0,TO_CHAR);
  1020.       act("$n go to sleep.",TRUE,victim,0,0,TO_ROOM);
  1021.         GET_POS(victim)=POSITION_SLEEPING;
  1022.     }
  1023.  
  1024.     return;
  1025.   }
  1026. }
  1027.  
  1028.  
  1029.  
  1030. void spell_strength(byte level, struct char_data *ch,
  1031.   struct char_data *victim, struct obj_data *obj)
  1032. {
  1033.   struct affected_type af;
  1034.  
  1035.     assert(victim);
  1036.  
  1037.   act("You feel stronger.", FALSE, victim,0,0,TO_CHAR);
  1038.  
  1039.   af.type      = SPELL_STRENGTH;
  1040.   af.duration  = level;
  1041.   af.modifier  = 1+(level>18);
  1042.  
  1043.   af.location  = APPLY_STR;
  1044.   af.bitvector = 0;
  1045.  
  1046.   affect_join(victim, &af, TRUE, FALSE);
  1047. }
  1048.  
  1049.  
  1050.  
  1051. void spell_ventriloquate(byte level, struct char_data *ch,
  1052.   struct char_data *victim, struct obj_data *obj)
  1053. {
  1054.     /* Not possible!! No argument! */
  1055. }
  1056.  
  1057.  
  1058.  
  1059. void spell_word_of_recall(byte level, struct char_data *ch,
  1060.   struct char_data *victim, struct obj_data *obj)
  1061. {
  1062.   extern int top_of_world;
  1063.   int loc_nr,location;
  1064.   bool found = FALSE;
  1065.  
  1066.   void do_look(struct char_data *ch, char *argument, int cmd);
  1067.  
  1068.     assert(victim);
  1069.  
  1070.   if (IS_NPC(victim))
  1071.     return;
  1072.  
  1073.   /*  loc_nr = GET_HOME(ch); */
  1074.  
  1075.   loc_nr = 3001;
  1076.   for (location = 0; location <= top_of_world; location++)
  1077.     if (world[location].number == loc_nr) {
  1078.       found = TRUE;
  1079.       break;
  1080.     }
  1081.  
  1082.   if ((location == top_of_world) || !found)
  1083.   {
  1084.     send_to_char("You are completely lost.\n\r", victim);
  1085.     return;
  1086.   }
  1087.  
  1088.     /* a location has been found. */
  1089.  
  1090.   act("$n disappears.", TRUE, victim, 0, 0, TO_ROOM);
  1091.   char_from_room(victim);
  1092.   char_to_room(victim, location);
  1093.   act("$n appears in the middle of the room.", TRUE, victim, 0, 0, TO_ROOM);
  1094.   do_look(victim, "",15);
  1095.  
  1096. }
  1097.  
  1098.  
  1099. void spell_summon(byte level, struct char_data *ch,
  1100.   struct char_data *victim, struct obj_data *obj)
  1101. {
  1102.     sh_int target;
  1103.  
  1104.     assert(ch && victim);
  1105.  
  1106.     if (GET_LEVEL(victim) > MIN(20,level+3)) {
  1107.         send_to_char("You failed.\n\r",ch);
  1108.         return;
  1109.     }
  1110.  
  1111.   if (IS_NPC(victim) && saves_spell(victim, SAVING_SPELL) ) {
  1112.         send_to_char("You failed.\n\r", ch);
  1113.         return;
  1114.     }
  1115.  
  1116.     act("$n disappears suddenly.",TRUE,victim,0,0,TO_ROOM);
  1117.  
  1118.     target = ch->in_room;
  1119.     char_from_room(victim);
  1120.     char_to_room(victim,target);
  1121.  
  1122.     act("$n arrives suddenly.",TRUE,victim,0,0,TO_ROOM);
  1123.     act("$n has summoned you!",FALSE,ch,0,victim,TO_VICT);
  1124.     do_look(victim,"",15);
  1125. }
  1126.  
  1127.  
  1128. void spell_charm_person(byte level, struct char_data *ch,
  1129.   struct char_data *victim, struct obj_data *obj)
  1130. {
  1131.   struct affected_type af;
  1132.  
  1133.   void add_follower(struct char_data *ch, struct char_data *leader);
  1134.   bool circle_follow(struct char_data *ch, struct char_data *victim);
  1135.   void stop_follower(struct char_data *ch);
  1136.  
  1137.     assert(ch && victim);
  1138.  
  1139.   /* By testing for IS_AFFECTED we avoid ei. Mordenkainens sword to be */
  1140.   /* abel to be "recharmed" with duration                              */
  1141.  
  1142.     if (victim == ch) {
  1143.         send_to_char("You like yourself even better!\n\r", ch);
  1144.         return;
  1145.     }
  1146.  
  1147.   if (!IS_AFFECTED(victim, AFF_CHARM) && !IS_AFFECTED(ch, AFF_CHARM) &&
  1148.       (level >= GET_LEVEL(victim))) {
  1149.     if (circle_follow(victim, ch)) {
  1150.       send_to_char("Sorry, following in circles can not be allowed.\n\r", ch);
  1151.       return;
  1152.     }
  1153.  
  1154.         if (saves_spell(victim, SAVING_PARA))
  1155.             return;
  1156.  
  1157.     if (victim->master)
  1158.       stop_follower(victim);
  1159.  
  1160.     add_follower(victim, ch);
  1161.  
  1162.     af.type      = SPELL_CHARM_PERSON;
  1163.  
  1164.     if (GET_INT(victim))
  1165.       af.duration  = 24*18/GET_INT(victim);
  1166.     else
  1167.       af.duration  = 24*18;
  1168.  
  1169.     af.modifier  = 0;
  1170.     af.location  = 0;
  1171.     af.bitvector = AFF_CHARM;
  1172.     affect_to_char(victim, &af);
  1173.  
  1174.         act("Isn't $n just such a nice fellow?",FALSE,ch,0,victim,TO_VICT);
  1175.     }
  1176. }
  1177.  
  1178.  
  1179.  
  1180. void spell_sense_life(byte level, struct char_data *ch,
  1181.   struct char_data *victim, struct obj_data *obj)
  1182. {
  1183.   struct affected_type af;
  1184.  
  1185.     assert(victim);
  1186.  
  1187.   if (!affected_by_spell(victim, SPELL_SENSE_LIFE)) {
  1188.     send_to_char("Your feel your awareness improve.\n\r", ch);
  1189.  
  1190.     af.type      = SPELL_SENSE_LIFE;
  1191.     af.duration  = 5*level;
  1192.     af.modifier  = 0;
  1193.     af.location  = APPLY_NONE;
  1194.     af.bitvector = AFF_SENSE_LIFE;
  1195.     affect_to_char(victim, &af);
  1196.   }
  1197. }
  1198.  
  1199.  
  1200. /* ***************************************************************************
  1201.  *                     Not cast-able spells                                  *
  1202.  * ************************************************************************* */
  1203.  
  1204. void spell_identify(byte level, struct char_data *ch,
  1205.   struct char_data *victim, struct obj_data *obj)
  1206. {
  1207.   char buf[256], buf2[256];
  1208.     int i;
  1209.   bool found;
  1210.  
  1211.     struct time_info_data age(struct char_data *ch);
  1212.  
  1213.   /* Spell Names */
  1214.     extern char *spells[];
  1215.  
  1216.     /* For Objects */
  1217.     extern char *item_types[];
  1218.     extern char *extra_bits[];
  1219.     extern char *apply_types[];
  1220.     extern char *affected_bits[];
  1221.  
  1222.  
  1223.   assert(ch && (obj || victim));
  1224.  
  1225.   if (obj) {
  1226.         send_to_char("You feel informed:\n\r", ch);
  1227.  
  1228.         sprintf(buf, "Object '%s', Item type: ", obj->name);
  1229.         sprinttype(GET_ITEM_TYPE(obj),item_types,buf2);
  1230.         strcat(buf,buf2); strcat(buf,"\n\r");
  1231.         send_to_char(buf, ch);
  1232.  
  1233.         if (obj->obj_flags.bitvector) {
  1234.             send_to_char("Item will give you following abilities:  ", ch);
  1235.             sprintbit(obj->obj_flags.bitvector,affected_bits,buf);
  1236.             strcat(buf,"\n\r");
  1237.             send_to_char(buf, ch);
  1238.         }
  1239.  
  1240.         send_to_char("Item is: ", ch);
  1241.         sprintbit(obj->obj_flags.extra_flags,extra_bits,buf);
  1242.         strcat(buf,"\n\r");
  1243.         send_to_char(buf,ch);
  1244.  
  1245.         sprintf(buf,"Weight: %d, Value: %d\n\r",
  1246.           obj->obj_flags.weight, obj->obj_flags.cost);
  1247.         send_to_char(buf, ch);
  1248.  
  1249.     switch (GET_ITEM_TYPE(obj)) {
  1250.  
  1251.             case ITEM_SCROLL : 
  1252.             case ITEM_POTION :
  1253.                 sprintf(buf, "Level %d spells of:\n\r",    obj->obj_flags.value[0]);
  1254.                 send_to_char(buf, ch);
  1255.                 if (obj->obj_flags.value[1] >= 1) {
  1256.                     sprinttype(obj->obj_flags.value[1]-1,spells,buf);
  1257.                     strcat(buf,"\n\r");
  1258.                     send_to_char(buf, ch);
  1259.                 }
  1260.                 if (obj->obj_flags.value[2] >= 1) {
  1261.                     sprinttype(obj->obj_flags.value[2]-1,spells,buf);
  1262.                     strcat(buf,"\n\r");
  1263.                     send_to_char(buf, ch);
  1264.                 }
  1265.                 if (obj->obj_flags.value[3] >= 1) {
  1266.                     sprinttype(obj->obj_flags.value[3]-1,spells,buf);
  1267.                     strcat(buf,"\n\r");
  1268.                     send_to_char(buf, ch);
  1269.                 }
  1270.                 break;
  1271.  
  1272.             case ITEM_WAND : 
  1273.             case ITEM_STAFF : 
  1274.                 sprintf(buf, "Has %d chages, with %d charges left.\n\r",
  1275.                   obj->obj_flags.value[1],
  1276.                   obj->obj_flags.value[2]);
  1277.                 send_to_char(buf, ch);
  1278.  
  1279.                 sprintf(buf, "Level %d spell of:\n\r",    obj->obj_flags.value[0]);
  1280.                 send_to_char(buf, ch);
  1281.  
  1282.                 if (obj->obj_flags.value[3] >= 1) {
  1283.                     sprinttype(obj->obj_flags.value[3]-1,spells,buf);
  1284.                     strcat(buf,"\n\r");
  1285.                     send_to_char(buf, ch);
  1286.                 }
  1287.                 break;
  1288.  
  1289.             case ITEM_WEAPON :
  1290.                 sprintf(buf, "Damage Dice is '%dD%d'\n\r",
  1291.                     obj->obj_flags.value[1],
  1292.                    obj->obj_flags.value[2]);
  1293.                 send_to_char(buf, ch);
  1294.                 break;
  1295.  
  1296.             case ITEM_ARMOR :
  1297.                 sprintf(buf, "AC-apply is %d\n\r",
  1298.                     obj->obj_flags.value[0]);
  1299.                 send_to_char(buf, ch);
  1300.                 break;
  1301.  
  1302.     }
  1303.  
  1304.         found = FALSE;
  1305.  
  1306.         for (i=0;i<MAX_OBJ_AFFECT;i++) {
  1307.             if ((obj->affected[i].location != APPLY_NONE) &&
  1308.                (obj->affected[i].modifier != 0)) {
  1309.                 if (!found) {
  1310.                     send_to_char("Can affect you as :\n\r", ch);
  1311.                     found = TRUE;
  1312.                 }
  1313.  
  1314.                 sprinttype(obj->affected[i].location,apply_types,buf2);
  1315.                 sprintf(buf,"    Affects : %s By %d\n\r", buf2,obj->affected[i].modifier);
  1316.                 send_to_char(buf, ch);
  1317.             }
  1318.         }
  1319.  
  1320.   } else {       /* victim */
  1321.  
  1322.         if (!IS_NPC(victim)) {
  1323.             sprintf(buf,"%d Years,  %d Months,  %d Days,  %d Hours old.\n\r",
  1324.                     age(victim).year, age(victim).month,
  1325.                     age(victim).day, age(victim).hours);
  1326.             send_to_char(buf,ch);
  1327.  
  1328.             sprintf(buf,"Height %dcm  Weight %dpounds \n\r",
  1329.               GET_HEIGHT(victim), GET_WEIGHT(victim));
  1330.             send_to_char(buf,ch);
  1331.  
  1332. /*
  1333.             sprintf(buf,"Str %d/%d,  Int %d,  Wis %d,  Dex %d,  Con %d\n\r",
  1334.                 GET_STR(victim), GET_ADD(victim),
  1335.                 GET_INT(victim),
  1336.                 GET_WIS(victim),
  1337.                 GET_DEX(victim),
  1338.                 GET_CON(victim) );
  1339.             send_to_char(buf,ch);
  1340. */
  1341.  
  1342.     } else {
  1343.       send_to_char("You learn nothing new.\n\r", ch);
  1344.     }
  1345.   }
  1346.  
  1347. }
  1348.  
  1349.  
  1350. /* ***************************************************************************
  1351.  *                     NPC spells..                                          *
  1352.  * ************************************************************************* */
  1353.  
  1354. void spell_fire_breath(byte level, struct char_data *ch,
  1355.   struct char_data *victim, struct obj_data *obj)
  1356. {
  1357.     int dam;
  1358.     int hpch;
  1359.     struct obj_data *burn;
  1360.  
  1361.     assert(victim && ch);
  1362.     assert((level >= 1) && (level <= 30)); 
  1363.  
  1364.     hpch = GET_HIT(ch);
  1365.     if(hpch<10) hpch=10;
  1366.  
  1367.     dam = number(0,hpch>>2);
  1368.  
  1369.     if ( saves_spell(victim, SAVING_BREATH) )
  1370.         dam >>= 1;
  1371.  
  1372.     damage(ch, victim, dam, SPELL_FIRE_BREATH);
  1373.  
  1374.     /* And now for the damage on inventory */
  1375.  
  1376.     if(number(0,30)<GET_LEVEL(ch))
  1377.     {
  1378.         if (!saves_spell(victim, SAVING_BREATH) )
  1379.         {
  1380.             for(burn=victim->carrying ; 
  1381.                 burn && (burn->obj_flags.type_flag!=ITEM_SCROLL) && 
  1382.                 (burn->obj_flags.type_flag!=ITEM_WAND) &&
  1383.                 (burn->obj_flags.type_flag!=ITEM_STAFF) &&
  1384.                 (burn->obj_flags.type_flag!=ITEM_NOTE) &&
  1385.             (number(0,2)==0) ;
  1386.                  burn=burn->next_content);
  1387.             if(burn)
  1388.             {
  1389.                 act("$o burns",0,victim,burn,0,TO_CHAR);
  1390.                 extract_obj(burn);
  1391.             }
  1392.         }
  1393.     }
  1394. }
  1395.  
  1396.  
  1397. void spell_frost_breath(byte level, struct char_data *ch,
  1398.   struct char_data *victim, struct obj_data *obj)
  1399. {
  1400.     int dam;
  1401.     int hpch;
  1402.     struct obj_data *frozen;
  1403.  
  1404.     assert(victim && ch);
  1405.     assert((level >= 1) && (level <= 30)); 
  1406.  
  1407.     hpch = GET_HIT(ch);
  1408.     if(hpch<10) hpch=10;
  1409.  
  1410.     dam = number(0,hpch>>2);
  1411.  
  1412.     if ( saves_spell(victim, SAVING_BREATH) )
  1413.         dam >>= 1;
  1414.  
  1415.     damage(ch, victim, dam, SPELL_FROST_BREATH);
  1416.  
  1417.     /* And now for the damage on inventory */
  1418.  
  1419.     if(number(0,30)<GET_LEVEL(ch))
  1420.     {
  1421.         if (!saves_spell(victim, SAVING_BREATH) )
  1422.         {
  1423.             for(frozen=victim->carrying ; 
  1424.                 frozen && (frozen->obj_flags.type_flag!=ITEM_DRINKCON) && 
  1425.                 (frozen->obj_flags.type_flag!=ITEM_FOOD) &&
  1426.                 (frozen->obj_flags.type_flag!=ITEM_POTION) &&
  1427.             (number(0,2)==0) ;
  1428.                  frozen=frozen->next_content); 
  1429.             if(frozen)
  1430.             {
  1431.                 act("$o breaks.",0,victim,frozen,0,TO_CHAR);
  1432.                 extract_obj(frozen);
  1433.             }
  1434.         }
  1435.     }
  1436. }
  1437.  
  1438.  
  1439. void spell_acid_breath(byte level, struct char_data *ch,
  1440.   struct char_data *victim, struct obj_data *obj)
  1441. {
  1442.     int dam;
  1443.     int hpch;
  1444.     int damaged;
  1445.  
  1446.     int apply_ac(struct char_data *ch, int eq_pos);
  1447.     
  1448.     assert(victim && ch);
  1449.     assert((level >= 1) && (level <= 30)); 
  1450.  
  1451.     hpch = GET_HIT(ch);
  1452.     if(hpch<10) hpch=10;
  1453.  
  1454.     dam = number(0,hpch>>2);
  1455.  
  1456.     if ( saves_spell(victim, SAVING_BREATH) )
  1457.         dam >>= 1;
  1458.  
  1459.     damage(ch, victim, dam, SPELL_ACID_BREATH);
  1460.  
  1461.     /* And now for the damage on equipment */
  1462.  
  1463.     if(number(0,30)<GET_LEVEL(ch))
  1464.     {
  1465.         if (!saves_spell(victim, SAVING_BREATH) )
  1466.         {
  1467.             for(damaged = 0; damaged<MAX_WEAR &&
  1468.                 (victim->equipment[damaged]) &&
  1469.                 (victim->equipment[damaged]->obj_flags.type_flag!=ITEM_ARMOR) &&
  1470.                 (victim->equipment[damaged]->obj_flags.value[0]>0) && 
  1471.             (number(0,2)==0) ; damaged++);  
  1472.             if(damaged<MAX_WEAR)
  1473.             {
  1474.                 act("$o is damaged.",0,victim,victim->equipment[damaged],0,TO_CHAR);
  1475.                 GET_AC(victim)-=apply_ac(victim,damaged);
  1476.                 ch->equipment[damaged]->obj_flags.value[0]-=number(1,7);
  1477.                 GET_AC(victim)+=apply_ac(victim,damaged);
  1478.                 ch->equipment[damaged]->obj_flags.cost = 0;
  1479.             }
  1480.         }
  1481.     }
  1482. }
  1483.  
  1484.  
  1485. void spell_gas_breath(byte level, struct char_data *ch,
  1486.   struct char_data *victim, struct obj_data *obj)
  1487. {
  1488.     int dam;
  1489.     int hpch;
  1490.  
  1491.     assert(victim && ch);
  1492.     assert((level >= 1) && (level <= 30)); 
  1493.  
  1494.     hpch = GET_HIT(ch);
  1495.     if(hpch<10) hpch=10;
  1496.  
  1497.     dam = number(0,hpch>>2);
  1498.  
  1499.     if ( saves_spell(victim, SAVING_BREATH) )
  1500.         dam >>= 1;
  1501.  
  1502.     damage(ch, victim, dam, SPELL_GAS_BREATH);
  1503.  
  1504.  
  1505. }
  1506.  
  1507.  
  1508. void spell_lightning_breath(byte level, struct char_data *ch,
  1509.   struct char_data *victim, struct obj_data *obj)
  1510. {
  1511.     int dam;
  1512.     int hpch;
  1513.  
  1514.     assert(victim && ch);
  1515.     assert((level >= 1) && (level <= 30)); 
  1516.  
  1517.     hpch = GET_HIT(ch);
  1518.     if(hpch<10) hpch=10;
  1519.  
  1520.     dam = number(0,hpch>>2);
  1521.  
  1522.     if ( saves_spell(victim, SAVING_BREATH) )
  1523.         dam >>= 1;
  1524.  
  1525.     damage(ch, victim, dam, SPELL_LIGHTNING_BREATH);
  1526.  
  1527.  
  1528. }
  1529.