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

healer.c

Go to the documentation of this file.
00001 /***************************************************************************
00002  *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
00003  *  Michael Seifert, Hans Henrik Strfeldt, Tom Madsen, and Katja Nyboe.    *
00004  *                                                                         *
00005  *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
00006  *  Chastain, Michael Quan, and Mitchell Tse.                              *
00007  *                                                                         *
00008  *  In order to use any part of this Merc Diku Mud, you must comply with   *
00009  *  both the original Diku license in 'license.doc' as well the Merc       *
00010  *  license in 'license.txt'.  In particular, you may not remove either of *
00011  *  these copyright notices.                                               *
00012  *                                                                         *
00013  *  Much time and thought has gone into this software and you are          *
00014  *  benefitting.  We hope that you share your changes too.  What goes      *
00015  *  around, comes around.                                                  *
00016  **************************************************************************/
00017 
00018 /***************************************************************************
00019  *   ROM 2.4 is copyright 1993-1998 Russ Taylor                            *
00020  *   ROM has been brought to you by the ROM consortium                     *
00021  *       Russ Taylor (rtaylor@hypercube.org)                               *
00022  *       Gabrielle Taylor (gtaylor@hypercube.org)                          *
00023  *       Brian Moore (zump@rom.org)                                        *
00024  *   By using this code, you have agreed to follow the terms of the        *
00025  *   ROM license, in the file Rom24/doc/rom.license                        *
00026  **************************************************************************/
00027 
00028 #if defined(macintosh)
00029 #include <types.h>
00030 #include <time.h>
00031 #else
00032 #include <sys/types.h>
00033 #include <sys/time.h>
00034 #endif
00035 #include <stdio.h>
00036 #include <string.h>
00037 #include <stdlib.h>
00038 #include "merc.h"
00039 #include "magic.h"
00040 
00041 void do_heal (CHAR_DATA * ch, char *argument)
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 }

Generated on Thu Jan 13 21:48:11 2005 for Beyond the Shadows by  doxygen 1.4.0