legend/
legend/area/
legend/player/
/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/
/***************************************************************************
 *  God Wars Mud copyright (C) 1994, 1995, 1996 by Richard Woolcock        *
 *                                                                         *
 *  Legend of Chrystancia copyright (C) 1999, 2000, 2001 by Matthew Little *
 *  This mud is NOT to be copied in whole or in part, or to be run without *
 *  the permission of Matthew Little. Nobody else has permission to        *
 *  authorise the use of this code.                                        *
 ***************************************************************************/

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

void sora_principle (CHAR_DATA * ch)
{
   if (IS_NPC (ch))
      return;
   if (ch->pcdata->powers[NPOWER_SORA] == 0)
   {
      stc ("       Sora: None.\n\r", ch);
      return;
   }
   if (ch->pcdata->powers[NPOWER_SORA] >= 1)
      stc ("       Sora: Mitsukeru", ch);
   if (ch->pcdata->powers[NPOWER_SORA] >= 2)
      stc (" Koryou", ch);
   if (ch->pcdata->powers[NPOWER_SORA] >= 3)
      stc (" Kakusu", ch);
   if (ch->pcdata->powers[NPOWER_SORA] >= 5)
      stc (" Kanzuite", ch);
   if (ch->pcdata->powers[NPOWER_SORA] >= 6)
      stc (" Bomuzite", ch);
   if (ch->pcdata->powers[NPOWER_SORA] >= 7)
      stc (" Mizotamouyo", ch);
   stc ("\n\r", ch);
   return;
}

void chikyu_principle (CHAR_DATA * ch)
{
   if (IS_NPC (ch))
      return;
   if (ch->pcdata->powers[NPOWER_CHIKYU] <= 5)
   {
      stc ("     Chikyu: None.\n\r", ch);
      return;
   }
   if (ch->pcdata->powers[NPOWER_CHIKYU] >= 6)
      stc ("     Chikyu: Harakiri", ch);
   if (ch->pcdata->powers[NPOWER_CHIKYU] >= 7)
      stc (" Orimasu", ch);
   if (ch->pcdata->powers[NPOWER_CHIKYU] >= 8)
      stc (" Gunaya", ch);
   stc ("\n\r", ch);
   return;
}

void ningenno_principle (CHAR_DATA * ch)
{
   if (IS_NPC (ch))
      return;
   if (ch->pcdata->powers[NPOWER_NINGENNO] == 0)
   {
      stc ("   Ningenno: None.\n\r", ch);
      return;
   }
   if (ch->pcdata->powers[NPOWER_NINGENNO] >= 1)
      stc ("   Ningenno: Tsume", ch);
   if (ch->pcdata->powers[NPOWER_NINGENNO] >= 3)
      stc (" Mienaku", ch);
   if (ch->pcdata->powers[NPOWER_NINGENNO] >= 6)
      stc (" Circle", ch);
   if (ch->pcdata->powers[NPOWER_NINGENNO] >= 7)
      stc (" Trip", ch);
   stc ("\n\r", ch);
   return;
}

void tengu_principle (CHAR_DATA * ch)
{
   if (IS_NPC (ch))
      return;
   if (ch->pcdata->powers[NPOWER_TENGU] == 0)
   {
      stc ("      Tengu: None.\n\r", ch);
      return;
   }
   if (ch->pcdata->powers[NPOWER_TENGU] >= 1)
      stc ("      Tengu: Kunoichi", ch);
   if (ch->pcdata->powers[NPOWER_TENGU] >= 4)
      stc (" Caltrops", ch);
   if (ch->pcdata->powers[NPOWER_TENGU] >= 5)
      stc (" Tetsubishi", ch);
   stc ("\n\r", ch);
   return;
}

void ashiko_principle (CHAR_DATA * ch)
{
   if (IS_NPC (ch))
      return;
   if (ch->pcdata->powers[NPOWER_ASHIKO] == 0)
   {
      stc ("     Ashiko: None.\n\r", ch);
      return;
   }
   if (ch->pcdata->powers[NPOWER_ASHIKO] >= 1)
      stc ("     Ashiko: Doka", ch);
   if (ch->pcdata->powers[NPOWER_ASHIKO] >= 2)
      stc (" Ngazumo", ch);
   if (ch->pcdata->powers[NPOWER_ASHIKO] >= 3)
      stc (" Nekade", ch);
   if (ch->pcdata->powers[NPOWER_ASHIKO] >= 4)
      stc (" Ipponsugi", ch);
   stc ("\n\r", ch);
   return;
}

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

   if (!IS_CLASS (ch, CLASS_NINJA))
   {
      do_rand_typo (ch);
      return;
   }
   stc ("#p================================================================================#n\n\r", ch);
   cent_to_char ("#w-[ Ninja Principles ]-#n", ch);
   stc ("#p================================================================================#n\n\r", ch);
   sora_principle (ch);
   chikyu_principle (ch);
   ningenno_principle (ch);
   tengu_principle (ch);
   ashiko_principle (ch);
   stc ("#wPowers not based on principles: Ncreate, Calm, Michi#n\n\r", ch);
   stc ("#p================================================================================#n\n\r", ch);
   stc ("Powers that are 'auto' are not listed.\n\rTo see all powers for each principle, type principle <principlename>\n\r", ch);
   stc ("#p================================================================================#n\n\r", ch);
   stc ("#wHelp files: Ashiku, Chikyu, Sora, Tengu, Ningenno, Principle, Ninja\n\r", ch);
   stc ("#p================================================================================#n\n\r", ch);
   return;
}

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

   argument = one_argument (argument, arg);

   if (IS_NPC (ch))
      return;

   if (!IS_CLASS (ch, CLASS_NINJA))
   {
      do_rand_typo (ch);
      return;
   }

   if (arg[0] == '\0')
   {
      send_to_char ("What piece of ninja armor do you wish to create?.\n\r",
		    ch);
      send_to_char ("A sword, dagger or mask? \n\r", ch);
      return;
   }
   if (!str_cmp (arg, "sword"))
      vnum = 29701;
   else if (!str_cmp (arg, "dagger"))
      vnum = 29700;
   else if (!str_cmp (arg, "mask"))
      vnum = 29702;
   else
   {
      send_to_char ("What piece of ninja armor do you wish to create?.\n\r",
		    ch);
      send_to_char ("A sword, dagger or mask? \n\r", ch);
      return;
   }
   if (ch->practice < 60)
   {
      send_to_char
	 ("It costs 60 primal to craft a piece of ninja equipment!\n\r", ch);
      return;
   }

   if (vnum == 0 || (pObjIndex = get_obj_index (vnum)) == NULL)
   {
      send_to_char ("Missing object, please inform Tijer.\n\r", ch);
      return;
   }
   ch->practice -= 60;
   obj = create_object (pObjIndex, 50);
   SET_BIT (obj->extra_flags, ITEM_LOYAL);
   FILL_STRING (obj->questowner, ch->name);
   obj_to_char (obj, ch);
   act ("$p appears in a cloud of smoke.", ch, obj, NULL, TO_CHAR);
   act ("$p appears in a cloud if smoke.", ch, obj, NULL, TO_ROOM);
   return;
}
void do_principles (CHAR_DATA * ch, char *argument)
{
   char arg1[MAX_INPUT_LENGTH];
   char arg2[MAX_INPUT_LENGTH];
   char buf[MAX_STRING_LENGTH];

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

   if (IS_NPC (ch))
      return;

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

   if (arg1[0] == '\0' && arg2[0] == '\0')
   {
      sprintf (buf,
	       "Principles: Sora (%d), Chikyu (%d), Ningenno (%d), Tengu (%d), Ashiko (%d).\n\r",
	       ch->pcdata->powers[NPOWER_SORA],
	       ch->pcdata->powers[NPOWER_CHIKYU],
	       ch->pcdata->powers[NPOWER_NINGENNO],
	       ch->pcdata->powers[NPOWER_TENGU],
	       ch->pcdata->powers[NPOWER_ASHIKO]);
      send_to_char (buf, ch);
      return;
   }
   if (arg2[0] == '\0')
   {
      if (!str_cmp (arg1, "tengu"))
      {
	 send_to_char
	    ("Tengu - The weapons and gadget mastery principle.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_TENGU] < 1)
	    stc ("You have none of the Tengu Principles.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_TENGU] > 0)
	    stc ("Kunoichi - Stun Bomb - Paralyze everyone in room.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_TENGU] > 1)
	    stc ("Shurijitsu - Dart Shiroken - Another Shiroken Attack\n\r",
		 ch);
	 if (ch->pcdata->powers[NPOWER_TENGU] > 2)
	    stc ("Hankyu - Double Shiroken - Double Dart Attack.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_TENGU] > 3)
	    stc ("Trulkor - Caltrops - Drops caltrops to poison and wither limbs.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_TENGU] > 4)
	    stc ("Tetsu-bishi - Cures - Creates cure concoctions.\n\r", ch);
	 return;
      }
      if (!str_cmp (arg1, "ashiko"))
      {
	 stc ("Ashiko - The Unarmed Combat principle.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_ASHIKO] < 1)
	    stc ("You have none of the Ashiko Principles.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_ASHIKO] > 0)
	    stc ("Doka - Incapacitate - Renders a limb useless.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_ASHIKO] > 1)
	    stc ("Ngazumo - Iron Fist - Toughens the hands that they feel like steal.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_ASHIKO] > 2)
	    stc ("Nekade - Pain Touch - Sets victim ablaze.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_ASHIKO] > 3)
	    stc ("Ippon-sugi - Stunning touch - Stuns and dazes opponent.\n\r", ch);
	 return;
      }

      if (!str_cmp (arg1, "sora"))
      {
	 send_to_char
	    ("Sora - The finding, observing, and locating principle.\n\r\n\r",
	     ch);
	 if (ch->pcdata->powers[NPOWER_SORA] < 1)
	    send_to_char ("You have none of the Sora principles.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_SORA] > 0)
	    send_to_char
	       ("Mitsukeru -Locate- The scrying power to find enemies.\n\r",
		ch);
	 if (ch->pcdata->powers[NPOWER_SORA] > 1)
	    send_to_char
	       ("Koryou -Consider- The read aura power, learn about your enemies.\n\r",
		ch);
	 if (ch->pcdata->powers[NPOWER_SORA] > 2)
	    send_to_char
	       ("Kakusu -Hidden- Enhanced Hide.  Only other ninjas can see you.\n\r",
		ch);
	 if (ch->pcdata->powers[NPOWER_SORA] > 3)
	    send_to_char
	       ("Uro-Uro -Silent Walk- You leave no footprints behind.\n\r",
		ch);
	 if (ch->pcdata->powers[NPOWER_SORA] > 4)
	    send_to_char ("Kanzuite -Aware- The truesight power.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_SORA] > 5)
	    send_to_char
	       ("Bomuzite -Sleep Gas- By mixing an potion, you can put everyone in a room to sleep.\n\r",
		ch);
	 if (ch->pcdata->powers[NPOWER_SORA] > 6)
	    send_to_char
	       ("Mizotamouyo  -Gate-      Gate to mobs or characters.\n\r",
		ch);
	 return;
      }
      else if (!str_cmp (arg1, "chikyu"))
      {
	 send_to_char ("Chikyu - Preperation for battle.\n\r\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_CHIKYU] < 1)
	    send_to_char ("You have none of the Chikyu principles.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_CHIKYU] > 0)
	    send_to_char ("Tsuyoku -Strength- Toughness.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_CHIKYU] > 1)
	    send_to_char ("Songai -Damage- Enhanced damage.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_CHIKYU] > 2)
	    send_to_char ("Isogu -Haste- Adds two extra attacks.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_CHIKYU] > 3)
	    send_to_char ("Tsuiseki -Hunt- Fast hunting.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_CHIKYU] > 4)
	    send_to_char ("Sakeru -Sonic Speed- Dodge more attacks.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_CHIKYU] > 5)
	    send_to_char
	       ("HaraKiri -Blood Power- Hurt yourself to gain  power.\n\r",
		ch);
	 if (ch->pcdata->powers[NPOWER_CHIKYU] > 6)
	    send_to_char
	       ("Orimasu -Mending- Regenerate your being through willpower alone.\n\r",
		ch);
	 if (ch->pcdata->powers[NPOWER_CHIKYU] > 7)
	    send_to_char
	       ("Gunaya - Entrap your foes with a spiritual net.\n\r", ch);
	 return;
      }
      else if (!str_cmp (arg1, "ningenno"))
      {
	 send_to_char
	    ("Ningenno - The battle, attacking and getting away.\n\r\n\r",
	     ch);
	 if (ch->pcdata->powers[NPOWER_NINGENNO] < 1)
	    send_to_char ("You have none of the Ningenno principles.\n\r",
			  ch);
	 if (ch->pcdata->powers[NPOWER_NINGENNO] > 0)
	    send_to_char
	       ("Tsume -Claw- IronClaw always worn on wrist to aid in hand-to-hand.\n\r",
		ch);
	 if (ch->pcdata->powers[NPOWER_NINGENNO] > 1)
	    send_to_char
	       ("Hakunetsu -First Strike- You get super backstabs.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_NINGENNO] > 2)
	    send_to_char ("Mienaku -Vanish- Never fail flee.\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_NINGENNO] > 3)
	    send_to_char
	       ("Shiroken -Throwing Star- Added attack per round, like headbutt for demons.\n\r",
		ch);
	 if (ch->pcdata->powers[NPOWER_NINGENNO] > 4)
	    send_to_char
	       ("Dokuyaku -Poison- Adds poisons to the Shiroken\n\r", ch);
	 if (ch->pcdata->powers[NPOWER_NINGENNO] > 5)
	    send_to_char
	       ("Circle - circle behind your opponent and hit him during battle\n\r",
		ch);

	 return;
      }
      sprintf (buf,
	       "Principles: Sora (%d), Chikyu (%d), Ningenno (%d), Tengu (%d), Ashiko (%d).\n\r",
	       ch->pcdata->powers[NPOWER_SORA],
	       ch->pcdata->powers[NPOWER_CHIKYU],
	       ch->pcdata->powers[NPOWER_NINGENNO],
	       ch->pcdata->powers[NPOWER_TENGU],
	       ch->pcdata->powers[NPOWER_ASHIKO]);
      send_to_char (buf, ch);
      return;
   }
   if (!str_cmp (arg2, "improve"))
   {
      int improve;
      int cost;
      int max;

      if (!str_cmp (arg1, "sora"))
      {
	 improve = NPOWER_SORA;
	 max = 7;
      }
      else if (!str_cmp (arg1, "chikyu"))
      {
	 improve = NPOWER_CHIKYU;
	 max = 8;
      }
      else if (!str_cmp (arg1, "ningenno"))
      {
	 improve = NPOWER_NINGENNO;
	 max = 7;
      }
      else if (!str_cmp (arg1, "tengu"))
      {
	 improve = NPOWER_TENGU;
	 max = 5;
      }
      else if (!str_cmp (arg1, "ashiko"))
      {
	 improve = NPOWER_ASHIKO;
	 max = 4;
      }
      else
      {
	 send_to_char
	    ("Principles: Sora, Chikyu, Ningenno, Tengu, Ashiko\n\r", ch);
	 return;
      }
      cost = (ch->pcdata->powers[improve] + 1) * 10;
      arg1[0] = UPPER (arg1[0]);
      if (ch->pcdata->powers[improve] >= max)
      {
	 sprintf (buf,
		  "You have already gained all the powers of the %s principle.\n\r",
		  arg1);
	 send_to_char (buf, ch);
	 return;
      }
      if (cost > ch->practice)
      {
	 sprintf (buf,
		  "It costs you %d primal to improve your %s principle.\n\r",
		  cost, arg1);
	 send_to_char (buf, ch);
	 return;
      }
      ch->pcdata->powers[improve] += 1;
      ch->practice -= cost;
      sprintf (buf, "You improve your ability in the %s principle.\n\r",
	       arg1);
      send_to_char (buf, ch);
   }
   else
      send_to_char
	 ("To improve a principle, type: Principle <principle type> improve.\n\r",
	  ch);
   return;
}

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

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

   if (IS_CLASS (ch, CLASS_NINJA))
   {

      if (ch->pcdata->stats[UNI_RAGE] >= 50)
      {
	 send_to_char ("But you are already in the state of Michi.\n\r", ch);
	 return;
      }
/*
	if ( ch->pcdata->powers[NINJAKI] < 100 ) 
	{
		send_to_char("But you don't have enough Ki to perform the michi.\n\r", ch);
		return;
	} 
*/
      send_to_char
	 ("You are gifted positive energy while performing the michi.\n\r",
	  ch);
      act ("$n is gifted positives energy while performing the michi.", ch,
	   NULL, NULL, TO_ROOM);
      ch->pcdata->stats[UNI_RAGE] += 500;
//    ch->pcdata->powers[NINJAKI] -= 100;
      WAIT_STATE (ch, 12);
      return;
   }
   else
      send_to_char ("But you are already in the state of Michi.\n\r", ch);
   return;
}

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

   argument = one_argument (argument, arg);

   if (IS_NPC (ch))
      return;

   if (!IS_CLASS (ch, CLASS_NINJA))
   {
      do_rand_typo (ch);
      return;
   }
   if (ch->pcdata->stats[UNI_GEN] > 2)
   {
      send_to_char ("Huh?\n\r", ch);
      return;
   }

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

   if ((victim = get_char_room (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_IMMORTAL (victim))
   {
      send_to_char ("Not on Immortals's.\n\r", ch);
      return;
   }

   if (ch == victim)
   {
      send_to_char ("You cannot discipline yourself.\n\r", ch);
      return;
   }

   if (victim->max_hit < 3000)
   {
      stc ("You need 3000hps before you can be classed\n\r", victim);
      stc ("They need 3000hps before they can be classed\n\r", ch);
      return;
   }
   if (IS_CLASS (victim, CLASS_NINJA))
   {
      send_to_char ("They are already disciplined.\n\r", ch);
      return;
   }

   if (victim->level != LEVEL_AVATAR && !IS_IMMORTAL (victim))
   {
      send_to_char ("You can only teach avatars.\n\r", ch);
      return;
   }

   if (victim->class != 0)
   {
      send_to_char ("They already have a profession.\n\r", ch);
      return;
   }
   if (!IS_IMMUNE (victim, IMM_VAMPIRE))
   {
      send_to_char ("You cannot discipline an unwilling person.\n\r", ch);
      return;
   }

   if (ch->exp < 100000)
   {
      send_to_char
	 ("You cannot afford the 100000 exp required to discipline them.\n\r",
	  ch);
      return;
   }

   if (victim->exp < 100000)
   {
      send_to_char
	 ("They cannot afford the 100000 exp required to be disciplined from you.\n\r",
	  ch);
      return;
   }

   ch->exp -= 100000;
   victim->exp -= 100000;

   act ("You teach $N the ways of the ninja.", ch, NULL, victim, TO_CHAR);
   act ("$n teaches $N the ways of the ninja.", ch, NULL, victim, TO_NOTVICT);
   act ("$n teaches you the way of the ninja.", ch, NULL, victim, TO_VICT);
   victim->class = CLASS_NINJA;
   send_to_char ("You are now a ninja.\n\r", victim);
   free_string (victim->lord);
   victim->lord = str_dup (ch->name);
   //free_string(victim->clan);
   //victim->clan = str_dup(ch->clan);
   victim->pcdata->stats[UNI_GEN] = ch->pcdata->stats[UNI_GEN] + 1;
   save_char_obj (ch);
   save_char_obj (victim);
   return;
}

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

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

   if (IS_CLASS (ch, CLASS_NINJA) && ch->pcdata->powers[NPOWER_SORA] < 3)
   {
      send_to_char ("You have not learned the Sora principle to 3.\n\r", ch);
      return;
   }
   if (ch->fight_timer > 0)
   {
      send_to_char ("Not until your fight timer expires.\n\r", ch);
      return;
   }

   if (ch->pcdata->powers[NINJAKI] < 30)
   {
      send_to_char ("You don't have 30 ki to activate your power.\n\r", ch);
      return;
   }

   if (IS_AFFECTED (ch, AFF_HIDE))
   {
      REMOVE_BIT (ch->affected_by, AFF_HIDE);
      act ("$n appears from the shadows.", ch, NULL, NULL, TO_ROOM);
      send_to_char ("You appear from the shadows.\n\r", ch);
   }
   else
   {
      act ("$n disappears into the shadows.", ch, NULL, NULL, TO_ROOM);
      send_to_char ("You disappear into the shadows.\n\r", ch);
      SET_BIT (ch->affected_by, AFF_HIDE);
      ch->pcdata->powers[NINJAKI] -= 30;
   }
   return;
}
void do_orimasu (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (!IS_CLASS (ch, CLASS_NINJA) || ch->pcdata->powers[NPOWER_CHIKYU] < 7)
   {
      send_to_char ("Huh?\n\r", ch);
      return;
   }
/*      else if( ch->pcdata->powers[NINJAKI] < 15 )
*       {
*               send_to_char("You do not have the required mental energies
*       to mend your being.\r\n", ch);
*               return;
*       }
*/
   else if (ch->position == POS_FIGHTING)
   {
      send_to_char ("You cannot mend your being with such distractions!\r\n",
		    ch);
      return;
   }
   if (ch->fight_timer > 0)
   {
      send_to_char ("Not until your fight timer expires.\n\r", ch);
      return;
   }

   send_to_char
      ("You take a deep breath and attempt to gain mastery over your injuries.\r\n",
       ch);
   act ("$n takes a deep breath and begins to concentrate.", ch, NULL, NULL,
	TO_ROOM);
   if (number_range (1, 5) != 1)
   {
      send_to_char ("You mend some of your injuries by force of will alone.",
		    ch);
      ch->hit +=
	 (int) (ch->max_hit *
		(double) ((double) 1 / (double) (number_range (8, 12))));
      ch->mana +=
	 (int) (ch->max_mana *
		(double) ((double) 1 / (double) (number_range (12, 16))));
      if (!IS_SET(ch->affected_by, AFF_HIDE)) {
      ch->move +=
	 (int) (ch->max_move *
		(double) ((double) 1 / (double) (number_range (12, 16))));
      }

      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;

/*              ch->pcdata->powers[NINJAKI] -= 15;*/
      act ("$n's wounds slowly begin to close before your eyes!", ch, NULL,
	   NULL, TO_ROOM);
      WAIT_STATE (ch, 12);
      return;
   }
   else
   {
      send_to_char ("You were unable to gain mastery over your mortal being.",
		    ch);
/*              ch->pcdata->powers[NINJAKI] -= 5;*/
      WAIT_STATE (ch, 12);
      return;
   }
}

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

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

   if (IS_CLASS (ch, CLASS_NINJA) && ch->pcdata->powers[NPOWER_SORA] < 5)
   {
      send_to_char ("You have not learned the Sora principle to 5.\n\r", ch);
      return;
   }

   else if (ch->pcdata->powers[NINJAKI] < 30)
   {
      send_to_char ("You don't have 30 Ki to increase your awareness.\n\r",
		    ch);
      return;
   }

   if (IS_SET (ch->act, PLR_HOLYLIGHT))
   {
      REMOVE_BIT (ch->act, PLR_HOLYLIGHT);
      send_to_char ("You're senses return to normal.\n\r", ch);
   }
   else
   {
      SET_BIT (ch->act, PLR_HOLYLIGHT);
      send_to_char ("You're senses increase into incredible proportions.\n\r",
		    ch);
      ch->pcdata->powers[NINJAKI] -= 30;
   }

   return;
}

void do_mienaku (CHAR_DATA * ch, char *argument)
{
   ROOM_INDEX_DATA *was_in;
   ROOM_INDEX_DATA *now_in;
   CHAR_DATA *victim;
   int attempt;

   if (IS_CLASS (ch, CLASS_NINJA) && ch->pcdata->powers[NPOWER_NINGENNO] < 3)
   {
      send_to_char ("You have not learned the Ningenno principle to 3.\n\r",
		    ch);
      return;
   }
   else if (!IS_CLASS (ch, CLASS_NINJA))
   {
      send_to_char ("Huh?\n\r", ch);
      return;
   }

   if (IS_NPC (ch))
      return;

   if ((victim = ch->fighting) == NULL)
   {
      if (ch->position == POS_FIGHTING)
	 ch->position = POS_STANDING;
      send_to_char ("You aren't fighting anyone.\n\r", ch);
      return;
   }

   WAIT_STATE( ch, 12);

   if (ch->pcdata->powers[NINJAKI] < 20)
   {
      send_to_char ("You don't have enough Ki points to flee.\n\r", ch);
      return;
   }
   if (IS_AFFECTED (ch, AFF_WEBBED))
   {
      send_to_char
	 ("You are unable to move with all this sticky webbing on.\n\r", ch);
      return;
   }

   was_in = ch->in_room;

   {
      EXIT_DATA *pexit;
      int door;

      send_to_char ("You move to vanish from combat!\n\r", ch);
if (IS_AFFECTED (ch, AFF_WEBBED))
   {
      send_to_char
         ("You are unable to move with all this sticky webbing on.\n\r", ch);
      return;
   }
   if (IS_SET (ch->affected_by, AFF_ENTRAILS))
   {
      send_to_char
         ("You are unable to move with these entrails entrapping you.\n\r",
          ch);
      return;
   }

      for (attempt = 0; attempt < 6; attempt++)
      {
	 door = number_door ();
	 if ((pexit = was_in->exit[door]) == 0 || pexit->to_room == NULL
	     || IS_SET (pexit->exit_info, EX_CLOSED) || (IS_NPC (ch)
							 && IS_SET (pexit->
								    to_room->
								    room_flags,
								    ROOM_NO_MOB)))
	    continue;

         if (WORN_ARTIFACT(ch, ARTI_MAIDENS_BREATH))
            break;

	 move_char (ch, door);
	 if ((now_in = ch->in_room) == was_in)
	    continue;

/* Use escape instead of flee so people know it's the ninja power */
	 ch->in_room = was_in;
	 act ("$n has escaped!", ch, NULL, NULL, TO_ROOM);
	 ch->in_room = now_in;

	 if (!IS_NPC (ch))
	    send_to_char ("You escape from combat!\n\r", ch);

/*	if (victim->in_room == ch->in_room)
    {
    	SET_BIT(victim->extra,BLINDFOLDED);
    	act("You start to move at super speeds and blind $N.",ch,NULL,victim,TO_CHAR);
    	act("$n starts to move at super speeds and blinds $N.",ch,NULL,victim,TO_ROOM);
    	act("$n starts to move at super speeds and blinds you.",ch,NULL,victim,TO_VICT);
    	
    	return;
    }
  */
	 ch->pcdata->powers[NINJAKI] -= 20;
	 stop_fighting (ch, TRUE);
	 return;
      }

   }
   return;
}

void do_bomuzite (CHAR_DATA * ch, char *argument)
{
   CHAR_DATA *victim;
   char arg1[MAX_INPUT_LENGTH];

   argument = one_argument (argument, arg1);

   if (IS_NPC (ch))
      return;

   if (!IS_CLASS (ch, CLASS_NINJA))
   {
      send_to_char ("Huh?\n\r", ch);
      return;
   }
   else if (ch->pcdata->powers[NPOWER_SORA] < 6)
   {
      send_to_char ("You have not learned the Sora principle to 6.\n\r", ch);
      return;
   }

   if (arg1[0] == '\0')
   {
      send_to_char ("Bomb who?\n\r", ch);
      return;
   }

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

   if (ch == victim)
   {
      send_to_char ("Not on yourself!\n\r", ch);
      return;
   }

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

   if (ch->pcdata->powers[NINJAKI] < 20)
   {
      send_to_char ("You don't have enough Ki points.\n\r", ch);
      return;
   }

   if (is_safe (ch, victim))
   { 
      stc ("You are unable to affect them\n\r", ch);
      return;
   }                            //NO using if safe :)

   if (victim->in_room == ch->in_room)
   {
      act ("You toss your bomb onto the floor and put $N to sleep.", ch, NULL,
	   victim, TO_CHAR);
      act ("$n tosses a bomb onto the floor.  You feel sleepy.", ch, NULL,
	   victim, TO_VICT);
      victim->position = POS_SLEEPING;
      ch->pcdata->powers[NINJAKI] -= 20;
      WAIT_STATE (ch, 12);
      return;
   }

   return;
}

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

   if (IS_NPC (ch))
      return;

   if (!IS_CLASS (ch, CLASS_NINJA) || ch->pcdata->powers[NPOWER_NINGENNO] < 1)
   {
      send_to_char ("Huh?\n\r", ch);
      return;
   }

   if (IS_VAMPAFF (ch, VAM_CLAWS))
   {

      send_to_char ("You remove the IronClaws from your wrists.\n\r", ch);
      REMOVE_BIT (ch->pcdata->stats[UNI_AFF], VAM_CLAWS);
      return;
   }

   send_to_char ("You attach IronClaws to your wrists.\n\r", ch);
   SET_BIT (ch->pcdata->stats[UNI_AFF], VAM_CLAWS);

   return;
}

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

   if (IS_NPC (ch))
      return;

   if (!IS_CLASS (ch, CLASS_NINJA) || ch->pcdata->powers[NPOWER_CHIKYU] < 6)
   {
      send_to_char ("Huh?\n\r", ch);
      return;
   }

   if (ch->pcdata->powers[HARA_KIRI] > 0)
   {
      send_to_char ("You are already experiencing the power of HaraKiri.\n\r",
		    ch);
      return;
   }

   if (ch->hit < ch->max_hit / 10)
   {
      send_to_char ("You are hurt too badly already.\n\r", ch);
      return;
   }

   ch->pcdata->powers[HARA_KIRI] = ch->hit / 500;
   if (ch->pcdata->powers[HARA_KIRI] < 5)
      ch->pcdata->powers[HARA_KIRI] = 5;
   ch->hit = 1;
   ch->mana = 1;
   ch->move = 1;
   send_to_char ("You cut your finger and bleed profusely.\n\r", ch);
   act ("$n cuts his finger and obtains the power of HaraKiri", ch, NULL,
	NULL, TO_ROOM);
   return;
}

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

   char arg[MAX_STRING_LENGTH];
   char buf[MAX_STRING_LENGTH];
   CHAR_DATA *victim;

   argument = one_argument (argument, arg);

   if (IS_NPC (ch))
      return;

   if (!IS_CLASS (ch, CLASS_NINJA) || ch->pcdata->powers[NPOWER_NINGENNO] < 7)
   {
      send_to_char ("Huh?\n\r", ch);
      return;
   }

   if ((victim = ch->fighting) == NULL)
   {
      if (arg[0] == '\0')
      {
	 send_to_char ("Trip whom?\r\n", ch);
	 return;
      }
      if ((victim = get_char_room (ch, arg)) == NULL)
      {
	 send_to_char ("How can you trip someone who is not here?\r\n", ch);
	 return;
      }
      else if (IS_NPC (victim))
      {
	 send_to_char ("You cannot trip them!\r\n", ch);
	 return;
      }
   }

   if (is_safe (ch, victim))
   { 
      stc ("You are unable to affect them\n\r", ch);
      return;
   }                            //NO using if safe :)

   if (number_range (1, 4) != 1)
   {
      sprintf (buf, "You skillfully trip %s, and they go down!\r\n",
	       victim->name);
      send_to_char (buf, ch);
      sprintf (buf,
	       "%s makes an impressive fighting move, and you land on your butt!\r\n",
	       ch->name);
      send_to_char (buf, victim);
      WAIT_STATE (ch, 5);
      WAIT_STATE (victim, 5);
      return;
   }
   else
   {
      send_to_char
	 ("You attempt an impressive fighting move, but instead land on your butt!\r\n",
	  ch);
      sprintf (buf,
	       "%s attempts to make an impressive fighting move, but lands on his butt!\r\n",
	       ch->name);
      send_to_char (buf, victim);
      WAIT_STATE (ch, 10);
      return;
   }
}

// Next 2 functions added by TheKid 03/02/01

void do_caltrops (CHAR_DATA * ch, char *argument)
{
   CHAR_DATA *victim;
   char arg1[MAX_INPUT_LENGTH];
   AFFECT_DATA af;
   int sn;

   argument = one_argument (argument, arg1);

   if (IS_NPC (ch))
      return;

   if (!IS_CLASS (ch, CLASS_NINJA))
   {
      send_to_char ("Huh?\n\r", ch);
      return;
   }
   if (ch->pcdata->powers[NPOWER_TENGU] < 4)
   {
      send_to_char ("You have not learned the Tengu principle to 4.\n\r", ch);
      return;
   }

   if (arg1[0] == '\0')
   {
      send_to_char ("Poison who?\n\r", ch);
      return;
   }

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

   if (ch == victim)
   {
      send_to_char ("Not on yourself!\n\r", ch);
      return;
   }

   if (is_safe (ch, victim))
   { 
      stc ("You are unable to affect them\n\r", ch);
      return;
   }                            //NO using if safe :)

   if (ch->pcdata->powers[NINJAKI] < 30)
   {
      send_to_char ("You don't have enough Ki points.\n\r", ch);
      return;
   }
   if (is_affected (victim, skill_lookup ("poison")))
   {
      stc ("They are already under the affects of caltrops.\n\r", ch);
      return;
   }
   if ((sn = skill_lookup ("poison")) < 0)
   {
      send_to_char ("Bug - please inform a coder.\n\r", ch);
      return;
   }
   ch->pcdata->powers[NINJAKI] -= 30;
   af.type = gsn_poison;
   af.duration = 10;
   af.location = APPLY_HITROLL;
   af.modifier = -50;
   af.bitvector = 0;
   af.type = sn;
   af.duration = 10;
   af.location = APPLY_STR;
   af.modifier = 0 - number_range (1, 3);
   af.bitvector = AFF_POISON;
   affect_to_char (victim, &af);
   act ("You toss your caltrop onto the floor and poison $N.", ch, NULL,
	victim, TO_CHAR);
   act ("$n tosses a caltrop onto the floor.  You feel sick.", ch, NULL,
	victim, TO_VICT);
   return;

}
void do_tetsubishi (CHAR_DATA * ch, char *argument)
{   
   CHAR_DATA *victim;
   char arg[MIL];
   int i, test = 0;
      
   argument = one_argument (argument, arg);
    
   if (IS_NPC (ch))
      return;
    
   if (!IS_CLASS (ch, CLASS_NINJA))
   {
      do_rand_typo (ch);
      return;   
   }
   if (ch->pcdata->powers[NPOWER_TENGU] < 5)
   {
      stc ("You haven't learned Tetsu-bishi yet\n\r", ch);
      return;
   }
   if (ch->mana < 500)   
   {
      send_to_char ("You don't have enough mana.\n\r", ch);
      return;
   }                
 
   if (ch->position == POS_FIGHTING)
   {
      stc ("Not while fighting!\n\r", ch);
      return;
   }
      
   victim = ch;
      
   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)
   {
      stc ("You are in perfect condition!\n\r", ch);
      return;
   }
      
   if (victim->loc_hp[6] > 0)
   {
      stc ("Your wounds close up and stop bleeding.\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)
   {  
      stc ("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;
   }
    
   act ("You feel more healthy.", ch, NULL, ch, TO_CHAR);
   act ("$n feels more healthy.", ch, NULL, ch, TO_ROOM);
   victim->hit += number_range(500,2500);
   victim->mana -= 500;
   if (victim->hit > victim->max_hit)
      victim->hit = victim->max_hit;
   update_pos(ch);
   WAIT_STATE (ch, 18);
   return;
}

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

   if (!IS_CLASS (ch, CLASS_NINJA))
   {
      do_rand_typo (ch);
      return;
   }
   if (ch->pcdata->powers[NPOWER_TENGU] < 5)
   {
      stc ("You haven't learned Tetsu-bishi yet\n\r", ch);
      return;
   }
   if (ch->mana < 500)
   {
      send_to_char ("You don't have enough mana.\n\r", ch);
      return;
   }

   if (ch->position == POS_FIGHTING)
   {
      stc ("Not while fighting!\n\r", ch);
      return;
   }

   if (ch->hit >= ch->max_hit)
   {
      stc ("You require no healing!\n\r", ch);
      return;
   }
   ch->mana = ch->mana - 500;
   ch->hit = ch->hit + 500;
   if (ch->hit > ch->max_hit)
      ch->hit = ch->max_hit;
   act ("You feel more healthy.", ch, NULL, ch, TO_CHAR);
   act ("$n feels more healthy.", ch, NULL, ch, TO_ROOM);
   update_pos (ch);
   WAIT_STATE (ch, 6);
   return;
}

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

   argument = one_argument (argument, arg);

   if (IS_NPC (ch))
      return;
   if (!IS_CLASS (ch, CLASS_NINJA) || ch->pcdata->powers[NPOWER_SORA] < 7)
   {
      send_to_char ("Huh?", ch);
      return;
   }
   if (ch->fight_timer > 0)
   {
      send_to_char ("Not until your fight timer expires.\n\r", ch);
      return;
   }

   if (arg[0] == '\0')
   {
      send_to_char
	 ("Who do you wish to walk to via the paths of darkness?\r\n", ch);
      return;
   }

   if ((victim = get_char_world (ch, arg)) == NULL || victim == ch
       || victim->in_room == NULL || ch->in_room == NULL || (IS_NPC (victim)
							     && victim->
							     level > 150))

   {
      send_to_char ("You attempt to walk through the shadows, but fail.\n\r",
		    ch);
      return;
   }

   if (victim->in_room == ch->in_room)
   {
      send_to_char ("But you are already there!\n\r", ch);
      return;
   }

   if (IS_NPC (victim) && IS_SET (victim->in_room->area->aflags, AFLAG_HQ))
   {
      stc ("You failed.\n\r", ch);
      return;
   }
   if (IS_SET (victim->in_room->room_flags, ROOM_SAFE)
//    ||   IS_SET(victim->in_room->room_flags, ROOM_PRIVATE)
//    ||   IS_SET(victim->in_room->room_flags, ROOM_SOLITARY)
//    ||   IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL)
       || (!IS_NPC (victim) && !IS_IMMUNE (victim, IMM_SUMMON)))
   {
      send_to_char ("You are unable to focus on their location.\n\r", ch);
      return;
   }

   send_to_char ("You dissipate into the shadows.\n\r", ch);
   act ("$n dissipates into the shadows, slowly vanishing from sight.", ch,
	NULL, NULL, TO_ROOM);
   char_from_room (ch);
   char_to_room (ch, victim->in_room);
   do_look (ch, "");
   send_to_char ("You coalesce from the darkness which surrounds you.\n\r",
		 ch);
   WAIT_STATE (ch, 5);
   return;
}

/***************************************************************************
 *  New Ninja Powers (C) 16/4/2000 Macademus All Rights Reserved           *
 ***************************************************************************/

/***************************************************************************
 *                              Tengu Principle                            *
 ***************************************************************************/

/* Level 1 - Kunoichi - a Stunning power*/

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

   char arg[MAX_STRING_LENGTH];
   char buf[MAX_STRING_LENGTH];
   CHAR_DATA *victim;

   argument = one_argument (argument, arg);

   if (IS_NPC (ch))
      return;

   if (!IS_CLASS (ch, CLASS_NINJA) || ch->pcdata->powers[NPOWER_TENGU] < 1)
   {
      send_to_char ("Huh?\n\r", ch);
      return;
   }

   if ((victim = ch->fighting) == NULL)
   {
      if (arg[0] == '\0')
      {
	 send_to_char ("Stun whom?\r\n", ch);
	 return;
      }
      if ((victim = get_char_room (ch, arg)) == NULL)
      {
	 send_to_char ("How can you stun someone who is not here?\r\n", ch);
	 return;
      }
      else if (IS_NPC (victim))
      {
	 send_to_char ("You cannot stun them!\r\n", ch);
	 return;
      }
   }

   if (ch == victim)
   {
      stc ("Yes you are stunning arent you?\n\r", ch);
      return;
   }

   if (is_safe (ch, victim))
   { 
      stc ("You are unable to affect them\n\r", ch);
      return;
   }                            //NO using if safe :)

   if (number_range (1, 4) != 1)
   {
      sprintf (buf, "The room glows bright white and %s is stunned!\r\n",
	       victim->name);
      send_to_char (buf, ch);
      sprintf (buf,
	       "%s makes the room glow bright white, and you fall to the ground stunned!\r\n",
	       ch->name);
      send_to_char (buf, victim);
      WAIT_STATE (ch, 5);
      victim->position = POS_STUNNED;
      return;
   }
   else
   {
      send_to_char
	 ("You attempt to let off your stun bomb, but it fails!\r\n", ch);
      sprintf (buf, "%s attempts to stun bomb you fail!\n\r", ch->name);
      send_to_char (buf, victim);
      WAIT_STATE (ch, 20);
      return;
   }
}

// Ashiko - Principle of Unarmed Combat

// LVL 1 Doka

void do_doka (CHAR_DATA * ch, char *argument)
{
   CHAR_DATA *victim;
   OBJ_DATA *obj;
   char arg[MAX_INPUT_LENGTH];
   bool blah = FALSE;
   int chance = 0;

   argument = one_argument (argument, arg);

   if (IS_NPC (ch))
      return;

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

   if (ch->pcdata->powers[NPOWER_ASHIKO] < 1)
   {
      stc ("You haven't learned the principle of doka.\n\r", ch);
      return;
   }

   if (arg[0] == '\0')
   {
      stc ("Who's limb do you wish to wither?\n\r", ch);
      return;
   }

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

   if (IS_ARM_R (victim, LOST_ARM) && IS_ARM_L (victim, LOST_ARM))
   {
      stc ("They have already lost both their arms.\n\r", ch);
      return;
   }

   WAIT_STATE (ch, 20);
   if (is_safe (ch, victim))
   {
      stc ("You are unable to affect them\n\r", ch);
      return;
   }				//NO using if safe :)

   if (IS_NPC (victim))
   {
      chance = number_range (45, 55);

      if (number_percent () > chance)
      {
	 stc ("Nothing happened.\n\r", ch);
	 return;
      }

      if (!IS_ARM_R (victim, LOST_ARM))
	 blah = FALSE;
      else
	 blah = TRUE;

      if (!blah)
      {
	 if (!IS_ARM_R (victim, LOST_ARM))
	    SET_BIT (victim->loc_hp[3], LOST_ARM);
	 if (!IS_BLEEDING (victim, BLEEDING_ARM_R))
	    SET_BIT (victim->loc_hp[6], BLEEDING_ARM_R);
	 if (IS_BLEEDING (victim, BLEEDING_HAND_R))
	    REMOVE_BIT (victim->loc_hp[6], BLEEDING_HAND_R);
	 act ("You concentrate deeply and $N's arm starts to wither!", ch,
	      NULL, victim, TO_CHAR);
	 act ("$n's eyes glow dark red as $e gazes at you, and your arm begins withering!", ch, NULL, victim, TO_NOTVICT);
	 act ("$n gazes evilly at $N, and $S arm begins withering!", ch, NULL,
	      victim, TO_VICT);
	 make_part (victim, "arm");
	 if (IS_ARM_L (victim, LOST_ARM) && IS_ARM_R (victim, LOST_ARM))
	 {
	    if ((obj = get_eq_char (victim, WEAR_ARMS)) != NULL)
	       take_item (victim, obj);
	 }
	 if ((obj = get_eq_char (victim, WEAR_WIELD)) != NULL)
	    take_item (victim, obj);
         if ((obj = get_eq_char (victim, WEAR_DUAL)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_HANDS)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_WRIST_R)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_FINGER_R)) != NULL)
	    take_item (victim, obj);
	 return;
      }

      else if (blah)
      {
	 if (!IS_ARM_L (victim, LOST_ARM))
	    SET_BIT (victim->loc_hp[2], LOST_ARM);
	 else
	    blah = TRUE;
	 if (!IS_BLEEDING (victim, BLEEDING_ARM_L))
	    SET_BIT (victim->loc_hp[6], BLEEDING_ARM_L);
	 if (IS_BLEEDING (victim, BLEEDING_HAND_L))
	    REMOVE_BIT (victim->loc_hp[6], BLEEDING_HAND_L);
	 act ("You concentrate deeply and $N's arm starts to wither!", ch,
	      NULL, victim, TO_CHAR);
	 act ("$n's eyes glow dark red as $e gazes at you, and your arm begins withering!", ch, NULL, victim, TO_NOTVICT);
	 act ("$n gazes evilly at $N, and $S arm begins withering!", ch, NULL,
	      victim, TO_VICT);
	 make_part (victim, "arm");
	 if (IS_ARM_L (victim, LOST_ARM) && IS_ARM_R (victim, LOST_ARM))
	 {
	    if ((obj = get_eq_char (victim, WEAR_ARMS)) != NULL)
	       take_item (victim, obj);
	 }
         if ((obj = get_eq_char (victim, WEAR_HOLD)) != NULL)
	    take_item (victim, obj);
         if ((obj = get_eq_char (victim, WEAR_DUAL)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_HANDS)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_WRIST_L)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_FINGER_L)) != NULL)
	    take_item (victim, obj);
	 return;
      }
   }

   else if (!IS_NPC (victim))
   {
      chance = 40;
      if (IS_ITEMAFF (victim, ITEMA_ARTIFACT))
	 chance = 0;
      if (number_percent () > chance)
      {
	 act ("You gaze intently at $N.\n\rNothing happens.", ch, NULL,
	      victim, TO_CHAR);
	 act ("$n gazes eerily at you.\n\rNothing happens.", ch, NULL, victim,
	      TO_VICT);
	 act ("$n gazes eerily at $N.", ch, NULL, victim, TO_NOTVICT);
	 return;
      }

      if (!IS_ARM_R (victim, LOST_ARM))
	 blah = FALSE;
      else
	 blah = TRUE;

      if (!blah)
      {
	 if (!IS_ARM_R (victim, LOST_ARM))
	    SET_BIT (victim->loc_hp[3], LOST_ARM);
	 if (!IS_BLEEDING (victim, BLEEDING_ARM_R))
	    SET_BIT (victim->loc_hp[6], BLEEDING_ARM_R);
	 if (IS_BLEEDING (victim, BLEEDING_HAND_R))
	    REMOVE_BIT (victim->loc_hp[6], BLEEDING_HAND_R);
	 act ("You concentrate deeply and $N's arm starts to wither!", ch,
	      NULL, victim, TO_CHAR);
	 act ("$n's eyes glow dark red as $e gazes at you, and your arm begins withering!", ch, NULL, victim, TO_NOTVICT);
	 act ("$n gazes evilly at $N, and $S arm begins withering!", ch, NULL,
	      victim, TO_VICT);
	 make_part (victim, "arm");
	 if (IS_ARM_L (victim, LOST_ARM) && IS_ARM_R (victim, LOST_ARM))
	 {
	    if ((obj = get_eq_char (victim, WEAR_ARMS)) != NULL)
	       take_item (victim, obj);
	 }
	 if ((obj = get_eq_char (victim, WEAR_WIELD)) != NULL)
	    take_item (victim, obj);
         if ((obj = get_eq_char (victim, WEAR_DUAL)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_HANDS)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_WRIST_R)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_FINGER_R)) != NULL)
	    take_item (victim, obj);
	 return;
      }

      else if (blah)
      {
	 if (!IS_ARM_L (victim, LOST_ARM))
	    SET_BIT (victim->loc_hp[2], LOST_ARM);
	 else
	    blah = TRUE;
	 if (!IS_BLEEDING (victim, BLEEDING_ARM_L))
	    SET_BIT (victim->loc_hp[6], BLEEDING_ARM_L);
	 if (IS_BLEEDING (victim, BLEEDING_HAND_L))
	    REMOVE_BIT (victim->loc_hp[6], BLEEDING_HAND_L);
	 act ("You concentrate deeply and $N's arm starts to wither!", ch,
	      NULL, victim, TO_CHAR);
	 act ("$n's eyes glow dark red as $e gazes at you, and your arm begins withering!", ch, NULL, victim, TO_NOTVICT);
	 act ("$n gazes evilly at $N, and $S arm begins withering!", ch, NULL,
	      victim, TO_VICT);
	 make_part (victim, "arm");
	 if (IS_ARM_L (victim, LOST_ARM) && IS_ARM_R (victim, LOST_ARM))
	 {
	    if ((obj = get_eq_char (victim, WEAR_ARMS)) != NULL)
	       take_item (victim, obj);
	 }
         if ((obj = get_eq_char (victim, WEAR_HOLD)) != NULL)
	    take_item (victim, obj);
         if ((obj = get_eq_char (victim, WEAR_DUAL)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_HANDS)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_WRIST_L)) != NULL)
	    take_item (victim, obj);
	 if ((obj = get_eq_char (victim, WEAR_FINGER_L)) != NULL)
	    take_item (victim, obj);
	 return;
      }
   }
   return;
}

// LVL 2 - Ngazumo
void do_ngazumo (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;

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

   if (ch->pcdata->powers[NPOWER_ASHIKO] < 2)
   {
      send_to_char ("You have not learned this principle yet.\n\r", ch);
      return;
   }

   if (IS_SET (ch->more, MORE_STEELFISTS))
   {
      REMOVE_BIT (ch->more, MORE_STEELFISTS);
      send_to_char ("Your fists resume their normal toughness.\n\r", ch);
      act ("$n's fists resume their normal toughness.\n\r", ch, NULL, NULL,
	   TO_ROOM);
      return;
   }

   if (!IS_SET (ch->more, MORE_STEELFISTS))
   {
      SET_BIT (ch->more, MORE_STEELFISTS);
      send_to_char ("Your fists turn as hard as steel!\n\r", ch);
      act ("$n's fists shine as they turn as hard as steel!\n\r", ch, NULL,
	   NULL, TO_ROOM);
      return;
   }
}

// LVL 3 - Nekade
DO_COM (do_nekade)
{
   CHAR_DATA *victim;
   char arg[MAX_INPUT_LENGTH];
   int damage;

   argument = one_argument (argument, arg);

   if (IS_NPC (ch))
      return;

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

   if (ch->pcdata->powers[NPOWER_ASHIKO] < 3)
   {
      stc ("You have not learned that principle yet.\n\r", ch);
      return;
   }

   if (arg[0] == '\0' && ch->fighting == NULL)
   {
      send_to_char ("Who do you wish to use Pain Touch on?\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 (ch == victim)
   {
      stc ("OUCH\n\r", ch);
      return;
   }

   if (is_safe (ch, victim))
   { 
      stc ("You are unable to affect them\n\r", ch);
      return;
   }                            //NO using if safe :)

   damage = number_range (1000, 2000);

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

   send_to_char
      ("You scream in agony as the pain shoots through your body!\n\r",
       victim);
   act ("$n doubles over and screams in agony!", victim, NULL, NULL, TO_ROOM);

   victim->hit -= damage;

   if ((IS_NPC (victim) && victim->hit < 1))
   {
      act ("$n's body falls limply to the ground.", victim, NULL, NULL,
	   TO_ROOM);
      WAIT_STATE (ch, 12);
      return;
   }
   update_pos (victim);
   if (IS_NPC (victim))
      multi_hit (victim, ch, TYPE_UNDEFINED);
   WAIT_STATE (ch, 12);
   return;
}

// LVL 4 - Ippon Sugi

DO_COM (do_ippon)
{
   CHAR_DATA *victim;
   char arg[MAX_INPUT_LENGTH];

   argument = one_argument (argument, arg);

   if (IS_NPC (ch))
      return;

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

   if (ch->pcdata->powers[NPOWER_ASHIKO] < 4)
   {
      stc ("You need Ashiko 4, to use this power!\n\r", ch);
      return;
   }

   if (arg[0] == '\0')
   {
      send_to_char ("Who do you want to Dazzle?\n\r", ch);
      return;
   }

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

   if (victim->position != POS_FIGHTING && victim->hit < victim->max_hit)
   {
      send_to_char ("Nothing happens.\n\r", ch);
   }

   if (is_safe (ch, victim))
   {
      return;
   }

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

   send_to_char ("You cover your eyes as you are dazzled!\n\r", victim);
   act ("$n covers $s eyes, looking dazzled!", victim, NULL, NULL, TO_ROOM);

   stop_fighting (victim, TRUE);
   update_pos (victim);
   if (victim->position > POS_STUNNED)
      victim->position = POS_STUNNED;
   if (IS_NPC (victim))
      multi_hit (victim, ch, TYPE_UNDEFINED);
   WAIT_STATE (ch, 12);
   return;
}