lurf/area/
lurf/build/testing/
lurf/log/
lurf/player/
lurf/player/backup/
/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/
#include <glib.h>

#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <merc.h>
#include <interp.h>
#include <tables.h>
#include <power.h>
#include <fight.h>
extern void show_spirit_rise args((CHAR_DATA *ch));
extern int find_path args(( int in_room_vnum, int out_room_vnum, CHAR_DATA *ch, int depth, int in_zone ));
extern bool    check_dumbshit  args( (char *command) );
extern void make_spirit args((CHAR_DATA *victim));


void power_witherlimb(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	OBJ_DATA  *obj;
	int       critical = number_range(1,4);

	act( "A look of concentration crosses $n's face.", ch, NULL, NULL, TO_ROOM );
	WAIT_STATE( ch, 12 );

	if ( is_safe(ch, victim) )
	{
		act("$n just failed to use Wither Limb on you.",ch,NULL,victim,TO_VICT);
		return;
	}

	if (IS_SWWF(ch) && number_percent() > 2 * get_breed(ch,BREED_METIS))
	{
		send_to_char("Nothing happens.\n\r",ch);
		act("$n just failed to use Wither Limb on you.",ch,NULL,victim,TO_VICT);
		return;
	}

	if (IS_VAMPIRE(ch) && number_percent() > 2 * get_disc(ch,DISC_THANATOSIS))
	{
		send_to_char("Nothing happens.\n\r",ch);
		act("$n just failed to use Wither Limb on you.",ch,NULL,victim,TO_VICT);
		return;
	}

	if (IS_MAGE(ch) && number_percent() > 2 * has_sphere(ch,SPHERE_LIFE))
	{
		send_to_char("Nothing happens.\n\r",ch);
		act("$n just failed to use Wither Limb on you.",ch,NULL,victim,TO_VICT);
		return;
	}

	if (IS_NPC(victim) && victim->level > 100)
	{
		send_to_char("They resist your attempt.\n\r",ch);
		return;
	}

	if (critical == 1)
	{
		if (IS_ARM_L(victim,LOST_ARM))
		{
			send_to_char( "Nothing happens.\n\r", ch );
			act("$n just failed to use Wither Limb on you.",ch,NULL,victim,TO_VICT);
			return;
		}

		SET_BIT(victim->loc_hp[2],LOST_ARM);
		if (IS_BLEEDING(victim,BLEEDING_HAND_L))
			REMOVE_BIT(victim->loc_hp[6],BLEEDING_HAND_L);
		send_to_char("Your left arm withers up and falls off!\n\r",victim);
		act("$n's left arm withers up and falls off!",victim,NULL,NULL,TO_ROOM);
		make_part(victim,"arm");
		if (IS_ARM_L(victim,LOST_ARM) && IS_ARM_R(victim,LOST_ARM))
		{
			if ((obj = get_eq_char( victim, WEAR_ARMS )) != NULL)
				take_item(victim,obj);
		}
		if ((obj = get_eq_char( victim, WEAR_HOLD )) != NULL)
			take_item(victim,obj);
		if ((obj = get_eq_char( victim, WEAR_HANDS )) != NULL)
			take_item(victim,obj);
		if ((obj = get_eq_char( victim, WEAR_WRIST_L )) != NULL)
			take_item(victim,obj);
		if ((obj = get_eq_char( victim, WEAR_FINGER_L )) != NULL)
			take_item(victim,obj);
		act("$n just used Wither Limb on you.",ch,NULL,victim,TO_VICT);
		if (IS_NPC(victim)) do_kill(victim,ch->name->str);
		return;
	}
	else if (critical == 2)
	{
		if (IS_ARM_R(victim,LOST_ARM))
		{
			send_to_char( "Nothing happens.\n\r", ch );
			act("$n just failed to use Wither Limb on you.",ch,NULL,victim,TO_VICT);
			return;
		}
		SET_BIT(victim->loc_hp[3],LOST_ARM);
		if (IS_BLEEDING(victim,BLEEDING_HAND_R))
			REMOVE_BIT(victim->loc_hp[6],BLEEDING_HAND_R);
		send_to_char("Your right arm withers up and falls off!\n\r",victim);
		act("$n's right arm withers up and falls off!",victim,NULL,NULL,TO_ROOM);
		make_part(victim,"arm");
		if (IS_ARM_L(victim,LOST_ARM) && IS_ARM_R(victim,LOST_ARM))
		{
			if ((obj = get_eq_char( victim, WEAR_ARMS )) != NULL)
				take_item(victim,obj);
		}
		if ((obj = get_eq_char( victim, WEAR_WIELD )) != NULL)
			take_item(victim,obj);
		if ((obj = get_eq_char( victim, WEAR_HANDS )) != NULL)
			take_item(victim,obj);
		if ((obj = get_eq_char( victim, WEAR_WRIST_R )) != NULL)
			take_item(victim,obj);
		if ((obj = get_eq_char( victim, WEAR_FINGER_R )) != NULL)
			take_item(victim,obj);
		act("$n just used Wither Limb on you.",ch,NULL,victim,TO_VICT);
		if (IS_NPC(victim)) do_kill(victim,ch->name->str);
		return;
	}
	else if (critical == 3)
	{
		if (IS_LEG_L(victim,LOST_LEG))
		{
			send_to_char( "Nothing happens.\n\r", ch );
			act("$n just failed to use Wither Limb on you.",ch,NULL,victim,TO_VICT);
			return;
		}
		SET_BIT(victim->loc_hp[4],LOST_LEG);
		if (IS_BLEEDING(victim,BLEEDING_FOOT_L))
			REMOVE_BIT(victim->loc_hp[6],BLEEDING_FOOT_L);
		send_to_char("Your left leg withers up and falls off!\n\r",victim);
		act("$n's left leg withers up and falls off!",victim,NULL,NULL,TO_ROOM);
		make_part(victim,"leg");
		if (IS_LEG_L(victim,LOST_LEG) && IS_LEG_R(victim,LOST_LEG))
		{
			if ((obj = get_eq_char( victim, WEAR_LEGS )) != NULL)
				take_item(victim,obj);
		}
		if ((obj = get_eq_char( victim, WEAR_FEET )) != NULL)
			take_item(victim,obj);
		act("$n just used Wither Limb on you.",ch,NULL,victim,TO_VICT);
		if (IS_NPC(victim)) do_kill(victim,ch->name->str);
		return;
	}
	else if (critical == 4)
	{
		if (IS_LEG_R(victim,LOST_LEG))
		{
			send_to_char( "Nothing happens.\n\r", ch );
			act("$n just failed to use Wither Limb on you.",ch,NULL,victim,TO_VICT);
			return;
		}
		SET_BIT(victim->loc_hp[5],LOST_LEG);
		if (IS_BLEEDING(victim,BLEEDING_FOOT_R))
			REMOVE_BIT(victim->loc_hp[6],BLEEDING_FOOT_R);
		send_to_char("Your right leg withers up and falls off!\n\r",victim);
		act("$n's right leg withers up and falls off!",victim,NULL,NULL,TO_ROOM);
		make_part(victim,"leg");
		if (IS_LEG_L(victim,LOST_LEG) && IS_LEG_R(victim,LOST_LEG))
		{
			if ((obj = get_eq_char( victim, WEAR_LEGS )) != NULL)
				take_item(victim,obj);
		}
		if ((obj = get_eq_char( victim, WEAR_FEET )) != NULL)
			take_item(victim,obj);
		act("$n just used Wither Limb on you.",ch,NULL,victim,TO_VICT);
		if (IS_NPC(victim)) do_kill(victim,ch->name->str);
		return;
	}
	send_to_char("Nothing happens.\n\r",ch);
	act("$n just failed to use Wither Limb on you.",ch,NULL,victim,TO_VICT);
	return;
}

void power_mother(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
    if (ch == victim)
    {
    	send_to_char( "You cannot use this power upon yourself.\n\r", ch );
    	return;
    }
	
    if (victim->hit < 10 || ch->hit < 10)
    {
        send_to_char("You feel this would be a bad time to touch them.\n\r",ch);
        return;
    }

    if (victim->loc_hp[6] > 0)
    {
    	int sn = skill_lookup( "clot" );
    	act( "You lay your hands upon $N.", ch, NULL, victim, TO_CHAR );
    	act( "$n's lays $s hands upon $N.", ch, NULL, victim, TO_NOTVICT );
    	act( "$n's lays $s hands upon you.", ch, NULL, victim, TO_VICT );
    	(*skill_table[sn].spell_fun) (sn,ch->level,ch,victim);
    }
    else
    {
    	if ((victim->loc_hp[0] + victim->loc_hp[1] + victim->loc_hp[2] +
    	    victim->loc_hp[3] + victim->loc_hp[4] + victim->loc_hp[5]) != 0)
    	{
    	    act( "You lay your hands upon $N.", ch, NULL, victim, TO_CHAR );
    	    act( "$n's lays $s hands upon $N.", ch, NULL, victim, TO_NOTVICT );
    	    act( "$n's lays $s hands upon you.", ch, NULL, victim, TO_VICT );
    	    reg_mend(victim);
    	}
    	else if (victim->hit < victim->max_hit)
    	{
    	    if (IS_SWWF(ch))
    	    	victim->hit += number_range(100,(get_auspice(ch, AUSPICE_THEURGE) * 1000 + get_tribe(ch, TRIBE_SHADOW_LORDS) * 1000) / 2);
    	    if (IS_MAGE(ch))
    			victim->hit += number_range(100,1000 * has_sphere(ch,SPHERE_LIFE));
    	    act( "You lay your hands upon $N.", ch, NULL, victim, TO_CHAR );
    	    act( "$n's lays $s hands upon $N.", ch, NULL, victim, TO_NOTVICT );
    	    act( "$n's lays $s hands upon you.", ch, NULL, victim, TO_VICT );
    	    update_pos(victim);
    	    if (victim->hit >= victim->max_hit)
    	    {
        		victim->hit = victim->max_hit;
        		send_to_char("You have been completely healed!\n\r",victim);
        		act("$n's wounds have been completely healed!",victim,NULL,NULL,TO_ROOM);
    	    }
	        else
	        {
		        send_to_char("Your wounds begin to heal!\n\r",victim);
		        act("$n's wounds begin to heal!",victim,NULL,NULL,TO_ROOM);
	        }
	    }
	    else
	    {   
	        send_to_char("They don't require any healing.\n\r",ch);
	        return;
	    }
    }
    act("$n just used Mother's Touch on you.",ch,NULL,victim,TO_VICT);
    WAIT_STATE( ch, 24 );
    return;
}

void power_clap(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
    int        trdamage = 0;
    SPHERE_DATA *paf;
	
	if (ch->pcdata->obeah > 0){
		char buf[MSL];
		
		sprintf(buf,"you cannot use this power for another %d minute(s)\n\r",ch->pcdata->obeah);
		send_to_char(buf,ch);
	}

	send_to_char( "You clap your hands together.\n\r", ch );
    act("$n claps $s hands together.",ch,NULL,NULL,TO_ROOM);

    if (IS_SWWF(ch))
        trdamage = get_tribe(ch, TRIBE_SHADOW_LORDS) * number_range(5,10);

    if (IS_MAGE(ch))
        trdamage = has_sphere(ch, SPHERE_FORCES) * number_range(5,10);

    if (ch->fighting != NULL)
    {
        send_to_char("Not while fighting.\n\r",ch);
        return;
    }
    //If there fighting make a check for it... willpower
    if (!IS_NPC(victim) && victim->pcdata->willpower >= number_range(1,25))
    {
        send_to_char("You resist somone's attempt to use clap on you.\n\r",victim);
        return;
    }

    send_to_char("The room reverberates with a huge roll of thunder!\n\r",victim);
    send_to_char("You clutch your head in agony as your eardrums seem to explode!\n\r",victim);
    act("$n clutches $s head in agony!",victim,NULL,NULL,TO_ROOM);
    act("$n just used Clap of Thunder on you.",ch,NULL,victim,TO_VICT);
    
    damage(ch,victim,trdamage,TYPE_BLAST);
    
    if (!IS_NPC(victim) && !IS_MAGE(victim) && IS_SET(victim->act, PLR_WIZINVIS))
    {
        REMOVE_BIT(victim->act, PLR_WIZINVIS);
        victim->invis_level = 0;
        send_to_char( "You slowly fade into existance.\n\r", victim );
        act("$n slowly fades into existance.",victim,NULL,NULL,TO_ROOM);
    }
    
    if (!IS_NPC(victim) && IS_MAGE(victim) && IS_SET(victim->act, PLR_WIZINVIS))
    {
        paf = find_spaffect(victim,PLR_WIZINVIS);
        sphere_remove(victim,paf);
        send_to_char( "You slowly fade into existance.\n\r", victim );
        act("$n slowly fades into existance.",victim,NULL,NULL,TO_ROOM);
    }
    update_pos(victim);

    victim->position = POS_STUNNED;
    send_to_char("You fall to the ground, stunned!\n\r",ch);
    act("$n falls to the ground, stunned!",victim,NULL,NULL,TO_ROOM);
    if (!IS_NPC(victim))
    	ch->pcdata->obeah = 5;
    return;
}

   
void power_fleshcraft(CHAR_DATA *ch, CHAR_DATA *victim, char *argument )
{
	char      arg [MAX_INPUT_LENGTH];
	
	argument = one_argument( argument, arg );
	
	if (IS_AFFECTED(ch,AFF_POLYMORPH) && !IS_VAMPAFF(ch,VAM_DISGUISED))
	{
		send_to_char( "Not while polymorphed.\n\r", ch );
		return;
	}
	
	if ( ch != victim)
	{
		if (!IS_NPC(victim))
		{
			send_to_char( "Not on Players's.\n\r", ch );
			return;
		}
	}
	
	if ( victim->level > 90 )
	{
		send_to_char( "You can only fleshcraft level 90 mobs and lower..\n\r", ch );
		return;
	}
	
	
	if ( ch == victim )
	{
		if (!IS_AFFECTED(ch,AFF_POLYMORPH) && !IS_VAMPAFF(ch,VAM_DISGUISED))
		{
			send_to_char( "You already look like yourself!\n\r", ch );
			return;
		}
		act("Your form shimmers and transforms into $N.",ch,NULL,victim,TO_CHAR);
		act("$N's form shimmers and transforms into %n.",ch,NULL,victim,TO_ROOM);
		REMOVE_BIT(ch->affected_by, AFF_POLYMORPH);
		REMOVE_BIT(ch->pcdata->stats[UNI_AFF], VAM_DISGUISED);
		ch->morph = g_string_assign(ch->morph,"");
		return;
	}
	if (IS_VAMPAFF(ch,VAM_DISGUISED))
	{
		act("Your form shimmers and transforms into a clone of $N.",ch,NULL,victim,TO_CHAR);
		act("$n's form shimmers and transforms into a clone of $N.",ch,NULL,victim,TO_NOTVICT);
		act("$N's form shimmers and transforms into a clone of you!",ch,NULL,victim,TO_VICT);
		ch->morph = g_string_assign(ch->morph,victim->short_descr->str);
		return;
	}
	act("Your form shimmers and transforms into a clone of $N.",ch,NULL,victim,TO_CHAR);
	act("$n's form shimmers and transforms into a clone of $N.",ch,NULL,victim,TO_NOTVICT);
	act("$n's form shimmers and transforms into a clone of you!",ch,NULL,victim,TO_VICT);
	SET_BIT(ch->affected_by, AFF_POLYMORPH);
	SET_BIT(ch->pcdata->stats[UNI_AFF], VAM_DISGUISED);
	ch->morph = g_string_assign(ch->morph,victim->short_descr->str);
	WAIT_STATE( ch, 24 );
    return;
}

void power_scream(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
    //char      buf[MAX_INPUT_LENGTH];
    int        tr_damage = 0;

    if (IS_SWWF(ch))
        tr_damage = get_tribe(ch,TRIBE_GET_OF_FENRIS) * 100;
    
    if (IS_CLASS(ch,CLASS_VAMPIRE) )
        tr_damage = get_disc(ch,DISC_MELPOMINEE) * 10;

    if ( victim == ch )
    {
        send_to_char( "You scream loudly at yourself!\n\r", ch );
        act("$n screams loudly at $mself!",ch,NULL,NULL,TO_ROOM);
        return;
    }
    else
    {
        act("You scream loudly at $N!",ch,NULL,victim,TO_CHAR);
        act("$n screams loudly at you!",ch,NULL,victim,TO_VICT);
        act("$n screams loudly at $N!",ch,NULL,victim,TO_NOTVICT);
    }

    if (IS_CLASS(ch,CLASS_TESTVAMP))
        tr_damage = get_disc(ch,DISC_MELPOMINEE) * number_range(100,200);
    
    if (IS_SWWF(ch))
        tr_damage = get_tribe(ch,TRIBE_GET_OF_FENRIS) * number_range(100,200);

    send_to_char("You clutch your head in agony as your eardrums seem to explode!\n\r",victim);
    act("$n clutches $s head in agony!",victim,NULL,NULL,TO_ROOM);
    
    damage(ch,victim,tr_damage,TYPE_BLAST);

    if (number_range(1,30) == 1)
    {
        victim->position = POS_STUNNED;
        send_to_char("You fall to the ground, stunned!\n\r",victim);
        act("$n falls to the ground, stunned!",victim,NULL,NULL,TO_ROOM);
        update_pos(victim);

    }
    
    return;
}

void power_truesight(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	SPHERE_DATA af;
	
	if (IS_CLASS(ch, CLASS_MAGE))
    {
        if (IS_SET(ch->act,PLR_HOLYLIGHT) )
            return;
        af.spell_number = mage_affect_slot("TrueSight");
        af.type      = TYPE_SPHERE_ACT;
        af.duration  = 10 * has_sphere(ch,SPHERE_CORRESPONDENCE);
        af.bitvector = PLR_HOLYLIGHT;
        sphere_to_char( ch, &af );
        send_to_char( mage_affect_table[mage_affect_slot("TrueSight")].on_msg, ch );
        return;
    }
	
    if ( IS_SET(ch->act, PLR_HOLYLIGHT) )
	{
		REMOVE_BIT(ch->act, PLR_HOLYLIGHT);
		send_to_char( "Your senses return to normal.\n\r", ch );
	}
	else
	{
		SET_BIT(ch->act, PLR_HOLYLIGHT);
		send_to_char( "Your senses increase to incredible proportions.\n\r", ch );
	}
	
    return;
}

void power_beckon(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
    char arg[MAX_INPUT_LENGTH];
    char buf[MAX_INPUT_LENGTH];
    CHAR_DATA *tvic;

    one_argument( argument, arg );

    if (arg[0] == '\0')
    {
		send_to_char("Please select the type of animal you which to summon.\n\r",ch);
		send_to_char("Choose from: Horse, Frog, Raven, Cat, Dog, Yak.\n\r",ch);
		return;
    }
	
    if (ch->pcdata->followers > 4)
    {
		send_to_char("Nothing happens.\n\r",ch);
		return;
    }
	
    strcpy(buf, "$N trots into the room." );
    if (!str_cmp(arg,"stallion") || !str_cmp(arg,"horse") || 
	!str_cmp(arg,"mount"))
    {
	ch->pcdata->followers++;
	tvic=create_mobile( get_mob_index( MOB_VNUM_MOUNT ) );
	tvic->level = 50;
	tvic->armor = -500;
	tvic->hitroll = 50;
	tvic->damroll = 50;
	tvic->hit = 5000;
	tvic->max_hit = 5000;
	tvic->name = g_string_assign(tvic->name,"mount black horse stallion");
	sprintf(buf,"%s's black stallion",ch->name->str);
	tvic->short_descr = g_string_assign(tvic->short_descr,buf);
	tvic->long_descr = g_string_assign(tvic->long_descr,"A beautiful black stallion stands here.\n\r");
	strcpy(buf, "$N trots into the room." );
    }
    else if (!str_cmp(arg,"frog"))
    {
		ch->pcdata->followers++;
		tvic=create_mobile( get_mob_index( MOB_VNUM_FROG ) );
		strcpy(buf, "$N hops into the room." );
    }
    else if (!str_cmp(arg,"raven"))
    {
		ch->pcdata->followers++;
		tvic=create_mobile( get_mob_index( MOB_VNUM_RAVEN ) );
		strcpy(buf, "$N flies into the room." );
    }
    else if (!str_cmp(arg,"dog"))
    {
		ch->pcdata->followers++;
		tvic=create_mobile( get_mob_index( MOB_VNUM_DOG ) );
    }
    else if (!str_cmp(arg,"cat"))
    {
		ch->pcdata->followers++;
		tvic=create_mobile( get_mob_index( MOB_VNUM_CAT ) );
    }
    else if (!str_cmp(arg,"molerat"))
    {
		ch->pcdata->followers++;
		tvic=create_mobile( get_mob_index( MOB_VNUM_MOLERAT ) );
    }
    else if (!str_cmp(arg,"yak"))
    {
		ch->pcdata->followers++;
		tvic=create_mobile( get_mob_index( MOB_VNUM_YAK ) );
    }
    else
    {
		send_to_char("Please select the type of animal you which to summon.\n\r",ch);
		send_to_char("Choose from: Horse, Frog, Raven, Cat, Dog, Yak.\n\r",ch);
		return;
    }
    tvic->lord = g_string_assign(tvic->lord,ch->name->str);
    char_to_room( tvic, ch->in_room );
    send_to_char("You whistle loudly.\n\r",ch);
    act( "$n whistles loudly.", ch, NULL, tvic, TO_ROOM );
    act( buf, ch, NULL, tvic, TO_CHAR );
    act( buf, ch, NULL, tvic, TO_ROOM );
    return;
}

void power_mask(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
     if ( IS_NPC(victim) )
     {
         send_to_char( "Not on NPC's.\n\r", ch );
         return;
     }

     if ( IS_IMMORTAL(victim) && victim != ch )
     {
         send_to_char( "You can only mask avatars or lower.\n\r", ch );
         return;
     }

     if ( ch == victim )
     {
         if (!IS_AFFECTED(ch,AFF_POLYMORPH) && !IS_VAMPAFF(ch,VAM_DISGUISED))
         {
             send_to_char( "You already look like yourself!\n\r", ch );
             return;
         }
         act("Your form shimmers and transforms into $N.",ch,NULL,victim,TO_CHAR);
         act("$n's form shimmers and transforms into $N.",ch,NULL,victim,TO_ROOM);
         REMOVE_BIT(ch->affected_by, AFF_POLYMORPH);
         REMOVE_BIT(ch->pcdata->stats[UNI_AFF], VAM_DISGUISED);
	ch->morph = g_string_assign(ch->morph,"");
         return;
     }
     if (IS_VAMPAFF(ch,VAM_DISGUISED))
     {
         act("Your form shimmers and transforms into a clone of $N.",ch,NULL,victim,TO_CHAR);
         act("$n's form shimmers and transforms into a clone of $N.",ch,NULL,victim,TO_NOTVICT);
         act("$n's form shimmers and transforms into a clone of you!",ch,NULL,victim,TO_VICT);
	ch->morph = g_string_assign(ch->morph,victim->name->str);
         return;
     }
     act("Your form shimmers and transforms into a clone of $N.",ch,NULL,victim,TO_CHAR);
     act("$n's form shimmers and transforms into a clone of $N.",ch,NULL,victim,TO_NOTVICT);
     act("$n's form shimmers and transforms into a clone of you!",ch,NULL,victim,TO_VICT);
     SET_BIT(ch->affected_by, AFF_POLYMORPH);
     SET_BIT(ch->pcdata->stats[UNI_AFF], VAM_DISGUISED);
     ch->morph = g_string_assign(ch->morph,victim->name->str);
     return;
}


void power_formillusion(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
    CHAR_DATA *original,*tvic;
    char      arg [MAX_INPUT_LENGTH];

    if (ch->pcdata->followers > 4)
    {
        send_to_char("Nothing happens.\n\r",ch);
        return;
    }

    if ( ( original = get_char_room( ch, arg ) ) == NULL )
    {
        send_to_char( "They aren't here.\n\r", ch );
        return;
    }

    if ( original->level > 200 )
    {
        send_to_char( "Nothing happens.\n\r", ch );
        return;
    }

    ch->pcdata->followers++;
    tvic=create_mobile( get_mob_index( MOB_VNUM_CLONE ) );
    char_to_room(tvic,get_room_index(ROOM_VNUM_DISCONNECTION));
    tvic->lord = g_string_assign(tvic->lord,ch->name->str);
    tvic->name = g_string_assign(tvic->name,original->name->str);
    if (IS_NPC(original))
	tvic->short_descr = g_string_assign(tvic->short_descr,original->short_descr->str);
    else
	tvic->short_descr = g_string_assign(tvic->short_descr,original->name->str);
    if (IS_NPC(original))
	original->long_descr = g_string_assign(original->long_descr,original->name->str);
    else
	tvic->long_descr = g_string_assign(tvic->long_descr,"");

    if (original->creature == CLASS_TESTVAMP)
        tvic->creature = CLASS_TESTVAMP;

    tvic->alignment = original->alignment;
    
    if (original->description->len > 1)
    {
	tvic->description = g_string_assign(tvic->description,original->description->str);
    }
    
    SET_BIT(tvic->act, ACT_NOPARTS);
    SET_BIT(tvic->added, ADDED_ILLUSION);
    
    if (IS_NPC(original)) 
        tvic->level = original->level;
    else 
        tvic->level = 50;
    
    tvic->hit = original->hit;
    tvic->max_hit = original->max_hit;
    tvic->mana = original->mana;
    tvic->max_mana = original->max_mana;
    tvic->move = original->move;
    tvic->max_move = original->max_move;
    tvic->hitroll = char_hitroll(original);
    tvic->damroll = char_damroll(original);
    tvic->armor = char_ac(original);
    
    char_from_room(tvic);
    char_to_room(tvic,original->in_room);

    send_to_char("A mirror image of you shimmers into existance.\n\r",original);
    act("A mirror image of $n appears in the room.",original,NULL,NULL,TO_ROOM);
    return;
}

void power_cloneobject(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
    OBJ_DATA *obj;
    OBJ_DATA *obj2;
    char      arg [MAX_INPUT_LENGTH];

    argument = one_argument( argument, arg );

    if ( ( obj = get_obj_carry( ch, arg ) ) == NULL )
    {
		send_to_char( "You are not carrying that object.\n\r", ch );
		return;
    }

    if (obj->questmaker->len > 1)
    {
	send_to_char( "You are unable to clone that object.\n\r", ch );
	return;
    }

    if (IS_SET(obj->extra_flags, ITEM_VANISH))
    {
	send_to_char( "You are unable to make illusions of illusions!\n\r", ch );
	return;
    }

    if (IS_SET(obj->quest, QUEST_RELIC) || IS_SET(obj->quest, QUEST_ARTIFACT))
    {
	send_to_char( "You are unable to clone that type of object.\n\r", ch );
	return;
    }

    if (obj->questowner->len > 1)
    {
	send_to_char( "You are unable to clone a claimed item.\n\r", ch );
	return;
    }

    if ( ch->carry_number + 1 > can_carry_n( ch ) )
    {
	send_to_char( "You cannot carry any more objects.\n\r", ch );
	return;
    }

    if ( ch->carry_weight + get_obj_weight( obj ) > can_carry_w( ch ) )
    {
	send_to_char( "You cannot carry that much weight.\n\r", ch );
	return;
    }

	if (IS_CLASS(ch, CLASS_VAMPIRE)) 
		ch->pcdata->condition[COND_THIRST] -= 20;
		

    if (( obj2 = create_object( obj->pIndexData, obj->level )) != NULL )
    {
	SET_BIT(obj2->extra_flags, ITEM_VANISH);
	obj2->timer = (get_disc(ch,DISC_CHIMERSTRY) * 5);
	obj2->cost = 0;
	switch (obj2->item_type)
	{
	    default:
		obj2->value[0] = obj->value[0];
		obj2->value[1] = obj->value[1];
		obj2->value[2] = obj->value[2];
		obj2->value[3] = obj->value[3];
		break;
	    case ITEM_WAND:
	    case ITEM_STAFF:
	    case ITEM_SCROLL:
	    case ITEM_POTION:
	    case ITEM_PILL:
		obj2->value[0] = 0;
		obj2->value[1] = 0;
		obj2->value[2] = 0;
		obj2->value[3] = 0;
		break;
	}
	obj_to_char(obj2, ch);
	act("An exact duplicate of $p appears in your hands.",ch,obj,NULL,TO_CHAR);
	act("An exact duplicate of $p appears in $n's hands.",ch,obj,NULL,TO_ROOM);
    }
    else
	send_to_char( "Bug - please inote Spiral or Dominion.\n\r", ch );
    return;
}

void power_web(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	int sn;
	int level;
	int spelltype;
	
	if ( ( sn = skill_lookup( "web" ) ) < 0 ) return;
	spelltype = skill_table[sn].target;
	level = (int)((double)ch->spl[spelltype] * 0.25);
	(*skill_table[sn].spell_fun) ( sn, level, ch, victim );
    return;
}

void power_readaura(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	OBJ_DATA  *obj;
	char      arg [MAX_INPUT_LENGTH];
	char      buf [MAX_INPUT_LENGTH];
	char      buf2 [MAX_INPUT_LENGTH];
	sh_int    count;
	
    one_argument(argument,arg);
	
    if ( victim == NULL )
	{
		if ( ( obj = get_obj_carry( ch, arg ) ) == NULL )
		{
			send_to_char( "Read the aura on what?\n\r", ch );
			return;
		}
		act("$n examines $p intently.",ch,obj,NULL,TO_ROOM);
		spell_identify( skill_lookup( "identify" ), ch->level, ch, obj );
		return;
	}
	
		if (!IS_NPC(victim) && IS_IMMUNE(victim,IMM_SHIELDED) && !IS_ITEMAFF(ch, ITEMA_VISION))
	{
		send_to_char("You are unable to read their aura.\n\r",ch);
		return;
	}
	
	if (!IS_NPC(victim) && IS_SET(victim->sphere_spaffect,AFSPHERE_SHIELD) && !IS_ITEMAFF(ch, ITEMA_VISION))
	{
		send_to_char("You are unable to read their aura.\n\r",ch);
		return;
	}
	
	act("$n examines $N intently.",ch,NULL,victim,TO_NOTVICT);
	act("$n examines you intently.",ch,NULL,victim,TO_VICT);
	if (IS_NPC(victim)) sprintf(buf, "%s is an NPC.\n\r",victim->short_descr->str);
	else 
	{
		if      (victim->level == 12) sprintf(buf, "%s is an Implementor.\n\r", victim->name->str);
		else if (victim->level == 11) sprintf(buf, "%s is a High Judge.\n\r", victim->name->str);
		else if (victim->level == 10) sprintf(buf, "%s is a Judge.\n\r", victim->name->str);
		else if (victim->level == 9 ) sprintf(buf, "%s is an Enforcer.\n\r", victim->name->str);
		else if (victim->level == 8 ) sprintf(buf, "%s is a Quest Maker.\n\r", victim->name->str);
		else if (victim->level == 7 ) sprintf(buf, "%s is a Builder.\n\r", victim->name->str);
		else if (victim->level >= 3 ) sprintf(buf, "%s is an Avatar.\n\r", victim->name->str);
		else sprintf(buf, "%s is a Mortal.\n\r", PERS(victim,ch));
	}
	send_to_char(buf,ch);
	if (!IS_NPC(victim))
	{
		sprintf(buf,"Str:%d, Int:%d, Wis:%d, Dex:%d, Con:%d.\n\r",get_curr_str(victim),get_curr_int(victim),get_curr_wis(victim),get_curr_dex(victim),get_curr_con(victim));
		send_to_char(buf,ch);
	}
	sprintf(buf,"Hp:%d/%d, Mana:%d/%d, Move:%d/%d.\n\r",victim->hit,victim->max_hit,victim->mana,victim->max_mana,victim->move,victim->max_move);
	send_to_char(buf,ch);
	if (!IS_NPC(victim)) sprintf(buf,"Hitroll:%d, Damroll:%d, AC:%d.\n\r",char_hitroll(victim),char_damroll(victim),char_ac(victim));
	else sprintf(buf,"AC:%d.\n\r",char_ac(victim));
	send_to_char(buf,ch);
	if (!IS_NPC(victim))
	{
		sprintf(buf,"Status:%d, ",victim->race);
		send_to_char(buf,ch);
		if (IS_CLASS(victim, CLASS_VAMPIRE))    
		{
			sprintf(buf,"Blood:%d, ",victim->pcdata->condition[COND_THIRST]);
			send_to_char(buf,ch);
		}
	}
	sprintf(buf,"Alignment:%d.\n\r",victim->alignment);
	send_to_char(buf,ch);
	if (!IS_NPC(victim) && IS_EXTRA(victim, EXTRA_PREGNANT))
		act("$N is pregnant.",ch,NULL,victim,TO_CHAR);
	if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_VAMPIRE))    
	{
		send_to_char("Disciplines:",ch);
		for ( count = 0 ; count < MAX_DISC ; count++ )
		{
			if ( get_disc(victim,count) > 0 )
			{
				sprintf(buf2, " %s %d ", discipline_table[count].name, get_disc(victim,count));
				strcat(buf, buf2);
			}
		}
		/*buf[strlen(buf)] = '.';  hack off the final comma, replace it with a period. */
		send_to_char(buf,ch);
		send_to_char("\n\r",ch);
	}
    return;
}

void power_beastwithin(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
    if (IS_NPC(victim))
    {
		send_to_char("But they have no beast to call forth!\n\r",ch);
		return;
    }
    
    if (!IS_SWWF(victim) && !IS_CLASS(victim,CLASS_VAMPIRE) && !IS_CLASS(victim,CLASS_WEREWOLF))
    {
    	send_to_char("But they have no beast to call forth!\n\r",ch);
		return;
    }
    
    if (IS_SWWF(victim) && ((victim->pcdata->rage_points * 100 / get_max_rage(victim)) > 50))
    {
		send_to_char("Their beast is already controlling them.\n\r",ch);
		return;
    }

    if ( (IS_CLASS(victim,CLASS_WEREWOLF) && victim->pcdata->stats[UNI_RAGE] > 90))
    {
		if (ch == victim)
	    	send_to_char("Your beast is already controlling you.\n\r",ch);
		else
	    	send_to_char("Their beast is already controlling them.\n\r",ch);
  		return;
    }
	
	if ( (IS_CLASS(victim,CLASS_VAMPIRE) && victim->pcdata->stats[UNI_RAGE] > 90))
    {
		if (ch == victim)
	    	send_to_char("Your beast is already controlling you.\n\r",ch);
		else
	    	send_to_char("Their beast is already controlling them.\n\r",ch);
  		return;
    }
	
	if ( IS_CLASS(victim,CLASS_WEREWOLF) && (victim->pcdata->stats[UNI_RAGE] < 5 || (IS_CLASS(victim, CLASS_VAMPIRE) && get_disc(victim,DISC_ANIMALISM) > 6)) )
    {
		if (ch == victim)
	    	send_to_char("You have too much control over your beast to use Beast Within.\n\r",ch);
		else
	    	send_to_char("They have too much control over their beast to use Beast Within on.\n\r",ch);
   		return;
    }
	
	if (victim->pcdata->willpower >= number_range(10,30))
    {
		send_to_char("You failed.\n\r",ch);
		return;
    }

	if (IS_CLASS(victim,CLASS_VAMPIRE) && get_disc(victim,DISC_PROTEAN) > 0 && 
	!IS_VAMPAFF(victim, VAM_NIGHTSIGHT) ) power_nightsight(victim,victim,"");
    if (IS_CLASS(victim,CLASS_VAMPIRE) && !IS_VAMPAFF(victim, VAM_FANGS)) power_fangs(victim,victim,"");
    if (IS_CLASS(victim,CLASS_VAMPIRE) && get_disc(victim,DISC_PROTEAN) > 1 && 
	!IS_VAMPAFF(victim, VAM_CLAWS) ) power_claws(victim,victim,"");
    if (IS_CLASS(victim,CLASS_WEREWOLF))
    {
		victim->pcdata->stats[UNI_RAGE] = number_range(150,200);
		do_werewolf(victim,"");
    }
    else if (IS_CLASS(victim,CLASS_VAMPIRE))
    {
	    if (victim->beast > 0) do_beastlike(victim,"");
		send_to_char("You bare yours fangs and growl as your inner beast consumes you.\n\r",victim);
		act("$n bares $s fangs and growls as $s inner beast consumes $m.",victim,NULL,NULL,TO_ROOM);
 		victim->pcdata->stats[UNI_RAGE] += number_range(10,20);
    }
	else if (IS_SWWF(victim))
	   victim->pcdata->rage_points += number_range(50,100);	
    
    return;
}

void power_moon_bridge(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	if ( victim == ch
		||   victim->in_room == NULL
		||   IS_NPC(ch)
		||   victim->level > 50
		||   (!IS_NPC(victim) && !IS_IMMUNE(victim, IMM_SUMMON) )
		||   IS_SET(ch->in_room->room_flags, ROOM_PRIVATE)
		||   IS_SET(ch->in_room->room_flags, ROOM_SOLITARY)
		||   IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL)
		||   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)
		||   victim->in_room->vnum == 1
		||   victim->in_room->vnum == 2
		||   victim->in_room->vnum == 1200
		||   (ch->pk_timer > 0 && is_tempsafe(ch)) 
		||   ( strstr(victim->in_room->area->builders, "Unlinked" ) )
		||   victim->in_room->vnum == ch->in_room->vnum)
	{
		send_to_char( "You failed.\n\r", ch );
		return;
	}
	
	send_to_char("You pray to the moon and start to walk.\n\r",ch);
	char_from_room( ch );
	char_to_room( ch, victim->in_room );
	
	do_look( ch,"auto");
	act( "In a flash $n appears in front of $N.", ch, NULL, victim, TO_NOTVICT );
	act( "In a flash $n appears in front of you.", ch, NULL, victim, TO_VICT );
    return;
}

bool can_becommanded(CHAR_DATA *ch, CHAR_DATA *victim, char *action){

	if (!check_dumbshit(action))
	{
		send_to_char( "I think not.\n\r", ch );
		return FALSE;
	}

	if (!can_see(victim,ch))
	{
		if (!IS_SET(ch->act,PLR_HOLYLIGHT))
		{
			send_to_char( "You are unable to make eye contact with them.\n\r", ch );
			return FALSE;
		}
	}

	if (IS_NPC(victim) && victim->level > 50){
		send_to_char("They resist your charms.\n\r",ch);
		return FALSE;
	}

	if (!IS_NPC(victim) && IS_SET(victim->pcdata->comm, COMM_MIND_BLOCK))
		return FALSE;

	if (IS_IMMORTAL(victim))
		return FALSE;

	if (victim->position == POS_FIGHTING){
		send_to_char("They are too busy to listen to you.\n\r",ch);
		return FALSE;
	}

	if (ch->fighting != NULL)
	{
		send_to_char("Not while fighting!\n\r",ch);
		return FALSE;
	}

	if (is_inpref(action,"|quit*escape*dissolve*greet*meet*garou*vampire*mage*trait*throw*token*zuluform*serpentis*change*mist*essence*train*rem*del*cons*drop*gift*claim*consent*meet*greet*propose*vampi*ma*maj*sid*side*reca*/*ha*hav*"))
	{
		send_to_char( "I think not.\n\r", ch );
		return FALSE;
	}

	if (!IS_NPC(victim) && strlen(victim->pcdata->conding) > 2 && 
			!str_cmp(victim->pcdata->conding,ch->name->str))
	{
		act("Your Boss Wouldn't like that.",victim,NULL,ch,TO_CHAR);
		act("$n shakes of $N's suggestion as thier boss wouldn't like it.",victim,NULL,ch,TO_NOTVICT);
		act("$n shakes off your suggestion with thier willpower.",victim,NULL,ch,TO_VICT);
		return FALSE; 

	}

	if (!IS_SET(victim->sphere_spaffect,AFSPHERE_TAINTED) && !IS_ADDED(victim, ADDED_LOYAL))
	{

		if (!IS_NPC(victim) && victim->pcdata->willpower >= number_range(1,30))
		{
			act("You shake off $N's suggestion with your willpower.",victim,NULL,ch,TO_CHAR);
			act("$n shakes off $N's suggestion with thier willpower.",victim,NULL,ch,TO_NOTVICT);
			act("$n shakes off your suggestion with thier willpower.",victim,NULL,ch,TO_VICT);
			return FALSE; 
		}
	}
	
	return TRUE;
}

void command_victim(CHAR_DATA *ch, CHAR_DATA *victim, char *action){

	char buf[MAX_STRING_LENGTH];

	if (IS_NPC(victim))
		sprintf( buf, "I think %s wants to %s", victim->short_descr->str, action );
	else if (!IS_NPC(victim) && IS_AFFECTED(victim, AFF_POLYMORPH))
		sprintf( buf, "I think %s wants to %s", victim->morph->str, action );
	else
		sprintf( buf, "I think %s wants to %s", victim->name->str, action );

	do_say(ch,buf);
	WAIT_STATE(ch,24);

	act("You blink in confusion.",victim,NULL,NULL,TO_CHAR);
	act("$n blinks in confusion.",victim,NULL,NULL,TO_ROOM);
	strcpy(buf,"Yes, you're right, I do...");
	do_say(victim,buf);
	if (IS_NPC(victim)) SET_BIT(victim->act, ACT_COMMANDED);
	interpret( victim, action );
	if (IS_NPC(victim)) REMOVE_BIT(victim->act, ACT_COMMANDED);
	
}

void power_command(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	char action[MAX_INPUT_LENGTH];

	smash_quote(argument);


	if ( argument[0] == '\0' )
	{
		send_to_char( "Command whom to do what?\n\r", ch );
		return;
	}

	one_argument(argument,action);

	if (!can_becommanded(ch,victim,action))
		return;

	command_victim(ch,victim,argument);		

	return;
}

void power_condition(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
    if ( IS_NPC(victim) )
    {
        send_to_char( "Not on NPC's.\n\r", ch );
        return;
    }

    if (!IS_NPC(victim) && IS_SET(victim->pcdata->comm, COMM_MIND_BLOCK))
        return;

    if (!can_see(victim,ch))
    {
        if (!IS_SET(ch->act,PLR_HOLYLIGHT) && IS_CLASS(ch,CLASS_VAMPIRE) && get_disc(ch,DISC_DOMINATE) < 6)
        {
            send_to_char( "You are unable to make eye contact with them.\n\r", ch );
            return;
        }
    }

    act("You stare deeply into $N's eyes.",ch,NULL,victim,TO_CHAR);
    act("$n stares deeply into $N's eyes.",ch,NULL,victim,TO_NOTVICT);
    act("$n stares deeply into your eyes.",ch,NULL,victim,TO_VICT);

    if (strlen(victim->pcdata->conding) > 2 && 
        !str_cmp(victim->pcdata->conding,ch->name->str))
    {
        victim->pcdata->conding = g_strdup( "" );
        REMOVE_BIT(victim->added, ADDED_LOYAL);
        act("You remove $N's conditioning.",ch,NULL,victim,TO_CHAR);
        act("$n removes your conditioning.",ch,NULL,victim,TO_VICT);
        return;
    }

    if (!IS_NPC(victim) && IS_CLASS(victim,CLASS_VAMPIRE) && victim->pcdata->stats[UNI_GEN] < ch->pcdata->stats[UNI_GEN])
    {
        act("You shake off $N's attempt to Condition you.",victim,NULL,ch,TO_CHAR);
        act("$n shakes off $N's attempt to Condition $m.",victim,NULL,ch,TO_NOTVICT);
        act("$n shakes off your attempt to Condition $m.",victim,NULL,ch,TO_VICT);
        act("$s mind is too strong to overcome.",victim,NULL,ch,TO_VICT);
        return;
    }

    if (!IS_NPC(victim) && ((victim->pcdata->willpower >= number_range(2,30) && 
                             IS_ADDED(victim, ADDED_LOYAL)) || victim->pcdata->willpower >= number_range(5,30)) &&
        strlen(victim->pcdata->conding) > 1)
    {
        act("You shake off $N's attempt to Condition you.",victim,NULL,ch,TO_CHAR);
        act("$n shakes off $N's attempt to Condition $m.",victim,NULL,ch,TO_NOTVICT);
        act("$n shakes off your attempt to Condition $m.",victim,NULL,ch,TO_VICT);
        return;
    }

    if (!IS_NPC(victim) &&  victim->pcdata->willpower >= number_range(1,20))
    {
        act("You shake off $N's attempt to Condition you.",victim,NULL,ch,TO_CHAR);
        act("$n shakes off $N's attempt to Condition $m.",victim,NULL,ch,TO_NOTVICT);
        act("$n shakes off your attempt to Condition $m.",victim,NULL,ch,TO_VICT);
        return;
    }

    if (strlen(victim->pcdata->conding) > 1)
    {
        victim->pcdata->conding = g_strdup( "" );
        REMOVE_BIT(victim->added, ADDED_LOYAL);
        act("You remove $N's conditioning.",ch,NULL,victim,TO_CHAR);
        act("$n removes your conditioning.",ch,NULL,victim,TO_VICT);
        return;
    }

    victim->pcdata->conding = g_strdup( ch->name->str );
    REMOVE_BIT(victim->added, ADDED_LOYAL);
    act("You condition $N's mind.",ch,NULL,victim,TO_CHAR);
    act("$n conditions your mind.",ch,NULL,victim,TO_VICT);
    return;
}

void power_serenity(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	if ( ch->fighting != NULL )
	{
		send_to_char("Not when your fighting someone!\n\r",ch);
	}

	//
	//Need to find a better wolfman then = PLR_WOLFMAN :P
	if (IS_NPC(victim))
	{
		send_to_char("They have no beast to suppress!\n\r",ch);
		return;
	}

	if (!IS_CLASS(victim,CLASS_VAMPIRE) && !IS_CLASS(victim, CLASS_WEREWOLF) && !IS_SWWF(victim))
	{
		send_to_char("They have no beast to suppress!\n\r",ch);
		return;
	}

	if ((IS_CLASS(victim,CLASS_VAMPIRE) 
				|| IS_CLASS(victim,CLASS_WEREWOLF)) 
			&& victim->pcdata->stats[UNI_RAGE] < 1 )
	{
		if (ch == victim)
			send_to_char("But your beast is not controlling you.\n\r",ch);
		else
			send_to_char("But their beast is not controlling them.\n\r",ch);

		return;
	}

	if ( IS_CLASS(ch,CLASS_VAMPIRE) && get_disc(victim,DISC_ANIMALISM) > 7 )
	{
		if (ch == victim)
			send_to_char("You have too much control over your beast to use Song of Serenity.\n\r",ch);
		else
			send_to_char("They have too much control over their beast to use Song of Serenity on.\n\r",ch);
		return;
	}

	if ( IS_ITEMAFF(victim, ITEMA_RAGER) )
	{
		send_to_char("You failed.\n\r",ch);
		return;
	}

	if (victim->pcdata->willpower > number_range(10,30))
	{
		send_to_char("You failed.\n\r",ch);
		return;
	}

	send_to_char("You take a deep breath and force back your inner beast.\n\r",victim);
	act("$n takes a deep breath and forces back $s inner beast.",victim,NULL,NULL,TO_ROOM);

	if (IS_CLASS(victim,CLASS_VAMPIRE) || IS_CLASS(victim,CLASS_WEREWOLF))
		victim->pcdata->stats[UNI_RAGE] -= 10;

	return;
}

void power_confuse(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	if (IS_SET(victim->added,ADDED_CONFUSE) )
		return;	

	SET_BIT(victim->added, ADDED_CONFUSE);

	if (IS_CLASS(ch,CLASS_VAMPIRE))
	{
		act("$N looks a little confused?",ch,NULL,victim,TO_ROOM);
		act("$N looks a little confused?",ch,NULL,victim,TO_CHAR);
		act("You look a little confused?",ch,NULL,victim,TO_VICT);
	}
	else
	{
		act("$N looks a little confused from the madness.",ch,NULL,victim,TO_ROOM);
		act("$N looks a little confused from the madness.",ch,NULL,victim,TO_CHAR);
		act("You look a little confused from madness.",ch,NULL,victim,TO_VICT);	
	}

	return;
}

void power_scry(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	ROOM_INDEX_DATA *chroom;
	ROOM_INDEX_DATA *victimroom;

	if (!knows_char(ch,victim))
	{
		send_to_char( "They aren't here.\n\r", ch );
		return;
	}	

	if (!IS_NPC(victim) && IS_IMMUNE(victim,IMM_SHIELDED) && !IS_ITEMAFF(ch, ITEMA_VISION))
	{
		send_to_char("You are unable to locate them.\n\r",ch);
		return;
	}

	if (!IS_NPC(victim) && get_tribe(victim,TRIBE_SHADOW_LORDS) > 0 )
	{
		send_to_char("They have a aura of confidence around them. You cannot breach it.\n\r",ch);
		return;
	}

	if (!IS_NPC(victim) && IS_SET(victim->sphere_spaffect,AFSPHERE_SHIELD) && !IS_ITEMAFF(ch, ITEMA_VISION))
	{
		send_to_char("You are unable to locate them.\n\r",ch);
		return;
	}
	chroom = ch->in_room;
	victimroom = victim->in_room;

	char_from_room(ch);
	char_to_room(ch,victimroom);

	do_look(ch,"auto");
	char_from_room(ch);
	char_to_room(ch,chroom);

	return;
}

void power_insane(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	SPHERE_DATA af;
	
	if (IS_SET(victim->added,ADDED_INSANE) )
	{
		send_to_char("They are already insane enough!\n\r",ch);
		return;	
	}
	
	af.spell_number = mage_affect_slot("Insane");
	af.type      = TYPE_SPHERE_ADDED;
	af.duration  = get_disc(ch,DISC_DEMENTATION);
	af.bitvector = ADDED_INSANE;
	sphere_to_char( victim, &af );
	send_to_char( mage_affect_table[mage_affect_slot("Insane")].on_msg, ch );
	WAIT_STATE( ch, 24 );
	
	act("$N starts to blabber about a small rabbit and drool madly.",ch,NULL,victim,TO_ROOM);
	act("Everything becomes clear to you, all the people around you are insane.",ch,NULL,victim,TO_VICT);
	
    return;
}

void power_spirit_sight(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	SPHERE_DATA af;

	if (IS_CLASS(ch,CLASS_MAGE))
	{
		if (IS_SET(ch->sight, SIGHT_SPIRIT))
			return;

		af.spell_number = mage_affect_slot("Spiritsight");
		af.type      = TYPE_SIGHT;
		af.duration  = 10 * has_sphere(ch,SPHERE_SPIRIT);
		af.bitvector = SIGHT_SPIRIT;
		sphere_to_char( ch, &af );
		send_to_char( mage_affect_table[mage_affect_slot("Spiritsight")].on_msg, ch );
		return;
	}
	/**
	 * FIXME: must remove the full spaffect not just the bit..
	 */
	if (IS_SET(ch->sight,SIGHT_SPIRIT) )
	{
		send_to_char("You can no longer see between planes.\n\r",ch);
		REMOVE_BIT(ch->sight, SIGHT_SPIRIT);
		return;
	}
	send_to_char("You can now see the spirit planes.\n\r",ch);
	SET_BIT(ch->sight, SIGHT_SPIRIT);
	return;
}

void power_haunt(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	SPHERE_DATA af;
	
	if (IS_SET(victim->added,ADDED_HAUNT) )
	{
		send_to_char("Several hundred more ghosts can't make them any more haunted.\n\r",ch);
		return;	
	}
	
	if (IS_SWWF(ch))
		send_to_char("You start to dreamspeak in to thier dreams and start haunting them!\n\r",ch);
	
	af.spell_number = mage_affect_slot("Haunt");
	af.type      = TYPE_SPHERE_ADDED;
	af.duration  = get_disc(ch,DISC_DEMENTATION);
	af.bitvector = ADDED_HAUNT;
	sphere_to_char( victim, &af );
	if (IS_CLASS(ch,CLASS_VAMPIRE))
		send_to_char( mage_affect_table[mage_affect_slot("Haunt")].on_msg, ch );
	
	act("$N starts to look around like they see something you don't.",ch,NULL,victim,TO_ROOM);
	act("You start to feel haunted.",ch,NULL,victim,TO_VICT);
    return;
}
void power_summon_spirit(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
    CHAR_DATA *familiar;

	familiar = create_mobile(get_mob_index(MOB_VNUM_RESTLESS_SPIRIT));

	familiar->level = ch->level / 10;	
	familiar->max_hit = ch->max_hit / 10;
	familiar->mana = ch->mana / 10;
	show_spirit_rise(ch);
	familiar->plane = PLANE_SPIRIT;

	SET_BIT(familiar->mob_con, MOBCON_NICE_SPIRIT);

	char_to_room(familiar,ch->in_room);
	
    ch->pcdata->familiar = familiar;
    familiar->wizard = ch;
    
    if ( !IS_NPC(victim) )
    {
    	send_to_char( "Not on players.\n\r", ch );
    	return;
    }
	
    act("Your summons worked as you look through $N's eyes.",ch,NULL,victim,TO_CHAR);
    return;
}

void power_shadowplane( CHAR_DATA *ch, CHAR_DATA *victim, char *argument )
{
	OBJ_DATA *obj;
	SPHERE_DATA af;
	char arg[MSL];

	one_argument(argument,arg);

	if (ch->fighting != NULL)
	{
		send_to_char("Not while fighting.\n\r",ch);
		return;
	}

	if(IS_CLASS(ch,CLASS_MAGE))
	{

		if (ch->plane == PLANE_SHADOW)
			return;

		af.spell_number = mage_affect_slot("Shadowplane");
		af.type      = TYPE_PLANE;
		af.duration  = 10 * has_sphere(ch,SPHERE_SPIRIT);
		af.bitvector = PLANE_SHADOW;
		sphere_to_char( ch, &af );
		send_to_char( mage_affect_table[mage_affect_slot("Shadowplane")].on_msg, ch );
		send_to_char("You fade into the plane of shadows.\n\r",ch);
		act("The shadows flicker and swallow up $n.",ch,NULL,NULL,TO_ROOM);
		do_look(ch,"auto");
		shift_obj_plane(ch);
		return;
	}
	if ( arg[0] == '\0' )
	{
		if (ch->plane == PLANE_NORMAL)
		{
			send_to_char("You fade into the plane of shadows.\n\r",ch);
			act("The shadows flicker and swallow up $n.",ch,NULL,NULL,TO_ROOM);
			ch->plane = PLANE_SHADOW;
			do_look(ch,"auto");
			shift_obj_plane(ch);
			return;
		}
		ch->plane = PLANE_NORMAL;
		send_to_char("You fade back into the real world.\n\r",ch);
		act("The shadows flicker and $n fades into existance.",ch,NULL,NULL,TO_ROOM);
		do_look(ch,"auto");
		shift_obj_plane(ch);
		return;
	}

	if ( ( obj = get_obj_here( ch, arg ) ) == NULL )
	{
		send_to_char( "What do you wish to toss into the shadow plane?\n\r", ch );
		return;
	}

	return;
}

void power_vanish( CHAR_DATA *ch, CHAR_DATA *victim, char *argument )
{
	SPHERE_DATA af;

	if (IS_CLASS(ch,CLASS_MAGE))
	{
		if (IS_SET(ch->act, PLR_WIZINVIS))
		{
			send_to_char("You are already Vanished!\n\r",ch);
			return;
		}
		af.spell_number = mage_affect_slot("Vanish");
		af.type      = TYPE_SPHERE_ACT;
		af.duration  = 10 * has_sphere(ch,SPHERE_CORRESPONDENCE);
		af.bitvector = PLR_WIZINVIS;
		ch->invis_level = ch->level;
		sphere_to_char( ch, &af );
		send_to_char( mage_affect_table[mage_affect_slot("Vanish")].on_msg, ch );
		return;
	}

	if ( IS_SET(ch->act, PLR_WIZINVIS) )
	{
		if ( ch->pk_timer > 3 )
		{
			send_to_char("Not with a combat timer greater then 3!\n\r",ch);
			return;
		}
		REMOVE_BIT(ch->act, PLR_WIZINVIS);
		ch->invis_level = 0;
		send_to_char( "You slowly fade into existance.\n\r", ch );
		act("$n slowly fades into existance.",ch,NULL,NULL,TO_ROOM);
	}
	else
	{
		ch->invis_level = ch->level;
		send_to_char( "You slowly fade out of existance.\n\r", ch );
		act("$n slowly fades out of existance.",ch,NULL,NULL,TO_ROOM);
		SET_BIT(ch->act, PLR_WIZINVIS);
	}
	return;
}


void power_zombie(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	OBJ_DATA *obj;

	/*
	 * Look for a corpse perferably on the ground.. and a npc
	 */
	for (obj = ch->in_room->contents; obj != NULL; obj = obj->next_content){

		if (obj->item_type == ITEM_CORPSE_NPC)
			create_zombie(obj);
	}

	send_to_char("Corpse not found!\n\r",ch);
	return;
}

void power_steal_soul(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	char arg[MSL];
	
	one_argument(argument,arg);
	
	if ((victim = get_char_room(ch,arg)) == NULL){
		send_to_char("There not here.\n\r",ch);
		return;
	}
	  	
	if (IS_NPC(ch))
		return;
		
	if (!IS_NPC(victim)){
		send_to_char("Not on players.\n\r",ch);
		return;
	}

	if (victim->level > 100){
		send_to_char("They resist your powers.\n\r",ch);
		return;
	}

	if (number_range(1,100) > 75){
		send_to_char("They resist your powers.\n\r",ch);
		return;
	}

	make_spirit(victim);
	ch->pcdata->familiar = victim;
	victim->wizard = ch;
	SET_BIT(victim->act,ACT_SENTINEL);
	do_say(victim,"As you command.");
	raw_kill(victim);
	send_to_char("OK\n\r",ch);
	return;
}

void power_compel(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
	char action[MAX_INPUT_LENGTH];

	smash_quote(argument);

	if ( argument[0] == '\0' )
	{
		send_to_char( "Command whom to do what?\n\r", ch );
		return;
	}

	one_argument(argument,action);

	if (!IS_SET(victim->affected_by,AFF_GHOST) && victim->plane != PLANE_SPIRIT){
		send_to_char("You can only compel spirits, Wraiths or Ghosts.\n\r",ch);
		return;	
	}

	if (!can_becommanded(ch,victim,action))
		return;

	command_victim(ch,victim,argument);		

	return;
}

/* 
 * Real tricky power, I need to check for the object on person, on floor or on other person
 * then we get to figure out how long it's stopped for
 */

void power_freeze_object(CHAR_DATA *ch, CHAR_DATA *victim, char *argument){
	char arg[MSL];
	char arg2[MSL];
	OBJ_DATA *obj = NULL;

	argument = one_argument(argument,arg);
	argument = one_argument(argument,arg2);

	if (arg[0] == '\0'){
		send_to_char("Syntax: freezeobj (object) (Victim - Optional)\n\r",ch);
		return;
	}

	if (arg2[0] == '\0'){
		obj = get_obj_carry(ch,arg);
		if ( obj == NULL)
			obj = get_obj_list(ch,arg,ch->in_room->contents); 
		if (obj == NULL){
			send_to_char("No object by that name found!\n\r",ch);
			return;
		}

	}

	if ((victim = get_char_room(ch,arg2)) == NULL){
		send_to_char("No one here by that name.\n\r",ch);
		return;
	}
	if (obj == NULL) 
		obj = get_eq_char(victim,WEAR_WIELD);
	if (obj == NULL) 
		obj = get_obj_carry(victim,arg);

	if (obj == NULL){
		send_to_char("They do not carry that object!\n\r",ch);
		return;
	}

	/*
	 * Ok we pretty much found our object by here..
	 * set a timer on it and freeze it.
	 */
	if (obj->timer > 0)
		obj->timer += get_disc(ch,DISC_TEMPORIS) * number_range(1,4);
	else
		obj->timer = get_disc(ch,DISC_TEMPORIS) * number_range(1,4);

	SET_BIT(obj->extra_flags,ITEM_FROZEN);
	return;
}


void power_ridewyld(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
    CHAR_DATA *familiar;
	
    if ( ( familiar = ch->pcdata->familiar ) != NULL ) 
    {
	    send_to_char( "Nothing happens.\n\r", ch );
	    return;
    }

    if ( !IS_NPC(victim) )
    {
    	send_to_char( "Not on players.\n\r", ch );
    	return;
    }
	
    if ( ( familiar = victim->wizard ) != NULL ) 
    {
	    send_to_char( "Nothing happens.\n\r", ch );
	    return;
    }

    switch ( victim->pIndexData->vnum )
    {
	default:
	    send_to_char( "Nothing happens.\n\r", ch );
	    return;
	case MOB_VNUM_FROG:
	case MOB_VNUM_RAVEN:
	case MOB_VNUM_CAT:
	case MOB_VNUM_DOG:
	case MOB_VNUM_EYE:
	case MOB_VNUM_MOLERAT:
    	case MOB_VNUM_YAK:
	    break;
    }

    act("You merge your spirit with that of $N.",ch,NULL,victim,TO_CHAR);
    ch->pcdata->familiar = victim;
    victim->wizard = ch;
    return;
}

void power_haunting(CHAR_DATA *ch, CHAR_DATA *victim, char *argument){
	CHAR_DATA *spirit;
	char arg[MSL];
	
	argument = one_argument(argument,arg);
	
	if ((spirit = get_char_room(ch,arg)) == NULL)
	{
		send_to_char("There not here.",ch);
		return;
	}
	
	if (spirit->plane != PLANE_SPIRIT){
		send_to_char("They are not on the Spirit Plane.\n\r",ch);
		return;
	}

	/*
	 * Run a check of willpower for the Spirit to be summoned
	 * if it's a mob run a chance check vs level
	 */
	if (IS_NPC(spirit)){
		if (spirit->level < number_range(1,50)){
			send_to_char("You have failed.\n\r",ch);
			return;
		}
	}
	else{
		if (ch->pcdata->willpower > number_range(1,40)){
			send_to_char("You have failed.\n\r",ch);
			return;
		}
	}
	if (IS_NPC(spirit))
	{
		spirit->hit = spirit->max_hit;
		spirit->mana = spirit->max_mana;
		spirit->move = spirit->max_move;
		SET_BIT(victim->affected_by, AFF_GHOST);
	}
	spirit->plane = PLANE_NORMAL;	
	act("$N appears right in front of you!",ch,NULL,spirit,TO_CHAR);
	act("You appear in front of $n as they have summoned you.",ch,NULL,spirit,TO_VICT);
	act("$N appears out of nowhere in front of $n!",ch,NULL,spirit,TO_NOTVICT);
	return;
}

void power_hags_wrinkles(CHAR_DATA *ch,CHAR_DATA *victim, char *argument){

	if (IS_SET(ch->extra,EXTRA_HAGS)){
		send_to_char("Your skin tightens up removing the hags wrinkles.\n\r",ch);
		REMOVE_BIT(ch->extra, EXTRA_HAGS);
	}
	else{
		send_to_char("Your skin loosens up revealing the hags wrinkles.\n\r",ch);
		SET_BIT(ch->extra,EXTRA_HAGS);
	}
	return;
}