cotn25/area/
cotn25/src/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"

void do_magearmor( CHAR_DATA *ch, char *argument )
{
  OBJ_INDEX_DATA *pObjIndex;
  OBJ_DATA *obj;
  char arg[MAX_INPUT_LENGTH];
  int vnum = 0;

  argument = one_argument( argument, arg );
  if (IS_NPC(ch)) return;
 	if(!IS_IMMORTAL(ch))
	{
    if( !IS_CLASS(ch, CLASS_HUMAN) )
    {
      send_to_char("What?\n\r",ch);
      return;
    }
	}
  if (arg[0] == '\0')
  {
    send_to_char("Please specify which piece of mage armor you wish to make: Dagger Staff Ring Collar Robe Cap Leggings Boots Gloves Sleeves Cape Belt Bracer Mask.\n\r",ch);
    return;
  }
  if ( ch->practice < 60 )
  {
    send_to_char("It costs 60 points of primal to create mage equipment.\n\r",ch);
    return;
  }
  if (!str_cmp(arg,"mask")) vnum = 33013;
  else if (!str_cmp(arg,"belt")) vnum = 33011;
  else if (!str_cmp(arg,"cape")) vnum = 33010;
  else if (!str_cmp(arg,"ring")) vnum = 33002;
  else if (!str_cmp(arg,"collar")) vnum = 33003;
  else if (!str_cmp(arg,"robe")) vnum = 33004;
  else if (!str_cmp(arg,"cap")) vnum = 33005;
  else if (!str_cmp(arg,"leggings")) vnum = 33006;
  else if (!str_cmp(arg,"boots")) vnum = 33007;
  else if (!str_cmp(arg,"gloves")) vnum = 33008;
  else if (!str_cmp(arg,"sleeves")) vnum = 33009;
  else if (!str_cmp(arg,"bracer")) vnum = 33012;
  else if (!str_cmp(arg,"staff")) vnum = 33000;
  else if (!str_cmp(arg,"dagger")) vnum = 33001;
  else
  {
    do_magearmor(ch,"");
    return;
  }
  if ( vnum == 0 || (pObjIndex = get_obj_index( vnum )) == NULL)
  {
    send_to_char("Missing object, please inform a God.\n\r",ch);
    return;
  }
  obj = create_object(pObjIndex, 50);
  obj->questowner = str_dup(ch->pcdata->switchname);
  obj_to_char(obj, ch);
  ch->practice -= 60;
  act("$p appears in your hands.",ch,obj,NULL,TO_CHAR);
  act("$p appears in $n's hands.",ch,obj,NULL,TO_ROOM);
  return;
}


void do_etherealhammer(CHAR_DATA * ch, char *argument)
{

	char buf[MAX_STRING_LENGTH];
	char buf2[MAX_STRING_LENGTH];
	CHAR_DATA *vch;
	CHAR_DATA *vch_next;
	int dam;
	dam = 6000;
	dam *= 8;
	dam /= 2;
	
	if(IS_NPC(ch)) return;
	
	if (!IS_CLASS(ch, CLASS_HUMAN))
	{
		stc("#0This is a Human Technomage Area Attack#n\n\r",ch);
		return;
	}
	for ( vch = ch->in_room->people; vch!=NULL;vch = vch_next)
	      {
	        vch_next = vch->next_in_room;
	        if (can_see(ch,vch))
	        if ( IS_NPC(ch) ? !IS_NPC(vch) : IS_NPC(vch) )
	        {
		if(is_safe(ch,vch)) continue;
	          sprintf(buf, "#0Your body is struck by lightning! [#C%d#n]\n\r", dam);
	          send_to_char( buf, vch );
	          sprintf(buf2, "#r%s's#0 body is struck by lightning! [#C%d#n]\n\r",vch->short_descr, dam);
	          send_to_char( buf2, ch );
	          set_fighting(ch,vch);
	          hurt_person(ch,vch,dam);
	        }
	      }
	
	WAIT_STATE(ch,8);

}



void do_humanarmor(CHAR_DATA *ch, char *argument)
{
  char arg[MSL];
  OBJ_DATA *obj;
  OBJ_INDEX_DATA *pObjIndex;
  int vnum;

  argument = one_argument(argument,arg);

  if (IS_NPC(ch)) return;
  if ( !IS_CLASS(ch, CLASS_HUMAN) )
  {
    stc("Huh?\n\r",ch);
    return;
  }

  if ( arg[0] == '\0' )
  {
    stc("What do you wish to make? [Ring Collar Plate Helmet Greaves Boots Gauntlets\n\r",ch);
    stc("                           Sleeves Cape Belt Bracer Visor Sword]\n\r",ch);
    return;
  }
  if ( ch->practice < 150 )
  {
    stc("You require 150 primal.\n\r",ch);
    return;
  }

       if (!str_cmp(arg,"ring"))	vnum = 95201;
  else if (!str_cmp(arg,"collar"))	vnum = 95202;
  else if (!str_cmp(arg,"plate"))	vnum = 95205;
  else if (!str_cmp(arg,"helmet"))	vnum = 95206;
  else if (!str_cmp(arg,"greaves")) 	vnum = 95208;
  else if (!str_cmp(arg,"boots"))	vnum = 95210;
  else if (!str_cmp(arg,"gauntlets")) 	vnum = 95209;
  else if (!str_cmp(arg,"sleeves")) 	vnum = 95207;
  else if (!str_cmp(arg,"cape")) 	vnum = 95213;
  else if (!str_cmp(arg,"belt")) 	vnum = 95203;
  else if (!str_cmp(arg,"bracer")) 	vnum = 95211;
  else if (!str_cmp(arg,"visor")) 	vnum = 95204;
  else if (!str_cmp(arg,"sword")) 	vnum = 95212;
  else
  {
    do_humanarmor(ch,"");
    return;
  }
  if ( vnum == 0 || (pObjIndex = get_obj_index( vnum )) == NULL)
  {
    send_to_char("Missing object, please inform a God.\n\r",ch);
    return;
  }
  obj = create_object(pObjIndex, 50);
  obj->questowner = str_dup(ch->pcdata->switchname);
  obj_to_char(obj, ch);
  ch->practice -= 150;
  act("$p appears in your hands.",ch,obj,NULL,TO_CHAR);
  act("$p appears in $n's hands.",ch,obj,NULL,TO_ROOM);
}


void do_implant(CHAR_DATA *ch, char *argument)
{
  char arg1[MAX_INPUT_LENGTH];
  char arg2[MAX_INPUT_LENGTH];
  char buf[MAX_STRING_LENGTH];
  argument = one_argument( argument, arg1 );
  argument = one_argument( argument, arg2 );

  if (IS_NPC(ch)) return;

  if (!IS_CLASS(ch, CLASS_HUMAN))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }

  if ( arg1[0] == '\0' && arg2[0] == '\0')
  {
  if (ch->pcdata->powers[CYBER_EYES] == 0)
      send_to_char("#0Eyes    #0[#R*****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_EYES] == 1)
      send_to_char("#0Eyes    #0[#G*#R****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_EYES] == 2)
      send_to_char("#0Eyes    #0[#G**#R***#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_EYES] == 3)
      send_to_char("#0Eyes    #0[#G***#R**#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_EYES] == 4)
      send_to_char("#0Eyes    #0[#G****#R*#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_EYES] >= 5)
      send_to_char("#0Eyes    #0[#G*****#0]#n.\n\r",ch);

  if (ch->pcdata->powers[CYBER_ARMS] == 0)
      send_to_char("#0Arms    #0[#R*****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_ARMS] == 1)
      send_to_char("#0Arms    #0[#G*#R****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_ARMS] == 2)
      send_to_char("#0Arms    #0[#G**#R***#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_ARMS] == 3)
      send_to_char("#0Arms    #0[#G***#R**#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_ARMS] == 4)
      send_to_char("#0Arms    #0[#G****#R*#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_ARMS] >= 5)
      send_to_char("#0Arms    #0[#G*****#0]#n.\n\r",ch);

  if (ch->pcdata->powers[CYBER_LEGS] == 0)
      send_to_char("#0Legs    #0[#R*****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_LEGS] == 1)
      send_to_char("#0Legs    #0[#G*#R****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_LEGS] == 2)
      send_to_char("#0Legs    #0[#G**#R***#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_LEGS] == 3)
      send_to_char("#0Legs    #0[#G***#R**#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_LEGS] == 4)
      send_to_char("#0Legs    #0[#G****#R*#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_LEGS] == 5)
      send_to_char("#0Legs    #0[#G*****#0]#n.\n\r",ch);

  if (ch->pcdata->powers[CYBER_HEAD] == 0)
      send_to_char("#0Head    #0[#R*****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_HEAD] == 1)
      send_to_char("#0Head    #0[#G*#R****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_HEAD] == 2)
      send_to_char("#0Head    #0[#G**#R***#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_HEAD] == 3)
      send_to_char("#0Head    #0[#G***#R**#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_HEAD] == 4)
      send_to_char("#0Head    #0[#G****#R*#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_HEAD] == 5)
      send_to_char("#0Head    #0[#G*****#0]#n.\n\r",ch);

  if (ch->pcdata->powers[CYBER_MIND] == 0)
      send_to_char("#0Mind    #0[#R*****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_MIND] == 1)
      send_to_char("#0Mind    #0[#G*#R****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_MIND] == 2)
      send_to_char("#0Mind    #0[#G**#R***#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_MIND] == 3)
      send_to_char("#0Mind    #0[#G***#R**#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_MIND] == 4)
      send_to_char("#0Mind    #0[#G****#R*#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_MIND] == 5)
      send_to_char("#0Mind    #0[#G*****#0]#n.\n\r",ch);

  if (ch->pcdata->powers[CYBER_HAND] == 0)
      send_to_char("#0Hands   #0[#R*****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_HAND] == 1)
      send_to_char("#0Hands   #0[#G*#R****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_HAND] == 2)
      send_to_char("#0Hands   #0[#G**#R***#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_HAND] == 3)
      send_to_char("#0Hands   #0[#G***#R**#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_HAND] == 4)
      send_to_char("#0Hands   #0[#G****#R*#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_HAND] == 5)
      send_to_char("#0Hands   #0[#G*****#0]#n.\n\r",ch);

  if (ch->pcdata->powers[CYBER_BODY] == 0)
      send_to_char("#0Body    #0[#R*****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_BODY] == 1)
      send_to_char("#0Body    #0[#G*#R****#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_BODY] == 2)
      send_to_char("#0Body    #0[#G**#R***#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_BODY] == 3)
      send_to_char("#0Body    #0[#G***#R**#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_BODY] == 4)
      send_to_char("#0Body    #0[#G****#R*#0]#n.\n\r",ch);
  if (ch->pcdata->powers[CYBER_BODY] == 5)
      send_to_char("#0Body    #0[#G*****#0]#n.\n\r",ch);

    send_to_char("\n\r#BSyntax: #wimplant #0(#wplace#D) #wimprove.#n\n\r",ch);
    return;
  }
  if (arg2[0] == '\0')
  {
    if (!str_cmp(arg1,"eyes"))
    {
     send_to_char("#0Current Eye Implants:#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_EYES] < 1)
      send_to_char("None.\n\r",ch);
      if (ch->pcdata->powers[CYBER_EYES] > 0)
      {
        if (ch->pcdata->powers[CYBER_EYES] > 3)
        {
          send_to_char("You Have Shadowsight.\n\r",ch);
          send_to_char("You Have The Ability to Scry.\n\r",ch);
          send_to_char("You have Truesight.\n\r",ch);
          return;
        }
        else if ((ch->pcdata->powers[CYBER_EYES] == 2))
        send_to_char("You Have Infrared Sight.\n\r",ch);
        else if ((ch->pcdata->powers[CYBER_EYES] == 1))
        send_to_char("You Have Nightsight.\n\r",ch);
      }
    return;
    }
    else if (!str_cmp(arg1,"arms"))
    {
      send_to_char("#0Current Arm Implants:#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_ARMS] < 1)
      send_to_char("#wNone#n.\n\r",ch);
      if (ch->pcdata->powers[CYBER_ARMS] > 0)
      send_to_char("#wThe Skin on your Arms Is Tough and Leathery.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_ARMS] > 1)
      send_to_char("#wThe Bones in your Arms are Made of Adamantite.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_ARMS] > 2)
      send_to_char("#wYou Have A Third Arm.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_ARMS] > 3)
      send_to_char("#wYou Have a Fourth Arm.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_ARMS] > 4)
      send_to_char("#wThere are Adamantite Bands covering Your Arms.#n\n\r",ch);
      return;
    }

    else if (!str_cmp(arg1,"legs"))
    {
      send_to_char("#0Current Leg Implants:#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_LEGS] < 1)
      send_to_char("#wNone#n.\n\r",ch);
      if (ch->pcdata->powers[CYBER_LEGS] > 0)
      send_to_char("#wThe Skin On Your Legs has a Leathery Texture.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_LEGS] > 1)
      send_to_char("#wThere is Increased Muscle mass on your legs.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_LEGS] > 2)
      send_to_char("#wThe Bones in your Legs are made of Adamantite.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_LEGS] > 3)
      send_to_char("#wThere are Steel Bands around your legs.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_LEGS] > 4)
      send_to_char("#wYour Legs allow you to move with Increased Quickness.#n\n\r",ch);
      return;
    }
    else if (!str_cmp(arg1,"head"))
    {
      send_to_char("#0Current head Implants:#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HEAD] < 1)
      send_to_char("#wNone#n.\n\r",ch);
      if (ch->pcdata->powers[CYBER_HEAD] > 0)
      send_to_char("#wThe Skin on your Head is tough. and leathery.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HEAD] > 1)
      send_to_char("#wYour Skull is made of Steel.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HEAD] > 2)
      send_to_char("#wYou have Two long Horns, Allowing you to Gore..#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HEAD] > 3)
      send_to_char("#wYou have SuperHuman Regeneration.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HEAD] > 4)
      send_to_char("#wYou Have Been Granted the Gift of Fangs.#n\n\r",ch);
      return;
    }
    else if (!str_cmp(arg1,"mind"))
    {
      send_to_char("#0Current brain Implants:#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_MIND] < 1)
      send_to_char("#wNone#n.\n\r",ch);
      if (ch->pcdata->powers[CYBER_MIND] > 0)
      send_to_char("#wYou Are Protected by A Powerful Shield.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_MIND] > 1)
      send_to_char("#wYou Have The Abilitiy To make Your Opponent Move Slowly.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_MIND] > 2)
      send_to_char("#wYou Have the Ability to Strike Fear into your Opponent.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_MIND] > 3)
      send_to_char("#wYou Have a Greater Understanding of Magic.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_MIND] > 4)
      send_to_char("#wYour Brain has been enhanced, You think clearly and at a rapid Rate..#n\n\r",ch);
      return;
    }
    else if (!str_cmp(arg1,"hands"))
    {
      send_to_char("#0Current Hand Implants:#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HAND] < 1)
      send_to_char("#wNone#n.\n\r",ch);
      if (ch->pcdata->powers[CYBER_HAND] > 0)
      send_to_char("#wYou have short retractable Claws.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HAND] > 1)
      send_to_char("#wYou can hone your claws to Razor Sharpness.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HAND] > 2)
      send_to_char("#wYou can Turn your Claws to Steel.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HAND] > 3)
      send_to_char("#wYou Are Fast with Your Hands, Enabling you to get a Punch or Two.#n\n\r",ch);
      send_to_char("#wIn during a Round of Combat.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HAND] > 4)
      send_to_char("#wThe Skin on your Hands has been infused with Steel.#n\n\r",ch);
      return;
    }
    else if (!str_cmp(arg1,"body"))
    {
      send_to_char("#0Current Body Implants:#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HAND] < 1)
      send_to_char("#wNone#n.\n\r",ch);
      if (ch->pcdata->powers[CYBER_HAND] > 0)
      send_to_char("#wYour Chest is Infused with Steel.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HAND] > 2)
      send_to_char("#wYour Back is infused with Steel.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HAND] > 3)
      send_to_char("#wYou have Superhuman Resistance.#n\n\r",ch);
      if (ch->pcdata->powers[CYBER_HAND] > 4)
      send_to_char("#wWith Arm implants your body can know allow the use of 4 arms.#n\n\r",ch);
      return;
    }
}
  if (!str_cmp(arg2,"improve"))
  {
      int implant;
      int cost;
      int max;

      if (!str_cmp(arg1,"eyes" )) {implant = CYBER_EYES; max = 5;}
      else if (!str_cmp(arg1,"arms")) {implant = CYBER_ARMS; max = 5;}
      else if (!str_cmp(arg1,"legs")) {implant = CYBER_LEGS; max = 5;}
      else if (!str_cmp(arg1,"head")) {implant = CYBER_HEAD; max = 5;}
      else if (!str_cmp(arg1,"mind")) {implant = CYBER_MIND; max = 5;}
      else if (!str_cmp(arg1,"hands")) {implant = CYBER_HAND; max = 5;}
      else if (!str_cmp(arg1,"body")) {implant = CYBER_BODY; max = 5;}
else
      {
        send_to_char("Implants are face, legs, and body.\n\r",ch);
        return;
      }

      if ((ch->pcdata->powers[implant] == 1)) cost = 25000;
      else if ((ch->pcdata->powers[implant] == 2)) cost = 50000;
      else if ((ch->pcdata->powers[implant] == 3)) cost = 100000;
      else if ((ch->pcdata->powers[implant] == 4)) cost = 200000;
      else if ((ch->pcdata->powers[implant] == 5)) cost = 400000;
      else if ((ch->pcdata->powers[implant] == 6)) cost = 800000;
	else cost = 12500;
      arg1[0] = UPPER(arg1[0]);

    if (ch->pcdata->stats[DEMON_CURRENT] < cost)
    {
        send_to_char("You Dont have Enough CP for This.\n\r",ch);
        return;
    }

      if ((ch->pcdata->powers[implant] >= max ))
      {
        sprintf(buf,"You already have all implants on your %s.\n\r",arg1);
        send_to_char(buf,ch);
        return;
      }

      ch->pcdata->powers[implant] += 1;
      ch->pcdata->stats[DEMON_CURRENT] -= cost;
      sprintf(buf,"You add an implant to your %s.\n\r",arg1);
      send_to_char(buf,ch);
      return;
  }
  else send_to_char("Syntax: implant (place) improve.\n\r",ch);
  return;
}

void do_steelclaws( CHAR_DATA *ch, char *argument )
{

   if (IS_NPC(ch))
	return;

    if (!IS_CLASS(ch,CLASS_HUMAN))
   {
        send_to_char("Huh?\n\r",ch);
        return;
   }

   if (ch->pcdata->powers[CYBER_HAND] < 3)
   {
	send_to_char("You need your Hand Implants to 3 for Steel Claws.\n\r",ch);
	return;
   }

   if (!IS_SET(ch->newbits2, NEW2_STEELCLAWS))
   {
	send_to_char("Your Bone Claws Slowly Turn to Solid Steel!\n\r",ch);
        act("$n's claws Turn To Solid Steel!",ch,NULL,NULL,TO_ROOM);
        SET_BIT(ch->newbits2, NEW2_STEELCLAWS);
	return;
   }

   if (IS_SET(ch->newbits2, NEW2_STEELCLAWS))
   {
	send_to_char("Your claws shift Back to Bone.\n\r",ch);
	act("$n's Claws Lose Thier Steel, and go back to Bone.\n\r",ch,NULL,NULL,TO_ROOM);
	REMOVE_BIT(ch->newbits2, NEW2_STEELCLAWS);
	return;
   }

}



void do_disorient(CHAR_DATA *ch, char *argument) {

	CHAR_DATA *victim;

	if (IS_NPC(ch)) return;
    if (ch->pcdata->powers[CYBER_MIND] < 3)
   {
	send_to_char("You need to get your Mind Implants to 3.\n\r",ch);
    	return;
    }
	if ((victim = ch->fighting) == NULL) {
	send_to_char("You are not fighting anyone.\n\r",  ch);
	return;}

	if (ch->move < 75) {
	send_to_char("You need 75 move to confuse your opponent.\n\r",ch);
	return;}

	act("$n attempts to disorient you.",ch,NULL,victim,TO_VICT);
	act("You attempt to disorient $N.",ch,NULL,victim,TO_CHAR);
	act("$n attempts to disorient $N.",ch,NULL,victim,TO_NOTVICT);

	ch->move -=75;

	if ( number_percent() > 25 ) {
	send_to_char("You failed.\n\r", ch );
	return;}

	else {
		do_flee(victim,"");	
	WAIT_STATE(ch, 16);
	return;	}

	return;
}






void do_mentalblock( CHAR_DATA *ch, char *argument )
{
  char arg [MAX_INPUT_LENGTH];

  argument = one_argument( argument, arg );

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_HUMAN))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }

  if (ch->pcdata->powers[CYBER_MIND] < 1){
  stc("You Need your Scry Block Implant for this.\n\r",ch);
  return;}

  if (!IS_IMMUNE(ch,IMM_SHIELDED) )
  {
    send_to_char("You shield your aura from those around you.\n\r",ch);
    SET_BIT(ch->immune, IMM_SHIELDED);
    return;
  }
  send_to_char("You stop shielding your aura.\n\r",ch);
  REMOVE_BIT(ch->immune, IMM_SHIELDED);
  return;
}


void do_reveal(CHAR_DATA *ch, char *argument)
{
  CHAR_DATA *ich;

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_HUMAN))
  {
    send_to_char("Huh?!?.\n\r",ch);
    return;
  }
  if (ch->mana < 5000)
  {
    send_to_char("You don't have the mystical energies to do this.\n\r",ch);
    return;
  } 
  act( "$n mumles a few words, and you are suddenly blinded by a flash.", ch, NULL, NULL, TO_ROOM );   
  send_to_char( "You reveal everything hidden in the room.\n\r", ch );
  for ( ich = ch->in_room->people; ich != NULL; ich = ich->next_in_room )
  {
    if (ich==ch || ich->trust > 6) continue;
    affect_strip ( ich, gsn_invis );
    affect_strip ( ich, gsn_mass_invis );
    affect_strip ( ich, gsn_sneak );
    if (IS_SET(ich->affected_by, AFF_HIDE))      REMOVE_BIT(ich->affected_by, AFF_HIDE);
    if (IS_SET(ich->affected_by, AFF_INVISIBLE)) REMOVE_BIT(ich->affected_by, AFF_INVISIBLE);
    if (IS_SET(ich->affected_by, AFF_SNEAK))     REMOVE_BIT(ich->affected_by, AFF_SNEAK);
    if (IS_SET(ich->act, PLR_WIZINVIS))          REMOVE_BIT(ich->act, PLR_WIZINVIS);
    if (IS_SET(ich->act, AFF_HIDE))              REMOVE_BIT(ich->act, AFF_HIDE);
    if (IS_SET(ich->affected_by, AFF_SHIFT))     REMOVE_BIT(ich->affected_by, AFF_SHIFT);
    if (IS_SET(ich->extra, EXTRA_EARTHMELD))     REMOVE_BIT(ich->extra, EXTRA_EARTHMELD);
    if (IS_AFFECTED(ch,AFF_SHADOWPLANE)) REMOVE_BIT(ch->affected_by, AFF_SHADOWPLANE);
    if (IS_AFFECTED(ch, AFF_PEACE)) REMOVE_BIT(ch->affected_by, AFF_PEACE);
    if (IS_AFFECTED(ch,AFF_ETHEREAL)) REMOVE_BIT(ch->affected_by, AFF_ETHEREAL);

    if (IS_CLASS(ich, CLASS_DROW) && IS_SET(ich->newbits, NEW_DARKNESS))
    {
      REMOVE_BIT(ich->newbits, NEW_DARKNESS);
      REMOVE_BIT(ich->in_room->room_flags, ROOM_TOTAL_DARKNESS);
    }
    send_to_char("You are suddenly very visible.\n\r",ich);
  }
  ch->mana -= 5000;
  return;
}




void do_chaosmagic (CHAR_DATA *ch, char *argument)
{
  char arg[MAX_STRING_LENGTH];
  CHAR_DATA *victim;
  int sn, random, level;

  argument=one_argument(argument,arg);
  level = ch->spl[RED_MAGIC]/4;

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_HUMAN))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }
  if (ch->mana < 1500)
  {
    send_to_char("You need more mana.\n\r",ch);
    return;
  }
  if (ch->in_room != NULL)
  {
    if ( IS_SET(ch->in_room->room_flags,ROOM_SAFE) )
    {
      send_to_char( "You cannot invoke the forces of chaos in a safe room.\n\r", ch );
      return;
    }
  }
  if (arg[0] == '\0' && ch->fighting != NULL) victim = ch->fighting;
  else if ((victim = get_char_room(ch, arg)) == NULL)
  {
    send_to_char("They are not here.\n\r", ch );
    return;
  }
  random = number_range(1,8);
  if (random == 1) sn = skill_lookup("spirit kiss");
  else if (random == 2) sn = skill_lookup("desanct");
  else if (random == 3) sn = skill_lookup("imp heal");
  else if (random == 4) sn = skill_lookup("imp fireball");
  else if (random == 5) sn = skill_lookup("imp faerie fire");
  else if (random == 6) sn = skill_lookup("shield");
  else if (random == 7) sn = skill_lookup("readaura");
  else if (random == 8) sn = skill_lookup("dispel magic");
  else sn = 0;
  if (sn  > 0) (*skill_table[sn].spell_fun) (sn,level,ch,victim);
  ch->mana -= 1500;
  WAIT_STATE(ch,1);
  return;
}

/* Syntax : chant <type> <color> <target>
 * ex. chant bless red self 
 */
void do_chant (CHAR_DATA *ch, char *argument)
{
  char arg1[MAX_STRING_LENGTH];
  char arg2[MAX_STRING_LENGTH];
  char buf1[MAX_STRING_LENGTH];
  char buf2[MAX_STRING_LENGTH];
  char buf3[MAX_STRING_LENGTH];
  CHAR_DATA *victim;
  AFFECT_DATA af;
  int i, dam, count, sn;
  int red_magic = ch->spl[RED_MAGIC];
  int blue_magic = ch->spl[BLUE_MAGIC];
  int green_magic = ch->spl[GREEN_MAGIC];
  int purple_magic = ch->spl[PURPLE_MAGIC];
  int yellow_magic = ch->spl[YELLOW_MAGIC];
  int magic_power = ch->spl[RED_MAGIC] + ch->spl[BLUE_MAGIC] + ch->spl[GREEN_MAGIC] + ch->spl[PURPLE_MAGIC] + ch->spl[YELLOW_MAGIC];
    
  argument=one_argument(argument,arg1);
  strcpy(arg2,argument);

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_HUMAN))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }
  if (arg1[0] == '\0')
  {  
    send_to_char("Syntax : chant <bless/curse/damage/heal> <target>.\n\r", ch);
    return;
  }  
  if (IS_ITEMAFF(ch, ITEMA_AFFENTROPY)) 
  {
    magic_power +=1100;
    red_magic +=510;
    yellow_magic +=510;
    purple_magic +=150;
    green_magic +=150;
    blue_magic +=150;
  }
  if (!str_cmp(arg1, "heal"))
  {
    if (arg2[0] == '\0') victim = ch;
    else if ((victim = get_char_room(ch, arg2)) == NULL)
    {
      send_to_char("They are not here.\n\r", ch );
      return;
    }
    if (ch->mana < 1500)
    {
      send_to_char("You need 1500 mana.\n\r",ch);
      return;
    }    
    act("$n channels lifeforce from the five elements into $N.",ch,NULL,victim,TO_NOTVICT);
    act("You channel lifeforce from the five elements into $N.",ch,NULL,victim,TO_CHAR);
    act("$n channels lifeforce from the five elements into you.",ch,NULL,victim,TO_VICT);
    WAIT_STATE(ch,1);
    ch->mana -= 1500;
    victim->hit = UMIN(victim->hit + (magic_power * 1.5), victim->max_hit);
    return;
  }
  else if (!str_cmp(arg1, "damage"))
  {
    if (arg2[0] == '\0' && ch->fighting != NULL) victim = ch->fighting;
    else if ((victim = get_char_room(ch, arg2)) == NULL)
    {
      send_to_char("They are not here.\n\r", ch );
      return;
    }
    if (ch->mana <1000)
    {
      send_to_char("You need 1000 mana.\n\r",ch);
      return;
    }
    if (victim == ch)
    {
      send_to_char("You really don't want to hurt yourself.\n\r", ch );
      return;
    }
    if (is_safe(ch, victim)) return;
    if (victim->position == POS_DEAD || ch->in_room != victim->in_room)
      return;
    if (IS_AFFECTED(ch, AFF_PEACE)) REMOVE_BIT(ch->affected_by, AFF_PEACE);
/*    if (victim->position > POS_STUNNED)
    {
      if (victim->fighting == NULL) set_fighting(victim, ch);
      if (ch->fighting == NULL) set_fighting(ch, victim);
    }*/
	set_fighting(ch,victim);
	set_fighting(victim,ch);
    WAIT_STATE(ch,13);
    ch->mana -= 1000;
    dam = number_range(red_magic*4, red_magic*5);
    dam += char_damroll(ch);
    dam *= ch->pcdata->upgrade_level + 1;
    dam /= 1.5;
    dam *= .9;
	if(dam >= 40000) dam = number_range(40000,41000);
//    if(dam > ch->damcap[DAM_CAP]) dam = number_range(ch->damcap[DAM_CAP] * 1.1, ch->damcap[DAM_CAP] * 3.0);
    sprintf(buf1,"$n calls for the forces of #Rhell#n to destroy $N [#C%d#n]" , dam);
    sprintf(buf2,"You call for the forces of #Rhell#n to destroy $N [#C%d#n]" , dam);
    sprintf(buf3,"$n calls for the forces of #Rhell#n to destroy you [#C%d#n]" , dam);
    act(buf1,ch,NULL,victim, TO_NOTVICT);
    act(buf2,ch,NULL,victim, TO_CHAR);
    act(buf3,ch,NULL,victim, TO_VICT);
    hurt_person(ch, victim, dam);
    if (victim->position == POS_DEAD || ch->in_room != victim->in_room) return;
    dam = number_range(blue_magic*4, blue_magic*5);
    dam += char_damroll(ch);
    dam *= ch->pcdata->upgrade_level + 1;
    dam /= 1.5;
    dam *= .9;
	if(dam >= 40000) dam = number_range(40000,41000);

    //if(dam > ch->damcap[DAM_CAP]) dam = number_range(ch->damcap[DAM_CAP] * 1.1, ch->damcap[DAM_CAP] * 3.0);
    sprintf(buf1,"$n summons a supernatural #Lstorm#n to strike $N with lightning [#C%d#n]" , dam);
    sprintf(buf2,"You summon a supernatural #Lstorm#n to strike $N with lightning [#C%d#n]" , dam);
    sprintf(buf3,"$n summons a supernatural #Lstorm#n to strike you with lightning [#C%d#n]" , dam);
    act(buf1,ch,NULL,victim, TO_NOTVICT);
    act(buf2,ch,NULL,victim, TO_CHAR);
    act(buf3,ch,NULL,victim, TO_VICT);
    hurt_person(ch, victim, dam);
    if (victim->position == POS_DEAD || ch->in_room != victim->in_room) return;
    dam = number_range(green_magic*4, green_magic*5);
    dam += char_damroll(ch);
    dam *= ch->pcdata->upgrade_level + 1;
    dam /= 1.5;
    dam *= .9;
	if(dam >= 40000) dam = number_range(40000,41000);

    //if(dam > ch->damcap[DAM_CAP]) dam = number_range(ch->damcap[DAM_CAP] * 1.1, ch->damcap[DAM_CAP] * 3.0);
    sprintf(buf1,"$n calls for #Gthorns#n to grow from the earth and pierce $N [#C%d#n]" , dam);
    sprintf(buf2,"You call for #Gthorns#n to grow from the earth and pierce $N [#C%d#n]" , dam);
    sprintf(buf3,"$n calls for #Gthorns#n to grow from the earth and pierce You [#C%d#n]" , dam);
    act(buf1,ch,NULL,victim, TO_NOTVICT);
    act(buf2,ch,NULL,victim, TO_CHAR);
    act(buf3,ch,NULL,victim, TO_VICT);
    hurt_person(ch, victim, dam);
    if (victim->position == POS_DEAD || ch->in_room != victim->in_room) return;
    dam = number_range(purple_magic*4, purple_magic*5);
    dam += char_damroll(ch);
    dam *= ch->pcdata->upgrade_level + 1;
    dam /= 1.5;
	dam *= .9;
	if(dam >= 40000) dam = number_range(40000,41000);

    //if(dam > ch->damcap[DAM_CAP]) dam = number_range(ch->damcap[DAM_CAP] * .9, ch->damcap[DAM_CAP] * 1.1);
    sprintf(buf1,"$n calls on the powers of the #punderdark#n to shatter $N's bones [#C%d#n]" , dam);
    sprintf(buf2,"You call on the powers of the #punderdark#n to shatter $N's bones [#C%d#n]" , dam);
    sprintf(buf3,"$n calls on the powers of the #punderdark#n to shatter your bones [#C%d#n]" , dam);
    act(buf1,ch,NULL,victim, TO_NOTVICT);
    act(buf2,ch,NULL,victim, TO_CHAR);
    act(buf3,ch,NULL,victim, TO_VICT);
    hurt_person(ch, victim, dam);
    if (victim->position == POS_DEAD || ch->in_room != victim->in_room) return;
    dam = number_range(yellow_magic*4, yellow_magic*5);
    dam += char_damroll(ch);
    dam *= ch->pcdata->upgrade_level + 1;
    dam /= 1.5;
	dam *= .9;
	if(dam >= 40000) dam = number_range(40000,41000);

    //if(dam > ch->damcap[DAM_CAP]) dam = number_range(ch->damcap[DAM_CAP] * .9, ch->damcap[DAM_CAP] * 1.1);
    sprintf(buf1,"$n spews forth a shower of #yacid#n striking $N [#C%d#n]" , dam);
    sprintf(buf2,"you spew forth a shower of #yacid#n striking $N [#C%d#n]" , dam);
    sprintf(buf3,"$n spews forth a shower of #yacid#n striking you [#C%d#n]" , dam);
    act(buf1,ch,NULL,victim, TO_NOTVICT);
    act(buf2,ch,NULL,victim, TO_CHAR);
    act(buf3,ch,NULL,victim, TO_VICT);
    hurt_person(ch, victim, dam);
    return;
  }
  else if (!str_cmp(arg1, "bless"))
  {
    if ((victim = get_char_room(ch, arg2)) == NULL)
    {
      send_to_char("They are not here.\n\r", ch );
      return;
    }
    if (ch->mana <2500)
    {
      send_to_char("You need 2500 mana.\n\r",ch);
      return;
    }
    if (victim->position == POS_DEAD || ch->in_room != victim->in_room)
      return;
    count = 0;
    for (i = 0; i<5 ; i++)
    {
      if (i==0) {sn = skill_lookup("purple sorcery");dam=purple_magic;}
      if (i==1) {sn = skill_lookup("yellow sorcery");dam=yellow_magic;}
      if (i==2) {sn = skill_lookup("green sorcery");dam=green_magic;}
      if (i==3) {sn = skill_lookup("red sorcery");dam=red_magic;}
      if (i==4) {sn = skill_lookup("blue sorcery");dam=blue_magic;}
      if (is_affected(victim, sn))
        continue;
      
      count++;
      
      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_HIT;
      af.modifier  = dam*2;
      af.bitvector = 0;
      affect_to_char(victim, &af);
      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_AC;
      af.modifier  = -dam/2;
      af.bitvector = 0;
      affect_to_char(victim, &af);
      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_MOVE;
      af.modifier  = dam*2;
      af.bitvector = 0;
      affect_to_char(victim, &af);
      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_MANA;
      af.modifier  = dam*2;
      af.bitvector = 0;
      affect_to_char(victim, &af);
      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_HITROLL;
      af.modifier  = dam/3;
      af.bitvector = 0;
      affect_to_char(victim, &af);
      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_DAMROLL;
      af.modifier  = dam/3;
      af.bitvector = 0;
      affect_to_char(victim, &af);
    }
    ch->mana -= count * 500;
    WAIT_STATE(ch,6);
    sprintf(buf1, "You bless $N with the power of the elements.");
    sprintf(buf2, "The power of the five elements fills your body.");
    act(buf1, ch, NULL, victim, TO_CHAR);
    act(buf2, ch, NULL, victim, TO_VICT);
    return;
  }
  else if (!str_cmp(arg1, "curse"))
  {
    if ((victim = get_char_room(ch, arg2)) == NULL)
    {
      send_to_char("They are not here.\n\r", ch );
      return;
    }
    if (ch->mana <2500)
    {
      send_to_char("You need 2500 mana.\n\r",ch);
      return;
    }
    if (victim->level < 3)
    {
      send_to_char("Not on mortal, thier bodies cant handles the strain....poor little buggers.\n\r",ch);
      return;
    }
    if (victim->position == POS_DEAD || ch->in_room != victim->in_room)
      return;
    count = 0;
    for (i = 0;i<5;i++)
    {
      if (i==0) {sn = skill_lookup("purple sorcery");dam=purple_magic;}
      if (i==1) {sn = skill_lookup("yellow sorcery");dam=yellow_magic;}
      if (i==2) {sn = skill_lookup("green sorcery");dam=green_magic;}
      if (i==3) {sn = skill_lookup("red sorcery");dam=red_magic;}
      if (i==4) {sn = skill_lookup("blue sorcery");dam=blue_magic;}
      if (is_affected(victim, sn))
        continue;
      
      count++;

      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_HIT;
      af.modifier  = -dam*2;
      af.bitvector = 0;
      affect_to_char(victim, &af);
      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_AC;
      af.modifier  = dam/2;
      af.bitvector = 0;
      affect_to_char(victim, &af);
      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_MOVE;
      af.modifier  = -dam*2;
      af.bitvector = 0;
      affect_to_char(victim, &af);
      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_MANA;
      af.modifier  = -dam*2;
      af.bitvector = 0;
      affect_to_char(victim, &af);
      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_HITROLL;
      af.modifier  = -dam/3;
      af.bitvector = 0;
      affect_to_char(victim, &af);
      af.type      = sn;
      af.duration  = dam/4;
      af.location  = APPLY_DAMROLL;
      af.modifier  = -dam/3;
      af.bitvector = 0;
      affect_to_char(victim, &af);
    }
    ch->mana -= count * 500;
    WAIT_STATE(ch,6);
    sprintf(buf1, "You curse $N with the power of the elements.");
    sprintf(buf2, "The power of the five elements wrecks your body.");
    act(buf1, ch, NULL, victim, TO_CHAR);
    act(buf2, ch, NULL, victim, TO_VICT);
    return;      
  }
  send_to_char("Syntax : chant <bless/curse/damage/heal> <target>.\n\r", ch);
  return;
}

/* Syntax : invoke <list/learn/spell> <none/power/power>
 * ex. invoke learn stoneskin
 * ex. invoke spell stoneskin
 */
void do_invoke (CHAR_DATA *ch, char *argument)
{
  char arg1[MAX_STRING_LENGTH];
  char arg2[MAX_STRING_LENGTH];
  char buf[MAX_STRING_LENGTH];
  int shieldcost=25;
  int steelshieldcost=5;
  int beastcost=10;
  int illusioncost=5;
  int defshieldcost=5;

  argument=one_argument(argument,arg1);
  strcpy(arg2,argument);

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_HUMAN))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }
  if (arg1[0]== '\0')
  {
    if(ch->pcdata->powers[PINVOKE] > 0)
      send_to_char("* You have the power to teleport yourself anywhere.\n\r",ch);
    if(ch->pcdata->powers[PINVOKE] > 1)
      send_to_char("* You know how to invoke mageshields.\n\r",ch);
    if(ch->pcdata->powers[PINVOKE] > 2)
      send_to_char("* You have the power to scry on far away places.\n\r",ch);
    if(ch->pcdata->powers[PINVOKE] > 3)
      send_to_char("* You can discharge your shields in a shower of power.\n\r",ch);
    if(ch->pcdata->powers[PINVOKE] > 4)
      send_to_char("* A deflector shield defends you in combat.\n\r",ch);
    if(ch->pcdata->powers[PINVOKE] > 5)
      send_to_char("* You have the power to turn your skin into solid steel.\n\r",ch);
    if(ch->pcdata->powers[PINVOKE] > 7)
      send_to_char("* You have mastered the power of illusions.\n\r",ch);
    if(ch->pcdata->powers[PINVOKE] > 8)
      send_to_char("* You can invoke the power of the beast.\n\r",ch);
    if(ch->pcdata->powers[PINVOKE] > 6 && ch->pcdata->powers[PINVOKE] < 10)
      send_to_char("* You have a deeper understanding of magic.\n\r",ch);
    if(ch->pcdata->powers[PINVOKE] > 9)
      send_to_char("* You have mastered the art of magic.\n\r",ch);
    sprintf(buf,"invokes Learned (%d).\n\r", ch->pcdata->powers[PINVOKE]);
    send_to_char(buf,ch);
    return;  
  }
  if (!str_cmp(arg1,"learn"))
  {
    int cost = (ch->pcdata->powers[PINVOKE]+1) * 20;
    if ( ch->pcdata->powers[PINVOKE] >= 10 )
    {
      send_to_char("You have already gained all the known invokes.\n\r",ch);
      return;
    }
    else if (cost > ch->practice)
    {
      send_to_char("you don't have enough primal.\n\r",ch);
      return;
    }
    else
    {
      ch->pcdata->powers[PINVOKE] +=1;
      ch->practice -= cost;
      send_to_char("You gain a deeper understanding of the mystical powers.\n\r",ch);
    }
    return;
  }
  else if (!str_cmp(arg1,"steelshield"))
  {
    if (ch->pcdata->powers[PINVOKE] < 6)
    {
      send_to_char("You don't have that invoke yet.\n\r",ch);
      return;
    }
    if (!IS_ITEMAFF(ch, ITEMA_STEELSHIELD) && ch->practice >= steelshieldcost)
    {
      SET_BIT(ch->itemaffect, ITEMA_STEELSHIELD);
      ch->practice -= steelshieldcost;
      send_to_char("Your skin turns to solid steel.\n\r",ch);
      return;
    }
    else if (IS_ITEMAFF(ch, ITEMA_STEELSHIELD))
    {
      send_to_char("Your skin cannot become any harder.\n\r",ch);
      return;
    }
    else
    {
      send_to_char("it costs 5 primal to activate steelskin.\n\r",ch);
      return;
    }
  }
  else if (!str_cmp(arg1,"beast"))
  {
    if (ch->pcdata->powers[PINVOKE] < 9)
    {
      send_to_char("You don't have that invoke yet.\n\r",ch);
      return;
    }
    if (!IS_ITEMAFF(ch, ITEMA_BEAST) && ch->practice >= beastcost)
    {
      SET_BIT(ch->itemaffect, ITEMA_BEAST);
      ch->practice -= beastcost;
      send_to_char("Your let your inner beast take control over your actions.\n\r",ch);
      return;
    }
    else if (IS_ITEMAFF(ch, ITEMA_BEAST))
    {
      send_to_char("You feel the beast inside of you roar, but nothing else happens.\n\r",ch);
      return;
    }
    else
    {
      send_to_char("it costs 10 primal to let the beast take over.\n\r",ch);
      return;
    }
  }
  else if (!str_cmp(arg1,"illusions"))
  {
    if (ch->pcdata->powers[PINVOKE] < 8)
    {
      send_to_char("You don't have that invoke yet.\n\r",ch);
      return;
    }
    if (!IS_ITEMAFF(ch, ITEMA_ILLUSIONS) && ch->practice >= illusioncost)
    {
      SET_BIT(ch->itemaffect, ITEMA_ILLUSIONS);
      ch->practice -= illusioncost;
      send_to_char("You conjure several images of yourself, making it impossibly to tell which is really you.\n\r",ch);
      return;
    }
    else if (IS_ITEMAFF(ch, ITEMA_ILLUSIONS))
    {
      send_to_char("You cannot summon any more illusions.\n\r",ch);
      return;
    }
    else
    {
      send_to_char("it costs 5 primal to invoke the illusions of yourself.\n\r",ch);
      return;
    }
    return;
  }
  else if (!str_cmp(arg1,"deflector"))
  {
    if (ch->pcdata->powers[PINVOKE] < 5)
    {
      send_to_char("You don't have that invoke yet.\n\r",ch);
      return;
    }
    if (!IS_ITEMAFF(ch, ITEMA_DEFLECTOR) && ch->practice >= defshieldcost)
    {
      SET_BIT(ch->itemaffect, ITEMA_DEFLECTOR);
      ch->practice -= defshieldcost;
      send_to_char("A shield appears in the air, preventing people from hitting you.\n\r",ch);
      return;
    }
    else if (IS_ITEMAFF(ch, ITEMA_DEFLECTOR))
    {
      send_to_char("You cannot summon any more shields.\n\r",ch);
      return;
    }
    else
    {
      send_to_char("it costs 5 primal to summon a shield.\n\r",ch);
      return;
    }
  }
  else if (!str_cmp(arg1,"mageshield") || !str_cmp(arg1,"shield"))
  {
    if (ch->pcdata->powers[PINVOKE] < 2)
    {
      send_to_char("You don't have that invoke yet.\n\r",ch);
      return;
    }
    if (!IS_SET(ch->newbits, NEW_MULTIARMS))
      SET_BIT(ch->newbits, NEW_MULTIARMS);
    if (!IS_ITEMAFF(ch, ITEMA_MAGESHIELD) && ch->practice>=shieldcost)
    {
      SET_BIT(ch->itemaffect, ITEMA_MAGESHIELD);
      ch->practice -= shieldcost;
      send_to_char("A layer of mystic shields envelopes your body.\n\r",ch);
      return;
    }
    else if (IS_ITEMAFF(ch, ITEMA_MAGESHIELD))
    {
      send_to_char("You are allready shielded.\n\r",ch);
      return;
    }
    else
    {
      send_to_char("The cost is 25 primal.\n\r",ch);
      return;
    }
  }
  else if (!str_cmp(arg1,"all"))
  {
    int totalcost = 0;
    if (ch->pcdata->powers[PINVOKE] < 9)
    {
      send_to_char("You don't have all invokes, so theres no point in invoking them all.\n\r",ch);
      return;
    }
    if (!IS_ITEMAFF(ch, ITEMA_MAGESHIELD)) totalcost += shieldcost;
    if (!IS_ITEMAFF(ch, ITEMA_DEFLECTOR)) totalcost += defshieldcost;
    if (!IS_ITEMAFF(ch, ITEMA_ILLUSIONS)) totalcost += illusioncost;
    if (!IS_ITEMAFF(ch, ITEMA_BEAST)) totalcost += beastcost;
    if (!IS_ITEMAFF(ch, ITEMA_STEELSHIELD)) totalcost += steelshieldcost;
    if (totalcost == 0)
    {
      send_to_char("You already have all invokes on.\n\r",ch);
      return;
    }
    if (ch->practice < totalcost)
    {
      send_to_char("You don't have the primal.\n\r",ch);
      return;
    }
    if (!IS_ITEMAFF(ch, ITEMA_MAGESHIELD)) SET_BIT(ch->itemaffect, ITEMA_MAGESHIELD);
    if (!IS_ITEMAFF(ch, ITEMA_DEFLECTOR)) SET_BIT(ch->itemaffect, ITEMA_DEFLECTOR);
    if (!IS_ITEMAFF(ch, ITEMA_ILLUSIONS)) SET_BIT(ch->itemaffect, ITEMA_ILLUSIONS);
    if (!IS_ITEMAFF(ch, ITEMA_BEAST)) SET_BIT(ch->itemaffect, ITEMA_BEAST);
    if (!IS_ITEMAFF(ch, ITEMA_STEELSHIELD)) SET_BIT(ch->itemaffect, ITEMA_STEELSHIELD);
    send_to_char("You invoke all your powers.\n\r",ch);
    ch->practice -= totalcost;
    return;
  }
  send_to_char("invoke <learn/mageshield/deflector/steelshield/illusions/beast/all>.\n\r",ch);
  return;
}

/* syntax : magics
 * shows all class powers in effect
 */
void do_magics (CHAR_DATA *ch, char *argument)
{
  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_HUMAN))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }
  if (IS_ITEMAFF(ch, ITEMA_MAGESHIELD))
    send_to_char("* Your skin is covered in a layer of mystical energies.\n\r",ch);
  if (IS_ITEMAFF(ch, ITEMA_BEAST))
    send_to_char("* Your inner beast is in control of your actions.\n\r",ch);
  if (IS_ITEMAFF(ch, ITEMA_STEELSHIELD))
    send_to_char("* Your skin is solid steel.\n\r",ch);
  if (IS_ITEMAFF(ch, ITEMA_DEFLECTOR))
    send_to_char("* A shield hovers in the air, defending you.\n\r",ch);
  if (IS_ITEMAFF(ch, ITEMA_ILLUSIONS))
    send_to_char("* Several images of you stand by your side.\n\r",ch);
  return;
}

/* syntax : discharge
 * (drops all elementalshields in one BIG blast)
 */
void do_discharge (CHAR_DATA *ch, char *argument)
{
  CHAR_DATA *vch;
  CHAR_DATA *vch_next;
  CHAR_DATA *mount;
  char buf1[MAX_STRING_LENGTH];
  char buf2[MAX_STRING_LENGTH];
  char buf3[MAX_STRING_LENGTH];
  int magic_power = ch->spl[RED_MAGIC] + ch->spl[BLUE_MAGIC] + ch->spl[GREEN_MAGIC] + ch->spl[PURPLE_MAGIC] + ch->spl[YELLOW_MAGIC];
  int dam;

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_HUMAN))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }
  if (ch->pcdata->powers[PINVOKE] < 4) /* 4 is just a test */
  {
    send_to_char("You don't have that invoke yet.\n\r",ch);
    return;
  }
  if (IS_ITEMAFF(ch, ITEMA_AFFENTROPY)) 
    magic_power +=100;
  if (IS_ITEMAFF(ch, ITEMA_MAGESHIELD))
  {
    REMOVE_BIT(ch->itemaffect, ITEMA_MAGESHIELD);
    for (vch = ch->in_room->people; vch != NULL; vch = vch_next)
    {
      vch_next = vch->next_in_room;
      if (vch != ch)
      {
        if (is_safe(ch,vch)) continue;
        if (vch->trust > 6) continue;        
        if ((mount = ch->mount) != NULL)
          if (mount == vch) continue;
        dam = number_range(magic_power*7/2, magic_power*9/2) + ch->damroll;
        if (IS_AFFECTED(vch, AFF_SANCTUARY)) dam *= 0.5;
        sprintf(buf1,"$n's mystical shields explodes in a shower of flames striking $N [#C%d#n]",dam);
        sprintf(buf2,"Your mystical shields explodes in a shower of flames striking $N [#C%d#n]",dam);
        sprintf(buf3,"$n's mystical shields explodes in a shower of flames striking you [#C%d#n]",dam);
        act(buf1,ch,NULL,vch, TO_NOTVICT);
        act(buf2,ch,NULL,vch, TO_CHAR);
        act(buf3,ch,NULL,vch, TO_VICT);
        hurt_person(ch,vch,dam);
        if (vch->position > POS_STUNNED)
        {
          if (vch->fighting == NULL) set_fighting(vch, ch);
          if (ch->fighting == NULL) set_fighting(ch, vch);
        }
      }
    }
  }
  return;
}


/* syntax : teleport <target>
 * ex : teleport satan
 */
void do_teleport (CHAR_DATA *ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  ROOM_INDEX_DATA *location;
  CHAR_DATA *victim;

  one_argument (argument, arg);
  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_HUMAN))
  {
    send_to_char("Huh?\n\r", ch );
    return;
	}
  if (ch->pcdata->powers[PINVOKE] < 1) /* 1 is just a test */
  {
    send_to_char("You don't have that invoke yet.\n\r",ch);
    return;
  }
  if ((victim = get_char_world(ch, arg)) == NULL) 
  {
    send_to_char("Teleport to whom?\n\r", ch );
    return;
  }
  if (IS_SET(victim->in_room->room_flags, ROOM_ASTRAL))
  { 
    stc( "You can't find it's room.\n\r",ch);
    return; 
  }
  if (IS_IMMUNE(victim, IMM_TRAVEL) && !IS_NPC(victim))
  {
    send_to_char("I don't think they want you to do that.\n\r",ch);
    return;
  } 
  if (IS_SET(ch->in_room->room_flags, ROOM_ASTRAL))
  {
    stc( "Your room is not connected to the astral plane.\n\r",ch);
    return;
  }
	location = victim->in_room;
  if (ch->mana < 250) 
  {
    send_to_char("You don't have the mana to cast teleport.\n\r", ch );
    return;
  }
	act("You utter a single powerword.", ch, NULL, NULL, TO_CHAR);
	act("$n utters a strange sounding word and disappers.", ch, NULL, NULL, TO_ROOM);
	ch->mana -= 250;
	char_from_room(ch);
	char_to_room(ch, location);
	do_look(ch, "auto");
	act("You materialize.", ch, NULL, NULL, TO_CHAR);
	act("$n suddenly appear from out of nowhere.", ch, NULL, NULL, TO_ROOM);
  return;
}

/* syntax : objectgate <object>
 * ex. objectgate 2.bells
 */
void do_objectgate (CHAR_DATA *ch, char *argument)
{
  OBJ_DATA *obj;
  char arg1[MAX_INPUT_LENGTH];

  argument = one_argument(argument, arg1);

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_HUMAN))
  {
    send_to_char("Huh?\n\r", ch );
    return;
  }
  if (arg1[0] == '\0')
  {
    send_to_char("What object do you want to attempt to gate?\n\r",ch);
    return;
  }
  if ((obj = get_obj_world(ch, arg1)) == NULL)
  {
    send_to_char("No such object.\n\r",ch);
    return;
  }
  if (IS_SET(obj->quest, QUEST_ARTIFACT) || IS_SET(obj->quest, QUEST_RELIC))
  {
    send_to_char("You cannot grab artifacts or relics.\n\r",ch);
    return;
  }
  if (obj->carried_by != NULL)
  {
    send_to_char("Someone is holding the item.\n\r",ch);
    return;
  }
  if (obj->in_room == NULL)
  {
    send_to_char("It seems to be inside something.\n\r",ch);
    return;
  }
  if (!IS_SET(obj->wear_flags, ITEM_TAKE))
  {
    send_to_char("This item is too big.\n\r",ch);
    return;
  }
  if( IS_SET(obj->in_room->room_flags, ROOM_ASTRAL))
  {
    send_to_char( "You can't find it's room.\n\r",ch);
    return;
  }
  if(IS_SET(ch->in_room->room_flags, ROOM_ASTRAL))
  {
    send_to_char( "Your room is not connected to the astral plane.\n\r",ch);
    return;
  }
  obj_from_room( obj );
  obj_to_char( obj, ch );
  send_to_char("The item appears in your hand.\n\r",ch);
  return;
}