clan/
class/
data/
doc/ideas/
doc/mobprogs/
gods/
log/
player/
time/
/*
 *  The unique portions SunderMUD 1 code as well as the integration efforts
 *  for code from other sources is based on the efforts of:
 *
 *  Lotherius (elfren@aros.net)
 *
 *  This code can only be used under the terms of the DikuMud, Merc,
 *  and ROM licenses. The same requirements apply to the changes that
 *  have been made.
 *
 * All other copyrights remain in place and in force.
*/


/* Healer code written for Merc 2.0 muds by Alander 
   direct questions or comments to rtaylor@cie-2.uoregon.edu
   any use of this code must include this header */

#include "everything.h"
#include "magic.h"

void do_heal(CHAR_DATA *ch, char *argument)
{
    CHAR_DATA *mob;
    char arg[MAX_INPUT_LENGTH];
    int cost,sn;
    SPELL_FUN *spell;
    char *words;	

    /* check for healer */
    for ( mob = ch->in_room->people; mob; mob = mob->next_in_room )
    {
        if ( IS_NPC(mob) && IS_SET(mob->act, ACT_IS_HEALER) )
            break;
    }
 
    if ( mob == NULL )
    {
        send_to_char( "You can't do that here.\n\r", ch );
        return;
    }

    one_argument(argument,arg);

    if (arg[0] == '\0')
    {
        /* display price list */
	act("$N says 'I offer the following spells:'",ch,NULL,mob,TO_CHAR);
	send_to_char("  light: cure light wounds        30 gold\n\r",ch);
	send_to_char("  serious: cure serious wounds    50 gold\n\r",ch);
	send_to_char("  critic: cure critical wounds   100 gold\n\r",ch);
	send_to_char("  heal: healing spell	          1000 gold\n\r",ch);
	send_to_char("  blind: cure blindness          300 gold\n\r",ch);
	send_to_char("  disease: cure disease         1000 gold\n\r",ch);
	send_to_char("  poison:  cure poison	       300 gold\n\r",ch); 
	send_to_char("  uncurse: remove curse	      2000 gold\n\r",ch);
	send_to_char("  refresh: restore movement      500 gold\n\r",ch);
	send_to_char("  mana:  restore mana	          1000 gold\n\r",ch);
	send_to_char("  {gfull{x: all mana, hp, movement 50000 gold\n\r",ch);
	send_to_char(" Type heal <type> to be healed.\n\r",ch);
	return;
    }

    switch (arg[0])
    {
	case 'l' :
	    spell = spell_cure_light;
	    sn    = skill_lookup("cure light");
	    words = "judicandus dies";
	    cost  = 30;
	    break;

	case 's' :
	    spell = spell_cure_serious;
	    sn    = skill_lookup("cure serious");
	    words = "judicandus gzfuajg";
	    cost  = 50;
	    break;

	case 'c' :
	    spell = spell_cure_critical;
	    sn    = skill_lookup("cure critical");
	    words = "judicandus qfuhuqar";
	    cost  = 100;
	    break;

	case 'h' :
	    spell = spell_heal;
	    sn = skill_lookup("heal");
	    words = "pzar";
	    cost  = 1000;
	    break;

	case 'b' :
	    spell = spell_cure_blindness;
	    sn    = skill_lookup("cure blindness");
      	    words = "judicandus noselacri";		
            cost  = 300;
	    break;

    	case 'd' :
	    spell = spell_cure_disease;
	    sn    = skill_lookup("cure disease");
	    words = "judicandus eugzagz";
	    cost = 1000;
	    break;

	case 'p' :
	    spell = spell_cure_poison;
	    sn    = skill_lookup("cure poison");
	    words = "judicandus sausabru";
	    cost  = 300;
	    break;
	
	case 'u' :
	    spell = spell_remove_curse; 
	    sn    = skill_lookup("remove curse");
	    words = "candussido judifgz";
	    cost  = 2000;
	    break;

	case 'r' :
	    spell =  spell_refresh;
	    sn    = skill_lookup("refresh");
	    words = "candusima"; 
	    cost  = 500;
	    break;

	case 'm' :
	    spell = NULL;
	    sn = -1;
	    words = "energizer";
	    cost = 1000;
	    break;
	
	case 'f' :
		spell = NULL;
		sn = -1;
		words = "{rSim{gsal{ybim{wbam{cba {bsal{ga{ydu {Gsal{Ya{Rdim{m!{x";
		cost = 50000;
		break;

	default :
	    act("$N says 'Type 'heal' for a list of spells.'",
	        ch,NULL,mob,TO_CHAR);
	    return;
    }

    if (cost > ch->gold)
    {
	act("$N says 'You do not have enough gold for my services.'",
	    ch,NULL,mob,TO_CHAR);
	return;
    }

    WAIT_STATE(ch,PULSE_VIOLENCE);

    ch->gold -= cost;
    mob->gold += cost;
    act("$n utters the words '$T'.",mob,NULL,words,TO_ROOM);
  
    if ((spell == NULL)&&(arg[0]=='m'))  /* restore mana trap...kinda hackish */
   		{
		ch->mana += dice(100,2) + mob->level / 4;
		ch->mana = UMIN(ch->mana,ch->max_mana);
		send_to_char("A warm glow passes through you.\n\r",ch);
		return;
    	}
	else if ((spell == NULL)&&(arg[0]=='f'))
		{
		ch->mana = ch->max_mana;
		ch->hit = ch->max_hit;
		ch->move = ch->max_move;
		send_to_char("The {gpower{x of the {rg{go{yd{cs{x flows into you!\n\r",ch);
		return;
		}

     if (sn == -1)
	return;
    
     spell(sn,mob->level,mob,ch);
}