ASPELL(spell_fear)
{
  struct char_data *target = (struct char_data *) victim;
  struct char_data *next_target;
  int rooms_to_flee = 0;

  ACMD(do_flee);

  if (ch == NULL)
        return;

  send_to_char("You radiate an aura of fear into the room!\r\n", ch);
  act("$n is surrounded by an aura of fear!", TRUE, ch, 0, 0, TO_ROOM);

  for (target = world[ch->in_room].people; target; target = next_target) {
        next_target = target->next_in_room;

        if (target == NULL) 
	       return;
		
	if (target == ch)
	       continue;
		
	if (GET_LEVEL(target) >= LVL_IMMORT)
	       continue;
		
	if (mag_savingthrow(target, 1)) {
	       sprintf(buf, "%s is unaffected by the fear!\r\n", GET_NAME(target));
	       act(buf, TRUE, ch, 0, 0, TO_ROOM);
	       send_to_char("Your victim is not afraid of the likes of you!\r\n", ch);
	       if (IS_NPC(target))
		 hit(target, ch, TYPE_UNDEFINED);
	       }
               else {
		 for(rooms_to_flee = level / 10; rooms_to_flee > 0; rooms_to_flee--) {
		    send_to_char("You flee in terror!\r\n", target);
		    do_flee(target, "", 0, 0);
		 }
	       }
	}
}
