warlock.c

demise/src/warlock.c · 103.2 KB

From the archive dodbackup-final.tar.gz

Download the archive   « Back to the archive contents

/***************************************************************************
 *  God Wars Mud originally written by KaVir aka Richard Woolcock.         *
 *  Changes done to the code done by Sage aka Walter Howard, this mud is   *
 *  for the public, however if you run this code it means you agree        *
 *  to the license.low, license.gw, and license.merc have fun. :)          *
***************************************************************************/
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <stdlib.h>
#include "merc.h"

void mage_damage args ((CHAR_DATA * ch, CHAR_DATA * victim, int dam,
			const char *message, int type));
void mage_message
args ((CHAR_DATA * ch, CHAR_DATA * victim, int dam, const char *message,
       int type));
int mage_immunity args ((CHAR_DATA * ch, int dam, const char *msg, int type));
void update_damcap args ((CHAR_DATA * ch, CHAR_DATA * victim));
void set_fighting args ((CHAR_DATA * ch, CHAR_DATA * victim));
void check_killer args ((CHAR_DATA * ch, CHAR_DATA * victim));

const char *sphere_name[9] = {
  "Correspondence", "Life",
  "Prime", "Entropy",
  "Mind", "Spirit",
  "Forces", "Matter",
  "Time"
};


bool
is_memb (CHAR_DATA * ch)
{
  int test = number_percent ();

  if (IS_SET (ch->mflags, MAGE_EMBRACED2))
    {
      send_to_char
	("You struggle to move, but the earth surrounding you won't budge.\n\r",
	 ch);
      return TRUE;
    }

  else if (IS_SET (ch->mflags, MAGE_EMBRACED1) && test > 30)
    {
      send_to_char
	("You struggle to move, but the earth surrounding you won't budge.\n\r",
	 ch);
      return TRUE;
    }

  else if (IS_SET (ch->mflags, MAGE_EMBRACED1) && test <= 30)
    {
      send_to_char
	("You manage to break free of the earth surrounding you.\n\r", ch);
      REMOVE_BIT (ch->mflags, MAGE_EMBRACED1);
      return FALSE;
    }

  return FALSE;
}

bool
is_mage (CHAR_DATA * ch)
{
  if (!IS_MAGE (ch))
    {
      do_huh (ch, "");
      return FALSE;
    }
  return TRUE;
}

void
creategate (CHAR_DATA * ch, int inroom, int toroom, bool perm)
{
  OBJ_DATA *in_gate;
  OBJ_DATA *to_gate;
  ROOM_INDEX_DATA *pIn;
  ROOM_INDEX_DATA *pTo;

  pIn = get_room_index (inroom);
  pTo = get_room_index (toroom);

  in_gate = create_object (get_obj_index (OBJ_VNUM_WGATE), 0);
  obj_to_room (in_gate, pIn);
  in_gate->value[0] = toroom;
  in_gate->value[1] = MAGE_INROOM_GATE;
  in_gate->value[3] = inroom;
  if (!perm)
    in_gate->timer = ch->spheres[MCOR] + 5;
  in_gate->item_type = ITEM_WGATE;

  to_gate = create_object (get_obj_index (OBJ_VNUM_WGATE), 0);
  obj_to_room (to_gate, pTo);
  to_gate->value[0] = inroom;
  to_gate->value[1] = MAGE_TOROOM_GATE;
  to_gate->value[3] = toroom;
  if (!perm)
    to_gate->timer = ch->spheres[MCOR] + 5;
  to_gate->item_type = ITEM_WGATE;

  return;
}

void
do_spheres (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  char arg1[MIL];
  char arg2[MIL];
  int disc, cost;
  int max_spheres;
  cost = 0;

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

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

  if (arg1[0] == '\0')
    {
      send_to_char
	("-=[**]_[**]=-=[**]_[**]=-=[**]_[**] Spheres [**]_[**]=-=[**]_[**]=-=[**]_[**]=-\n\r",
	 ch);
      send_to_char
	("[+]                                                                         [+]\n\r",
	 ch);
      sprintf (buf,
	       "[+]    Correspondence  (%s%s%s%s%s)       Life    (%s%s%s%s%s)      Forces  (%s%s%s%s%s)   [+]\n\r",
	       ch->spheres[MCOR] >= 1 ? "*" : " ",
	       ch->spheres[MCOR] >= 2 ? "*" : " ",
	       ch->spheres[MCOR] >= 3 ? "*" : " ",
	       ch->spheres[MCOR] >= 4 ? "*" : " ",
	       ch->spheres[MCOR] >= 5 ? "*" : " ",
	       ch->spheres[MLIF] >= 1 ? "*" : " ",
	       ch->spheres[MLIF] >= 2 ? "*" : " ",
	       ch->spheres[MLIF] >= 3 ? "*" : " ",
	       ch->spheres[MLIF] >= 4 ? "*" : " ",
	       ch->spheres[MLIF] >= 5 ? "*" : " ",
	       ch->spheres[MFOR] >= 1 ? "*" : " ",
	       ch->spheres[MFOR] >= 2 ? "*" : " ",
	       ch->spheres[MFOR] >= 3 ? "*" : " ",
	       ch->spheres[MFOR] >= 4 ? "*" : " ",
	       ch->spheres[MFOR] >= 5 ? "*" : " ");
      send_to_char (buf, ch);
      if (IS_NEPHANDI (ch))
	{
	  sprintf (buf,
		   "[+]       Entropy      (%s%s%s%s%s)       Mind    (%s%s%s%s%s)      Spirit  (%s%s%s%s%s)   [+]\n\r[+]                    (%s%s%s%s%s)                                              [+]\n\r",
		   ch->spheres[MENT] >= 1 ? "*" : " ",
		   ch->spheres[MENT] >= 2 ? "*" : " ",
		   ch->spheres[MENT] >= 3 ? "*" : " ",
		   ch->spheres[MENT] >= 4 ? "*" : " ",
		   ch->spheres[MENT] >= 5 ? "*" : " ",
		   ch->spheres[MMIN] >= 1 ? "*" : " ",
		   ch->spheres[MMIN] >= 2 ? "*" : " ",
		   ch->spheres[MMIN] >= 3 ? "*" : " ",
		   ch->spheres[MMIN] >= 4 ? "*" : " ",
		   ch->spheres[MMIN] >= 5 ? "*" : " ",
		   ch->spheres[MSPI] >= 1 ? "*" : " ",
		   ch->spheres[MSPI] >= 2 ? "*" : " ",
		   ch->spheres[MSPI] >= 3 ? "*" : " ",
		   ch->spheres[MSPI] >= 4 ? "*" : " ",
		   ch->spheres[MSPI] >= 5 ? "*" : " ",
		   ch->spheres[MENT] >= 6 ? "*" : " ",
		   ch->spheres[MENT] >= 7 ? "*" : " ",
		   ch->spheres[MENT] >= 8 ? "*" : " ",
		   ch->spheres[MENT] >= 9 ? "*" : " ",
		   ch->spheres[MENT] >= 10 ? "*" : " ");
	}
      else if (IS_NECROMANCER (ch))
	{
	  sprintf (buf,
		   "[+]       Entropy      (%s%s%s%s%s)       Mind    (%s%s%s%s%s)      Spirit  (%s%s%s%s%s)   [+]\n\r[+]                                                               (%s%s%s%s%s)   [+]\n\r",
		   ch->spheres[MENT] >= 1 ? "*" : " ",
		   ch->spheres[MENT] >= 2 ? "*" : " ",
		   ch->spheres[MENT] >= 3 ? "*" : " ",
		   ch->spheres[MENT] >= 4 ? "*" : " ",
		   ch->spheres[MENT] >= 5 ? "*" : " ",
		   ch->spheres[MMIN] >= 1 ? "*" : " ",
		   ch->spheres[MMIN] >= 2 ? "*" : " ",
		   ch->spheres[MMIN] >= 3 ? "*" : " ",
		   ch->spheres[MMIN] >= 4 ? "*" : " ",
		   ch->spheres[MMIN] >= 5 ? "*" : " ",
		   ch->spheres[MSPI] >= 1 ? "*" : " ",
		   ch->spheres[MSPI] >= 2 ? "*" : " ",
		   ch->spheres[MSPI] >= 3 ? "*" : " ",
		   ch->spheres[MSPI] >= 4 ? "*" : " ",
		   ch->spheres[MSPI] >= 5 ? "*" : " ",
		   ch->spheres[MSPI] >= 6 ? "*" : " ",
		   ch->spheres[MSPI] >= 7 ? "*" : " ",
		   ch->spheres[MSPI] >= 8 ? "*" : " ",
		   ch->spheres[MSPI] >= 9 ? "*" : " ",
		   ch->spheres[MSPI] >= 10 ? "*" : " ");
	}
      else
	{
	  sprintf (buf,
		   "[+]       Entropy      (%s%s%s%s%s)       Mind    (%s%s%s%s%s)      Spirit  (%s%s%s%s%s)   [+]\n\r",
		   ch->spheres[MENT] >= 1 ? "*" : " ",
		   ch->spheres[MENT] >= 2 ? "*" : " ",
		   ch->spheres[MENT] >= 3 ? "*" : " ",
		   ch->spheres[MENT] >= 4 ? "*" : " ",
		   ch->spheres[MENT] >= 5 ? "*" : " ",
		   ch->spheres[MMIN] >= 1 ? "*" : " ",
		   ch->spheres[MMIN] >= 2 ? "*" : " ",
		   ch->spheres[MMIN] >= 3 ? "*" : " ",
		   ch->spheres[MMIN] >= 4 ? "*" : " ",
		   ch->spheres[MMIN] >= 5 ? "*" : " ",
		   ch->spheres[MSPI] >= 1 ? "*" : " ",
		   ch->spheres[MSPI] >= 2 ? "*" : " ",
		   ch->spheres[MSPI] >= 3 ? "*" : " ",
		   ch->spheres[MSPI] >= 4 ? "*" : " ",
		   ch->spheres[MSPI] >= 5 ? "*" : " ");
	}
      send_to_char (buf, ch);
      if (IS_WISHENCHANT (ch))
	{
	  sprintf (buf,
		   "[+]        Prime       (%s%s%s%s%s)       Time    (%s%s%s%s%s)      Matter  (%s%s%s%s%s)   [+]\n\r[+]                                                                         (%s%s%s%s%s)   [+]\n\r",
		   ch->spheres[MPRI] >= 1 ? "*" : " ",
		   ch->spheres[MPRI] >= 2 ? "*" : " ",
		   ch->spheres[MPRI] >= 3 ? "*" : " ",
		   ch->spheres[MPRI] >= 4 ? "*" : " ",
		   ch->spheres[MPRI] >= 5 ? "*" : " ",
		   ch->spheres[MTIM] >= 1 ? "*" : " ",
		   ch->spheres[MTIM] >= 2 ? "*" : " ",
		   ch->spheres[MTIM] >= 3 ? "*" : " ",
		   ch->spheres[MTIM] >= 4 ? "*" : " ",
		   ch->spheres[MTIM] >= 5 ? "*" : " ",
		   ch->spheres[MMAT] >= 1 ? "*" : " ",
		   ch->spheres[MMAT] >= 2 ? "*" : " ",
		   ch->spheres[MMAT] >= 3 ? "*" : " ",
		   ch->spheres[MMAT] >= 4 ? "*" : " ",
		   ch->spheres[MMAT] >= 5 ? "*" : " ",
		   ch->spheres[MMAT] >= 6 ? "*" : " ",
		   ch->spheres[MMAT] >= 7 ? "*" : " ",
		   ch->spheres[MMAT] >= 8 ? "*" : " ",
		   ch->spheres[MMAT] >= 9 ? "*" : " ",
		   ch->spheres[MMAT] >= 10 ? "*" : " ");
	}
      else if (IS_GYPSY (ch))
	{
	  sprintf (buf,
		   "[+]        Prime       (%s%s%s%s%s)       Time    (%s%s%s%s%s)      Matter  (%s%s%s%s%s)   [+]\n\r[+]                                          (%s%s%s%s%s)                        [+]\n\r",
		   ch->spheres[MPRI] >= 1 ? "*" : " ",
		   ch->spheres[MPRI] >= 2 ? "*" : " ",
		   ch->spheres[MPRI] >= 3 ? "*" : " ",
		   ch->spheres[MPRI] >= 4 ? "*" : " ",
		   ch->spheres[MPRI] >= 5 ? "*" : " ",
		   ch->spheres[MTIM] >= 1 ? "*" : " ",
		   ch->spheres[MTIM] >= 2 ? "*" : " ",
		   ch->spheres[MTIM] >= 3 ? "*" : " ",
		   ch->spheres[MTIM] >= 4 ? "*" : " ",
		   ch->spheres[MTIM] >= 5 ? "*" : " ",
		   ch->spheres[MMAT] >= 1 ? "*" : " ",
		   ch->spheres[MMAT] >= 2 ? "*" : " ",
		   ch->spheres[MMAT] >= 3 ? "*" : " ",
		   ch->spheres[MMAT] >= 4 ? "*" : " ",
		   ch->spheres[MMAT] >= 5 ? "*" : " ",
		   ch->spheres[MTIM] >= 6 ? "*" : " ",
		   ch->spheres[MTIM] >= 7 ? "*" : " ",
		   ch->spheres[MTIM] >= 8 ? "*" : " ",
		   ch->spheres[MTIM] >= 9 ? "*" : " ",
		   ch->spheres[MTIM] >= 10 ? "*" : " ");
	}
      else
	{
	  sprintf (buf,
		   "[+]        Prime       (%s%s%s%s%s)       Time    (%s%s%s%s%s)      Matter  (%s%s%s%s%s)   [+]\n\r",
		   ch->spheres[MPRI] >= 1 ? "*" : " ",
		   ch->spheres[MPRI] >= 2 ? "*" : " ",
		   ch->spheres[MPRI] >= 3 ? "*" : " ",
		   ch->spheres[MPRI] >= 4 ? "*" : " ",
		   ch->spheres[MPRI] >= 5 ? "*" : " ",
		   ch->spheres[MTIM] >= 1 ? "*" : " ",
		   ch->spheres[MTIM] >= 2 ? "*" : " ",
		   ch->spheres[MTIM] >= 3 ? "*" : " ",
		   ch->spheres[MTIM] >= 4 ? "*" : " ",
		   ch->spheres[MTIM] >= 5 ? "*" : " ",
		   ch->spheres[MMAT] >= 1 ? "*" : " ",
		   ch->spheres[MMAT] >= 2 ? "*" : " ",
		   ch->spheres[MMAT] >= 3 ? "*" : " ",
		   ch->spheres[MMAT] >= 4 ? "*" : " ",
		   ch->spheres[MMAT] >= 5 ? "*" : " ");
	}
      send_to_char (buf, ch);
      send_to_char
	("[+]                                                                         [+]\n\r",
	 ch);
      send_to_char
	("-=[**]_[**]=-=[**]_[**]=-=[**]_[**]---------[**]_[**]=-=[**]_[**]=-=[**]_[**]=-\n\r",
	 ch);
      return;
    }

  if (arg2[0] == '\0')
    {
      if (!str_prefix (arg1, "Life"))
	{
	  if (ch->spheres[MLIF] == 0)
	    {
	      send_to_char
		("You have no knowledge of the sphere of Life.\n\r", ch);
	      return;
	    }

	  if (ch->spheres[MLIF] >= 1)
	    {
	      divide_to_char (ch);
	      cent_to_char ("The Sphere of Life", ch);
	      divide_to_char (ch);
	      cent_to_char ("Ho Tien Chi", ch);
	    }
	  if (ch->spheres[MLIF] >= 2)
	    cent_to_char ("Little Good Death", ch);
	  if (ch->spheres[MLIF] >= 3)
	    cent_to_char ("Better Body", ch);
	  if (ch->spheres[MLIF] >= 4)
	    cent_to_char ("Shapechange", ch);
	  if (ch->spheres[MLIF] >= 5)
	    cent_to_char ("Layhands / Movedrain", ch);
	  divide_to_char (ch);
	  return;
	}

      if (!str_prefix (arg1, "Prime"))
	{
	  if (ch->spheres[MPRI] == 0)
	    {
	      send_to_char
		("You have no knowledge of the sphere of Prime.\n\r", ch);
	      return;
	    }

	  if (ch->spheres[MPRI] >= 1)
	    {
	      cent_to_char ("The Sphere of Prime", ch);
	      divide_to_char (ch);
	      cent_to_char ("Quintessence", ch);
	    }
	  if (ch->spheres[MPRI] >= 2)
	    cent_to_char ("Enchant", ch);
	  if (ch->spheres[MPRI] >= 3)
	    cent_to_char ("Rubbing of the Bones", ch);
	  if (ch->spheres[MPRI] >= 4)
	    cent_to_char ("Flames of Purification", ch);
	  if (ch->spheres[MPRI] >= 5)
	    cent_to_char ("Quintessence Blast", ch);
	  divide_to_char (ch);
	  return;
	}

      if (!str_prefix (arg1, "Matter"))
	{
	  if (ch->spheres[MMAT] == 0)
	    {
	      send_to_char
		("You have no knowledge of the sphere of Matter.\n\r", ch);
	      return;
	    }

	  if (ch->spheres[MMAT] >= 1)
	    {
	      divide_to_char (ch);
	      cent_to_char ("The Sphere of Matter", ch);
	      divide_to_char (ch);
	      cent_to_char ("Analyze Substance", ch);
	    }
	  if (ch->spheres[MMAT] >= 2)
	    cent_to_char ("Alter State", ch);
	  if (ch->spheres[MMAT] >= 3)
	    cent_to_char ("Alter Weight", ch);
	  if (ch->spheres[MMAT] >= 4)
	    cent_to_char ("Enchant Armor", ch);
	  if (ch->spheres[MMAT] >= 5)
	    cent_to_char ("Hover", ch);
	  if (ch->spheres[MMAT] >= 6)
	    cent_to_char ("Mask of Wishes (craft mask)", ch);
	  if (ch->spheres[MMAT] >= 7)
	    cent_to_char ("Temper", ch);
	  divide_to_char (ch);
	  return;
	}

      if (!str_prefix (arg1, "Spirit"))
	{
	  if (ch->spheres[MSPI] == 0)
	    {
	      send_to_char
		("You have no knowledge of the Sphere of Spirit.\n\r", ch);
	      return;
	    }

	  if (ch->spheres[MSPI] >= 1)
	    {
	      divide_to_char (ch);
	      cent_to_char ("The Sphere of Spirit", ch);
	      divide_to_char (ch);
	      cent_to_char ("Call Spirit", ch);
	    }
	  if (ch->spheres[MSPI] >= 2)
	    cent_to_char ("Spirit Kiss", ch);
	  if (ch->spheres[MSPI] >= 3)
	    cent_to_char ("Awaken the Inanimate", ch);
	  if (ch->spheres[MSPI] >= 4)
	    cent_to_char ("Spirit Blast", ch);
	  if (ch->spheres[MSPI] >= 5)
	    cent_to_char ("Breach the Gauntlet", ch);
	  if (ch->spheres[MSPI] >= 6)
	    cent_to_char ("Sculpt will give you one Staff", ch);
	  if (ch->spheres[MSPI] >= 7)
	    cent_to_char ("Improved Damcap", ch);
	  if (ch->spheres[MSPI] >= 8)
	    cent_to_char ("Improved Zombies from awaken", ch);
	  if (ch->spheres[MSPI] >= 9)
	    cent_to_char ("Improved Spirit blast", ch);

	  if (ch->spheres[MSPI] >= 10)
	    cent_to_char ("Improved SpiritKiss", ch);
	  divide_to_char (ch);
	  return;
	}

      if (!str_prefix (arg1, "Entropy"))
	{
	  if (ch->spheres[MENT] == 0)
	    {
	      send_to_char
		("You have no knowledge of the Sphere of Entropy.\n\r", ch);
	      return;
	    }
	  else
	    {
	      divide_to_char (ch);
	      cent_to_char ("The Sphere of Entropy", ch);
	      divide_to_char (ch);
	      cent_to_char ("Dim Mak", ch);
	      cent_to_char ("Entropic Blast", ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "You have obtained a level %d knowledge of Entropy.",
		       ch->spheres[MENT]);
	      cent_to_char (buf, ch);
	      sprintf (buf, "This multiplies your damage by %f.",
		       (1 + (ch->spheres[MENT] * .1)));
	      cent_to_char (buf, ch);
	      sprintf (buf, "This divides your damage taken by 1.5.");
	      cent_to_char (buf, ch);
	      sprintf (buf, "This increases the level of your spells by %d.",
		       ch->spheres[MENT] * 5);
	      cent_to_char (buf, ch);
	      divide_to_char (ch);
	      return;
	    }
	}

      if (!str_prefix (arg1, "Correspondence"))
	{
	  if (ch->spheres[MCOR] == 0)
	    {
	      send_to_char
		("You have no knowledge of the sphere of Correspondence.\n\r",
		 ch);
	      return;
	    }

	  if (ch->spheres[MCOR] > 0)
	    {
	      cent_to_char ("The Sphere of Correspondence", ch);
	      divide_to_char (ch);
	      cent_to_char ("Perception", ch);
	    }

	  if (ch->spheres[MCOR] > 1)
	    {
	      cent_to_char ("Gateway to the Non-Living", ch);
	    }

	  if (ch->spheres[MCOR] > 2)
	    {
	      cent_to_char ("Gateway to the Living", ch);
	    }

	  if (ch->spheres[MCOR] > 3)
	    {
	      cent_to_char ("The Grasp of Elminster", ch);
	      cent_to_char ("The Eternal Gateway", ch);
	    }

	  if (ch->spheres[MCOR] > 4)
	    {
	      cent_to_char ("Polyappearance", ch);
	    }
	  divide_to_char (ch);
	  return;
	}

      else if (!str_cmp (arg1, "Mind"))
	{
	  if (ch->spheres[MMIN] == 0)
	    {
	      send_to_char
		(" You have no knowledge of the Sphere of the Mind.\n\r", ch);
	      return;
	    }

	  if (ch->spheres[MMIN] > 0)
	    {
	      divide_to_char (ch);
	      cent_to_char ("The Sphere of Mind", ch);
	      divide_to_char (ch);
	      cent_to_char ("Shield", ch);
	    }

	  if (ch->spheres[MMIN] > 1)
	    {
	      cent_to_char ("Subliminal Impulse", ch);
	    }

	  if (ch->spheres[MMIN] > 2)
	    cent_to_char ("Probe Thoughts", ch);

	  if (ch->spheres[MMIN] > 3)
	    cent_to_char ("Possession", ch);

	  if (ch->spheres[MMIN] > 4)
	    cent_to_char ("Untether", ch);
	  divide_to_char (ch);
	  return;
	}

      else if (!str_prefix (arg1, "Forces"))
	{
	  if (ch->spheres[MFOR] == 0)
	    {
	      send_to_char
		("You have no knowledge of the Sphere of Forces.\n\r", ch);
	      return;
	    }

	  if (ch->spheres[MFOR] > 0)
	    {
	      cent_to_char ("The Sphere of Forces", ch);
	      line (ch);
	      cent_to_char ("Discharge Static", ch);
	    }
	  if (ch->spheres[MFOR] > 1)
	    {
	      cent_to_char ("Telekinesis", ch);
	    }
	  if (ch->spheres[MFOR] > 2)
	    {
	      cent_to_char ("Call Lightning", ch);
	      cent_to_char ("Control Weather", ch);
	    }
	  if (ch->spheres[MFOR] > 3)
	    {
	      cent_to_char ("Embracing the Earth Mother", ch);
	    }
	  if (ch->spheres[MFOR] > 4)
	    {
	      cent_to_char ("Tempest Shards", ch);
	      line (ch);
	    }
	  return;
	}

      else if (!str_cmp (arg1, "Time"))
	{
	  if (ch->spheres[MTIM] == 0)
	    {
	      send_to_char
		("You have no knowledge of the Sphere of Time.\n\r", ch);
	      return;
	    }
	  else
	    {
	      sprintf (buf, "You have a level %d knowledge of Time.\n\r",
		       ch->spheres[MTIM]);
	      send_to_char (buf, ch);
	      if (ch->spheres[MTIM] > 5)
		stc ("You can Craft the Crystal Orb.\n\r", ch);
	      if (ch->spheres[MTIM] > 5)
		stc ("You know the Slow Conjuration.\n\r", ch);
	      if (ch->spheres[MTIM] > 6)
		stc ("You know the Haste Conjuration.\n\r", ch);
	      if (ch->spheres[MTIM] > 7)
		stc ("You know how to activate your time shield.\n\r", ch);
	      if (ch->spheres[MTIM] > 8)
		stc ("You know how to call your time guardian.\n\r", ch);

	      return;
	    }
	  return;
	}


    }

  if (!str_cmp (arg2, "learn"))
    {
      if (!str_prefix (arg1, "correspondence"))
	{
	  if (ch->class == CLASS_MAGE && ch->pcdata->runes[0] < WHITE_MAGIC)
	    max_spheres = 5;
	  else
	    max_spheres = 3;

	  disc = MCOR;
	}
      else if (!str_prefix (arg1, "life"))
	{
	  if (ch->class == CLASS_MAGE && ch->pcdata->runes[0] < WHITE_MAGIC)
	    max_spheres = 5;
	  else
	    max_spheres = 3;

	  disc = MLIF;
	}
      else if (!str_prefix (arg1, "prime"))
	{
	  if (ch->class == CLASS_MAGE && ch->pcdata->runes[0] < WHITE_MAGIC)
	    max_spheres = 5;
	  else
	    max_spheres = 3;

	  disc = MPRI;
	}
      else if (!str_prefix (arg1, "entropy"))
	{
	  if (ch->class == CLASS_MAGE && ch->pcdata->runes[0] < WHITE_MAGIC)
	    max_spheres = 5;
	  else if (IS_NEPHANDI (ch))
	    max_spheres = 10;
	  else
	    max_spheres = 3;

	  disc = MENT;
	}
      else if (!str_prefix (arg1, "mind"))
	{
	  if (ch->class == CLASS_MAGE && ch->pcdata->runes[0] < WHITE_MAGIC)
	    max_spheres = 5;
	  else
	    max_spheres = 3;

	  disc = MMIN;
	}
      else if (!str_prefix (arg1, "spirit"))
	{
	  if (ch->class == CLASS_MAGE && ch->pcdata->runes[0] < WHITE_MAGIC)
	    max_spheres = 5;
	  else if (IS_NECROMANCER (ch))
	    max_spheres = 10;
	  else
	    max_spheres = 3;

	  disc = MSPI;
	}
      else if (!str_prefix (arg1, "forces"))
	{
	  if (ch->class == CLASS_MAGE && ch->pcdata->runes[0] < WHITE_MAGIC)
	    max_spheres = 5;
	  else
	    max_spheres = 3;

	  disc = MFOR;
	}
      else if (!str_prefix (arg1, "matter"))
	{
	  if (ch->class == CLASS_MAGE && ch->pcdata->runes[0] < WHITE_MAGIC)
	    max_spheres = 5;
	  else if (IS_WISHENCHANT (ch))
	    max_spheres = 10;
	  else
	    max_spheres = 3;

	  disc = MMAT;
	}
      else if (!str_prefix (arg1, "time"))
	{
	  if (ch->class == CLASS_MAGE && ch->pcdata->runes[0] < WHITE_MAGIC)
	    max_spheres = 5;
	  else if (IS_GYPSY (ch))
	    max_spheres = 10;
	  else
	    max_spheres = 3;

	  disc = MTIM;
	}
      else
	{
	  send_to_char
	    ("You must select from the following spheres:\n\r  Correspondence, Life, Prime, Entropy, Mind, Spirit, Forces, Matter, Time.\n\r",
	     ch);
	  return;
	}
    }
  else
    {
      do_spheres (ch, "");
      return;
    }

  cost = ((ch->spheres[disc] + 1) * 1000);

  if (ch->spheres[disc] >= max_spheres)
    {
      sprintf (buf,
	       "You have already learned all levels of the %s sphere.\n\r",
	       sphere_name[disc]);
      send_to_char (buf, ch);
      return;
    }

  if (ch->pcdata->power[POWER_CURRENT] < cost)
    {
      sprintf (buf,
	       "You need %d %s points to obtain a new level of understanding of the %s sphere.\n\r",
	       cost, get_class (ch), sphere_name[disc]);
      send_to_char (buf, ch);
      return;
    }

  ch->pcdata->power[POWER_CURRENT] -= cost;
  ch->spheres[disc]++;
  sprintf (buf, "Your knowledge of the %s sphere increases.\n\r",
	   sphere_name[disc]);
  send_to_char (buf, ch);
  return;

}



void
do_slow (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  OBJ_DATA *obj;
  char arg[MIL];
  AFFECT_DATA af;
  int mcost = 10000, sn;
  int level = ch->spheres[MTIM];

  argument = one_argument (argument, arg);

  if (!IS_MAGE (ch) || ch->spheres[MTIM] < 7)
    {
      do_huh (ch, "");
      return;
    }

  if (ch->mana < mcost)
    {
      send_to_char
	("You need atleast 10000 mystical power before you can use this skill.\n\r",
	 ch);
      return;
    }

  obj = get_eq_char (ch, WEAR_SPECIAL);

  if (obj == NULL)
    {
      stc
	("You need to have an activated crystal orb in order to use this power.\n\r",
	 ch);
      return;
    }
  if (!IS_SET (obj->weapflags, WEAPON_SPELLORB))
    {
      stc
	("You need to have an activated crystal orb in order to use this power.\n\r",
	 ch);
      return;
    }

  if (arg[0] == '\0' && ch->fighting == NULL)
    {
      stc ("Whom do you wish to slow?\n\r", ch);
      return;
    }

  if ((victim = ch->fighting) == NULL)
    {
      if ((victim = get_pc_world (ch, arg)) == NULL)
	{
	  send_to_char ("They aren't here.\n\r", ch);
	  return;
	}
    }

  if (ch == victim)
    {
      stc ("Now that would be really stupid.\n\r", ch);
      return;
    }

  if (global_safe (ch, victim))
    return;

  if ((sn = skill_lookup ("sluggish")) < 0)
    {
      stc ("Bad bug, inform Corim at once.\n\r", ch);
      return;
    }

  if (is_affected (victim, sn))
    {
      send_to_char ("They are already slowed.\n\r", ch);
      return;
    }

  act ("$n grasps $p and mumbles a quick conjuration.", ch, obj, NULL,
       TO_ROOM);
  act ("You grasp $p and quickly recite the slow conjuration.", ch, obj, NULL,
       TO_CHAR);

  (*skill_table[sn].spell_fun) (sn, level, ch, victim);
  waiting (ch, 9);

  ch->mana -= mcost;

  return;

}

void
do_temper (CHAR_DATA * ch, char *argument)
{
  OBJ_DATA *obj;
  char arg[MIL];

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!IS_MAGE (ch))
    {
      do_huh (ch, "");
      return;
    }

  if (ch->spheres[MMAT] < 7)
    {
      stc
	("You need 7 in your Matter Sphere before you can Temper anything.\n\r",
	 ch);
      return;
    }

  if (ch->pcdata->crystal < 5)
    {
      send_to_char ("You dont have the required 5 power crystals\n\r", ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("What object do you wish to enchant?\n\r", ch);
      return;
    }

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

  if (IS_SET (obj->quest, QUEST_TEMPERED))
    {
      send_to_char ("This item has already been tempered.\n\r", ch);
      return;
    }
  else if (obj->points < 20000 && obj->item_type != ITEM_WEAPON)
    {
      send_to_char ("The object must be worth at least 20000 credits.\n\r",
		    ch);
      return;
    }
  else if (obj->points < 40000 && obj->item_type == ITEM_WEAPON)
    {
      send_to_char ("The object must be worth at least 40000 credits.\n\r",
		    ch);
      return;
    }

  REMOVE_BIT (obj->quest, QUEST_STR);
  REMOVE_BIT (obj->quest, QUEST_DEX);
  REMOVE_BIT (obj->quest, QUEST_INT);
  REMOVE_BIT (obj->quest, QUEST_WIS);
  REMOVE_BIT (obj->quest, QUEST_CON);
  REMOVE_BIT (obj->quest, QUEST_HITROLL);
  REMOVE_BIT (obj->quest, QUEST_DAMROLL);
  REMOVE_BIT (obj->quest, QUEST_HIT);
  REMOVE_BIT (obj->quest, QUEST_MANA);
  REMOVE_BIT (obj->quest, QUEST_MOVE);
  REMOVE_BIT (obj->quest, QUEST_AC);
  REMOVE_BIT (obj->quest, QUEST_DAMCAP);
  SET_BIT (obj->quest, QUEST_TEMPERED);
  ch->pcdata->crystal -= 5;
  act ("You Temper $p in Wish Flame.", ch, obj, NULL, TO_CHAR);
  act ("$n Tempers $p in Wish Flame.", ch, obj, NULL, TO_ROOM);
  return;
}

void
do_haste (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  OBJ_DATA *obj;
  char arg[MIL];
  AFFECT_DATA af;
  int mcost = 10000, sn;
  int level = ch->spheres[MTIM];

  argument = one_argument (argument, arg);

  if (!IS_MAGE (ch) || ch->spheres[MTIM] < 8)
    {
      do_huh (ch, "");
      return;
    }

  if (ch->mana < mcost)
    {
      send_to_char
	("You need atleast 10000 mystical power before you can use this skill.\n\r",
	 ch);
      return;
    }

  obj = get_eq_char (ch, WEAR_SPECIAL);

  if (obj == NULL)
    {
      stc
	("You need to have an activated crystal orb in order to use this power.\n\r",
	 ch);
      return;
    }
  if (!IS_SET (obj->weapflags, WEAPON_SPELLORB))
    {
      stc
	("You need to have an activated crystal orb in order to use this power.\n\r",
	 ch);
      return;
    }

  if (arg[0] == '\0')
    {
      if (ch == NULL)
	return;

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

  if ((sn = skill_lookup ("haste")) < 0)
    {
      stc ("Bad bug, inform Corim at once.\n\r", ch);
      return;
    }

  if (is_affected (victim, sn))
    {
      send_to_char ("They are already hasted.\n\r", ch);
      return;
    }

  act ("$n grasps $p and mumbles a quick conjuration.", ch, obj, NULL,
       TO_ROOM);
  act ("You grasps $p and quickly recite the haste conjuration.", ch, obj,
       NULL, TO_CHAR);
  (*skill_table[sn].spell_fun) (sn, level, ch, victim);
  waiting (ch, 9);

  ch->mana -= mcost;

  return;

}

void
do_drainmove (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;

  if (!IS_MAGE (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (ch->spheres[MLIF] < 5)
    {
      send_to_char ("You need the 5th sphere of Life for this.\n\r", ch);
      return;
    }
  if ((victim = get_char_world (ch, argument)) == NULL)
    {
      send_to_char ("You were unable to find them.\n\r", ch);
      return;
    }
  else
    {
      if (is_safe (ch, victim))
	return;

      ch->mana += (victim->move * 0.2);
      victim->move -= (victim->move * 0.2);
      send_to_char ("Your feet seem to become heavier..\n\r", victim);
      send_to_char
	("You drain them and convert their power to mystical power.\n\r", ch);
      return;
    }
  return;
}

void
do_perception (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (!IS_MAGE (ch))
    {
      do_huh (ch, "");
      return;
    }
  if (ch->spheres[MCOR] < 1)
    {
      send_to_char
	("You must obtain level one Correspondence to enable your higher Perception.\n\r",
	 ch);
      return;
    }

  if (IS_SET (ch->mflags, MAGE_PERCEPTION))
    {
      send_to_char ("Your higher perception fades.\n\r", ch);
      REMOVE_BIT (ch->affected_by, AFF_SHADOWSIGHT);
      REMOVE_BIT (ch->act, PLR_HOLYLIGHT);
      REMOVE_BIT (ch->vampaff, VAM_NIGHTSIGHT);
      REMOVE_BIT (ch->mflags, MAGE_PERCEPTION);
      REMOVE_BIT (ch->nymbits, NYM_DEATHSIGHT);
      return;
    }

  else
    {
      send_to_char ("Your perception soars to new levels.\n\r", ch);
      SET_BIT (ch->mflags, MAGE_PERCEPTION);
      SET_BIT (ch->affected_by, AFF_SHADOWSIGHT);
      SET_BIT (ch->act, PLR_HOLYLIGHT);
      SET_BIT (ch->vampaff, VAM_NIGHTSIGHT);
//      SET_BIT (ch->nymbits, NYM_DEATHSIGHT);
      return;
    }

  return;
}

// Shield, Scry, Level II Correspondence

void
do_objectgate (CHAR_DATA * ch, char *argument)
{
  OBJ_DATA *obj;
  char arg1[MIL];
  char arg2[MIL];
  bool perm = FALSE;

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

  if (IS_NPC (ch))
    return;

  if (!IS_CREATOR (ch))
    {
      if (!is_mage (ch))
	return;

      if (ch->spheres[MCOR] < 2)
	{
	  send_to_char
	    ("You must obtain level two Correspondence to Open a Spacial Gate.\n\r",
	     ch);
	  return;
	}
      if (ch->spheres[MLIF] < 2 || ch->spheres[MMAT] < 2)
	{
	  send_to_char
	    ("This sphere must be used in conjunction with either Life 2 or Matter 2, which you have not obtained.\n\r",
	     ch);
	  return;
	}
    }
  if (is_inarena (ch))
    return;

  if (arg1[0] == '\0')
    {
      send_to_char ("What object do you want to attempt to gate to?\n\r", ch);
      return;
    }

  if ((obj = get_obj_world (ch, arg1)) == NULL)
    {
      send_to_char
	("You concentrate deeply on foreign planes, but can find no such object.\n\r",
	 ch);
      return;
    }
  if (obj->in_room == NULL)
    {
      act
	("You attempt to create a rift in space to $p, but the other end seems to be too narrow.",
	 ch, obj, NULL, TO_CHAR);
      return;
    }

  if (obj->item_type == ITEM_QUEST || obj->item_type == ITEM_CRYSTAL
      || obj->item_type == ITEM_EXP || obj->item_type == ITEM_PIECE)
    {
      stc ("You try to grab it, but it seems to leap out of your reach.\n\r",
	   ch);
      return;
    }
  if (obj->item_type == ITEM_PIECE)
    {
      stc ("You try to grab it, but it seems to leap out of your reach.\n\r",
	   ch);
      return;
    }

  if (IS_SET (obj->extra_flags, ITEM_NOSUMMON)
      || IS_SET (obj->extra_flags, ITEM_NOLOCATE))
    {
      stc ("You try to grab it, but it seems to leap out of your reach.\n\r",
	   ch);
      return;
    }

  if (obj->in_room == ch->in_room)
    {
      act
	("Your foolish attempt to grab your feet was not accepted by the forces of good.",
	 ch, obj, NULL, TO_CHAR);
      return;
    }

  if (!str_cmp (arg2, "grab"))
    {
      if (objsafe (ch, obj, TRUE))
	return;

      if (IS_SET (obj->quest, QUEST_ARTIFACT)
	  || IS_SET (obj->quest, ITEM_EQUEST)
	  || IS_SET (obj->quest, QUEST_RELIC))
	{
	  act
	    ("You reach through a rift in space and try to pull $p through, but a mystical force rips it from your hands.",
	     ch, obj, NULL, TO_CHAR);
	  return;
	}

      if (obj->carried_by != NULL)
	{
	  act
	    ("You reach through a rift in space and try to pull $p through, but someone snatches it away from you.",
	     ch, obj, NULL, TO_CHAR);
	  return;
	}
    }
  else
    {
      if (objsafe (ch, obj, FALSE))
	return;

      if (IS_SET (obj->quest, QUEST_ARTIFACT)
	  || IS_SET (obj->quest, ITEM_EQUEST)
	  || IS_SET (obj->quest, QUEST_RELIC))
	{
	  act
	    ("You attempt to create a rift in space to $p, but it is unlocatable.",
	     ch, obj, NULL, TO_CHAR);
	  return;
	}

      if (obj->carried_by != NULL)
	{
	  act
	    ("You attempt to create a rift in space to $p, but it seems to be possessed by another.",
	     ch, obj, NULL, TO_CHAR);
	  return;
	}

    }

  if (!str_cmp (arg2, "permanent"))
    {
      if (ch->practice < 5)
	{
	  send_to_char
	    ("You require five units of Primal energy to support a permanent rift.\n\r",
	     ch);
	  return;
	}

      perm = TRUE;
      ch->practice -= 5;
    }


  creategate (ch, ch->in_room->vnum, obj->in_room->vnum, perm);

  if (!str_cmp (arg2, "grab"))
    {
      obj_from_room (obj);
      obj_to_char (obj, ch);
      act ("You reach through a rift in space and pull $p through the tear.",
	   ch, obj, NULL, TO_CHAR);
      act
	("$n's hand plunges through a small tear in space and reappears holding $p.",
	 ch, obj, NULL, TO_ROOM);
    }
  else
    {
      act ("You create a rent in the Tapestry to $p.", ch, obj, NULL,
	   TO_CHAR);
      act ("$n creates a small rent in reality.", ch, obj, NULL, TO_ROOM);
    }

  return;

}

void
do_mgate (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg1[MIL];
  char arg2[MIL];
  char str[MSL];
  bool pull = FALSE;
  bool perm = FALSE;

  str[0] = '\0';
  argument = one_argument (argument, arg1);
  argument = one_argument (argument, arg2);

  if (IS_NPC (ch) || !is_mage (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (ch->pcdata->mgate > 0)
    {
      if (ch->pcdata->mgate > 1)
	sprintf (str, "You cannot use this power for another %s.\n\r",
		 get_time (ch->pcdata->mgate, ""));
      else
	sprintf (str, "You cannot use this power for another second.\n\r");
      send_to_char (str, ch);
      return;
    }
  if (ch->fight_timer > 0)
    {
      send_to_char ("You cannot use this with a fighttimer.\n\r", ch);
      return;
    }

  if (ch->spheres[MCOR] < 3)
    {
      send_to_char
	("You must obtain a level three mastery of Correspondence to use Astral Gateways.\n\r",
	 ch);
      return;
    }

  if (arg1[0] == '\0')
    {
      send_to_char ("Whom do you wish to open an Astral Gate to?\n\r", ch);
      return;
    }

  if ((victim = get_char_world (ch, arg1)) == NULL)
    {
      send_to_char
	("You scry the foreign planes, but can find no such entity.\n\r", ch);
      return;
    }

  if (is_inarena (victim))
    return;
  if (is_inarena (ch))
    return;
  if (travelsafe (ch, victim))
    return;

  if (IS_SET (victim->evenmore, EM_JAILED))
    {
      send_to_char ("What??? You wish to go to jail too?\n\r", ch);
      return;
    }
  if (IS_NPC (ch) && IS_SET (ch->act, ACT_WONDER))	//bleh
    {
      send_to_char ("Failed.\n\r", ch);
      return;
    }

  if (!str_cmp (arg2, "pull"))
    {
      if (ch->spheres[MCOR] < 4)
	{
	  send_to_char
	    ("You must obtain a level four mastery of Correspondence to pull another being through the Tapestry.\n\r",
	     ch);
	  return;
	}

      if (victim->level > 100)
	{
	  send_to_char
	    ("Your victim is far too large to be pulled through the rent.\n\r",
	     ch);
	  return;
	}
      if (victim->fighting != NULL)
	{
	  send_to_char
	    ("They are moving too much for you to get a hold on.\n\r", ch);
	  return;
	}
      else
	pull = TRUE;
    }

  if (!str_cmp (arg2, "permanent"))
    {
      if (ch->practice < 5)
	{
	  send_to_char
	    ("You require Five units of Primal Energy to create an Eternal Gateway.\n\r",
	     ch);
	  return;
	}

      perm = TRUE;
      ch->practice -= 5;
    }

  if (!IS_NPC (victim) && !IS_IMMUNE (victim, IMM_SUMMON))
    {
      act
	("You attempt to open an astral gate to $N, but the rift quickly closes.",
	 ch, NULL, victim, TO_CHAR);
      act ("$n creates a magical rift before you, which quickly disappears.",
	   ch, NULL, victim, TO_VICT);
      act ("$n attempts to open an astral gate, but fails.", ch, NULL, victim,
	   TO_ROOM);
      return;
    }

  if (IS_NPC (victim) && victim->level > 2000)
    {
      act ("You attempt to open an astral gate to $N, but fail.", ch, NULL,
	   victim, TO_CHAR);
      act ("$n attempts to open an astral gate, but fails.", ch, NULL, victim,
	   TO_ROOM);
      return;
    }

  creategate (ch, ch->in_room->vnum, victim->in_room->vnum, perm);

  if (!pull)
    {
      act ("You create a small rent in the Tapestry to $N.", ch, NULL, victim,
	   TO_CHAR);
      act ("A small tear in reality pops into existance in front of you.", ch,
	   NULL, victim, TO_VICT);
      act ("$n creates a small tear in reality.", ch, NULL, victim, TO_ROOM);
    }

  if (pull)
    {
      act ("You create a small rent in the Tapestry and pull $N through it.",
	   ch, NULL, victim, TO_CHAR);
      act
	("A small tear in reality pops into existance before you.\n\r  You are violently ripped through the tear!",
	 ch, NULL, victim, TO_VICT);
      char_from_room (victim);
      char_to_room (victim, ch->in_room);
      do_look (victim, "");
      act
	("$n creates a small tear in reality.\n\rSeconds later, $N pops out of the rent, looking confused.",
	 ch, NULL, victim, TO_NOTVICT);
    }
  ch->pcdata->mgate = 5;
  return;
}

void
do_polyappear (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MCOR] < 5)
    {
      send_to_char
	("You must become a master of the sphere of Correspondence to use Polyappearance.\n\r",
	 ch);
      return;
    }

  if (IS_SET (ch->mflags, MAGE_POLYAPPEAR))
    {
      send_to_char ("Your body phases and reforms as one being.\n\r", ch);
      act ("$n's many forms phase and reform as one being.", ch, NULL, NULL,
	   TO_ROOM);
      REMOVE_BIT (ch->mflags, MAGE_POLYAPPEAR);
      return;
    }

  else
    {
      send_to_char ("Your body phases and splits into multiple figures.\n\r",
		    ch);
      act ("$n's body phases and splits into multiple figures.", ch, NULL,
	   NULL, TO_ROOM);
      SET_BIT (ch->mflags, MAGE_POLYAPPEAR);
      return;
    }

  return;
}

void
do_discharge (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  CHAR_DATA *vch = NULL;
  CHAR_DATA *vch_next = NULL;
  char arg1[MIL];
  int damage;

  argument = one_argument (argument, arg1);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (arg1[0] == '\0')
    {
      send_to_char ("Who do you wish to strike down?\n\r", ch);
      return;
    }

  if (ch->spheres[MFOR] < 1)
    {
      send_to_char
	("You must have a level one knowledge of the Forces to discharge Static Electricity.\n\r",
	 ch);
      return;
    }

  if (str_cmp (arg1, "all"))
    {
      if ((victim = get_char_room (ch, arg1)) == NULL)
	{
	  send_to_char ("You were unable to locate your victim.\n\r", ch);
	  return;
	}

      if (victim->level < 3)
	{
	  send_to_char ("They must be an avatar!\n\r", ch);
	  return;
	}

      waiting (ch, 11);
      damage =
	number_range (ch->spheres[MFOR] * 120, ch->spheres[MFOR] * 150);
      if (weather_info.sky == SKY_LIGHTNING)
	damage += number_range (100, 200);
      if (weather_info.sky == SKY_RAINING)
	damage -= number_range (300, 350);

      if (IS_NPC (victim))
	{
	  damage *= 3;
	  mage_damage (ch, victim, damage, "electricity burst",
		       MAGEDAM_ELECTRIC);
	}
      else
	{
	  mage_damage (ch, victim, damage, "electricity burst",
		       MAGEDAM_ELECTRIC);
	}
    }
  else
    {
      damage = number_range (ch->spheres[MFOR] * 50, ch->spheres[MCOR] * 60);
      if (weather_info.sky == SKY_LIGHTNING)
	damage += 50;
      if (weather_info.sky == SKY_RAINING)
	damage -= 200;

      waiting (ch, 16 - (ch->spheres[MCOR] + ch->spheres[MFOR] - 1));
      for (vch = ch->in_room->people; vch != NULL; vch = vch_next)
	{
	  vch_next = vch->next_in_room;
	  if (vch->level < 3)
	    continue;

	  if (vch != ch)
	    mage_damage (ch, vch, damage, "electricity burst",
			 MAGEDAM_ELECTRIC);
	}
    }

  return;

}

void
do_telekinetics (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MFOR] < 2)
    {
      send_to_char
	("You must obtain a level two knowledge of Forces to use Telekinesis.\n\r",
	 ch);
      return;
    }

  if (IS_SET (ch->mflags, MAGE_TELEKINETICS))
    {
      send_to_char ("You relax your mental energies.\n\r", ch);
      REMOVE_BIT (ch->mflags, MAGE_TELEKINETICS);
      return;
    }

  else
    {
      send_to_char ("You focus your mental energies into your attacks.\n\r",
		    ch);
      SET_BIT (ch->mflags, MAGE_TELEKINETICS);
      return;
    }

  return;
}

void
do_call_lightning (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MIL];
  int dam;

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MFOR] < 3)
    {
      send_to_char
	("You must obtain a level three knowledge of Forces to Call Lightning.\n\r",
	 ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Whom do you wish to Call Lightning upon?\n\r", ch);
      return;
    }

  if ((victim = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("You were unable to locate your victim.\n\r", ch);
      return;
    }

  if (victim->level < 3)
    {
      send_to_char ("They must be an avatar!\n\r", ch);
      return;
    }

  if (weather_info.sky != SKY_LIGHTNING)
    {
      send_to_char ("There is no lightning in the sky to call!\n\r", ch);
      return;
    }

  waiting (ch, 12);
  dam = number_range ((ch->spheres[MFOR] * 350), (ch->spheres[MFOR] * 500));
  if (!IS_NPC (ch))
    dam -= number_range (100, 150);

  mage_damage (ch, victim, dam, "lightning blast", MAGEDAM_ELECTRIC);
  return;
}

void
do_controlweather (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))

    if (ch->spheres[MFOR] < 3)
      {
	send_to_char
	  ("You need a level three knowledge of Forces to Control the Weather.\n\r",
	   ch);
	return;
      }

  if (arg[0] == '\0')
    {
      send_to_char
	("How do you want to change the weather?\n     Syntax: controlweather <rain,lightning,clear>\n\r",
	 ch);
      return;
    }

  waiting (ch, 16);
  if (!str_cmp (arg, "rain"))
    {
      send_to_char ("You wave your hands over your head.\n\r", ch);
      send_to_char ("The skies blacken and rain begins to fall.\n\r", ch);
      weather_info.sky = SKY_RAINING;
    }
  else if (!str_cmp (arg, "lightning"))
    {
      send_to_char ("You wave your hands over your head.\n\r", ch);
      send_to_char ("The skies blacken.\n\r", ch);
      send_to_char ("Lightning streaks across the sky.\n\r", ch);
      weather_info.sky = SKY_LIGHTNING;
    }
  else if (!str_cmp (arg, "clear"))
    {
      send_to_char ("You wave your hands over your head.\n\r", ch);
      send_to_char ("The skies slowly clear up.\n\r", ch);
      weather_info.sky = SKY_CLOUDLESS;
    }
  else
    {
      send_to_char
	("Invalid option.\n   Syntax: controlweather <rain,lightning,clear>\n\r",
	 ch);
      return;
    }

  return;
}

void
do_earthembrace (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MIL];

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MFOR] < 4)
    {
      send_to_char
	("You must obtain a level four knowledge of the Forces to use Embrace of the Earth Mother.\n\r",
	 ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Whom do you wish to have Gaia Embrace?\n\r", ch);
      return;
    }

  if ((victim = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("You were unable to locate your victim.\n\r", ch);
      return;
    }

  if (is_safe (ch, victim))
    return;

  if (victim->level < 3)
    {
      send_to_char ("They must be an avatar!\n\r", ch);
      return;
    }

  act ("You call upon the forces of the Earth to embrace $N!", ch, NULL,
       victim, TO_CHAR);
  act ("$n begins to chant mysteriously.", ch, NULL, victim, TO_ROOM);
  act ("The ground shakes and rises to embrace $N!", ch, NULL, victim,
       TO_NOTVICT);
  act ("The ground under your feet starts to surround your body.", ch, NULL,
       victim, TO_VICT);
  SET_BIT (victim->mflags, MAGE_EMBRACED2);
  waiting (ch, 9);
  return;
}

void
do_tempest (CHAR_DATA * ch, char *argument)
{
  ROOM_INDEX_DATA *old_room;
  CHAR_DATA *victim;
  CHAR_DATA *vch;
  CHAR_DATA *vch_next;
  char buf[MSL];
  int number_hit = 0;
  char arg[MIL];
  int dam;
  bool timer = FALSE;
  bool doub = FALSE;
  bool half = FALSE;


  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;


  if (IS_SET (mudconfig->world_affects, WORLD_DOUBLEDAMCAP))
    doub = TRUE;
  if (IS_SET (mudconfig->world_affects, WORLD_HALFDAMCAP))
    half = TRUE;

  if (ch->spheres[MFOR] < 5)
    {
      send_to_char ("You must master the Forces to use Tempest Blizzard.\n\r",
		    ch);
      return;
    }

  if (ch->mana < 2500)
    {
      send_to_char ("You need 2500 mystical power to use this power.\n\r",
		    ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Who do you wish to summon an Ice Storm upon?\n\r", ch);
      return;
    }

  if ((victim = get_char_world (ch, arg)) == NULL)
    {
      send_to_char ("You scry the planes, but cannot find your victim.\n\r",
		    ch);
      return;
    }

  if (victim->level < 3)
    {
      send_to_char ("They must be an avatar!\n\r", ch);
      return;
    }

  if (victim->in_room->area != ch->in_room->area)
    {
      if (ch->spheres[MFOR] < 5 || ch->spheres[MCOR] < 5
	  || ch->level < LEVEL_MAGE)
	{
	  send_to_char
	    ("You locate your victim, but they are too distant.\n\r", ch);
	  return;
	}
    }

  if (is_asafe (ch, victim))
    return;

  if (global_safe (ch, victim))
    return;

  if (!IS_NPC (victim) && IS_QUICK (victim, QUICKENING_MAGIC)
      && (ch->in_room != victim->in_room))
    {
      send_to_char ("You are unable to locate them with your magic.\n\r", ch);
      sprintf (buf, "%s just tried to use tempest shards at you.\n\r",
	       ch->name);
      send_to_char (buf, victim);
      return;
    }

  ch->mana -= 2500;
  waiting (ch, 12);

  if (!IS_NPC (victim))
    {
      sprintf (buf,
	       "You call upon the Forces of Nature to obliterate %s.\n\r",
	       victim->name);
    }
  else
    {
      sprintf (buf,
	       "You call upon the Forces of Nature to obliterate %s.\n\r",
	       victim->short_descr);
    }
  stc (buf, ch);
  act
    ("The sky turns an ominous white.\n\r...Seconds later, deadly shards of ice shoot out of the sky, piercing your skin.\n\r",
     victim, NULL, victim, TO_NOTVICT);
  stc
    ("The sky turns an ominous white.\n\r...Seconds later, deadly shards of ice shoot out of the sky, piercing your skin.\n\r",
     victim);


  for (vch = char_list; vch != NULL; vch = vch_next)
    {
      vch_next = vch->next;

      if (vch->in_room == NULL)
	continue;
      if (vch->in_room == victim->in_room)
	{
	  if (vch->level < 3)
	    continue;
	  if (number_hit > 9)
	    continue;
	  if (vch == ch)
	    continue;
	  if (global_safe (ch, vch))
	    continue;

	  if (vch != ch)
	    {
	      dam =
		number_range (ch->spheres[MFOR] * 2000,
			      ch->spheres[MFOR] * 2500);
	      if (vch == victim)
		dam += number_range (500, 1500);
	      if (ch->level >= LEVEL_ARCHMAGE)
		dam += number_range (1000, 2000);


	      if (IS_NPC (vch))
		{
		  dam *= 2.3;

		  if (doub)
		    dam *= 2;

		  if (half)
		    dam /= 2;
		}

	      if (!IS_NPC (vch))
		{
		  timer = TRUE;
		}
	      mage_damage (ch, vch, dam, "ice shards", MAGEDAM_ICESTORM);
	      number_hit++;
	      if (!IS_NPC (vch) && vch->in_room != ch->in_room)
		{
		  vch->fight_timer = 0;
		}
	    }

	  continue;
	}

    }

  if (timer)
    ch->fight_timer = 30;

  return;
}

bool
is_immune (CHAR_DATA * ch, int type)
{
  if (IS_SET (ch->imms[IMMUNITY], type))
    return TRUE;
  else
    return FALSE;
}

bool
is_resistant (CHAR_DATA * ch, int type)
{
  if (IS_SET (ch->imms[RESISTANCE], type))
    return TRUE;
  else
    return FALSE;
}

bool
is_vulnerable (CHAR_DATA * ch, int type)
{
  if (IS_SET (ch->imms[VULNERABLE], type))
    return TRUE;
  else
    return FALSE;
}

int
mage_immunity (CHAR_DATA * ch, int dam, const char *msg, int type)
{
  if (IS_NPC (ch))
    return dam;

  if (is_immune (ch, type))
    dam = 0;

  else if (is_resistant (ch, type))
    dam /= 2;

  else if (is_vulnerable (ch, type))
    dam *= 2;

  return dam;
}

void
mage_damage (CHAR_DATA * ch, CHAR_DATA * victim, int dam, const char *message,
	     int type)
{
  int max_dam = ch->damcap[DAM_CAP];

  if (victim->position == POS_DEAD)
    return;

  if (ch->damcap[DAM_CHANGE] == 1)
    update_damcap (ch, victim);

  if (dam > max_dam)
    dam = max_dam;

  if (victim != ch)
    {
      /*
       * Certain attacks are forbidden.
       * Most other attacks are returned.
       */
      if (victim->in_room == ch->in_room)
	{
	  if (is_safe (ch, victim))
	    return;
	}
      check_killer (ch, victim);

      if (victim->position > POS_STUNNED)
	{
	  if (victim->fighting == NULL && ch->in_room == victim->in_room)
	    {
	      set_fighting (victim, ch);
	      victim->position = POS_FIGHTING;
	    }
	}

      if (victim->position > POS_STUNNED)
	{
	  if (ch->fighting == NULL && ch->in_room == victim->in_room)
	    set_fighting (ch, victim);
	  /*
	   * If victim is charmed, ch might attack victim's master.
	   */
	  if (IS_NPC (ch)
	      && IS_NPC (victim)
	      && IS_AFFECTED (victim, AFF_CHARM)
	      && victim->master != NULL
	      && victim->master->in_room == ch->in_room
	      && number_bits (3) == 0)
	    {
	      stop_fighting (ch, FALSE);
	      multi_hit (ch, victim->master, TYPE_UNDEFINED);
	      return;
	    }
	}

      /*
       * More charm stuff.
       */
      if (victim->master == ch)
	stop_follower (victim);

      /*
       * Damage modifiers.
       */
      if (IS_AFFECTED (ch, AFF_HIDE))
	{
	  if (!can_see (victim, ch))
	    {
	      dam *= 1.5;
	      send_to_char
		("You use your concealment to get a surprise attack!\n\r",
		 ch);
	    }
	  REMOVE_BIT (ch->affected_by, AFF_HIDE);
	  act ("$n leaps from $s concealment.", ch, NULL, NULL, TO_ROOM);
	}

      if (IS_AFFECTED (victim, AFF_SANCTUARY) && dam > 1)
	dam *= 0.5;

      if (IS_AFFECTED (victim, AFF_PROTECT) && IS_EVIL (ch) && dam > 1)
	dam -= dam * 0.25;

      if (dam < 0)
	dam = 0;

      // I'll eventually add resistances, immunities, vulnerabilities, etc
      // Right about here. Amen.

      mage_message (ch, victim, dam, message, type);
      hurt_person (ch, victim, dam, 0);
      return;
    }

  else
    return;
}

void
mage_message (CHAR_DATA * ch, CHAR_DATA * victim, int dam,
	      const char *message, int type)
{
  char buf1[MSL];
  char buf2[MSL];
  char buf3[MSL];
  char damm[MSL];
  char dam2[MSL];
  char buf[MSL];
  const char *chm;
  const char *victm;

  if (dam == 0)
    {
      chm = " miss";
      victm = " misses";
    }
  else if (dam <= 50)
    {
      chm = " graze";
      victm = " grazes";
    }
  else if (dam <= 100)
    {
      chm = " wound";
      victm = " wounds";
    }
  else if (dam <= 200)
    {
      chm = " mutilate";
      victm = " mutilates";
    }
  else if (dam <= 300)
    {
      chm = " massacre";
      victm = " massacres";
    }
  else if (dam <= 400)
    {
      chm = " eviscerate";
      victm = " eviscerates";
    }
  else if (dam <= 500)
    {
      chm = " annihilate";
      victm = " annihilates";
    }
  else if (dam <= 600)
    {
      chm = " obliterate";
      victm = " obliterates";
    }
  else if (dam <= 800)
    {
      chm = " dissipate";
      victm = " dissipates";
    }
  else if (dam <= 1000)
    {
      chm = " vaporize";
      victm = " vaporizes";
    }
  else
    {
      chm = " liquify";
      victm = " liquifies";
    }

  if (!IS_NPC (victim) && (victim->hit - dam) < 0)
    {
      if (type == MAGEDAM_ELECTRIC)
	{
	  sprintf (buf,
		   "Your electric shock #7[#R%d#7]#n causes %s to spasm violently and vomit #rblood#n\n\r.",
		   dam, victim->name);
	  stc (buf, ch);
	  act
	    ("$n's electric shock causes $N to spasm violently and vomit #rblood#n.",
	     ch, NULL, victim, TO_NOTVICT);
	  sprintf
	    ("%s's electric shock #7[#R%d#7]#n causes your body to spasm violently as you vomit #rblood#n.",
	     ch->name, dam);
	  act (buf, ch, NULL, victim, TO_VICT);
	  make_part (victim, "blood");
	}

      else if (type == MAGEDAM_ICESTORM)
	{
	  act
	    ("Your ice shards tear $N's flesh from $S body and leave $M #Rfatally#n injured.",
	     ch, NULL, victim, TO_CHAR);
	  act
	    ("$n's ice shards tear $N's flesh from $S body and leave $M #Rfatally#n injured.",
	     ch, NULL, victim, TO_NOTVICT);
	  act
	    ("$n's ice shards tear your flesh from your body and leave you #Rfatally#n injured.",
	     ch, NULL, victim, TO_VICT);
	  make_part (victim, "blood");
	}

      else
	{
	  act ("Your magical energy tears $N's body asunder.", ch, NULL,
	       victim, TO_CHAR);
	  act ("$n's magical energies tear $N's body asunder.", ch, NULL,
	       victim, TO_NOTVICT);
	  act ("$n's magical energies tear your body asunder.", ch, NULL,
	       victim, TO_VICT);
	  make_part (victim, "blood");
	}
    }

  if (dam == 0 && is_immune (ch, type))
    {
      sprintf (buf1, "$N is unaffected by your %s.", message);
      sprintf (buf2, "$N is unaffected by $n's %s.", message);
      sprintf (buf3, "You are unaffected by $n's %s.", message);
    }

  if (dam == 0 && !is_immune (ch, type))
    {
      sprintf (buf1, "You miss $N with your %s.", message);
      sprintf (buf2, "$n misses $N with $s %s.", message);
      sprintf (buf3, "$n misses you with $s %s.", message);
    }

  else
    {
      if (ch->spheres[MFOR] > 1)
	{
	  sprintf (damm, "#R%d#n", dam);
	  sprintf (dam2, " [%s]", damm);
	}
      else
	sprintf (dam2, ".");

      sprintf (buf1, "You%s $N with your %s%s", chm, message, dam2);
      sprintf (buf2, "$n%s $N with $s %s.", victm, message);
      sprintf (buf3, "$n%s%s you with $s %s.", victm, dam2, message);
    }

  act (buf1, ch, NULL, victim, TO_CHAR);
  act (buf2, ch, NULL, victim, TO_NOTVICT);
  act (buf3, ch, NULL, victim, TO_VICT);

  return;

}

void
do_quintessence (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MPRI] < 1)
    {
      send_to_char
	("You cannot store Quintessence until you have learned level 1 Prime.\n\r",
	 ch);
      return;
    }

  line2 (ch);
  cent_to_char ("Quintessence", ch);
  line2 (ch);
  sprintf (buf,
	   "*    You have %2d points of Quintessence stored within your body.               *\n\r",
	   ch->quint[BODY]);
  send_to_char (buf, ch);
  sprintf (buf,
	   "*    You have %2d points of Quintessence stored within your Avatar.             *\n\r",
	   ch->quint[AVATAR]);
  send_to_char (buf, ch);
  line2 (ch);
  return;
}

int
check_quint (CHAR_DATA * ch)
{
  if (ch->spheres[MPRI] < 3)
    return ch->quint[AVATAR];
  else if (ch->spheres[MPRI] >= 3)
    return (ch->quint[AVATAR] + ch->quint[BODY]);
  else
    return ch->quint[AVATAR];
}

void
subtract_quint (CHAR_DATA * ch, int number)
{
  int max;

  if (ch->level == LEVEL_APPRENTICE)
    max = ch->spheres[MPRI];
  if (ch->level == LEVEL_MAGE)
    max = ch->spheres[MPRI] * 2;
  if (ch->level == LEVEL_ARCHMAGE)
    max = ch->spheres[MPRI] * 3;

  ch->quint[MTOTAL] = check_quint (ch);	// Find Total Quint of Char
  ch->quint[MTOTAL] -= number;	// Subtract from Max
  if (ch->quint[MTOTAL] > max)
    {
      ch->quint[AVATAR] = max;
      ch->quint[MTOTAL] -= max;
      if (ch->quint[MTOTAL] > max)
	{
	  ch->quint[BODY] = max;
	  ch->quint[MTOTAL] = 0;
	}
      else
	{
	  ch->quint[BODY] = ch->quint[MTOTAL];
	  ch->quint[MTOTAL] = 0;
	}
    }
  else
    {
      ch->quint[AVATAR] = ch->quint[MTOTAL];	// Move all quint to Avatar
      ch->quint[BODY] = 0;	// Drain the body
    }
  return;
}

void
add_quint (CHAR_DATA * ch, int number)
{
  int max;

  if (ch->level == LEVEL_APPRENTICE)
    max = ch->spheres[MPRI];
  if (ch->level == LEVEL_MAGE)
    max = ch->spheres[MPRI] * 2;
  if (ch->level == LEVEL_ARCHMAGE)
    max = ch->spheres[MPRI] * 3;

  ch->quint[MTOTAL] = check_quint (ch);
  ch->quint[MTOTAL] += number;
  if (ch->quint[MTOTAL] > max)
    {
      ch->quint[AVATAR] = max;
      ch->quint[MTOTAL] -= max;
      if (ch->quint[MTOTAL] > max)
	{
	  ch->quint[BODY] = max;
	  ch->quint[MTOTAL] = 0;
	}
      else
	{
	  ch->quint[BODY] = ch->quint[MTOTAL];
	  ch->quint[MTOTAL] = 0;
	}
    }
  else
    {
      ch->quint[AVATAR] = ch->quint[MTOTAL];
      ch->quint[BODY] = 0;
    }
  return;
}

void
do_enchant (CHAR_DATA * ch, char *argument)
{
  OBJ_DATA *obj;
  char arg[MSL];

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MPRI] < 2)
    {
      send_to_char
	("You must obtain a level two knowledge of Prime to use Enchant Weapon.\n\r",
	 ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("What object do you wish to enchant?\n\r", ch);
      return;
    }

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

  if (obj->item_type != ITEM_WEAPON)
    {
      act ("$p is not a weapon.", ch, obj, NULL, TO_CHAR);
      return;
    }

  /* HUNTERMARK - Hmm, need check so they don't enchant weaponformed players */
  if (obj->chobj != NULL)
    {
      send_to_char ("Somehow the object seems to resist your magic.\n\r", ch);
      return;
    }

  if (IS_SET (obj->extra_flags, ITEM_VANISH))
    {
      stc ("Not on Illusions.\n\r", ch);
      return;
    }

  if (IS_SET (obj->quest, QUEST_MAGEENCHANT))
    {
      act ("$p is already filled with quintessence.", ch, obj, NULL, TO_CHAR);
      return;
    }

  if (IS_SET (obj->spectype, SITEM_MASTERY))
    {
      stc ("This is a mastery item.\n\r", ch);
      return;
    }

  if (ch->pcdata->crystal < 2)
    {
      send_to_char ("You dont have the required 2 power crystals\n\r", ch);
      return;
    }

  if (check_quint (ch) < 1)
    {
      send_to_char
	("You need one point of quintessence available to use this power.\n\r",
	 ch);
      return;
    }

  if (IS_SET (obj->quest, QUEST_ARTIFACT))
    {
      act ("$p is too powerful for your quintessence.", ch, obj, NULL,
	   TO_CHAR);
      return;
    }

  obj->value[1] += (ch->spheres[MPRI] * 2);
  obj->value[2] += (ch->spheres[MPRI] * 2);
  SET_BIT (obj->quest, QUEST_MAGEENCHANT);
  ch->pcdata->crystal -= 2;
  act ("$p glows radiantly as you infuse your quintessence into it.", ch, obj,
       NULL, TO_CHAR);
  act ("$n's weapon, $p, glows brilliantly.", ch, obj, NULL, TO_ROOM);
  subtract_quint (ch, 1);
  return;
}

void
do_rubbing (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MSL];
  int dam;
  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MPRI] < 3)
    {
      send_to_char
	("You must obtain level three Prime to use Rubbing of the Bones.\n\r",
	 ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Whom do you wish to use this on?\n\r", ch);
      return;
    }

  if ((victim = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("You cannot find your victim here.\n\r", ch);
      return;
    }

  if (victim->level < 3)
    {
      send_to_char ("They must be an avatar!\n\r", ch);
      return;
    }

  if (check_quint (ch) < 2)
    {
      send_to_char
	("You must have two points of quintessence to use this power.\n\r",
	 ch);
      return;
    }

  subtract_quint (ch, 2);
  dam = ch->spheres[MPRI] * 1200;
  if (!IS_NPC (victim))
    dam /= number_range (1.5, 2);
  mage_damage (ch, victim, dam, "quintessence warp", MAGEDAM_QUINT);
  waiting (ch, 8);
  if (!IS_NPC (victim))
    act ("You have been knocked on your ass by $n's blast.", ch, NULL, victim,
	 TO_VICT);
  waiting (victim, 12);
  return;
}

void
do_entropyblast (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MIL];
  int sn, level;

  level = ch->spheres[MENT];

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MENT] < 1)
    {
      send_to_char
	("You must obtain level one Entropy to use Entropic Blast.\n\r", ch);
      return;
    }

  if (arg[0] == '\0' && ch->fighting == NULL)
    {
      send_to_char ("Who do you wish to strike with a Entropic Blast?\n\r",
		    ch);
      return;
    }

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

  if (is_safe (ch, victim))
    return;

  if ((sn = skill_lookup ("entropic blast")) < 0)
    {
      stc ("Major Bug, please tell Corim.\n\r", ch);
      return;
    }

  if (check_quint (ch) < 2)
    {
      send_to_char
	("You need two points of quintessence to strike someone with your Entropic Blast.\n\r",
	 ch);
      return;
    }

  (*skill_table[sn].spell_fun) (sn, level, ch, victim);
  waiting (ch, 12);
  subtract_quint (ch, 2);
  return;
}

void
do_purification (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MSL];
  int dam;
  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MPRI] < 4)
    {
      send_to_char
	("You must obtain level three Prime to use Flames of Purification.\n\r",
	 ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Whom do you wish to use this on?\n\r", ch);
      return;
    }

  if ((victim = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("You cannot find your victim here.\n\r", ch);
      return;
    }
  if (victim->level < 3)
    {
      send_to_char ("They must be an avatar!\n\r", ch);
      return;
    }

  if (check_quint (ch) < 3)
    {
      send_to_char
	("You must have three points of quintessence to use this power.\n\r",
	 ch);
      return;
    }

  subtract_quint (ch, 3);
  dam = ch->spheres[MPRI] * 1350;
  if (!IS_NPC (victim))
    dam /= number_range (1.5, 2);
  mage_damage (ch, victim, dam, "flames of purification", MAGEDAM_QUINT);
  waiting (ch, 12);
  return;
}

void
do_qblast (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MSL];
  int dam;
  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MPRI] < 5)
    {
      send_to_char
	("You must obtain level five Prime to use Quintessence Blast.\n\r",
	 ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Whom do you wish to use this on?\n\r", ch);
      return;
    }

  if ((victim = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("You cannot find your victim here.\n\r", ch);
      return;
    }

  if (victim->level < 3)
    {
      send_to_char ("They must be an avatar!\n\r", ch);
      return;
    }

  if (check_quint (ch) < 5)
    {
      send_to_char
	("You must have five points of quintessence to use this power.\n\r",
	 ch);
      return;
    }

  subtract_quint (ch, 5);
  dam = ch->spheres[MPRI] * 1800;
  if (!IS_NPC (victim))
    dam /= number_range (1.5, 2);
  mage_damage (ch, victim, dam, "quintessence blast", MAGEDAM_QUINT);
  waiting (ch, 12);
  return;
}

void
do_dimmak (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MENT] < 1)
    {
      send_to_char ("You must obtain level one entropy to use Dim Mak.\n\r",
		    ch);
      return;
    }

  if (IS_SET (ch->mflags, MFLAGS_DIMMAK))
    {
      REMOVE_BIT (ch->mflags, MFLAGS_DIMMAK);
      send_to_char
	("You no longer focus your attacks on your opponent's weakness.\n\r",
	 ch);
      return;
    }

  else
    {
      SET_BIT (ch->mflags, MFLAGS_DIMMAK);
      send_to_char
	("You now focus your attacks on your opponent's weakness.\n\r", ch);
      return;
    }

  return;
}

void
do_hotienchi (CHAR_DATA * ch, char *argument)
{
  int i, test = 0;
  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MLIF] < 1)
    {
      send_to_char ("You must obtain level one Life to use Ho Tien Chi.\n\r",
		    ch);
      return;
    }

  for (i = 0; i < 7; i++)
    {
      if (ch->loc_hp[i] > 0)
	test++;
    }

  if (ch->hit == ch->max_hit && ch->mana == ch->max_mana
      && ch->move == ch->max_move && test == 0)
    {
      send_to_char ("You are in perfect condition!\n\r", ch);
      return;
    }

  if (ch->loc_hp[6] > 0)
    {
      send_to_char ("Your wounds seal and stop #rbleeding#n.\n\r", ch);
      ch->loc_hp[6] = 0;
    }

  if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] + ch->loc_hp[3] +
       ch->loc_hp[4] + ch->loc_hp[5]) != 0)
    {
      send_to_char
	("Your bones mend themselves together and new limbs grow out of your body.\n\r",
	 ch);
      ch->loc_hp[0] = 0;
      ch->loc_hp[1] = 0;
      ch->loc_hp[2] = 0;
      ch->loc_hp[3] = 0;
      ch->loc_hp[4] = 0;
      ch->loc_hp[5] = 0;
    }

  send_to_char ("A warm feeling spreads through your body.\n\r", ch);
  ch->hit += (ch->spheres[MLIF] * 200);
  ch->mana += (ch->spheres[MLIF] * 100);
  ch->move += (ch->spheres[MLIF] * 100);
  if (ch->hit > ch->max_hit)
    ch->hit = ch->max_hit;
  if (ch->mana > ch->max_mana)
    ch->mana = ch->max_mana;
  if (ch->move > ch->max_move)
    ch->move = ch->max_move;
  waiting (ch, 18);
  return;
}

void
do_littledeath (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MSL];

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!IS_MAGE (ch))
    return;

  if (ch->spheres[MLIF] < 2)
    {
      send_to_char
	("You must obtain level two Life to use Little Good Death.\n\r", ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Whom do you wish to use this on?\n\r", ch);
      return;
    }

  if ((victim = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("You cannot find your victim here.\n\r", ch);
      return;
    }


  if (!IS_NPC (victim))
    {
      send_to_char ("A human being is too complex for this spell.\n\r", ch);
      return;
    }

  if (victim->level > 100)
    {
      act ("$N's pattern is too complex to destroy.", ch, NULL, victim,
	   TO_CHAR);
      return;
    }

  waiting (ch, 12);
  act ("You mentally grasp $N's pattern and tear $M to shreds.", ch, NULL,
       victim, TO_CHAR);
  act ("$n's eyes turn black.\n$N's body is torn to shreds before your eyes!",
       ch, NULL, victim, TO_ROOM);
  raw_kill (victim, ch);
  return;
}

void
do_betterbody (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MLIF] < 3)
    {
      send_to_char
	("You must obtain level three Life to use Better Body.\n\r", ch);
      return;
    }


  if (IS_SET (ch->mflags, MAGE_BETTERBODY))
    {
      send_to_char ("Your body shrinks to its true form.\n\r", ch);
      REMOVE_BIT (ch->mflags, MAGE_BETTERBODY);
      free_string (ch->morph);
      ch->morph = str_dup (get_form (ch));
      if (strlen (ch->morph) < 2)
	{
	  REMOVE_BIT (ch->affected_by, AFF_POLYMORPH);
	  REMOVE_BIT (ch->vampaff, VAM_DISGUISED);
	}
      ch->pcdata->perm_str -= 4;
      ch->pcdata->perm_con -= 2;
      ch->pcdata->perm_dex -= 3;
      return;
    }

  if (IS_SET (ch->affected_by, AFF_POLYMORPH)
      && !IS_SET (ch->vampaff, VAM_DISGUISED))
    {
      stc ("Not while polymorphed.\n\r", ch);
      return;
    }

  send_to_char ("Your body contorts and grows to supernatural size.\n\r", ch);
  SET_BIT (ch->mflags, MAGE_BETTERBODY);
  SET_BIT (ch->affected_by, AFF_POLYMORPH);
  SET_BIT (ch->vampaff, VAM_DISGUISED);
  free_string (ch->morph);
  ch->morph = str_dup (get_form (ch));
  ch->pcdata->perm_str += 4;
  ch->pcdata->perm_dex += 3;
  ch->pcdata->perm_con += 2;
  return;
}

void
do_shapechange (CHAR_DATA * ch, char *argument)
{
  char arg[MSL];
  char buf[MSL];
  int choice = 0;

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MLIF] < 4)
    {
      send_to_char ("You must obtain level four Life to Change Shape.\n\r",
		    ch);
      return;
    }

  if (arg[0] == '\0')
    {
      divide_to_char (ch);
      cent_to_char ("Forms", ch);
      divide_to_char (ch);
      send_to_char ("    [ 0 ]  Human\n", ch);
      send_to_char ("    [ 1 ]  Tiger\n", ch);
      send_to_char ("    [ 2 ]  Lion\n", ch);
      send_to_char ("    [ 3 ]  Raven\n", ch);
      send_to_char ("    [ 4 ]  Frog\n", ch);
      send_to_char ("    [ 5 ]  Dog\n", ch);
      send_to_char ("    [ 6 ]  Hawk\n", ch);
      send_to_char ("    [ 7 ]  Mouse\n", ch);
      send_to_char ("    [ 8 ]  Spider\n", ch);
      divide_to_char (ch);
      return;
    }

  choice = is_number (arg) ? atoi (arg) : -1;

  if (choice == 1)
    {
      sprintf (buf, "%s the ferocious tiger", ch->name);
      send_to_char ("You transform into a ferocious tiger.\n\r", ch);
      act ("$n transforms into a tiger.", ch, NULL, NULL, TO_ROOM);
    }
  else if (choice == 2)
    {
      sprintf (buf, "%s the lion", ch->name);
      send_to_char ("You transform into a lion.\n\r", ch);
      act ("$n transforms into a lion.", ch, NULL, NULL, TO_ROOM);
    }
  else if (choice == 3)
    {
      sprintf (buf, "%s the raven", ch->name);
      send_to_char ("You transform into a raven.\n\r", ch);
      act ("$n transforms into a raven.", ch, NULL, NULL, TO_ROOM);
    }
  else if (choice == 4)
    {
      sprintf (buf, "%s the frog", ch->name);
      send_to_char ("You transform into a frog.\n\r", ch);
      act ("$n transforms into a frog.", ch, NULL, NULL, TO_ROOM);
    }
  else if (choice == 5)
    {
      sprintf (buf, "%s the dog", ch->name);
      send_to_char ("You transform into a small dog.\n\r", ch);
      act ("$n transforms into a dog.", ch, NULL, NULL, TO_ROOM);
    }
  else if (choice == 6)
    {
      sprintf (buf, "%s the hawk", ch->name);
      send_to_char ("You transform into a hawk.\n\r", ch);
      act ("$n transforms into a hawk.", ch, NULL, NULL, TO_ROOM);
    }
  else if (choice == 7)
    {
      sprintf (buf, "%s the mouse", ch->name);
      send_to_char ("You transform into a white mouse.\n\r", ch);
      act ("$n transforms into a white mouse.", ch, NULL, NULL, TO_ROOM);
    }
  else if (choice == 8)
    {
      sprintf (buf, "%s the spider", ch->name);
      send_to_char ("You transform into a black spider.\n\r", ch);
      act ("$n transforms into a black spider.", ch, NULL, NULL, TO_ROOM);
    }
  else if (choice == 0)
    {
      if (IS_AFFECTED (ch, AFF_POLYMORPH))
	{
	  REMOVE_BIT (ch->affected_by, AFF_POLYMORPH);
	  REMOVE_BIT (ch->mflags, MAGE_SHAPED);
	  free_string (ch->morph);
	  ch->morph = str_dup ("");
	  send_to_char ("You revert to your human form.\n\r", ch);
	  act ("$n reverts to $s human form.", ch, NULL, NULL, TO_ROOM);
	  return;
	}
      else
	{
	  send_to_char ("You aren't even shapechanged!\n\r", ch);
	  return;
	}
    }
  else
    {
      send_to_char ("That's not a choice!\n\r", ch);
      do_shapechange (ch, "");
      return;
    }

  SET_BIT (ch->affected_by, AFF_POLYMORPH);
  SET_BIT (ch->mflags, MAGE_SHAPED);
  clear_stats (ch);
  free_string (ch->morph);
  ch->morph = str_dup (buf);
  return;
}


void
do_layhands (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MSL];
  int i, test = 0;

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MLIF] < 1)
    {
      send_to_char ("You must obtain level one Life to use Ho Tien Chi.\n\r",
		    ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Whom do you wish to use this on?\n\r", ch);
      return;
    }

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

  for (i = 0; i < 7; i++)
    {
      if (victim->loc_hp[i] > 0)
	test++;
    }

  if (victim->hit == victim->max_hit && victim->mana == victim->max_mana
      && victim->move == victim->max_move && test == 0)
    {
      send_to_char ("They are in perfect condition!\n\r", ch);
      return;
    }

  if (victim->loc_hp[6] > 0)
    {
      send_to_char ("Your wounds seal and stop #rbleeding#n.\n\r", victim);
      victim->loc_hp[6] = 0;
    }

  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)
    {
      send_to_char
	("Your bones mend themselves together and new limbs grow out of your body.\n\r",
	 victim);
      victim->loc_hp[0] = 0;
      victim->loc_hp[1] = 0;
      victim->loc_hp[2] = 0;
      victim->loc_hp[3] = 0;
      victim->loc_hp[4] = 0;
      victim->loc_hp[5] = 0;
    }

  send_to_char ("A warm feeling spreads through your body.\n\r", victim);
  victim->hit += (ch->spheres[MLIF] * 75);
  victim->mana += (ch->spheres[MLIF] * 50);
  victim->move += (ch->spheres[MLIF] * 50);
  if (victim->hit > victim->max_hit)
    victim->hit = victim->max_hit;
  if (victim->mana > victim->max_mana)
    victim->mana = victim->max_mana;
  if (victim->move > victim->max_move)
    victim->move = victim->max_move;
  waiting (ch, 18);
  act ("You lay your hands on $N and rejuvenate $M.", ch, NULL, victim,
       TO_CHAR);
  update_pos (victim);
  return;
}

void
do_analyze (CHAR_DATA * ch, char *argument)
{
  OBJ_DATA *obj;
  char arg[MSL];
  char buf[MIL];
  CHAR_DATA *victim;
  int con_hit, con_dam, con_ac, con_hp, con_mana, con_move;
  int con_str, con_int, con_dex, con_wis, con_con;
  int con_max_hp, con_max_mana, con_max_move;

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MMAT] < 1)
    {
      send_to_char
	("You must obtain level one Matter to use Analyze Substance.\n\r",
	 ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Analyze what?\n\r", ch);
      return;
    }

  if ((victim = get_char_room (ch, arg)) == NULL)
    {
      if ((obj = get_obj_carry (ch, arg)) == NULL)
	{
	  send_to_char ("Analyze what?\n\r", ch);
	  return;
	}
      act ("You analyze the substance pattern of $p.", ch, obj, NULL,
	   TO_CHAR);
      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 analyze them.\n\r", ch);
      if (!IS_NPC (victim) && ch != victim && IS_MORE (victim, MORE_GUARDIAN))
	{
	  guardian_message (victim);
	  act ("$n just failed to use Analyze on you.", ch, NULL, victim,
	       TO_VICT);
	}
      return;
    }

  act ("You analyze the pattern of $N's aura.", ch, NULL, victim, TO_CHAR);
  act ("$n examines $N intently.", ch, NULL, victim, TO_NOTVICT);
  act ("$n examines you intently.", ch, NULL, victim, TO_VICT);

  if (!IS_NPC (victim) && IS_EXTRA (victim, EXTRA_FAKE_CON))
    {
      con_hit = victim->pcdata->fake_hit;
      con_dam = victim->pcdata->fake_dam;
      con_ac = victim->pcdata->fake_ac;
      con_str = victim->pcdata->fake_stats[STAT_STR];
      con_int = victim->pcdata->fake_stats[STAT_INT];
      con_wis = victim->pcdata->fake_stats[STAT_WIS];
      con_dex = victim->pcdata->fake_stats[STAT_DEX];
      con_con = victim->pcdata->fake_stats[STAT_CON];
      con_hp = victim->pcdata->fake_hp;
      con_mana = victim->pcdata->fake_mana;
      con_move = victim->pcdata->fake_move;
      con_max_hp = victim->pcdata->fake_max_hp;
      con_max_mana = victim->pcdata->fake_max_mana;
      con_max_move = victim->pcdata->fake_max_move;
    }
  else
    {
      con_hit = char_hitroll (victim);
      con_dam = char_damroll (victim);
      con_ac = char_ac (victim);
      con_str = get_curr_str (victim);
      con_int = get_curr_int (victim);
      con_wis = get_curr_wis (victim);
      con_dex = get_curr_dex (victim);
      con_con = get_curr_con (victim);
      con_hp = victim->hit;
      con_mana = victim->mana;
      con_move = victim->move;
      con_max_hp = victim->max_hit;
      con_max_mana = victim->max_mana;
      con_max_move = victim->max_move;
    }
  if (IS_NPC (victim))
    sprintf (buf, "%s is an NPC.\n\r", victim->short_descr);
  else
    {
      if (victim->level == 13)
	sprintf (buf, "%s is an Owner.\n\r", victim->name);
      else if (victim->level == 12)
	sprintf (buf, "%s is an Implementor.\n\r", victim->name);
      else if (victim->level == 11)
	sprintf (buf, "%s is a High Judge.\n\r", victim->name);
      else if (victim->level == 10)
	sprintf (buf, "%s is a Judge.\n\r", victim->name);
      else if (victim->level == 9)
	sprintf (buf, "%s is an Enforcer.\n\r", victim->name);
      else if (victim->level == 8)
	sprintf (buf, "%s is a Quest Maker.\n\r", victim->name);
      else if (victim->level == 7)
	sprintf (buf, "%s is a Builder.\n\r", victim->name);
      else if (victim->level >= 3)
	sprintf (buf, "%s is an Avatar.\n\r", victim->name);
      else
	sprintf (buf, "%s is a Mortal.\n\r", victim->name);
    }
  send_to_char (buf, ch);
  sprintf (buf, "Str: %d.  Int: %d.  Wis: %d.  Dex: %d.  Con: %d.\n\r",
	   con_str, con_int, con_wis, con_dex, con_con);
  send_to_char (buf, ch);
  sprintf (buf, "Life: %d/%d, Mp: %d/%d, Vitality: %d/%d.\n\r",
	   con_hp, con_max_hp, con_mana, con_max_mana, con_move,
	   con_max_move);
  send_to_char (buf, ch);
  sprintf (buf, "Hitroll: %d, Damroll: %d, AC: %d.\n\r",
	   con_hit, con_dam, con_ac);
  send_to_char (buf, ch);
  if (!IS_NPC (victim))
    {
      sprintf (buf, "Status: %d, ", victim->race);
      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_VAMPIRE (victim)
      && victim->pcdata->diableries[DIAB_EVER] >= 5)
    act ("$N's soul is permanently stained with multiple diablerie.", ch,
	 NULL, victim, TO_CHAR);
  if (!IS_NPC (victim) && IS_VAMPIRE (victim)
      && victim->pcdata->diableries[DIAB_TIME] > 0)
    act ("$N has recently committed diablerie.", ch, NULL, victim, TO_CHAR);
  if (!IS_NPC (victim) && IS_MORE (victim, MORE_INFORM))
    {
      if (ch->pcdata->lie == LIE_TRUE)
	act ("$N has recently lied.", ch, NULL, victim, TO_CHAR);
      else
	act ("$N has recently spoken truthfully.", ch, NULL, victim, TO_CHAR);
    }
  if (!IS_NPC (victim) && ch != victim && IS_MORE (victim, MORE_GUARDIAN))
    {
      guardian_message (victim);
      act ("$n just used Analyze on you.", ch, NULL, victim, TO_VICT);
    }
  return;
}

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

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MMAT] < 2)
    {
      send_to_char
	("You must obtain level two Matter to use Alter State.\n\r", ch);
      return;
    }

  if (arg[0] == '\0' && ch->fighting == NULL)
    {
      send_to_char ("Whom do you wish to use this on?\n\r", ch);
      return;
    }

  if (ch->fighting == NULL)
    {
      if ((victim = get_char_room (ch, arg)) == NULL)
	{
	  send_to_char ("You are unable to find them in this room.\n\r", ch);
	  return;
	}
    }
  else
    victim = ch->fighting;

  if (is_safe (ch, victim))
    return;

  if ((obj = get_eq_char (victim, WEAR_WIELD)) == NULL)
    {
      if ((obj = get_eq_char (victim, WEAR_HOLD)) == NULL)
	{
	  send_to_char ("They aren't using any weapons!\n\r", ch);
	  return;
	}
    }

  if (obj != NULL && IS_SET (obj->weapflags, WEAPON_BONDED))
    {
      if (number_range (1, 10) > 3)
	{
	  act ("$N refuses to let go of $p.", ch, obj, victim, TO_CHAR);
	  return;
	}
    }

  if (check_quint (ch) < 2)
    {
      send_to_char
	("You need two points of quintessence to use this power.\n\r", ch);
      return;
    }

  obj_from_char (obj);
  obj_to_char (obj, victim);
  act ("You alter the state of $N's weapon, causing $M to drop it.", ch, NULL,
       victim, TO_CHAR);
  act ("$n's eyes fade to dark black.", ch, NULL, NULL, TO_ROOM);
  act ("$p shakes violently, causing you to drop it.", ch, obj, victim,
       TO_VICT);
  subtract_quint (ch, 2);
  waiting (ch, 16);
  return;
}

void
do_alterweight (CHAR_DATA * ch, char *argument)
{
  OBJ_DATA *obj;
  char arg[MSL];

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MMAT] < 3)
    {
      send_to_char
	("You must obtain level three Matter to use Alter Weight.\n\r", ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Which object's weight do you want to lower?\n\r", ch);
      return;
    }

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

  if (IS_SET (obj->extra_flags, ITEM_VANISH))
    {
      stc ("Not on Illusions.\n\r", ch);
      return;
    }

  if (obj->weight <= 1)
    {
      send_to_char ("That object is already as light as possible!\n\r", ch);
      return;
    }

  obj->weight = 1;
  act ("You rearrange $p's pattern, lowering it's weight.", ch, obj, NULL,
       TO_CHAR);
  act ("$n's eyes glow emerald green.", ch, NULL, NULL, TO_ROOM);
  waiting (ch, 8);
  return;
}

void
do_enchantarmor (CHAR_DATA * ch, char *argument)
{
  OBJ_DATA *obj;
  AFFECT_DATA *paf;
  char arg[MSL];

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MMAT] < 4)
    {
      send_to_char
	("You must obtain level four Matter to use Enchant Armor.\n\r", ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Which piece of armor do you want to enchant?\n\r", ch);
      return;
    }

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

  if (IS_SET (obj->quest, QUEST_MAGEENCHANT))
    {
      send_to_char ("This object has already been enchanted.\n\r", ch);
      return;
    }

  if (IS_SET (obj->spectype, SITEM_MASTERY))
    {
      send_to_char ("This is a mastery item.\n\r", ch);
      return;
    }

  if (IS_SET (obj->extra_flags, ITEM_VANISH))
    {
      stc ("Not on Illusions.\n\r", ch);
      return;
    }

  if (obj->item_type != ITEM_ARMOR)
    {
      send_to_char ("This item isn't a piece of armor.\n\r", ch);
      return;
    }

  if (check_quint (ch) < 3)
    {
      send_to_char
	("You need three points of quintessence to Enchant Armor.\n\r", ch);
      return;
    }

  if (ch->pcdata->crystal < 3)
    {
      send_to_char ("You dont have the required 3 power crystals\n\r", ch);
      return;
    }

  act ("You lay your hands on $p and rearrange its pattern.", ch, obj, NULL,
       TO_CHAR);
  act
    ("$n's eyes glow brilliantly blue.\n$n lays $s hands on $p.\n$p glows blue.",
     ch, obj, NULL, TO_ROOM);
  SET_BIT (obj->quest, QUEST_MAGEENCHANT);
  ch->pcdata->crystal -= 3;

  if (affect_free == NULL)
    {
      paf = alloc_perm (sizeof (*paf));
    }
  else
    {
      paf = affect_free;
      affect_free = affect_free->next;
    }

  paf->type = skill_lookup ("enchant weapon");
  paf->duration = -1;
  paf->location = APPLY_HITROLL;
  paf->modifier = (ch->spheres[MMAT] * 3);
  paf->bitvector = 0;
  paf->next = obj->affected;
  obj->affected = paf;

  if (affect_free == NULL)
    {
      paf = alloc_perm (sizeof (*paf));
    }
  else
    {
      paf = affect_free;
      affect_free = affect_free->next;
    }

  paf->type = skill_lookup ("enchant weapon");
  paf->duration = -1;
  paf->location = APPLY_DAMROLL;
  paf->modifier = (ch->spheres[MMAT] * 3);
  paf->bitvector = 0;
  paf->next = obj->affected;
  obj->affected = paf;

  waiting (ch, 16);
  subtract_quint (ch, 3);
  return;
}

void
do_hover (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MMAT] < 5)
    {
      send_to_char ("You must obtain level 5 matter to use Hoverwalk.\n\r",
		    ch);
      return;
    }

  if (IS_AFFECTED (ch, AFF_FLYING))
    {
      send_to_char
	("You slowly float to the ground as your air cushion dissipates.\n\r",
	 ch);
      act ("$n slowly floats to the ground.", ch, NULL, NULL, TO_ROOM);
      REMOVE_BIT (ch->affected_by, AFF_FLYING);
      return;
    }
  else
    {
      send_to_char
	("You restructure the pattern of the air around your body.\n\rYou slowly float into the air.\n\r",
	 ch);
      act ("$n slowly floats into the air.", ch, NULL, NULL, TO_ROOM);
      SET_BIT (ch->affected_by, AFF_FLYING);
      return;
    }

  return;
}

void
do_mshadow (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MMIN] < 5)
    {
      send_to_char ("You must obtain level five Mind to use Untether.\n\r",
		    ch);
      return;
    }

  if (ch->fight_timer > 0)
    {
      send_to_char ("Not until your fight timer expires.\n\r", ch);
      return;
    }

  if (!IS_AFFECTED (ch, AFF_SHADOWPLANE))
    {
      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);
      SET_BIT (ch->affected_by, AFF_SHADOWPLANE);
      do_look (ch, "auto");
      return;
    }

  REMOVE_BIT (ch->affected_by, AFF_SHADOWPLANE);
  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");
  return;
}

void
do_callspirit (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  AFFECT_DATA af;

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MSPI] < 1)
    {
      send_to_char ("You must obtain level one Spirit to Call Spirits.\n\r",
		    ch);
      return;
    }

  if (ch->pcdata->followers > 5)
    {
      send_to_char ("Nothing seems to happen.\n\r", ch);
      return;
    }

  send_to_char ("You chant an arcane spell and conjure a spirit.\n\r", ch);
  act ("$n chants loudly in a foreign language.", ch, NULL, NULL, TO_ROOM);

  ch->pcdata->followers++;
  victim = create_mobile (get_mob_index (MOB_VNUM_GUARDIAN));
  victim->name = str_dup ("spirit");
  victim->short_descr = str_dup ("A wicked spirit");
  victim->long_descr =
    str_dup ("A ghostly image hovers over the ground here.");
  victim->level = 200;
  victim->hit = 5000;
  victim->max_hit = 5000;
  victim->hitroll = 50;
  victim->damroll = 50;
  victim->armor = 300;
  SET_BIT (victim->act, ACT_NOEXP);
  char_to_room (victim, ch->in_room);
  add_follower (victim, ch);
  af.duration = -1;
  af.location = APPLY_NONE;
  af.modifier = 0;
  af.bitvector = AFF_CHARM;
  affect_to_char (victim, &af);
  act ("$N materializes next to $n.", ch, NULL, victim, TO_ROOM);
  return;
}

void
do_spiritkiss (CHAR_DATA * ch, char *argument)
{
  int sn, level;
  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MSPI] < 2)
    {
      send_to_char
	("You must obtain level two Spirit to use Spirit Kiss.\n\r", ch);
      return;
    }

  if ((sn = skill_lookup ("spirit kiss")) < 0)
    return;

  if (is_affected (ch, sn))
    {
      send_to_char ("You are already blessed by the spirits.\n\r", ch);
      return;
    }

  if (check_quint (ch) < 1)
    {
      send_to_char
	("You need one point of quintessence to call a spirit.\n\r", ch);
      return;
    }

  level = (ch->spheres[MSPI] * 5);
  if (ch->spheres[MSPI] >= 10)
    level *= 2;
  (*skill_table[sn].spell_fun) (sn, level, ch, ch);
  waiting (ch, 12);
  subtract_quint (ch, 1);
  return;
}

void
do_spiritblast (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MSL];
  char buf[MSL];
  int togain;
  int dam;
  char damm[MSL];

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MSPI] < 4)
    {
      send_to_char ("You must obtain level 4 Spirit to use Spirit Blast.\n\r",
		    ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Whom do you want to use Spirit Blast on?\n\r", ch);
      return;
    }

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

  if (victim->level < 3)
    {
      send_to_char ("They must be an avatar!\n\r", ch);
      return;
    }



  dam = ch->spheres[MSPI] * 26;
  mage_damage (ch, victim, dam, "spirit blast", MAGEDAM_OTHER);
  togain = number_range (ch->spheres[MSPI] * 30, dam * 26);
  if (ch->spheres[MSPI] >= 9)
    {
      victim->hit -= (togain * 2);
    }
  else
    {
      victim->mana -= togain;
      victim->move -= togain;
    }
  if (ch->spheres[MSPI] >= 9)
    {
      ch->hit += togain;
    }
  else
    {
      ch->mana += togain;
      ch->move += togain;
    }
  if (ch->mana > (ch->max_mana + 500))
    ch->mana = (ch->max_mana + 500);
  if (ch->move > (ch->max_move + 500))
    ch->move = (ch->max_move + 500);

  if (ch->spheres[MSPI] > 1)
    {
      sprintf (damm, "#L%d#n", togain);
      sprintf (buf, "You absorb %s points of energy from the blast.\r\n",
	       damm);
    }

  send_to_char (buf, ch);

  send_to_char ("You feel drained.\n\r", victim);
  waiting (ch, 16);
  return;
}

void
do_breach (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *vch;
  CHAR_DATA *vch_next;
  CHAR_DATA *mount;

  if (IS_NPC (ch))
    return;

  if (!is_mage (ch))
    return;

  if (ch->spheres[MSPI] < 5)
    {
      send_to_char
	("You must obtain level 5 Spirit to Breach the Gauntlet.\n\r", ch);
      return;
    }

  if (check_quint (ch) < 2)
    {
      send_to_char
	("You need two points of quintessence to breach the gauntlet.\n\r",
	 ch);
      return;
    }
  if (has_fighttimer (ch))
    return;
  for (vch = char_list; vch != NULL; vch = vch_next)
    {
      vch_next = vch->next;
      if (vch->in_room == NULL)
	continue;
      if (!IS_NPC (vch) && vch->pcdata->chobj != NULL)
	continue;
      if (vch->level < 3)
	continue;
      if (IS_SET (vch->affected_by, AFF_SHADOWPLANE))
	continue;
      if (ch == vch)
	continue;
      if (vch->in_room == ch->in_room)
	{
	  if ((mount = ch->mount) != NULL)
	    {
	      if (mount == vch)
		continue;
	    }

	  if (can_see (ch, vch))
	    {
	      act
		("$n's eyes turn dark black.\nThe room is torn apart before your very eyes, and you fall into a black nothingness.",
		 ch, NULL, vch, TO_VICT);
	      SET_BIT (vch->affected_by, AFF_SHADOWPLANE);
	    }
	}
    }
  SET_BIT (ch->affected_by, AFF_SHADOWPLANE);
  subtract_quint (ch, 2);
  send_to_char
    ("You tear the room apart, reforming it in the spirit world.\n\r", ch);
  return;

}

void
do_newstaff (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MIL];
  char arg2[MIL];
  char buf[MSL];

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

  if (IS_NPC (ch))
    return;

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

  if (arg[0] == '\0')
    {
      send_to_char ("Whom do you want to let make a new staff?\n\r", ch);
      return;
    }

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

  if (IS_NPC (victim))
    {
      send_to_char ("Not on NPC's.\n\r", ch);
      return;
    }

  if (!IS_MAGE (victim))
    {
      stc ("They arent even a Mage.\n\r", ch);
      return;
    }

  if (victim->class != CLASS_MAGE)
    {
      send_to_char ("They arent even a pure Mage.\n\r", ch);
      return;
    }

  if (arg2[0] == '\0')
    {
      send_to_char
	("What staff kind do you want to grant them a new shot at making.\n\r",
	 ch);
      send_to_char ("Illusionist/Conjurer/Invoker.\n\r", ch);
      return;
    }

  if (!str_cmp (arg2, "illusionist"))
    {
      if (!IS_SET (victim->xbits, X_ILLUSIONIST))
	{
	  send_to_char ("They havent even made it once.\n\r", ch);
	  return;
	}

      if (IS_SET (victim->xbits, X_ILLUSIONIST_TWO))
	{
	  REMOVE_BIT (victim->xbits, X_ILLUSIONIST_TWO);
	}

      send_to_char
	("You have been granted another shot at making the Illusionist Staff.\n\r",
	 victim);
      sprintf (buf,
	       "You have granted %s another chance at making the Illusionist Staff.\n\r",
	       victim->name);
      send_to_char (buf, ch);
      REMOVE_BIT (victim->xbits, X_ILLUSIONIST);
      return;
    }

  if (!str_cmp (arg2, "conjurer"))
    {
      if (!IS_SET (victim->xbits, X_CONJURER))
	{
	  send_to_char ("They havent even made it once.\n\r", ch);
	  return;
	}

      if (IS_SET (victim->xbits, X_CONJURER_TWO))
	{
	  REMOVE_BIT (victim->xbits, X_CONJURER_TWO);
	}

      send_to_char
	("You have been granted another shot at making the Conjurer's Staff.\n\r",
	 victim);
      sprintf (buf,
	       "You have granted %s another chance at making the Conjurer's Staff.\n\r",
	       victim->name);
      send_to_char (buf, ch);
      REMOVE_BIT (victim->xbits, X_CONJURER);
      return;
    }


  if (!str_cmp (arg2, "invoker"))
    {
      if (!IS_SET (victim->xbits, X_ARCHMAGE))
	{
	  send_to_char ("They havent even made it once.\n\r", ch);
	  return;
	}

      if (IS_SET (victim->xbits, X_ARCHMAGE_TWO))
	{
	  REMOVE_BIT (victim->xbits, X_ARCHMAGE_TWO);
	}

      send_to_char
	("You have been granted another shot at making the Invoker's Staff.\n\r",
	 victim);
      sprintf (buf,
	       "You have granted %s another chance at making the Invoker's Staff.\n\r",
	       victim->name);
      send_to_char (buf, ch);
      REMOVE_BIT (victim->xbits, X_ARCHMAGE);
      return;
    }

  else

    do_newstaff (ch, "");
  return;
}

void
do_craft (CHAR_DATA * ch, char *argument)
{
  OBJ_INDEX_DATA *pObjIndex;
  OBJ_DATA *obj;
  char arg[MIL];
  char arg2[MIL];
  char buf[MSL];
  char buf2[MSL];
  char *mage_col;
  int vnum = 0;

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

  if (IS_NPC (ch))
    return;

  if (!IS_PUREMAGE (ch) && !IS_WISHENCHANT (ch) && !IS_GYPSY (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }

  if (IS_WISHENCHANT (ch))
    {
      if (ch->spheres[MMAT] < 6)
	{
	  stc
	    ("You need Matter to 6 before you can craft the mask of wishes.\n\r",
	     ch);
	  return;
	}
      if (str_cmp (arg, "mask"))
	{
	  stc ("Syntax is craft mask.\n\r", ch);
	  return;
	}
    }

  if (IS_GYPSY (ch))
    {
      if (ch->spheres[MTIM] < 6)
	{
	  stc
	    ("You need Time to 6 before you can craft the crystal orb.\n\r",
	     ch);
	  return;
	}
      if (str_cmp (arg, "orb"))
	{
	  stc ("Syntax is craft orb.\n\r", ch);
	  return;
	}
    }


  if (arg[0] == '\0')
    {
      if (!IS_WISHENCHANT (ch) && !IS_GYPSY (ch))
	{
	  stc
	    ("Please specify what kind of equipment you want to create.\n\r",
	     ch);
	  stc ("Girth, Mask, Robe, Staff.\n\r", ch);
	  return;
	}
      else if (IS_WISHENCHANT (ch))
	{
	  stc ("Syntax is craft mask.\n\r", ch);
	  return;
	}
      else if (IS_GYPSY (ch))
	{
	  stc ("Syntax is craft focus.\n\r", ch);
	  return;
	}
      else
	{
	  return;
	}
    }

  if (ch->practice < 100)
    {
      stc ("It costs 100 points of primal to craft an item.\n\r", ch);
      return;
    }

  if (!str_cmp (arg, "girth"))
    vnum = 29615;
  else if (!str_cmp (arg, "mask"))
    vnum = 29616;
  else if (!str_cmp (arg, "robe"))
    vnum = 29617;
  else if (!str_cmp (arg, "staff"))
    vnum = 29618;
  else if (!str_cmp (arg, "orb") && IS_GYPSY (ch))
    vnum = 30037;
  else
    {
      stc ("Please specify what kind of equipment you want to create.\n\r",
	   ch);
      stc ("Girth, Mask, Robe, Staff.\n\r", ch);
      return;
    }


  if (!str_cmp (arg, "staff"))
    {
      if (arg2[0] == '\0')
	{
	  stc ("Please chose a staff type.\n\r", ch);
	  stc ("Syntax: Craft Staff (Illusionist/Conjurer/Invoker).\n\r", ch);
	  return;
	}

      if (!str_cmp (arg2, "illusionist"))
	{
	  if (IS_SET (ch->xbits, X_ILLUSIONIST) && !IS_CREATOR (ch))
	    {
	      stc
		("You can only make one Illusionist's Staff, have a problem with that, take it up with Corim!\n\r",
		 ch);
	      return;
	    }
	  if (ch->pcdata->runes[0] == WHITE_MAGIC)
	    {
	      stc
		("You can't make the staff's unless you are in a school of magic.\n\r",
		 ch);
	      return;
	    }
	  vnum = 29618;
	}

      else if (!str_cmp (arg2, "conjurer"))
	{
	  if (IS_SET (ch->xbits, X_CONJURER) && !IS_CREATOR (ch))
	    {
	      stc
		("You can only make one Conjurer's Staff, have a problem with that, take it up with Corim!\n\r",
		 ch);
	      return;
	    }
	  if (ch->pcdata->runes[0] == WHITE_MAGIC)
	    {
	      stc
		("You can't make the staff's unless you are in a school of magic.\n\r",
		 ch);
	      return;
	    }
	  vnum = 29618;
	}
      else if (!str_cmp (arg2, "invoker"))
	{
	  if (IS_SET (ch->xbits, X_ARCHMAGE) && !IS_CREATOR (ch))
	    {
	      stc
		("You can only make one Staff of the Invoker, have a problem with that, take it up with Corim!\n\r",
		 ch);
	      return;
	    }
	  if (ch->pcdata->runes[0] == WHITE_MAGIC)
	    {
	      stc
		("You can't make the staff's unless you are in a school of magic.\n\r",
		 ch);
	      return;
	    }
	  vnum = 29618;
	}
      else
	{
	  stc ("Please chose a staff type.\n\r", ch);
	  stc ("Syntax: Craft Staff (Illusionist/Conjurer/Invoker).\n\r", ch);
	  return;
	}

    }


  if (!str_cmp (arg2, "conjurer") && ch->level < 5)
    {
      stc ("You need to be atleast a Conjurer to create this staff.\n\r", ch);
      return;
    }

  if (!str_cmp (arg2, "invoker") && ch->level < 6)
    {
      stc ("You need to be an Invoker to create this staff.\n\r", ch);
      return;
    }

  if (vnum == 0 || (pObjIndex = get_obj_index (vnum)) == NULL)
    {
      send_to_char ("Missing object, please inform Corim.\n\r", ch);
      return;
    }
  switch (ch->pcdata->runes[0])
    {
    default:
    case PURPLE_MAGIC:
      mage_col = "#pA#Pi#pr#n";
      break;
    case RED_MAGIC:
      mage_col = "#rF#Rir#re#n";
      break;
    case BLUE_MAGIC:
      mage_col = "#lWa#Lt#ler#n";
      break;
    case GREEN_MAGIC:
      mage_col = "#gEa#Gr#gth#n";
      break;
    case YELLOW_MAGIC:
      mage_col = "#oSp#yir#oit#n";
      break;
    case WHITE_MAGIC:
      mage_col = "#7Hollow#n";
      break;
    }

  obj = create_object (pObjIndex, 50);
  obj_to_char (obj, ch);
  SET_BIT (obj->spectype, SITEM_MAGE);
  if (obj->questmaker != NULL)
    free_string (obj->questmaker);
  obj->questmaker = str_dup (ch->name);
  if (obj->questowner != NULL)
    free_string (obj->questowner);
  obj->questowner = str_dup (ch->name);

  free_string (obj->creator);
  sprintf (buf, "%s (Craft)", ch->name);
  obj->creator = str_dup (buf);

  obj->condition = 100;
  obj->toughness = 100;
  obj->resistance = 1;

  if (!str_cmp (arg, "girth"))
    {
      obj->value[0] = 100;
      obj->value[3] = 16;
      sprintf (buf, "#cA %s #cMage Girth#n", mage_col);
      free_string (obj->short_descr);
      obj->short_descr = str_dup (buf);

      sprintf (buf, "#cA %s #cMage Girth#n", mage_col);
      free_string (obj->description);
      obj->description = str_dup (buf);
      add_affect (obj, APPLY_HITROLL, 20);
      add_affect (obj, APPLY_DAMROLL, 20);
      add_affect (obj, APPLY_AC, -100);
      add_affect (obj, APPLY_MANA, 1000);

    }

  if (!str_cmp (arg, "mask"))
    {
      if (!IS_WISHENCHANT (ch))
	{
	  obj->value[0] = 100;
	  obj->value[3] = 17;
	  sprintf (buf, "#cA %s #cMage Mask#n", mage_col);
	  sprintf (buf2, "#cA %s #cMage Mask#n", mage_col);
	  add_affect (obj, APPLY_HITROLL, 20);
	  add_affect (obj, APPLY_DAMROLL, 20);
	  add_affect (obj, APPLY_AC, -100);
	  add_affect (obj, APPLY_MANA, 1000);
	}
      else
	{
	  REMOVE_BIT (obj->spectype, SITEM_MAGE);
	  SET_BIT (obj->spectype, SITEM_DJINN);
	  obj->value[0] = 100;
	  obj->value[3] = 15;
	  sprintf (buf, "#rThe Mask of #CW#cishe#Cs#n");
	  sprintf (buf2, "#rThe Mask of #CW#cishe#Cs#n");
	  add_affect (obj, APPLY_HITROLL, 75);
	  add_affect (obj, APPLY_DAMROLL, 75);
	  add_affect (obj, APPLY_AC, -600);
	  add_affect (obj, APPLY_MANA, 4000);
	  add_affect (obj, APPLY_HIT, 4000);
	  add_affect (obj, APPLY_MOVE, 4000);
	}

      free_string (obj->short_descr);
      obj->short_descr = str_dup (buf);
      free_string (obj->description);
      obj->description = str_dup (buf2);
    }

  if (!str_cmp (arg, "robe"))
    {
      obj->value[0] = 100;
      obj->value[3] = 21;
      sprintf (buf, "#cA %s #cMage Robe#n", mage_col);
      free_string (obj->short_descr);
      obj->short_descr = str_dup (buf);

      sprintf (buf, "#cA %s #cMage Robe#n", mage_col);
      free_string (obj->description);
      obj->description = str_dup (buf);
      add_affect (obj, APPLY_HITROLL, 20);
      add_affect (obj, APPLY_DAMROLL, 20);
      add_affect (obj, APPLY_AC, -100);
      add_affect (obj, APPLY_MANA, 1000);
    }

  if (!str_cmp (arg, "orb"))
    {
      SET_BIT (obj->spectype, SITEM_NINJA);
      SET_BIT (obj->weapflags, WEAPON_SPELLORB);
      obj->item_type = ITEM_BOOK;
      if (!IS_SET (obj->wear_flags, ITEM_TAKE))
	SET_BIT (obj->wear_flags, ITEM_TAKE);
      if (IS_SET (obj->wear_flags, ITEM_HOLD))
	REMOVE_BIT (obj->wear_flags, ITEM_HOLD);
      if (IS_SET (obj->wear_flags, ITEM_WIELD))
	REMOVE_BIT (obj->wear_flags, ITEM_WIELD);
      if (!IS_SET (obj->wear_flags, ITEM_WEAR_SPECIAL))
	SET_BIT (obj->wear_flags, ITEM_WEAR_SPECIAL);
      sprintf (buf, "#7An #rAr#Rca#rne #CC#cry#7s#cta#Cl#7 Orb#n");
      free_string (obj->short_descr);
      obj->short_descr = str_dup (buf);
      sprintf (buf, "#7An #rAr#Rca#rne #CC#cry#7s#cta#Cl#7 Orb#n");
      free_string (obj->description);
      obj->description = str_dup (buf);
      free_string (obj->name);
      obj->name = str_dup ("orb gypsy arcane");
      add_affect (obj, APPLY_HITROLL, 60);
      add_affect (obj, APPLY_DAMROLL, 60);
      add_affect (obj, APPLY_AC, -500);
      add_affect (obj, APPLY_DAMCAP, 250);
      add_affect (obj, APPLY_MANA, 3000);
    }

  if (!str_cmp (arg, "staff"))
    {
      obj->value[0] = 15000;

      if (!str_cmp (arg2, "illusionist"))
	{

	  sprintf (buf, "#cA Dull %s #cIllusionist's Staff#n", mage_col);
	  free_string (obj->short_descr);
	  obj->short_descr = str_dup (buf);

	  sprintf (buf, "#cA Dull %s #cIllusionist's Staff#n", mage_col);
	  free_string (obj->description);
	  obj->description = str_dup (buf);
	  obj->value[1] = 100;
	  obj->value[2] = 200;
	  add_affect (obj, APPLY_HITROLL, 20);
	  add_affect (obj, APPLY_DAMROLL, 20);
	  add_affect (obj, APPLY_AC, -100);
	  add_affect (obj, APPLY_MANA, 1000);

	  if (!IS_SET (ch->xbits, X_ILLUSIONIST))
	    {
	      SET_BIT (ch->xbits, X_ILLUSIONIST);
	    }
	}

      if (!str_cmp (arg2, "conjurer"))
	{


	  sprintf (buf, "#cA Glowing Conjurer's Staff Of %s#n", mage_col);
	  free_string (obj->short_descr);
	  obj->short_descr = str_dup (buf);

	  sprintf (buf, "#cA Glowing Conjurer's Staff Of %s#n", mage_col);
	  free_string (obj->description);
	  obj->description = str_dup (buf);
	  obj->value[1] = 200;
	  obj->value[2] = 400;
	  add_affect (obj, APPLY_HITROLL, 40);
	  add_affect (obj, APPLY_DAM

Showing the first 100 KB of 103.2 KB. Download the archive for the full file.

Site Stats

Snippets: 1791
Codebases: 571