This is an improved version of the old fear spell originally posted by Jason Huang.
This version has been tested with ROM2.4b6. Please email any suggestions for
improvements to normativo@a*l.c*m. Do whatever you want with this code, but please
keeps Jason's header intact and observe the ROM license.

						--Siva
						A random builder at mud.aarchonmud.com:7000					
&&&&&& IN MERC.H, Find this line:

#define MAX_SKILL          150

and increase the number by one, to make room for the new spell.

&&&&&& IN CONST.C add the following into the skill_table (if you have changed the stock
const.c, make sure the slot number does not conflict with another new spell):

 {
     "fear", {20, 53, 20, 53}, {1, 1, 2, 2},
     spell_fear, TAR_CHAR_OFFENSIVE, POS_FIGHTING,
     NULL, SLOT (969), 12, 12,
     "fear", "!FEAR!", ""}

&&&&&& In one of your help files (perhaps help.are) add:

-1 FEAR~
Syntax: cast fear <target>

The fear spell strikes abject terror into the heart of its victim, 
causing them to panic and attempt to flee. If the spell is successfully
cast, the target will attempt to flee--though the target may also be so
frightened that it cannot organize a successful retreat.

Though the fear spell is often seen as a convenient way to relocate a
troublesome creature or escape a losing battle, using this spell unprovoked
against a player character will earn the caster the label of KILLER.

Originally written by Jason Huang (god@sure.net). 
Revised by Siva (mud.aarchonmud.com:7000)
~ 

&&&&&& SOMEWHERE IN MAGIC.H:

DECLARE_SPELL_FUN(	spell_fear		);


&&&&&& AT THE BOTTOM OF MAGIC.C:

/* Revised by Siva (normativo@a*l.c*m) for ROM2.4b6 on 02/17/04	       */
/* Please email ideas for improvements or post your own revision of    */
/* this code. Based on:                                                */
/* Original Code by Jason Huang (god@sure.net).                        */
/* Permission to use this code is granted provided this header is      */
/* retained and unaltered.                                             */ 

void spell_fear( int sn, int level, CHAR_DATA *ch, void *vo, int target )
{
    CHAR_DATA *victim = (CHAR_DATA *) vo;
    ROOM_INDEX_DATA *in_room;
    EXIT_DATA *pexit;
    int door;
    
    if (       (victim == ch)
	|| (!victim->in_room)
	|| ( IS_SET( victim->in_room->room_flags, ROOM_SAFE      ) )
	|| ( IS_SET( victim->in_room->room_flags, ROOM_PRIVATE   ) )
	|| ( IS_SET( victim->in_room->room_flags, ROOM_SOLITARY  ) )
	|| ( IS_SET( victim->in_room->room_flags, ROOM_NO_RECALL ) )
	|| ( !IS_AWAKE( victim ) )
	|| ( victim->level >= level) 
	|| ( victim->in_room->area != ch->in_room->area )
    || (( IS_NPC( victim ) && saves_spell( level, victim, DAM_CHARM))))
    {
	send_to_char( "You failed to inspire fear.\n\r", ch );
	return;
    }

	check_killer (ch, victim);
    act ("$n scares the hell out of $N!", ch, NULL, victim,
         TO_NOTVICT);
    act ("$n scares the hell out of you!", ch, NULL, victim,
         TO_VICT);
    act ("You scare the hell out of $N!", ch, NULL, victim, TO_CHAR);
    
    if ((victim->fighting) == NULL)
	 {
       //this bit is "borrowed" from stock update.c, can be changed
       //to make fear more successful by always finding a
       //random exit.
       in_room = victim->in_room;
       for (door = 0; door < 6; door++)
       	 	{
		 if ( (number_bits (3) == 0)
	         && ((door = number_bits (5)) <= 5) 
                 && ((pexit = ch->in_room->exit[door]) != NULL)
                 && (pexit->u1.to_room != NULL)
                 && (!IS_SET (pexit->exit_info, EX_CLOSED))
                 && (!IS_SET (pexit->u1.to_room->room_flags, ROOM_NO_MOB))
                 && (!IS_SET (ch->act, ACT_STAY_AREA) || (pexit->u1.to_room->area == ch->in_room->area))
                 && (!IS_SET (ch->act, ACT_OUTDOORS) || !IS_SET (pexit->u1.to_room->room_flags, ROOM_INDOORS))
                 && (!IS_SET (ch->act, ACT_INDOORS)  || IS_SET (pexit->u1.to_room->room_flags, ROOM_INDOORS)))
       	
        		{
			     if (victim->position < POS_STANDING) do_stand(victim, NULL);
                 act ("$N runs for $S life!", ch, NULL, victim, TO_NOTVICT);
	             act ("You run in terror from $n!", ch, NULL, victim, TO_VICT);
      	         act ("$N flees from the sight of your indominable menace!", ch, NULL, victim, TO_CHAR);
        		move_char (victim, door, FALSE);
        		return;
        		}
		} 

            act ("But $N is too panicked to escape!", ch, NULL, victim, TO_NOTVICT);
            act ("But you are too panicked to escape!", ch, NULL, victim, TO_VICT);
            act ("But $N is too terrified to escape your wrath!", ch, NULL, victim, TO_CHAR);
            return;
              
       } 
    else do_flee( victim, "" );   
    return;
}