Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

healer.c File Reference

#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "merc.h"
#include "magic.h"

Include dependency graph for healer.c:

Go to the source code of this file.

Functions

void do_heal (CHAR_DATA *ch, char *argument)


Function Documentation

void do_heal CHAR_DATA ch,
char *  argument
 

Definition at line 41 of file healer.c.

References act, ACT_IS_HEALER, deduct_cost(), dice(), char_data::gold, char_data::in_room, IS_NPC, IS_SET, char_data::level, char_data::mana, MAX_INPUT_LENGTH, char_data::next_in_room, one_argument(), room_index_data::people, PULSE_VIOLENCE, send_to_char(), char_data::silver, skill_lookup(), spell_cure_blindness(), spell_cure_critical(), spell_cure_disease(), spell_cure_light(), spell_cure_poison(), spell_cure_serious(), spell_heal(), spell_refresh(), spell_remove_curse(), str_prefix(), TARGET_CHAR, TO_CHAR, TO_ROOM, UMIN, and WAIT_STATE.

00042 {
00043     CHAR_DATA *mob;
00044     char arg[MAX_INPUT_LENGTH];
00045     int cost, sn;
00046     SPELL_FUN *spell;
00047     char *words;
00048 
00049     /* check for healer */
00050     for (mob = ch->in_room->people; mob; mob = mob->next_in_room)
00051     {
00052         if (IS_NPC (mob) && IS_SET (mob->act, ACT_IS_HEALER))
00053             break;
00054     }
00055 
00056     if (mob == NULL)
00057     {
00058         send_to_char ("You can't do that here.\n\r", ch);
00059         return;
00060     }
00061 
00062     one_argument (argument, arg);
00063 
00064     if (arg[0] == '\0')
00065     {
00066         /* display price list */
00067         act ("$N says 'I offer the following spells:'", ch, NULL, mob,
00068              TO_CHAR);
00069         send_to_char ("  light: cure light wounds      10 gold\n\r", ch);
00070         send_to_char ("  serious: cure serious wounds  15 gold\n\r", ch);
00071         send_to_char ("  critic: cure critical wounds  25 gold\n\r", ch);
00072         send_to_char ("  heal: healing spell          50 gold\n\r", ch);
00073         send_to_char ("  blind: cure blindness         20 gold\n\r", ch);
00074         send_to_char ("  disease: cure disease         15 gold\n\r", ch);
00075         send_to_char ("  poison:  cure poison          25 gold\n\r", ch);
00076         send_to_char ("  uncurse: remove curse          50 gold\n\r", ch);
00077         send_to_char ("  refresh: restore movement      5 gold\n\r", ch);
00078         send_to_char ("  mana:  restore mana          10 gold\n\r", ch);
00079         send_to_char (" Type heal <type> to be healed.\n\r", ch);
00080         return;
00081     }
00082 
00083     if (!str_prefix (arg, "light"))
00084     {
00085         spell = spell_cure_light;
00086         sn = skill_lookup ("cure light");
00087         words = "judicandus dies";
00088         cost = 1000;
00089     }
00090 
00091     else if (!str_prefix (arg, "serious"))
00092     {
00093         spell = spell_cure_serious;
00094         sn = skill_lookup ("cure serious");
00095         words = "judicandus gzfuajg";
00096         cost = 1600;
00097     }
00098 
00099     else if (!str_prefix (arg, "critical"))
00100     {
00101         spell = spell_cure_critical;
00102         sn = skill_lookup ("cure critical");
00103         words = "judicandus qfuhuqar";
00104         cost = 2500;
00105     }
00106 
00107     else if (!str_prefix (arg, "heal"))
00108     {
00109         spell = spell_heal;
00110         sn = skill_lookup ("heal");
00111         words = "pzar";
00112         cost = 5000;
00113     }
00114 
00115     else if (!str_prefix (arg, "blindness"))
00116     {
00117         spell = spell_cure_blindness;
00118         sn = skill_lookup ("cure blindness");
00119         words = "judicandus noselacri";
00120         cost = 2000;
00121     }
00122 
00123     else if (!str_prefix (arg, "disease"))
00124     {
00125         spell = spell_cure_disease;
00126         sn = skill_lookup ("cure disease");
00127         words = "judicandus eugzagz";
00128         cost = 1500;
00129     }
00130 
00131     else if (!str_prefix (arg, "poison"))
00132     {
00133         spell = spell_cure_poison;
00134         sn = skill_lookup ("cure poison");
00135         words = "judicandus sausabru";
00136         cost = 2500;
00137     }
00138 
00139     else if (!str_prefix (arg, "uncurse") || !str_prefix (arg, "curse"))
00140     {
00141         spell = spell_remove_curse;
00142         sn = skill_lookup ("remove curse");
00143         words = "candussido judifgz";
00144         cost = 5000;
00145     }
00146 
00147     else if (!str_prefix (arg, "mana") || !str_prefix (arg, "energize"))
00148     {
00149         spell = NULL;
00150         sn = -1;
00151         words = "energizer";
00152         cost = 1000;
00153     }
00154 
00155 
00156     else if (!str_prefix (arg, "refresh") || !str_prefix (arg, "moves"))
00157     {
00158         spell = spell_refresh;
00159         sn = skill_lookup ("refresh");
00160         words = "candusima";
00161         cost = 500;
00162     }
00163 
00164     else
00165     {
00166         act ("$N says 'Type 'heal' for a list of spells.'",
00167              ch, NULL, mob, TO_CHAR);
00168         return;
00169     }
00170 
00171     if (cost > (ch->gold * 100 + ch->silver))
00172     {
00173         act ("$N says 'You do not have enough gold for my services.'",
00174              ch, NULL, mob, TO_CHAR);
00175         return;
00176     }
00177 
00178     WAIT_STATE (ch, PULSE_VIOLENCE);
00179 
00180     deduct_cost (ch, cost);
00181     mob->gold += cost / 100;
00182     mob->silver += cost % 100;
00183     act ("$n utters the words '$T'.", mob, NULL, words, TO_ROOM);
00184 
00185     if (spell == NULL)
00186     {                            /* restore mana trap...kinda hackish */
00187         ch->mana += dice (2, 8) + mob->level / 3;
00188         ch->mana = UMIN (ch->mana, ch->max_mana);
00189         send_to_char ("A warm glow passes through you.\n\r", ch);
00190         return;
00191     }
00192 
00193     if (sn == -1)
00194         return;
00195 
00196     spell (sn, mob->level, mob, ch, TARGET_CHAR);
00197 }

Here is the call graph for this function:


Generated on Thu Jan 13 22:00:46 2005 for Beyond the Shadows by  doxygen 1.4.0