#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "emlen.h"

#define OPERATING_ROOM 21043

void 
do_implant (CHAR_DATA * ch, char *argy)
{
  short hp_cost[] =
  {3, 2, 2, 3, 2, 0, 1, 0, 1, 4};
  short mp_cost[] =
  {0, 0, 0, 0, 0, 5, 0, 5, 0, 0};
  long xp_cost[] =
  {250000, 250000, 150000, 300000, 300000, 300000, 400000, 350000, 200000, 400000};
  short gold_cost[] =
  {80, 60, 40, 60, 60, 60, 80, 40, 60, 80};
  short min_level[] =
  {17, 15, 15, 18, 21, 23, 26, 22, 16, 25};
  int num = -1;
  char *s =
  {"You already have that implant!\n\r"};
  char buf[500];
  DEFINE_COMMAND ("implant", do_implant, POSITION_STANDING, 1, LOG_NORMAL, "This command is used to get implants when you are an Aturion at a implant specialist.")
    if (ch->in_room->vnum != OPERATING_ROOM)
    {
      send_to_char ("There is no operating room here.\n\r", ch);
      return;
    }
#ifdef NEW_WORLD
  if (IS_MOB (ch))
    return;
  if (!IS_EVIL (ch))
    {
      send_to_char ("Only Aturions may get implants!\n\r", ch);
      return;
    }
  if (argy[0] == '\0')
    {
      send_to_char ("Lvl  Implant                       Costs\n\r", ch);
      send_to_char ("------------------------------------------------------------------\n\r", ch);
      send_to_char (" 17  [A] Arm strength implant......... 3 perm hp, 250k exp, 80 gold\n\r", ch);
      send_to_char (" 15  [B] Leg strength implant......... 2 perm hp, 250k exp, 60 gold\n\r", ch);
      send_to_char (" 15  [C] Hand strength implant........ 2 perm hp, 150k exp, 40 gold\n\r", ch);
      send_to_char (" 18  [D] Body strength implant........ 3 perm hp, 300k exp, 60 gold\n\r", ch);
      send_to_char (" 21  [E] Arm dexterity implant........ 2 perm hp, 300k exp, 60 gold\n\r", ch);
      send_to_char (" 23  [F] Leg durability implant....... 5 perm mp, 300k exp, 60 gold\n\r", ch);
      send_to_char (" 26  [G] Brain microchip implant...... 1 perm hp, 400k exp, 80 gold\n\r", ch);
      send_to_char (" 22  [H] Bionic feet implant.......... 5 perm mp, 350k exp, 40 gold\n\r", ch);
      send_to_char (" 16  [I] Metal hand plate implant..... 1 perm hp, 200k exp, 60 gold\n\r", ch);
      send_to_char (" 25  [J] Steel ribcage implant........ 4 perm hp, 400k exp, 80 gold\n\r", ch);
      send_to_char ("\n\rType 'help implant' for more info.\n\r", ch);
      return;
    }

  if (UPPER (argy[0]) == 'A')
    {
      num = 0;
      send_to_char ("You request an arm strength implant...\n\r", ch);
    }
  if (UPPER (argy[0]) == 'B')
    {
      num = 1;
      send_to_char ("You request a leg strength implant...\n\r", ch);
    }
  if (UPPER (argy[0]) == 'C')
    {
      num = 2;
      send_to_char ("You request a hand strength implant...\n\r", ch);
    }
  if (UPPER (argy[0]) == 'D')
    {
      num = 3;
      send_to_char ("You request a body strength implant...\n\r", ch);
    }
  if (UPPER (argy[0]) == 'E')
    {
      num = 4;
      send_to_char ("You request an arm dexterity implant...\n\r", ch);
    }
  if (UPPER (argy[0]) == 'F')
    {
      num = 5;
      send_to_char ("You request a leg durability implant...\n\r", ch);
    }
  if (UPPER (argy[0]) == 'G')
    {
      num = 6;
      send_to_char ("You request a brain microchip implant...\n\r", ch);
    }
  if (UPPER (argy[0]) == 'H')
    {
      num = 7;
      send_to_char ("You request a bionic feet implant...\n\r", ch);
    }
  if (UPPER (argy[0]) == 'I')
    {
      num = 8;
      send_to_char ("You request a metal hand plate implant...\n\r", ch);
    }
  if (UPPER (argy[0]) == 'J')
    {
      num = 9;
      send_to_char ("You request a steel ribcage implant...\n\r", ch);
    }

  if (num == -1)
    {
      send_to_char ("That implant is unknown.\n\r", ch);
      return;
    }

  if (num == 0 && HAS_ARMS_STRENGTH_IMPLANT (ch))
    {
      send_to_char (s, ch);
      return;
    }
  if (num == 1 && HAS_LEGS_STRENGTH_IMPLANT (ch))
    {
      send_to_char (s, ch);
      return;
    }
  if (num == 2 && HAS_HANDS_STRENGTH_IMPLANT (ch))
    {
      send_to_char (s, ch);
      return;
    }
  if (num == 3 && HAS_BODY_STRENGTH_IMPLANT (ch))
    {
      send_to_char (s, ch);
      return;
    }
  if (num == 4 && HAS_ARMS_DEXTERITY_IMPLANT (ch))
    {
      send_to_char (s, ch);
      return;
    }
  if (num == 5 && HAS_LEGS_RUNNING_IMPLANT (ch))
    {
      send_to_char (s, ch);
      return;
    }
  if (num == 6 && HAS_HEAD_BRAIN_IMPLANT (ch))
    {
      send_to_char (s, ch);
      return;
    }
  if (num == 7 && HAS_FEET_IMPLANT (ch))
    {
      send_to_char (s, ch);
      return;
    }
  if (num == 8 && HAS_HANDS_ARMOR_IMPLANT (ch))
    {
      send_to_char (s, ch);
      return;
    }
  if (num == 9 && HAS_BODY_ARMOR_IMPLANT (ch))
    {
      send_to_char (s, ch);
      return;
    }

  if (hp_cost[num] > ch->max_hit || hp_cost[num] > ch->hit)
    {
      send_to_char ("You don't have enough hit points to recieve this implant.\n\r", ch);
      return;
    }
  if (mp_cost[num] > ch->max_move || mp_cost[num] > ch->move)
    {
      send_to_char ("You don't have enough move points to recieve this implant.\n\r", ch);
      return;
    }
  if (xp_cost[num] > ch->exp)
    {
      send_to_char ("You don't have enough experience to recieve this implant.\n\r", ch);
      return;
    }
  if (gold_cost[num] * 100 > ch->pcdata->bank)
    {
      send_to_char ("You do not have enough money in your bank account for the implant.\n\r", ch);
      return;
    }
  if (min_level[num] > LEVEL (ch))
    {
      send_to_char ("You are not yet of high enough level to recieve this implant.\n\r", ch);
      return;
    }

  sprintf (buf, "You lose %d permanent hit points and %d permanent move points.\n\r", hp_cost[num], mp_cost[num]);
  send_to_char (buf, ch);
  ch->max_hit -= hp_cost[num];
  ch->max_move -= mp_cost[num];
  SUBHIT(ch,hp_cost[num]);
  SUBMOVE(ch,mp_cost[num]);
  sprintf (buf, "You pay the %d gold fee for the implant from your bank account.\n\r", gold_cost[num]);
  send_to_char (buf, ch);
  ch->pcdata->bank -= (gold_cost[num] * 100);
  sprintf (buf, "%ld of your experience points are lost during the operation.\n\r", xp_cost[num]);
  ch->exp -= xp_cost[num];

  if (num == 0)
    {
      SET_BIT (ch->pcdata->implants_1, IMPLANT_ARMS);
      send_to_char ("The doctor removes your bicep and tricep, replacing them with specially\n\r", ch);
      send_to_char ("treated, lab-grown, silicon implants!\n\r", ch);
      return;
    }

  if (num == 1)
    {
      SET_BIT (ch->pcdata->implants_1, IMPLANT_LEGS);
      send_to_char ("The doctor removes your quadraceps, and calf-muscle, replacing them with\n\r", ch);
      send_to_char ("lab-grown, silicon muscle implants.  Your hamstring is then removed and\n\r", ch);
      send_to_char ("replaced with a super-strong, super-responsive, new-age titanium alloy.\n\r", ch);
      return;
    }

  if (num == 2)
    {
      SET_BIT (ch->pcdata->implants_1, IMPLANT_HANDS);
      send_to_char ("The doctor removes the tendons from your hands, and then inserts super-strong\n\r", ch);
      send_to_char ("titanium tendons in replacement.\n\r", ch);
      return;
    }

  if (num == 3)
    {
      SET_BIT (ch->pcdata->implants_1, IMPLANT_BODY);
      send_to_char ("The doctor removes your pectoral and stomach muscle masses, replacing them\n\r", ch);
      send_to_char ("with specially treated muscle mass from the Aturion mammoth.\n\r", ch);
      return;
    }

  if (num == 4)
    {
      SET_BIT (ch->pcdata->implants_2, IMPLANT_ARMS);
      send_to_char ("The doctor replaces the nerves in your arms with superconductive\n\r", ch);
      send_to_char ("synthetic nerve fibers.\n\r", ch);
      return;
    }

  if (num == 5)
    {
      SET_BIT (ch->pcdata->implants_2, IMPLANT_LEGS);
      send_to_char ("The doctor injects you with the newest super-serum, and your legs begin\n\r", ch);
      send_to_char ("to tingle and bulk up with increased durability.\n\r", ch);
      return;
    }

  if (num == 6)
    {
      SET_BIT (ch->pcdata->implants_2, IMPLANT_HEAD);
      send_to_char ("The doctor painfully shoves a tiny, pulsating microchip through your ear\n\r", ch);
      send_to_char ("and into your brain.\n\r", ch);
      return;
    }

  if (num == 7)
    {
      SET_BIT (ch->pcdata->implants_2, IMPLANT_FEET);
      send_to_char ("The doctor chops off both of your feet, removes the skin from them, then\n\r", ch);
      send_to_char ("attaches state-of-the-art metallic feet.  After he is done, he carefully\n\r", ch);
      send_to_char ("replaces the skin, then inflates the feet to their normal size with a strange,\n\r", ch);
      send_to_char ("silicon gel.\n\r", ch);
      return;
    }

  if (num == 8)
    {
      SET_BIT (ch->pcdata->implants_2, IMPLANT_HANDS);
      send_to_char ("The doctor carefully inserts over 20 carefully placed metal plates into each\n\r", ch);
      send_to_char ("one of your hands.\n\r", ch);
      return;
    }

  if (num == 9)
    {
      SET_BIT (ch->pcdata->implants_2, IMPLANT_BODY);
      send_to_char ("The doctor removes your ribs, one by one, for what seems like days.  He then\n\r", ch);
      send_to_char ("proceeds to implant a titanium sternum, and from there, he adds super-strong\n\r", ch);
      send_to_char ("metallic ribs, and then sews you back up.\n\r", ch);
      return;
    }
#endif
  return;
}

void 
do_mobscatter (CHAR_DATA * ch, char *argy)
{
  char vnum[100];
  char how_many[100];
  int vn;
  int objs;
  ROOM_DATA *rd = NULL;
  CHAR_DATA *mob;
  MOB_PROTOTYPE *mid;
  DEFINE_COMMAND ("mobscatter", do_mobscatter, POSITION_DEAD, 110, LOG_ALWAYS, "This command scatters (amount) mobs of prototype <vnum> around the world.  Syntax: mobscatter <vnum> (amount).")

    argy = one_argy (argy, vnum);
  argy = one_argy (argy, how_many);
  if (!is_number (vnum))
    {
      send_to_char ("Uhh... syntax is: \"mobscatter <vnum> (amount)\".\n\r", ch);
      return;
    }
  if ((mid = get_mob_index ((vn = atoi (vnum)))) == NULL)
    {
      send_to_char ("That mob vnum doesn't exist...\n\r", ch);
      return;
    }
  if (is_number (how_many))
    {
      objs = atoi (how_many);
    }
  else
    objs = 1;
  while (objs > 0)
    {
      while (rd == NULL)
	{
	  rd = get_room_index (number_range (1000, top_vnum_room));
	}
      if (!rd->area->open)
	{
	  rd = NULL;
	  continue;
	}
      if (rd->sector_type == SECT_WATER_SWIM || rd->sector_type == SECT_WATER_NOSWIM)
	{
	  rd = NULL;
	  continue;
	}
      objs--;
      mob = create_mobile (mid);
      char_to_room (mob, rd);
      rd = NULL;
    }
  return;
}

void 
do_scatter (CHAR_DATA * ch, char *argy)
{
  char vnum[100];
  char how_many[100];
  int vn;
  int objs;
  ROOM_DATA *rd = NULL;
  SINGLE_OBJECT *obj;
  OBJ_PROTOTYPE *oid;
  DEFINE_COMMAND ("objscatter", do_scatter, POSITION_DEAD, 110, LOG_ALWAYS, "This command scatters (amount) objects of prototype <vnum> around the world.  Syntax: objscatter <vnum> (amount).")

    argy = one_argy (argy, vnum);
  argy = one_argy (argy, how_many);
  if (!is_number (vnum))
    {
      send_to_char ("Uhh... syntax is: \"scatter <vnum> (amount)\".\n\r", ch);
      return;
    }
  if ((oid = get_obj_index ((vn = atoi (vnum)))) == NULL)
    {
      send_to_char ("That object vnum doesn't exist...\n\r", ch);
      return;
    }
  if (is_number (how_many))
    {
      objs = atoi (how_many);
    }
  else
    objs = 1;
  while (objs > 0)
    {
      while (rd == NULL)
	{
	  rd = get_room_index (number_range (1000, top_vnum_room));
	}
      if (!rd->area->open)
	{
	  rd = NULL;
	  continue;
	}
      if (rd->sector_type == SECT_WATER_SWIM || rd->sector_type == SECT_WATER_NOSWIM)
	{
	  rd = NULL;
	  continue;
	}
      objs--;
      obj = create_object (oid, 1);
      obj_to (obj, rd);
      rd = NULL;
    }
  return;
}

void 
do_ctpsr (CHAR_DATA * ch, char *argy)
{
  int i;
  int begin = 0;
  int end = 0;
  int ttl = 0;
  char firstargy[500];
  ROOM_DATA *oneroom;
  DEFINE_COMMAND ("z_relocate_tps", do_ctpsr, POSITION_DEAD, 110, LOG_ALWAYS, "This command relocates tps in <begin> <end> range to other parts of the world.")
    argy = one_argy (argy, firstargy);
  begin = atoi (firstargy);
  end = atoi (argy);
  if (begin < 1 || end < 1 || end < begin)
    {
      send_to_char ("Invalid range of rooms!\n\r", ch);
      return;
    }
  for (i = begin; i <= end; i++)
    {
      if ((oneroom = get_room_index (i)) == NULL)
	continue;
      if (oneroom->tps == 0)
	continue;
      ttl += oneroom->tps;
      award_tps (ch, oneroom->tps);
      oneroom->tps = 0;
    }
  sprintf (firstargy, "%d tps relocated.\n\r", ttl);
  send_to_char (firstargy, ch);
  return;
}



void 
do_catps (CHAR_DATA * ch, char *argy)
{
  int iHash;
  ROOM_DATA *oneroom;
  DEFINE_COMMAND ("z_clear_all_tps", do_catps, POSITION_DEAD, 110, LOG_ALWAYS, "This command clears all tps in the world!!  Use with caution!!!")

    for (iHash = 0; iHash < HASH_MAX; iHash++)
    {
      for (oneroom = room_hash[iHash]; oneroom != NULL; oneroom = oneroom->next)
	{
	  if (oneroom->tps != 0)
	    oneroom->tps = 0;
	}
    }
  send_to_char ("All travel points cleared.\n\r", ch);
  return;
}

/*Strip a character of all non-worn items, INCLUDING what's inside backpacks */
void 
strip_nonworn (CHAR_DATA * ch)
{
  SINGLE_OBJECT *obj;
  SINGLE_OBJECT *obj_next;
  for (obj = ch->carrying; obj != NULL; obj = obj_next)
    {
      obj_next = obj->next_content;
      if (IS_SET (obj->pIndexData->extra_flags, ITEM_SAVE))
	continue;
      if (number_range (1, 4) == 2)
	{
	  if (obj->contains != NULL)
	    {
	      free_it (obj);
	      send_to_char ("Poof!!  You feel a bit lighter.\n\r", ch);
	      continue;
	    }
	  if (obj->in_obj != NULL)
	    {
	      free_it (obj);
	      continue;
	    }
	  if (obj->wear_loc == -1)
	    {
	      free_it (obj);
	      continue;
	    }
	}
    }
  return;
}




void 
do_alien (CHAR_DATA * ch, char *argy)
{
  SINGLE_OBJECT *obj;
  SINGLE_OBJECT *next_obj;
  int k;
  char buf1[SML_LENGTH];
  char buf2[SML_LENGTH];
  char buf3[SML_LENGTH];
  char buf4[SML_LENGTH];
  char buf5[SML_LENGTH];
  char buf6[SML_LENGTH];
  char workstr[STD_LENGTH];
  int tmp_str, tmp_wis, tmp_int, tmp_con, tmp_dex;
  DEFINE_COMMAND ("transform", do_alien, POSITION_STANDING, pow.remort_level, LOG_ALWAYS, "This command is used to transform your character.  See help transform.")

    if (IS_MOB (ch))
    return;
  if (LEVEL (ch) < pow.remort_level)
    return;
  if (pow.max_remorts == 0)
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }

  if (pow.max_remorts == 1 && ch->pcdata->remort_times > 0)
    {
      send_to_char ("You have already transformed; you cannot do it again!\n\r", ch);
      return;
    }

  if (ch->pcdata->remort_times >= pow.max_remorts)
    {
      send_to_char ("You have reached the max transformations possible.\n\r", ch);
      return;
    }

  if (pow.must_be_in_room > 1 && (!ch->in_room || ch->in_room->vnum != pow.must_be_in_room))
    {
      send_to_char ("You aren't in the proper place in the world to do that!!\n\r", ch);
      return;
    }
  if (pow.add_to_stats && (argy == "" || argy[0] == '\0'))
    {
      show_remort (ch);
      return;
    }
  if (pow.add_to_stats)
    {
      argy = one_argy (argy, buf1);
      if (str_cmp (buf1, "str") && str_cmp (buf1, "int") && str_cmp (buf1, "wis") &&
	  str_cmp (buf1, "con") && str_cmp (buf1, "dex"))
	{
	  show_remort (ch);
	  return;
	}
      argy = one_argy (argy, buf2);
      if (str_cmp (buf2, "str") && str_cmp (buf2, "int") && str_cmp (buf2, "wis") &&
	  str_cmp (buf2, "con") && str_cmp (buf2, "dex"))
	{
	  show_remort (ch);
	  return;
	}
      argy = one_argy (argy, buf3);
      if (str_cmp (buf3, "str") && str_cmp (buf3, "int") && str_cmp (buf3, "wis") &&
	  str_cmp (buf3, "con") && str_cmp (buf3, "dex"))
	{
	  show_remort (ch);
	  return;
	}
      argy = one_argy (argy, buf4);
      if (str_cmp (buf4, "str") && str_cmp (buf4, "int") && str_cmp (buf4, "wis") &&
	  str_cmp (buf4, "con") && str_cmp (buf4, "dex"))
	{
	  show_remort (ch);
	  return;
	}
      argy = one_argy (argy, buf5);
      if (str_cmp (buf5, "str") && str_cmp (buf5, "int") && str_cmp (buf5, "wis") &&
	  str_cmp (buf5, "con") && str_cmp (buf5, "dex"))
	{
	  show_remort (ch);
	  return;
	}
      argy = one_argy (argy, buf6);
      if (str_cmp (buf6, "prac") && str_cmp (buf6, "dam"))
	{
	  show_remort (ch);
	  return;
	}
      tmp_str = 0;
      tmp_int = 0;
      tmp_con = 0;
      tmp_wis = 0;
      tmp_dex = 0;
      for (k = 1; k <= 5; k++)
	{
	  char tb[STD_LENGTH];
	  tb[0] = '\0';
	  if (k == 1)
	    strcpy (tb, buf1);
	  if (k == 2)
	    strcpy (tb, buf2);
	  if (k == 3)
	    strcpy (tb, buf3);
	  if (k == 4)
	    strcpy (tb, buf4);
	  if (k == 5)
	    strcpy (tb, buf5);
	  if (!str_cmp (tb, "str"))
	    tmp_str++;
	  if (!str_cmp (tb, "int"))
	    tmp_int++;
	  if (!str_cmp (tb, "con"))
	    tmp_con++;
	  if (!str_cmp (tb, "wis"))
	    tmp_wis++;
	  if (!str_cmp (tb, "dex"))
	    tmp_dex++;
	}
      if (ch->pcdata->perm_str + tmp_str > race_info[ch->pcdata->race].limits[0] ||
	  ch->pcdata->perm_int + tmp_int > race_info[ch->pcdata->race].limits[1] ||
	  ch->pcdata->perm_con + tmp_con > race_info[ch->pcdata->race].limits[4] ||
	  ch->pcdata->perm_wis + tmp_wis > race_info[ch->pcdata->race].limits[2] ||
      ch->pcdata->perm_dex + tmp_dex > race_info[ch->pcdata->race].limits[3])
	{
	  send_to_char ("You may not push any stats over your race limits!\n\r", ch);
	  return;
	}
      ch->pcdata->perm_str += tmp_str;
      ch->pcdata->perm_int += tmp_int;
      ch->pcdata->perm_con += tmp_con;
      ch->pcdata->perm_wis += tmp_wis;
      ch->pcdata->perm_dex += tmp_dex;
      if (!str_cmp (buf6, "prac"))
	ch->pcdata->practice += 25;
      if (!str_cmp (buf6, "dam"))
	ch->damroll += 2;
    }

/*Begin transforming the character */
  for (obj = ch->carrying; obj != NULL; obj = next_obj)
    {
      next_obj = obj->next_content;
      if (IS_SET (obj->pIndexData->extra_flags, ITEM_SAVE))
	continue;
      if (pow.vaporize_inv && (obj->wear_loc == -1 || obj->contains != NULL))
	{
	  sprintf (workstr, "%s just vaporized!!\n\r", capitalize (obj->pIndexData->short_descr));
	  send_to_char (workstr, ch);
	  free_it (obj);
	  continue;
	}
      else if (obj->wear_loc != -1)
	unequip_char (ch, obj);
      if (pow.vaporize_all)
	{
	  sprintf (workstr, "%s just vaporized!!\n\r", capitalize (obj->pIndexData->short_descr));
	  send_to_char (workstr, ch);
	  free_it (obj);
	  continue;
	}
    }
  send_to_char ("Your worn items were removed to inventory.\n\r", ch);
  ch->pcdata->level = 1;
  ch->exp = 1;
  ch->pcdata->remort_times++;
  ch->pcdata->tps = 0;
  set_initial_hp (ch);
  ch->pcdata->practice = 15;
  ch->pcdata->learn = 6;
  ch->pcdata->profession_flag = 0;
  for (k = 0; k < SKILL_COUNT; k++)
    {
      ch->pcdata->learned[k] = -100;
    }
  natural_mana (ch);

  if (pow.race_change < 50 && pow.race_change >= 0)
    {
      ch->pcdata->race = pow.race_change;
    }
  if (!pow.evil_good)
    {
      ch->pcdata->warpoints = 0;
      ch->pcdata->alignment = -1000;
    }
#ifdef NEW_WORLD
  ch->pcdata->alignment = -1000;
#endif
  conv_race (ch);

  if (pow.beams_to_room > 0)
    {
      int to_room;
      if (pow.beams_to_room == 1)
	{
	  to_room = (IS_EVIL (ch) ? 99 : 100);
	}
      else
	to_room = pow.beams_to_room;
      char_from_room (ch);
      char_to_room (ch, get_room_index (to_room));
      do_look (ch, "auto");
    }
  send_to_char ("\x1B[37;1mTransformation complete!!!\x1B[37;0m\n\r", ch);
  if (!pow.evil_good)
    {
      ch->pcdata->alignment = -1000;
      conv_race (ch);
    }
  if (pow.max_remorts > 1)
    {
      sprintf (workstr, "This is remort number \x1B[37;1m%d\x1B[37;0m for your character!\n\r", ch->pcdata->remort_times);
      send_to_char (workstr, ch);
      if (ch->pcdata->remort_times == 2)
	send_to_char ("You now never will get hungry!!\n\r", ch);
      if (ch->pcdata->remort_times == 3)
	send_to_char ("You now never will get thirsty!!\n\r", ch);
    }

  do_save (ch, "xx2xx11");
  return;
}

void 
show_profs (CHAR_DATA * ch)
{
  bool found_any = FALSE;
  int pos;
  char buf[1024];
  buf[0] = '\0';
  sprintf (buf, "\x1B[32;1mCurrent profession(s): ");
  if (IS_PROF (ch, PROF_HEALER))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[37;1mHealer\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_WIZARD))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[35;1mWizard\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_KNIGHT))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[37;1mKnight\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_BARBARIAN))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[0;33mBarbarian\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_RANGER))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[0;36mRanger\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_PALADIN))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[37;1mPaladin\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_DRUID))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[0;32mDruid\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_ARCHMAGE))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[35;1mArchmage\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_ASSASSIN))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[31;1mAssassin\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_MONK))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[36;1mMonk\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_BARD))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[0;35mBard\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_ATURION_HUNTER))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[0;31mHunter\x1b[37;0m");
    }
  if (IS_PROF (ch, PROF_ATURION_ENGINEER))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "Engineer");
    }
  if (IS_PROF (ch, PROF_ATURION_PHILOSOPHER))
    {
      if (found_any)
	strcat (buf, ", ");
      found_any = TRUE;
      strcat (buf, "\x1B[34;1mPhilosopher\x1b[37;0m");
    }
  if (!found_any)
    send_to_char ("Current Profession(s): \x1B[37;1mNone\x1B[37;0m.\n\r", ch);
  else
    {
      strcat (buf, ".");
      pos = ch->position;
      ch->position = POSITION_STANDING;
      act (buf, ch, NULL, ch, TO_CHAR);
      ch->position = pos;
    }
  return;
}

void 
show_profs_available (CHAR_DATA * ch)
{
  if (IS_EVIL (ch))
    {
      send_to_char ("Professions Available to you: Hunter, Engineer, Philosopher.\n\r", ch);
      send_to_char ("Cost to take on one of these new professions is 45 levels.\n\r", ch);
      return;
    }

  send_to_char ("\x1B[34;1m-------------------------------------------------------------------------\n\r", ch);
  send_to_char ("\x1B[36;1mProfessions Available to you: \x1B[37;0m\n\r", ch);
  send_to_char ("Healer, Wizard, Knight, Barbarian, Ranger, Paladin, Monk, Bard, Assassin.\n\r", ch);
  if (IS_PROF (ch, PROF_HEALER))
    {
      send_to_char ("\x1B[37;1mHealer --> Druid\n\r", ch);
    }
  if (IS_PROF (ch, PROF_WIZARD))
    {
      send_to_char ("\x1B[37;1mWizard --> Archmage\n\r", ch);
    }
  send_to_char ("\x1B[34;1m-------------------------------------------------------------------------\x1B[37;0m\n\r", ch);
  send_to_char ("Cost to take on a new profession (after your first) is \x1B[37;1m35\x1B[37;0m levels.\n\r", ch);
  return;
}

void 
remove_all_objs (CHAR_DATA * ch)
{
  SINGLE_OBJECT *obj;
  SINGLE_OBJECT *nxt;
  for (obj = ch->carrying; obj != NULL; obj = nxt)
    {
      nxt = obj->next_content;
      if (obj->wear_loc != -1)
	unequip_char (ch, obj);
    }
  send_to_char ("Your worn items were removed to inventory.\n\r", ch);
  return;
}

#ifdef NEW_WORLD
void 
do_prof (CHAR_DATA * ch, char *argy)
{
/*char *plh[] = PROFESSION_LIST_HUMANOID; 
   char *splh[] = SECONDARY_PROF_LIST;
   char *pla[] = PROFESSION_LIST_ATURION;
 */
  char arg1[500];
  char arg2[500];
  int i;
  int bit = 0;
  DEFINE_COMMAND ("professions", do_prof, POSITION_DEAD, 0, LOG_NORMAL, "This command allows you to list, select, or add a profession.")

    arg1[0] = '\0';
  arg2[0] = '\0';
  if (strlen (argy) > 499)
    return;
  if (argy[0] == '\0')
    show_profs (ch);
  argy = one_argy (argy, arg1);
  argy = one_argy (argy, arg2);
  if (!str_cmp (arg1, "list"))
    {
      show_profs_available (ch);
      return;
    }
  if (str_cmp (arg1, "add"))
    {
      send_to_char ("Valid options are: Profession list, or Profession add <profession>.\n\r", ch);
      return;
    }
  if (IS_EVIL (ch) && ch->pcdata->profession_flag != 0 && ch->pcdata->level < 45)
    {
      send_to_char ("It will COST you 45 levels to add a profession.  You don't have enough.\n\r", ch);
      return;
    }
  if (!IS_EVIL (ch) && ch->pcdata->profession_flag != 0 && ch->pcdata->level < 35)
    {
      send_to_char ("It will COST you 35 levels to add a profession.  You don't have enough.\n\r", ch);
      return;
    }
  S_HEALER (arg2, bit)
    S_WIZARD (arg2, bit)
    S_KNIGHT (arg2, bit)
    S_BARBARIAN (arg2, bit)
    S_RANGER (arg2, bit)
    S_PALADIN (arg2, bit)
    S_DRUID (arg2, bit)
    S_ARCHMAGE (arg2, bit)
    S_ASSASSIN (arg2, bit)
    S_MONK (arg2, bit)
    S_BARD (arg2, bit)
    S_HUNTER (arg2, bit)
    S_ENGINEER (arg2, bit)
    S_PHILOSOPHER (arg2, bit)
    if (bit == 0)
    {
      send_to_char ("I don't know that profession.\n\r", ch);
      return;
    }
  if (IS_PROF (ch, bit))
    {
      send_to_char ("But you are already of that profession!\n\r", ch);
      return;
    }
  if (IS_SET (bit, PROF_DRUID) && !IS_PROF (ch, PROF_HEALER))
    {
      send_to_char ("You must be a healer before you can become a druid.\n\r", ch);
      return;
    }
  if (IS_SET (bit, PROF_ARCHMAGE) && !IS_PROF (ch, PROF_WIZARD))
    {
      send_to_char ("You must be a wizard before you can become an archmage.\n\r", ch);
      return;
    }
  if (IS_EVIL (ch) && !IS_SET (bit, PROF_ATURION_HUNTER) && !IS_SET (bit, PROF_ATURION_ENGINEER) && !IS_SET (bit, PROF_ATURION_PHILOSOPHER))
    {
      send_to_char ("You are an Aturion!\n\r", ch);
      return;
    }
  if (!IS_EVIL (ch) && (IS_SET (bit, PROF_ATURION_HUNTER) || IS_SET (bit, PROF_ATURION_ENGINEER) || IS_SET (bit, PROF_ATURION_PHILOSOPHER)))
    {
      send_to_char ("I don't know that profession!\n\r", ch);
      return;
    }
  ch->pcdata->learn = 0;
  ch->pcdata->practice = 0;

  for (i = 0; i < SKILL_COUNT; i++)
    ch->pcdata->learned[i] = -100;

  if (IS_EVIL (ch) && ch->pcdata->profession_flag != 0)
    {
      int oldlev = ch->pcdata->level;
      remove_all_objs (ch);
      ch->max_move = 95;
      ch->max_hit = number_range (59, 68);
      ch->pcdata->practice += 8;
      ch->pcdata->learn += 3;
      ch->pcdata->level = 1;
      for (i = 1; i < (oldlev - 44); i++)
	{
	  ch->pcdata->level++;
	  advance_level (ch);
	}
      ch->pcdata->tps = FIND_TPS ((ch->pcdata->level - 1), 0);
      ch->exp = FIND_EXP ((ch->pcdata->level - 1), 0);
      natural_mana (ch);
      upd_mana (ch);
    }
  if (!IS_EVIL (ch) && ch->pcdata->profession_flag != 0)
    {
      int oldlev = ch->pcdata->level;
      remove_all_objs (ch);
      ch->max_move = 80;
      ch->max_hit = number_range (27, 33);
      ch->pcdata->level = 1;
      for (i = 1; i < (oldlev - 34); i++)
	{
	  ch->pcdata->level++;
	  advance_level (ch);
	}
      ch->pcdata->tps = FIND_TPS ((ch->pcdata->level - 1), 0);
      ch->exp = FIND_EXP ((ch->pcdata->level - 1), 0);
      natural_mana (ch);
      upd_mana (ch);
    }
  if (ch->pcdata->level > 3)
    ch->pcdata->learn += 6 + (ch->pcdata->level - 3);
  else
    ch->pcdata->learn += (ch->pcdata->level * 2);
  ch->pcdata->practice = (wis_app[get_curr_wis (ch)].practice) * (LEVEL (ch));
  MAXHIT(ch);
  MAXMOVE(ch);
  send_to_char ("Welcome to the profession!!\n\r", ch);
  ADD_PROF (ch, bit);
  return;
}
#endif

void 
do_grunt (CHAR_DATA * ch, char *argy)
{
  AFFECT_DATA aff;
  SPELL_DATA *s;
  DEFINE_COMMAND ("grunt", do_grunt, POSITION_RESTING, 0, LOG_NORMAL, "This is a barbarian skill.  You do not need to practice it.")
    bzero (&aff, sizeof (aff));
  if ((s = skill_lookup (NULL, gsn_grunt)) == NULL)
    return;
  if (!CAN_LEARN (ch, s) || LEVEL (ch) < s->spell_level)
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (ch->move < s->mana)
    {
      send_to_char ("You are too exhausted.\n\r", ch);
      return;
    }
  aff.type = gsn_grunt;
  aff.duration = number_range (2, 6);
  aff.location = APPLY_DAMROLL;
  aff.modifier = number_range (2, 4);
  aff.bitvector = 0;
  SUBMOVE(ch, s->mana);
  renew_affect (ch, &aff);
  send_to_char ("You let out a huge, primal grunt, and the veins in your neck pop out!\n\r", ch);
  act ("$n lets out a loud, primal grunt, and the veins in $s neck pop out!!", ch, NULL, ch, TO_ROOM);
  return;
}

void 
do_bite (CHAR_DATA * ch, char *argy)
{
  CHAR_DATA *victim;
  DEFINE_COMMAND ("bite", do_bite, POSITION_FIGHTING, 0, LOG_NORMAL, "This command lets barbarians bite during battle.")
    victim = FIGHTING (ch);
  if (IS_PLAYER (ch) && (!IS_PROF (ch, PROF_BARBARIAN) || LEVEL (ch) < 10))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (victim == NULL)
    {
      send_to_char ("You must be fighting to use bite!\n\r", ch);
      return;
    }
  if (ch->move < 8)
    {
      send_to_char ("You are too exhausted.\n\r", ch);
      return;
    }


  if (!ch->fgt || is_fighting_near(ch,victim)==-1) {
	send_to_char("You must be next to your opponent to bite him/her/it.\n\r",ch);
	return;
	}

  if (ch->fgt && ch->fgt->field_ticks>0) {
	setnext(ch,"bite");
	return;
	}



  SUBMOVE(ch,8);
  WAIT_STATE (ch, 2 * PULSE_VIOLENCE);
  if (number_range (1, 100) < (2 * get_curr_dex (ch)))
    {
      act ("$B$5You take a bite out of $N.$R$7", ch, NULL, victim, TO_CHAR);
      act ("$B$5$n bites $N.$R$7", ch, NULL, victim, TO_NOTVICT);
      act ("$B$5$n bites you!$R$7", ch, NULL, victim, TO_VICT);
      show_hitdam (0, "bite", (get_curr_str (ch) / 2), ch, victim);
      victim->hit -= number_range (1, (get_curr_str (ch) / 3));
      if (victim->hit < 1)
	victim->hit = 1;
 if (ch->fgt && ch->fgt->field && victim && victim->fgt && victim->fgt->field) {
	java_hit_field(ch->fgt->field,ch,ch->fgt->pos_x,ch->fgt->pos_y,
		       victim->fgt->pos_x,victim->fgt->pos_y);
	}
    }


  else
    {
      act ("You bite at the air, nearly missing $N.", ch, NULL, victim, TO_CHAR);
      act ("$n bites at the air, nearly missing $N.", ch, NULL, victim, TO_NOTVICT);
      act ("$n tries to bite you, but misses.", ch, NULL, victim, TO_VICT);
    }
  return;
}

void 
do_headbutt (CHAR_DATA * ch, char *argy)
{
  CHAR_DATA *victim;
  SPELL_DATA *sp;
  SINGLE_OBJECT *o = NULL;
  DEFINE_COMMAND ("headbutt", do_headbutt, POSITION_FIGHTING, 0, LOG_NORMAL, "This command lets barbarians headbutt their opponent during battle.")
    victim = FIGHTING (ch);
  o = get_eq_char (ch, WEAR_HEAD);

  if ((sp = skill_lookup (NULL, gsn_headbutt)) == NULL)
    return;

  if (IS_PLAYER (ch) && LEVEL (ch) < sp->spell_level)
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (victim == NULL)
    {
      send_to_char ("You must be fighting to use headbutt!\n\r", ch);
      return;
    }
  if (ch->move < sp->mana)
    {
      send_to_char ("You are too exhausted.\n\r", ch);
      return;
    }
  if (!can_groundfight (victim))
    {
      send_to_char ("You can't headbutt that type of creature!\n\r", ch);
      return;
    }

  if (!ch->fgt || is_fighting_near(ch,victim)==-1) {
	send_to_char("You must be next to your opponent to headbutt him/her/it.\n\r",ch);
	return;
	}

  if (ch->fgt && ch->fgt->field_ticks>0) {
	setnext(ch,"headbutt");
	return;
	}



  SUBMOVE(ch,sp->mana);
  WAIT_STATE (ch, sp->casting_time * PULSE_VIOLENCE);
  if (ch->height - 60 > victim->height)
    {
      act ("You try to bend down to headbutt $N, but $E is too short!", ch, NULL, victim, TO_CHAR);
      act ("$n tries to headbutt you, but $e is too tall!", ch, NULL, victim, TO_VICT);
      return;
    }
  if (number_range (1, 65) < (2 * get_curr_dex (ch)))
    {
      if (IS_MOB (ch) || (number_range (1, 100) < ch->pcdata->learned[gsn_headbutt]))
	{
	  int dam;
	  act ("$B$5You slam your head directly into $N's head.$R$7", ch, NULL, victim, TO_CHAR);
	  act ("$B$5$n slams $S head into $N's head.  OUCH!$R$7", ch, NULL, victim, TO_NOTVICT);
	  act ("$B$5$n headbutts you!$R$7", ch, NULL, victim, TO_VICT);
	  dam = translate (sp->damage, LEVEL (ch), ch);
	  if (o == NULL)
	    {
	      SUBHIT(ch,(get_curr_str(ch)/7));
	      if (ch->hit < 1)
		ch->hit = 1;
	      send_to_char ("Ouch!  You should really try investing in a helmet next time!\n\r", ch);
	    }
	  else
	    {
	      dam += (get_curr_str (ch) / 7);
	    }
	  show_hitdam (sp->gsn, "headbutt", dam, ch, victim);
	  SUBHIT(victim,dam);
	  if (victim->hit < 1)
	    victim->hit = 1;
 if (ch->fgt && ch->fgt->field && victim && victim->fgt && victim->fgt->field) {
	java_hit_field(ch->fgt->field,ch,ch->fgt->pos_x,ch->fgt->pos_y,
		       victim->fgt->pos_x,victim->fgt->pos_y);
	}
	  return;
	}
    }

  act ("You try to headbutt $N but miss completely.", ch, NULL, victim, TO_CHAR);
  act ("$n tried to headbutt $N but misses.", ch, NULL, victim, TO_NOTVICT);
  act ("$n tries to headbutt you, but misses.", ch, NULL, victim, TO_VICT);

  return;
}


void 
do_slam (CHAR_DATA * ch, char *argy)
{
  CHAR_DATA *victim;
  SPELL_DATA *sp;
  SINGLE_OBJECT *wield1;
  SINGLE_OBJECT *wield2;
  DEFINE_COMMAND ("bodyslam", do_slam, POSITION_FIGHTING, 0, LOG_NORMAL, "This command lets barbarians body slam their opponent during battle.")
    wield1 = get_eq_char (ch, WEAR_HOLD_1);
  wield2 = get_eq_char (ch, WEAR_HOLD_2);
  victim = FIGHTING (ch);
  if ((sp = skill_lookup (NULL, gsn_bodyslam)) == NULL)
    return;
  if (IS_PLAYER (ch) && sp->spell_level > LEVEL (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (ch->pcdata->learned[gsn_bodyslam] < 1)
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (victim == NULL)
    {
      send_to_char ("You must be fighting to use bodyslam!\n\r", ch);
      return;
    }
  if (wield1 || wield2)
    {
      send_to_char ("You can't have anything in your hands if you want to bodyslam.\n\r", ch);
      return;
    }
  if (ch->move < sp->mana)
    {
      send_to_char ("You are too exhausted.\n\r", ch);
      return;
    }
  if (!can_groundfight (victim))
    {
      send_to_char ("You can't bodyslam that type of creature!\n\r", ch);
      return;
    }

  if (!ch->fgt || is_fighting_near(ch,victim)==-1) {
	send_to_char("You must be next to your opponent to bodyslam him/her/it.\n\r",ch);
	return;
	}

  if (ch->fgt && ch->fgt->field_ticks>0) {
	setnext(ch,"bodyslam");
	return;
	}



  SUBMOVE(ch,sp->mana);
  WAIT_STATE (ch, sp->casting_time * PULSE_VIOLENCE);
  if (ch->height + 12 < victim->height)
    {
      act ("You try to lift up $N, but $E is too tall!", ch, NULL, victim, TO_CHAR);
      act ("$n tries to lift you up, but you are too tall and heavy!", ch, NULL, victim, TO_VICT);
      return;
    }
  if (number_range (1, 70) < (2 * get_curr_dex (ch)))
    {
      if (IS_MOB (ch) || (number_range (1, 100) < ch->pcdata->learned[gsn_bodyslam]))
	{
	  int dam;
	  act ("$B$5You pick up $N and slam $M to the ground.$R$7", ch, NULL, victim, TO_CHAR);
	  act ("$B$5$n picks up $N and bodyslams $M.$R$7", ch, NULL, victim, TO_NOTVICT);
	  act ("$B$5$n picks you up and slams you down to the ground, hard!$R$7", ch, NULL, victim, TO_VICT);
	  dam = translate (sp->damage, LEVEL (ch), ch);
	  show_hitdam (sp->gsn, "bodyslam", dam, ch, victim);
	  victim->hit -= dam;
	  if (victim->hit < 1)
	    victim->hit = 1;
 if (ch->fgt && ch->fgt->field && victim && victim->fgt && victim->fgt->field) {
	java_hit_field(ch->fgt->field,ch,ch->fgt->pos_x,ch->fgt->pos_y,
		       victim->fgt->pos_x,victim->fgt->pos_y);
	}
	  return;
	}
    }
  act ("You attempt to pick up $N, but fail.", ch, NULL, victim, TO_CHAR);
  act ("$n tries to pick up $N but fails miserably.", ch, NULL, victim, TO_NOTVICT);
  act ("$n tries to pick you up and bodyslam you, but fails.", ch, NULL, victim, TO_VICT);
  return;
}


void 
do_disembowel (CHAR_DATA * ch, char *argy)
{
  CHAR_DATA *victim;
  SPELL_DATA *sp;
  SINGLE_OBJECT *obj;
  int dt;
  int dis;
  DEFINE_COMMAND ("disembowel", do_disembowel, POSITION_FIGHTING, 0, LOG_NORMAL, "This command allows Assassins to disembowel their opponent during battle.")
    victim = FIGHTING (ch);
  if ((sp = skill_lookup (NULL, gsn_disembowel)) == NULL)
    return;
  if (IS_PLAYER (ch) && sp->spell_level > LEVEL (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (ch->pcdata->learned[gsn_disembowel] < 1)
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }

  if ((obj = get_item_held (ch, ITEM_WEAPON)) == NULL)
    {
      send_to_char ("You need to be wielding a weapon to disembowel.\n\r", ch);
      return;
    }
  dt = ((I_WEAPON *) obj->more)->attack_type;
  if (attack_table[dt].hit_type != TYPE_PIERCE)
    {
      send_to_char ("You need to be wielding a piercing weapon for that!\n\r", ch);
      return;
    }

  if (victim == NULL)
    {
      send_to_char ("You must be fighting to use disembowel!\n\r", ch);
      return;
    }
  if (ch->move < sp->mana)
    {
      send_to_char ("You are too exhausted.\n\r", ch);
      return;
    }


  if (!ch->fgt || is_fighting_near(ch,victim)==-1) {
	send_to_char("You must be next to your opponent to disembowel him/her/it.\n\r",ch);
	return;
	}

  if (ch->fgt && ch->fgt->field_ticks>0) {
	setnext(ch,"disembowel");
	return;
	}




  SUBMOVE(ch,sp->mana);
  WAIT_STATE (ch, sp->casting_time * PULSE_VIOLENCE);
  if (number_range (1, 30) < (get_curr_dex (ch)))
    {
      if (IS_MOB (ch) || (number_range (1, 100) < ch->pcdata->learned[gsn_disembowel]))
	{
	  int dam;
	  act ("$B$5You stab your dagger into $N's stomach and $S guts spill to the ground!$R$7", ch, NULL, victim, TO_CHAR);
	  act ("$B$5$n stabs $N's stomach causing $S guts to spill to the ground!$R$7", ch, NULL, victim, TO_NOTVICT);
	  act ("$B$5$n stabs you in the stomach causing blood and guts to spill over the ground!$R$7", ch, NULL, victim, TO_VICT);
	  dam = translate (sp->damage, LEVEL (ch), ch);
	  show_hitdam (sp->gsn, "disembowel", dam, ch, victim);
	  victim->hit -= dam;
	  if (victim->hit < 1)
	    victim->hit = 1;
 if (ch->fgt && ch->fgt->field && victim && victim->fgt && victim->fgt->field) {
	java_hit_field(ch->fgt->field,ch,ch->fgt->pos_x,ch->fgt->pos_y,
		       victim->fgt->pos_x,victim->fgt->pos_y);
	}
	  return;
	}
    }
  dis = number_range (1, 3);
  switch (dis)
    {
    case 1:
      act ("Your swing wildly attempting to disembowel $N but miss completely.", ch, NULL, victim, TO_CHAR);
      break;
    case 2:
      act ("You barely miss $N's stomach.", ch, NULL, victim, TO_CHAR);
      break;
    case 3:
      act ("You attempt to disembowel $N, but fail.", ch, NULL, victim, TO_CHAR);
    default:
      break;
    }
  return;
}


void 
do_elbow (CHAR_DATA * ch, char *argy)
{
  CHAR_DATA *victim;
  SPELL_DATA *sp;
  DEFINE_COMMAND ("elbow", do_elbow, POSITION_FIGHTING, 0, LOG_NORMAL, "This command lets monks elbow their opponent during battle.")
    victim = FIGHTING (ch);

  if ((sp = skill_lookup ("Elbow", -1)) == NULL)
    return;

  if (IS_PLAYER (ch) && LEVEL (ch) < sp->spell_level)
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (ch->pcdata->learned[gsn_elbow] < 1)
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }


  if (victim == NULL)
    {
      send_to_char ("You must be fighting to use elbow!\n\r", ch);
      return;
    }
  if (ch->move < sp->mana)
    {
      send_to_char ("You are too exhausted.\n\r", ch);
      return;
    }


  if (!ch->fgt || is_fighting_near(ch,victim)==-1) {
	send_to_char("You must be next to your opponent to elbow him/her/it.\n\r",ch);
	return;
	}

  if (ch->fgt && ch->fgt->field_ticks>0) {
	setnext(ch,"elbow");
	return;
	}



  SUBMOVE(ch,sp->mana);
  WAIT_STATE (ch, sp->casting_time * PULSE_VIOLENCE);
  if (number_range (1, 25) < (get_curr_dex (ch)))
    {
      if (IS_MOB (ch) || (number_range (1, 100) < ch->pcdata->learned[gsn_elbow]))
	{
	  int dam;
	  int damg = number_range (1, 3);
	  if (damg == 1)
	    {
	      act ("$B$5You ram your elbow directly into $N's stomach.$R$7", ch, NULL, victim, TO_CHAR);
	      act ("$B$5$n rams $S elbow into $N's stomach.  OUCH!$R$7", ch, NULL, victim, TO_NOTVICT);
	      act ("$B$5$n elbows you in the stomach!$R$7", ch, NULL, victim, TO_VICT);
	    }
	  if (damg == 2)
	    {
	      act ("$B$5You slam your elbow $N's chest.$R$7", ch, NULL, victim, TO_CHAR);
	      act ("$B$5$n slams $S elbow into $N's chest!$R$7", ch, NULL, victim, TO_NOTVICT);
	      act ("$B$5$n slams $S elbow into your stomach!$R$7", ch, NULL, victim, TO_VICT);
	    }
	  if (damg == 3)
	    {
	      act ("$B$5You slam your elbow into $N's shoulder.$R$7", ch, NULL, victim, TO_CHAR);
	      act ("$B$5$n slams $S elbow into $N's shoulder.$R$7", ch, NULL, victim, TO_NOTVICT);
	      act ("$B$5$n elbows you in the shoulder!$R$7", ch, NULL, victim, TO_VICT);
	    }

	  dam = translate (sp->damage, LEVEL (ch), ch);
	  show_hitdam (sp->gsn, "elbow", dam, ch, victim);
	  victim->hit -= dam;
	  if (victim->hit < 1)
	    victim->hit = 1;
 if (ch->fgt && ch->fgt->field && victim && victim->fgt && victim->fgt->field) {
	java_hit_field(ch->fgt->field,ch,ch->fgt->pos_x,ch->fgt->pos_y,
		       victim->fgt->pos_x,victim->fgt->pos_y);
	}
	  return;
	}
    }
  act ("You try to elbow $N but miss, and hit only air.", ch, NULL, victim, TO_CHAR);
  act ("$n tried to elbow $N but misses.", ch, NULL, victim, TO_NOTVICT);
  act ("$n tries to elbow you, but misses.", ch, NULL, victim, TO_VICT);
  return;
}