Healer snippet for EmberMUD
                         Install sheet by Rindar (Ron Cole)


Notes:  This is a version of the pay healer that can be found in 
practically every codebase from MERC and ROM to Mythran.  Since 
so many people take credit for doing this, I have know idea which
one to actually give credit too.. if you know, e-mail me.

        What the healer code does is simple.  When ever someone 
types HEAL in a room, the function checks to see if there are any 
NPC's with the act_healer flag on them.  If there are, it allows 
for people to pay the healer to cast certain spells on them.  
Needless to say, these healers should be rare and expensive or else
no one will purchase the HEALING spell group anymore.  However, 
they can be a valuable addition to your MUD if used properly.

Install:  Follow the directions below to install the code.

     1)  You need to add the appropriate line of code to activate
       the HEAL command in interp.h.  Here is what ours looks like,  
       with the lines before and after /* */'ed out:

 /* DECLARE_DO_FUN( do_gtell        ); */
    DECLARE_DO_FUN( do_heal         );
 /* DECLARE_DO_FUN( do_help         ); */

     2)  Open interp.c and add the appropriate lines of code to
       activate the HEAL command.  Here is what ours looks like:
     
 /* { "goto",           do_goto,        POS_DEAD,       L8,  LOG_NORMAL, 1 }, */
    { "heal",           do_heal,        POS_RESTING,     0,  LOG_NORMAL, 1 },
 /* { "hit",            do_kill,        POS_FIGHTING,    0,  LOG_NORMAL, 0 }, */

     3)  Insert the snippet at the bottom of the sheet into one of
       the .c files.  I recommend using act_obj.c because it fits with 
       the other merchant code.

     4)  You need to create the act flag IS_HEALER.  Open merc.h and
       find the section "* ACT bits for mobs." Add the following define
       line in the next open space, making sure to CHANGE THE LETTER
       to the NEXT LETTER in the order.

          #define ACT_IS_HEALER           (aa)

     5)  Open handler.c. Find the section that return's ascii names of 
       act vectors.  Look for the following line of code:

         char *act_bit_name( int act_flags )
         
       Install this line in the next available space:

         if (act_flags & ACT_IS_HEALER   ) strcat(buf, " healer");

     6)  Open bit.c.  find the line "const struct flag_type act_flags[] ="
       Add the following line to the table at the end before the 
       blank section:
       
         {   "healer",               ACT_IS_HEALER,          TRUE    },

     7)  Recompile.  You are done.

        Code complete.  Remember, you can modify the cost of the spells 
in the do_heal function.  This may be necessary in order to assure that
those with the Healing spell group do not get upset.

-= Rindar
(clogar@concentric.net)


** Note:  This function is provided "as is" and may be used so long as 
1)  The author's name is kept at the top of the function (if requested) and
2)  all other previous licensing aggreements are abided by.  The author 
assumes no responsibility for problems that occur through use or install-
ation, including lost wages, bugs, deletions, downtimes, etc...  Use at 
your own risk.  All new code is copyrighted by its author.


The do_heal function:

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      1000 silver\n\r",ch);
        send_to_char("  serious: cure serious wounds  1500 silver\n\r",ch);
        send_to_char("  critic: cure critical wounds  2500 silver\n\r",ch);
        send_to_char("  heal: healing spell	      5000 silver\n\r",ch);
        send_to_char("  blind: cure blindness         2000 silver\n\r",ch);
        send_to_char("  disease: cure disease         1500 silver\n\r",ch);
        send_to_char("  poison:  cure poison	      2500 silver\n\r",ch); 
        send_to_char("  uncurse: remove curse	      5000 silver\n\r",ch);
        send_to_char("  refresh: restore movement      500 silver\n\r",ch);
        send_to_char("  mana:  restore mana	      1000 silver\n\r",ch);
        send_to_char(" Type heal <type> to be healed.\n\r",ch);
        return;
    }

    if (!str_prefix(arg,"light"))
    {
        spell = spell_cure_light;
        sn    = skill_lookup("cure light");
        words = "judicandus dies";
         cost  = 1000;
    }

    else if (!str_prefix(arg,"serious"))
    {
        spell = spell_cure_serious;
        sn    = skill_lookup("cure serious");
        words = "judicandus gzfuajg";
        cost  = 1600;
    }

    else if (!str_prefix(arg,"critical"))
    {
        spell = spell_cure_critical;
        sn    = skill_lookup("cure critical");
        words = "judicandus qfuhuqar";
        cost  = 2500;
    }

    else if (!str_prefix(arg,"heal"))
    {
        spell = spell_heal;
        sn = skill_lookup("heal");
        words = "pzar";
        cost  = 5000;
    }

    else if (!str_prefix(arg,"blindness"))
    {
        spell = spell_cure_blindness;
        sn    = skill_lookup("cure blindness");
        words = "judicandus noselacri";         
        cost  = 2000;
    }

    else if (!str_prefix(arg,"disease"))
    {
        spell = spell_cure_disease;
        sn    = skill_lookup("cure disease");
        words = "judicandus eugzagz";
        cost = 1500;
    }

    else if (!str_prefix(arg,"poison"))
    {
        spell = spell_cure_poison;
        sn    = skill_lookup("cure poison");
        words = "judicandus sausabru";
        cost  = 2500;
    }
        
    else if (!str_prefix(arg,"uncurse") || !str_prefix(arg,"curse"))
    {
        spell = spell_remove_curse; 
        sn    = skill_lookup("remove curse");
        words = "candussido judifgz";
        cost  = 5000;
    }

    else if (!str_prefix(arg,"mana") || !str_prefix(arg,"energize"))
    {
        spell = NULL;
        sn = -1;
        words = "energizer";
        cost = 1000;
    }


    else if (!str_prefix(arg,"refresh") || !str_prefix(arg,"moves"))
    {
        spell =  spell_refresh;
        sn    = skill_lookup("refresh");
        words = "candusima"; 
        cost  = 500;
    }

    else 
    {
        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)  /* restore mana trap...kinda hackish */
    {
        ch->mana += dice(2,8) + mob->level / 3;
        ch->mana = UMIN(ch->mana,ch->max_mana);
        send_to_char("A warm glow passes through you.\n\r",ch);
        return;
     }

     if (sn == -1)
        return;
    
     (*skill_table[sn].spell_fun) ( sn, mob->level, mob, ch );

     /* spell(sn,mob->level,mob,ch,TARGET_CHAR); */
}