#include <sys/types.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "mud.h"

extern void transStatApply args((CHAR_DATA *ch, int strMod, int spdMod, int intMod, int conMod));
extern void transStatRemove args((CHAR_DATA *ch));

void do_fiendform(CHAR_DATA *ch, char *argument )
{
    if (IS_NPC(ch) || ch->race != 8)
      return;

    int TotalPLMod = 12;
    int TotalStrMod = 12;
    int TotalSpdMod = 12;
    int TotalIntMod = 9;
    int TotalConMod = 6;
    int MeditationMod = ch->pcdata->demonmeditation;


    if (xIS_SET((ch)->affected_by, AFF_INFERNALWILL))
    {
      TotalPLMod += 4;
      TotalStrMod += 6;
      TotalSpdMod += 8;
      TotalIntMod += 4;
      TotalConMod += 2;
    }

    if (xIS_SET((ch)->affected_by, AFF_DEMONMEDITATION))
    {
      TotalPLMod += MeditationMod;
      TotalStrMod += (MeditationMod / 2);
      TotalSpdMod += (MeditationMod / 2);
      TotalIntMod += MeditationMod;
      TotalConMod += MeditationMod;
    }
    
    if (xIS_SET((ch)->affected_by, AFF_FIENDFORM))
    {
	    act( AT_DGREY, "Your body reverts to its usual, weaker self.", ch, NULL, NULL, TO_CHAR );
	    act( AT_DGREY, "$n's body reverts to its usual, weaker self.", ch, NULL, NULL, TO_NOTVICT );
	    xREMOVE_BIT( ch->affected_by, AFF_FIENDFORM );

        TotalPLMod -= 12;
        TotalStrMod -= 12;
        TotalSpdMod -= 12;
        TotalIntMod -= 9;
        TotalConMod -= 6;
	    ch->pl = ch->exp * TotalPLMod;
		if (ch->pl < ch->exp)
			ch->pl = ch->exp;
	    transStatApply(ch, TotalStrMod, TotalSpdMod, TotalIntMod, TotalConMod);
 	    return;
      }

	if ( ch->mana < skill_table[gsn_fiendform]->min_mana )
	{
	    send_to_char( "You don't have enough energy.\n\r", ch );
	    return;
	}

    WAIT_STATE( ch, skill_table[gsn_fiendform]->beats );
	if ( can_use_skill(ch, number_percent(), gsn_fiendform ) )
	{

        act( AT_DGREY, "A cursed wind flows forth from your aura, whistling its mournful song. As", ch, NULL, NULL, TO_CHAR );
        actl( AT_DGREY, "the wind encircles you, you can feel a tightening in your gut, but what it", ch, NULL, NULL, TO_CHAR );
        actl( AT_DGREY, "is you cannot say... A great mental weight is placed upon you suddenly as", ch, NULL, NULL, TO_CHAR );
        actl( AT_DGREY, "your skin becomes taught and hardens into a sort of a carapace. Your girth", ch, NULL, NULL, TO_CHAR );
        actl( AT_DGREY, "is lessened, leaving your figure lithe and agile, with curved horns", ch, NULL, NULL, TO_CHAR );
        actl( AT_DGREY, "sprouted from your head and joints.", ch, NULL, NULL, TO_CHAR );
             act( AT_BLOOD, "You have ascended to the hallowed status of Fiend.", ch, NULL, NULL, TO_CHAR );

        act( AT_DGREY, "A cursed wind flows forth from $n's aura, whistling its mournful song. As", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_DGREY, "the wind encircles $m, $e seems to feel a tightening in $s gut, but what it", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_DGREY, "is $e cannot say... A great mental weight is placed upon $m suddenly as", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_DGREY, "$s skin becomes taught and hardens into a sort of a carapace. $n's girth", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_DGREY, "is lessened, leaving $s figure lithe and agile, with curved horns", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_DGREY, "sprouted from $s head and joints.", ch, NULL, NULL, TO_NOTVICT );
             act( AT_BLOOD, "$n has ascended to the hallowed status of Fiend.", ch, NULL, NULL, TO_NOTVICT );

	xSET_BIT( (ch)->affected_by, AFF_FIENDFORM );
	ch->pl = ch->exp * TotalPLMod;
	transStatApply(ch, TotalStrMod, TotalSpdMod, TotalIntMod, TotalConMod);
	learn_from_success( ch, gsn_fiendform );
    }
	else
	{
	act( AT_GREY, "You attempt to summon the cursed winds, but none respond to your calls.", ch, NULL, NULL, TO_CHAR );
	act( AT_GREY, "$n stands deathly still for a moment, but nothing really happens.", ch, NULL, NULL, TO_NOTVICT );
	learn_from_failure( ch, gsn_fiendform );
    }

	ch->mana -= skill_table[gsn_fiendform]->min_mana;
	return;
}

void do_infernalwill(CHAR_DATA *ch, char *argument )
{
      if (IS_NPC(ch) || ch->race != 8)
      return;
      
	// Ignore my error checking, kthnx.

    int TotalPLMod = 4;
          //pager_printf(ch,"&WPL Mod: &R%d", TotalPLMod);
    int TotalStrMod = 6;
    int TotalSpdMod = 8;
    int TotalIntMod = 4;
    int TotalConMod = 2;
    int MeditationMod = ch->pcdata->demonmeditation;


    if (xIS_SET((ch)->affected_by, AFF_FIENDFORM))
    {
      TotalPLMod += 12;
           //pager_printf(ch,"&WPL Mod: &R%d", TotalPLMod);
      TotalStrMod += 12;
      TotalSpdMod += 12;
      TotalIntMod += 9;
      TotalConMod += 6;
    }

    if (xIS_SET((ch)->affected_by, AFF_DEMONMEDITATION))
    {
      TotalPLMod += MeditationMod;
      TotalStrMod += (MeditationMod / 2);
      TotalSpdMod += (MeditationMod / 2);
      TotalIntMod += MeditationMod;
      TotalConMod += MeditationMod;
    }
    
      if (xIS_SET((ch)->affected_by, AFF_INFERNALWILL))
      {
	    act( AT_RED, "You rest your weary mind.", ch, NULL, NULL, TO_CHAR );
	    act( AT_RED, "$n rests $s weary mind.", ch, NULL, NULL, TO_NOTVICT );
	    xREMOVE_BIT( ch->affected_by, AFF_INFERNALWILL );
	    
        TotalPLMod -= 4;
	     //pager_printf(ch,"&WPL Mod: &R%d", TotalPLMod);
        TotalStrMod -= 6;
        TotalSpdMod -= 8;
        TotalIntMod -= 4;
        TotalConMod -= 2;
	    ch->pl = ch->exp * TotalPLMod;
		if (ch->pl < ch->exp)
			ch->pl = ch->exp;
	    transStatApply(ch, TotalStrMod, TotalSpdMod, TotalIntMod, TotalConMod);
 	    return;
      }

	if ( ch->mana < skill_table[gsn_infernalwill]->min_mana )
	{
	    send_to_char( "You don't have enough energy.\n\r", ch );
	    return;
	}

    WAIT_STATE( ch, skill_table[gsn_infernalwill]->beats );
	if ( can_use_skill(ch, number_percent(), gsn_infernalwill ) )
	{
        act( AT_BLOOD, "With some effort, you release your mental tension and bask in clarity for", ch, NULL, NULL, TO_CHAR );
        actl( AT_BLOOD, "a few brief moments, preparing yourself for the oncoming rush. As soon as", ch, NULL, NULL, TO_CHAR );
        actl( AT_BLOOD, "you establish a manageable balance, you open up the floodgates to your tainted", ch, NULL, NULL, TO_CHAR );
        actl( AT_BLOOD, "soul. Without even trying, diabolical evils fill your mind, flowing through", ch, NULL, NULL, TO_CHAR );
        actl( AT_BLOOD, "your veins and giving your mental powers a much needed boost.", ch, NULL, NULL, TO_CHAR );

        act( AT_BLOOD, "With some effort, $n releases $s mental tension and basks in clarity for", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_BLOOD, "a few brief moments, preparing $mself for the oncoming rush. As soon as", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_BLOOD, "$e establishes a manageable balance, $e opens up the floodgates to $s tainted", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_BLOOD, "soul. Without even trying, diabolical evils fill $s mind, flowing through", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_BLOOD, "$s veins and giving $s mental powers a much needed boost.", ch, NULL, NULL, TO_NOTVICT );

	xSET_BIT( (ch)->affected_by, AFF_INFERNALWILL );
	ch->pl = ch->exp * TotalPLMod;
	transStatApply(ch, TotalStrMod, TotalSpdMod, TotalIntMod, TotalConMod);
	learn_from_success( ch, gsn_infernalwill );
    }
	else
	{
	act( AT_GREY, "You attempt to release your mental tension, but you're too tense, mentally.", ch, NULL, NULL, TO_CHAR );
	act( AT_GREY, "$n tries to relax $s mind, but only ends up minding relaxing.", ch, NULL, NULL, TO_NOTVICT );
	learn_from_failure( ch, gsn_infernalwill );
    }

	ch->mana -= skill_table[gsn_infernalwill]->min_mana;
	return;
}

void do_demonmeditation(CHAR_DATA *ch, char *argument )
{
      if (IS_NPC(ch) || ch->race != 8)
      return;
      
    int TotalPLMod = 0;
    int TotalStrMod = 0;
    int TotalSpdMod = 0;
    int TotalIntMod = 0;
    int TotalConMod = 0;
    int MeditationMod = 0;
    
    if (xIS_SET((ch)->affected_by, AFF_FIENDFORM))
    {
      TotalPLMod += 12;
      TotalStrMod += 12;
      TotalSpdMod += 12;
      TotalIntMod += 9;
      TotalConMod += 6;
    }

    if (xIS_SET((ch)->affected_by, AFF_INFERNALWILL))
    {
      TotalPLMod += 4;
      TotalStrMod += 6;
      TotalSpdMod += 8;
      TotalIntMod += 4;
      TotalConMod += 2;
    }

	if ( argument[0] == '\0' || atoi(argument) <= 0)
	{
      if (xIS_SET((ch)->affected_by, AFF_DEMONMEDITATION))
      {
	    act( AT_BLOOD, "You release your hold on your inner demons...", ch, NULL, NULL, TO_CHAR );
	    act( AT_BLOOD, "$n releases $s hold on $s inner demons...", ch, NULL, NULL, TO_NOTVICT );
	    xREMOVE_BIT( ch->affected_by, AFF_DEMONMEDITATION );
	    
      /* I defaulted these to 0 so we don't have to subtract again. Stupid Krono. 
        TotalPLMod -= ch->pcdata->demonmeditation;
        TotalStrMod -= (ch->pcdata->demonmeditation / 2);
        TotalSpdMod -= (ch->pcdata->demonmeditation / 2);
        TotalIntMod -= ch->pcdata->demonmeditation;
        TotalConMod -= ch->pcdata->demonmeditation;*/
	    ch->pl = ch->exp * TotalPLMod;
		if (ch->pl < ch->exp)
			ch->pl = ch->exp;
	    transStatApply(ch, TotalStrMod, TotalSpdMod, TotalIntMod, TotalConMod);
        ch->pcdata->demonmeditation = 0;
	    return;
      }
      else
      {
		send_to_char( "Syntax: demonic <PL modifier>\n\r", ch );
		return;
      }
    }

    MeditationMod = atoi(argument);

    if (MeditationMod < 4)
      MeditationMod = 4;
    if (MeditationMod > 10)
      MeditationMod = 10;

    ch->pcdata->demonmeditation = MeditationMod;

      TotalPLMod += MeditationMod;
      TotalStrMod += (MeditationMod / 2);
      TotalSpdMod += (MeditationMod / 2);
      TotalIntMod += MeditationMod;
      TotalConMod += MeditationMod;

	if ( ch->mana < (skill_table[gsn_demonmeditation]->min_mana * MeditationMod))
	{
	    send_to_char( "You don't have enough energy.\n\r", ch );
	    return;
	}

    WAIT_STATE( ch, skill_table[gsn_demonmeditation]->beats );
	if ( can_use_skill(ch, number_percent(), gsn_demonmeditation ) )
	{
        act( AT_RED, "Sitting down cross-legged upon the ground, you slowly exhale and reflect", ch, NULL, NULL, TO_CHAR );
        actl( AT_RED, "inwardly to the most dangerous depths of your soul, searching for your", ch, NULL, NULL, TO_CHAR );
        actl( AT_RED, "inner demons. One by one, you find and release these spiritual beings of", ch, NULL, NULL, TO_CHAR );
        actl( AT_RED, "malice, as much physical as ethereal. A shock of crimson lightning throws", ch, NULL, NULL, TO_CHAR );
        actl( AT_RED, "itself through you, the spirit demons howling and wailing as you constrict", ch, NULL, NULL, TO_CHAR );
        actl( AT_RED, "them into your massive aura...", ch, NULL, NULL, TO_CHAR );

        act( AT_RED, "Sitting down cross-legged upon the ground, $n slowly exhales and reflects", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_RED, "inwardly to the most dangerous depths of $s soul, searching for $s", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_RED, "inner demons. One by one, $e finds and releases these spiritual beings of", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_RED, "malice, as much physical as ethereal. A shock of crimson lightning throws", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_RED, "itself through $n, the spirit demons howling and wailing as $e constricts", ch, NULL, NULL, TO_NOTVICT );
        actl( AT_RED, "them into $s massive aura...", ch, NULL, NULL, TO_NOTVICT );

	xSET_BIT( (ch)->affected_by, AFF_DEMONMEDITATION );
	ch->pl = ch->exp * TotalPLMod;
	transStatApply(ch, TotalStrMod, TotalSpdMod, TotalIntMod, TotalConMod);
	learn_from_success( ch, gsn_demonmeditation );
    }
	else
	{
	act( AT_GREY, "You attempt to release your mental tension, but you're too tense, mentally.", ch, NULL, NULL, TO_CHAR );
	act( AT_GREY, "$n tries to relax $s mind, but only ends up minding relaxing.", ch, NULL, NULL, TO_NOTVICT );
	learn_from_failure( ch, gsn_demonmeditation );
    }

	ch->mana -= (skill_table[gsn_demonmeditation]->min_mana * MeditationMod);
	return;
}


void do_cleaver(CHAR_DATA *ch, char *argument )
{
    OBJ_DATA *obj;
    CHAR_DATA *victim;
    int dam = 0;
    bool unarmed = FALSE/*, ik = FALSE*/;
    int ikchance = 0;
    
    obj = get_eq_char(ch, WEAR_WIELD);

    if (obj == NULL)
      unarmed = TRUE;

    if ( IS_NPC(ch) && IS_AFFECTED( ch, AFF_CHARM ) )
    {
        send_to_char( "You can't concentrate enough for that.\n\r", ch );
        return;
    }

    if ( !IS_NPC(ch) && ch->exp < skill_table[gsn_cleaver]->skill_level[ch->class] )
    {
        send_to_char( "You can't do that.\n\r", ch );
        return;
        }

    victim = who_fighting(ch);

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

    if (ch->focus < skill_table[gsn_cleaver]->focus)
    {
		send_to_char( "You need to focus more.\n\r", ch );
        return;
    }

    if (unarmed == TRUE)
    {
      if ( ch->mana < skill_table[gsn_cleaver]->min_mana )
      {
        send_to_char( "You don't have enough energy.\n\r", ch );
        return;
      }
      ikchance = 200;
      ch->mana -= skill_table[gsn_cleaver]->min_mana;
    }
    else
    {
      if ( ch->mana < (skill_table[gsn_cleaver]->min_mana + 100))
      {
        send_to_char( "You don't have enough energy.\n\r", ch );
        return;
      }
      ikchance = 100;
      ch->mana -= (skill_table[gsn_cleaver]->min_mana) + 100;
    }

	ch->focus -= skill_table[gsn_cleaver]->focus;
        

    WAIT_STATE( ch, skill_table[gsn_cleaver]->beats );
    if (ch->race != 9)
    {
     if ( can_use_skill(ch, number_percent(),gsn_cleaver ) )
     {
        switch (number_range(1, ikchance ))
        {
          case 42:
            if ( (IS_NPC(victim) || !IS_NPC(victim)) && ( !xIS_SET(ch->act, PLR_SPAR) 
            || !xIS_SET(ch->act, PLR_SPAR)) )
            {
              if (victim->pl / ch->pl >= 2)
              {
                act( AT_BLOOD, "You surge forth from yourself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_CHAR );
                act( AT_RED, "However $N is too powerful for you, and it disperses about $M with little argument.", ch, NULL, victim, TO_CHAR );
                act( AT_BLOOD, "$n surges forth from $mself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_VICT );
                act( AT_RED, "However you are too powerful for $m, and it disperses about you with little argument.", ch, NULL, victim, TO_VICT );
                act( AT_BLOOD, "$n surges forth from $mself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_NOTVICT );
                act( AT_RED, "However $N is too powerful for $n, and it disperses about $M with little argument.", ch, NULL, victim, TO_NOTVICT );
                dam = 0;
                break;
              }

              dam = 999999999;
              act( AT_BLOOD, "You surge forth from yourself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_CHAR );
              act( AT_RED, "$N is completely unprepared, and is cleaved neatly in two by the attack!", ch, NULL, victim, TO_CHAR );
              act( AT_BLOOD, "$n surges forth from $mself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_VICT );
              act( AT_RED, "You are completely unprepared, and are cleaver neatly in two by the attack!", ch, NULL, victim, TO_VICT );
              act( AT_BLOOD, "$n surges forth from $mself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_NOTVICT );
              act( AT_RED, "$N is completely unprepared, and is cleaved neatly in two by the attack!", ch, NULL, victim, TO_NOTVICT );

              learn_from_success( ch, gsn_cleaver );
              global_retcode = damage( ch, victim, dam, gsn_cleaver );

              if (unarmed == FALSE && obj->pIndexData->vnum > 1259 && obj->pIndexData->vnum < 1266)
              {
                switch (number_range(1, 10 ))
                {
                  default:
                    break;
                  case 10:
                    act( AT_DGREY, "Your demon weapon bursts into shards from the force!", ch, NULL, victim, TO_CHAR );
                    act( AT_DGREY, "$n's demon weapon bursts into shards from the force!", ch, NULL, victim, TO_VICT );
                    act( AT_DGREY, "$n's demon weapon bursts into shards from the force!", ch, NULL, victim, TO_NOTVICT );
                    obj_from_char( obj );
                    extract_obj( obj );
                  break;
                }
              }
			  break;
            }

        default:
          if (unarmed == TRUE)
          {
            dam = get_attmod(ch, victim) * number_range( 14, 20 );
            if (ch->charge > 0) 
              dam = chargeDamMult(ch, dam);

            act( AT_BLOOD, "You engulf your entire arm in blood red energy, its tendrils licking forth", ch, NULL, victim, TO_CHAR );
            actl( AT_BLOOD, "from you like the unquenchable flames it emulates. Quickly, you lunge forward, ", ch, NULL, victim, TO_CHAR );
            actl( AT_BLOOD, "whipping the arm out in front of you and throwing a razor sharp wave of energy ", ch, NULL, victim, TO_CHAR );
            actl( AT_BLOOD, "straight for $N! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

            act( AT_BLOOD, "$n engulfs $s entire arm in blood red energy, its tendrils licking forth ", ch, NULL, victim, TO_VICT );
            actl( AT_BLOOD, "from $m like the unquenchable flames it emulates. Quickly, $e lunges forward, ", ch, NULL, victim, TO_VICT );
            actl( AT_BLOOD, "whipping $s arm out in front of $m and throwing a razor sharp wave of energy ", ch, NULL, victim, TO_VICT );
            actl( AT_BLOOD, "straight for you! &W[$t]", ch, num_punct(dam), victim, TO_VICT );

            act( AT_BLOOD, "$n engulfs $s entire arm in blood red energy, its tendrils licking forth ", ch, NULL, victim, TO_NOTVICT );
            actl( AT_BLOOD, "from $m like the unquenchable flames it emulates. Quickly, $e lunges forward, ", ch, NULL, victim, TO_NOTVICT );
            actl( AT_BLOOD, "whipping $s arm out in front of $m and throwing a razor sharp wave of energy ", ch, NULL, victim, TO_NOTVICT );
            actl( AT_BLOOD, "straight for $N! &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT ); 

          }
          else
          {
            dam = get_attmod(ch, victim) * number_range( 16, 23 );
            if (ch->charge > 0) 
              dam = chargeDamMult(ch, dam);

            act( AT_BLOOD, "You engulf the entire length of your weapon in fiery, blood red energy, its", ch, NULL, victim, TO_CHAR );
            actl( AT_BLOOD, "tendrils licking forth like savage, bloodthirty hounds. Lunging forward, you ", ch, NULL, victim, TO_CHAR );
            actl( AT_BLOOD, "pull it across at chest-level, an incomprehensibly sharp wave of energy surging", ch, NULL, victim, TO_CHAR );
            actl( AT_BLOOD, "forth from the unholy weapon! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

            act( AT_BLOOD, "$n engulfs the entire length of $s weapon in fiery, blood red energy, its", ch, NULL, victim, TO_VICT );
            actl( AT_BLOOD, "tendrils licking forth like savage, bloodthirty hounds. Lunging forward, $e", ch, NULL, victim, TO_VICT );
            actl( AT_BLOOD, "pulls it across at chest-level, an incomprehensibly sharp wave of energy surging", ch, NULL, victim, TO_VICT );
            actl( AT_BLOOD, "forth from the unholy weapon! &W[$t]", ch, num_punct(dam), victim, TO_VICT );

            act( AT_BLOOD, "$n engulfs the entire length of $s weapon in fiery, blood red energy, its", ch, NULL, victim, TO_NOTVICT );
            actl( AT_BLOOD, "tendrils licking forth like savage, bloodthirty hounds. Lunging forward, $e", ch, NULL, victim, TO_NOTVICT );
            actl( AT_BLOOD, "pulls it across at chest-level, an incomprehensibly sharp wave of energy surging", ch, NULL, victim, TO_NOTVICT );
            actl( AT_BLOOD, "forth from the unholy weapon! &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

         }  
      
        learn_from_success( ch, gsn_cleaver);
        dam = portal_counter(ch, victim, dam, gsn_cleaver );
        
        if (dam > 0)
          global_retcode = damage( ch, victim, dam, gsn_cleaver );

        break;
      }
    }
    else
     {
      act( AT_DGREY, "You fail to gather the required energies.", ch, NULL, victim, TO_CHAR );
      act( AT_DGREY, "$n fails to gather $s energies.", ch, NULL, victim, TO_VICT );
      act( AT_DGREY, "$n fails to gather $s energies.", ch, NULL, victim, TO_NOTVICT );
      learn_from_failure( ch, gsn_cleaver );
      global_retcode = damage( ch, victim, 0, gsn_cleaver );
     }
    }
    else
    {
     if ( can_use_skill(ch, number_percent(),gsn_demonwave ) )
     {
        switch (number_range(1, ikchance ))
        {
          case 42:
            if ( (IS_NPC(victim) || !IS_NPC(victim)) && ( !xIS_SET(ch->act, PLR_SPAR) 
            || !xIS_SET(ch->act, PLR_SPAR)) )
            {
              if (victim->pl / ch->pl >= 2)
              {
                act( AT_PURPLE, "You surge forth from yourself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_CHAR );
                act( AT_PINK, "However $N is too powerful for you, and it disperses about $M with little argument.", ch, NULL, victim, TO_CHAR );
                act( AT_PURPLE, "$n surges forth from $mself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_VICT );
                act( AT_PINK, "However you are too powerful for $m, and it disperses about you with little argument.", ch, NULL, victim, TO_VICT );
                act( AT_PURPLE, "$n surges forth from $mself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_NOTVICT );
                act( AT_PINK, "However $N is too powerful for $n, and it disperses about $M with little argument.", ch, NULL, victim, TO_NOTVICT );
                dam = 0;
                break;
              }

              dam = 999999999;
              act( AT_PURPLE, "You surge forth from yourself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_CHAR );
              act( AT_PINK, "$n is completely unprepared, and is cleaved neatly in two by the attack!", ch, NULL, victim, TO_CHAR );
                act( AT_PURPLE, "$n surges forth from $mself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_VICT );
              act( AT_PINK, "You are completely unprepared, and are cleaver neatly in two by the attack!", ch, NULL, victim, TO_VICT );
                act( AT_PURPLE, "$n surges forth from $mself an unholy wave of energy sharp enough to cut the sky!", ch, NULL, victim, TO_NOTVICT );
              act( AT_PINK, "$n is completely unprepared, and is cleaved neatly in two by the attack!", ch, NULL, victim, TO_CHAR );

              learn_from_success( ch, gsn_demonwave );
              global_retcode = damage( ch, victim, dam, gsn_cleaver );

            }

        default:
          if (unarmed == TRUE)
          {
            dam = get_attmod(ch, victim) * number_range( 14, 20 );
            if (ch->charge > 0) 
              dam = chargeDamMult(ch, dam);

            act( AT_PINK, "You engulf your entire arm in blood red energy, its tendrils licking forth", ch, num_punct(dam), victim, TO_CHAR );
            actl( AT_PINK, "from you like the unquenchable flames it emulates. Quickly, you lunge forward, ", ch, num_punct(dam), victim, TO_CHAR );
            actl( AT_PINK, "whipping the arm out in front of you and throwing a razor sharp wave of energy ", ch, num_punct(dam), victim, TO_CHAR );
            actl( AT_PINK, "straight for $N! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

            act( AT_PINK, "$n engulfs $s entire arm in blood red energy, its tendrils licking forth ", ch, num_punct(dam), victim, TO_VICT );
            actl( AT_PINK, "from $m like the unquenchable flames it emulates. Quickly, $e lunges forward, ", ch, num_punct(dam), victim, TO_VICT );
            actl( AT_PINK, "whipping $s arm out in front of $m and throwing a razor sharp wave of energy ", ch, num_punct(dam), victim, TO_VICT );
            actl( AT_PINK, "straight for you! &W[$t]", ch, num_punct(dam), victim, TO_VICT );

            act( AT_PINK, "$n engulfs $s entire arm in blood red energy, its tendrils licking forth ", ch, num_punct(dam), victim, TO_NOTVICT );
            actl( AT_PINK, "from $m like the unquenchable flames it emulates. Quickly, $e lunges forward, ", ch, num_punct(dam), victim, TO_NOTVICT );
            actl( AT_PINK, "whipping $s arm out in front of $m and throwing a razor sharp wave of energy ", ch, num_punct(dam), victim, TO_NOTVICT );
            actl( AT_PINK, "straight for $N! &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT ); 

          }
          else
          {
            dam = get_attmod(ch, victim) * number_range( 16, 23 );
            if (ch->charge > 0) 
              dam = chargeDamMult(ch, dam);

            act( AT_PINK, "You engulf the entire length of your weapon in fiery, blood red energy, its", ch, num_punct(dam), victim, TO_CHAR );
            actl( AT_PINK, "tendrils licking forth like savage, bloodthirty hounds. Lunging forward, you ", ch, num_punct(dam), victim, TO_CHAR );
            actl( AT_PINK, "pull it across at chest-level, an incomprehensibly sharp wave of energy surging", ch, num_punct(dam), victim, TO_CHAR );
            actl( AT_PINK, "forth from the unholy weapon! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

            act( AT_PINK, "$n engulfs the entire length of $s weapon in fiery, blood red energy, its", ch, num_punct(dam), victim, TO_VICT );
            actl( AT_PINK, "tendrils licking forth like savage, bloodthirty hounds. Lunging forward, $e", ch, num_punct(dam), victim, TO_VICT );
            actl( AT_PINK, "pulls it across at chest-level, an incomprehensibly sharp wave of energy surging", ch, num_punct(dam), victim, TO_VICT );
            actl( AT_PINK, "forth from the unholy weapon! &W[$t]", ch, num_punct(dam), victim, TO_VICT );

            act( AT_PINK, "$n engulfs the entire length of $s weapon in fiery, blood red energy, its", ch, num_punct(dam), victim, TO_NOTVICT );
            actl( AT_PINK, "tendrils licking forth like savage, bloodthirty hounds. Lunging forward, $e", ch, num_punct(dam), victim, TO_NOTVICT );
            actl( AT_PINK, "pulls it across at chest-level, an incomprehensibly sharp wave of energy surging", ch, num_punct(dam), victim, TO_NOTVICT );
            actl( AT_PINK, "forth from the unholy weapon! &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

         }  
      
        learn_from_success( ch, gsn_demonwave);
        dam = portal_counter(ch, victim, dam, gsn_cleaver );
        
        if (dam > 0)
          global_retcode = damage( ch, victim, dam, gsn_cleaver );

        break;
      }
    }
    else
    {
      act( AT_PURPLE, "You fail to gather the required energies.", ch, NULL, victim, TO_CHAR );
      act( AT_PURPLE, "$n fails to gather $s energies.", ch, NULL, victim, TO_VICT );
      act( AT_PURPLE, "$n fails to gather $s energies.", ch, NULL, victim, TO_NOTVICT );
      learn_from_failure( ch, gsn_demonwave );
      global_retcode = damage( ch, victim, 0, gsn_cleaver );
    }
   }
    return;
}

void do_darkness_flare(CHAR_DATA *ch, char *argument )
{
        AFFECT_DATA af;
        CHAR_DATA *vch, *vch_next;

    if ( !IS_NPC(ch)
    &&   ch->exp < skill_table[gsn_darkness_flare]->skill_level[ch->class] )
    {
        send_to_char( "You can't do that.\n\r", ch );
        return;
    }
    if ( xIS_SET(ch->in_room->room_flags, ROOM_ARENA)
      || xIS_SET(ch->in_room->room_flags, ROOM_SAFE))
    {
      send_to_char( "There's no need to use that here.\n\r", ch );
      return;
    }
    if ( who_fighting( ch ) == NULL )
    {
        send_to_char( "You aren't fighting anyone.\n\r", ch );
        return;
    }
        if ( ch->mana < skill_table[gsn_darkness_flare]->min_mana )
        {
            send_to_char( "You don't have enough energy.\n\r", ch );
            return;
        }
        if (ch->focus < skill_table[gsn_darkness_flare]->focus)
    {
                send_to_char( "You need to focus more.\n\r", ch );
                return;
    }
    else
        ch->focus -= skill_table[gsn_darkness_flare]->focus;

    WAIT_STATE( ch, skill_table[gsn_darkness_flare]->beats );

    if ( can_use_skill(ch, number_percent(),gsn_darkness_flare ) )
    {
        act( AT_DGREY, "You put your hands to your face and yell out 'DARKNESS FLARE!' emitting a blast of unpenetrable darkness.", ch, NULL, NULL, TO_CHAR );
        act( AT_DGREY, "$n puts $s hands to $s face and yells out 'DARKNESS FLARE!' blinding everyone in the room with unpenetrable darnkess!", ch, NULL, NULL, TO_NOTVICT );

        learn_from_success( ch, gsn_darkness_flare );
    for ( vch = ch->in_room->first_person; vch; vch = vch_next )
    {

        vch_next = vch->next_in_room;
        if( !IS_AWAKE( vch ) )
          continue;

        if( vch->race == RACE_DEMON || vch->race == RACE_ANDROID )
          continue;

        if( number_range( 1, 100 ) < ( get_curr_int( vch ) / 10 ) )
        {
          send_to_char( "You manage to look away at the last moment and shield "
                        "your eyes.\n\r", vch );
          continue;
        }

        if (ch != vch)
        {
                af.type      = gsn_darkness_flare;
                af.duration  = 15;
                af.location  = APPLY_HITROLL;
                af.modifier  = -6;
                af.bitvector = meb(AFF_BLIND);
                affect_to_char( vch, &af );
        }
    }

    }
    else
    {
        act( AT_DGREY, "You put your hands to your face but forget the words. Nothing happens.", ch, NULL, NULL, TO_CHAR );
        act( AT_DGREY, "$n raises $s hands to $s head, gets a stupid look on $s face, then stands there.", ch, NULL, NULL, TO_NOTVICT );
        learn_from_failure( ch, gsn_darkness_flare );
    }
    ch->mana -= skill_table[gsn_darkness_flare]->min_mana;
    return;
}

void do_demonweapon(CHAR_DATA *ch, char *argument )
{
    OBJ_DATA *o;
    OBJ_INDEX_DATA *pObjIndex;

    if( IS_NPC(ch) )
          return;

    if( argument[0] == '\0' )
    {
        ch_printf(ch,"\n\rSyntax: 'Demon weapon' <command>\n\r");
        ch_printf(ch,"\n\r");
        ch_printf(ch,"Command can only be one of the following:\n\r");
        ch_printf(ch,"\n\r");
        ch_printf(ch,"scimitar longsword katana claymore lance maul remove \n\r");
        return;
    }

    if( !(!str_cmp(argument,"scimitar")) && !(!str_cmp(argument,"longsword")) &&
        !(!str_cmp(argument,"katana")) && !(!str_cmp(argument,"claymore")) &&
        !(!str_cmp(argument,"lance")) && !(!str_cmp(argument,"maul")) && !(!str_cmp(argument,"remove")) )
    {
        do_demonweapon(ch,"");
        return;
    }

    if ( IS_NPC(ch) && IS_AFFECTED( ch, AFF_CHARM ) )
    {
        send_to_char( "You can't concentrate enough for that.\n\r", ch );
        return;
    }
    if ( !IS_NPC(ch)
    &&   ch->exp < skill_table[gsn_demonweapon]->skill_level[ch->class] )
    {
        send_to_char( "You can't do that.\n\r", ch );
        return;
    }

        if( !str_cmp(argument,"remove") )
        {
          o = get_eq_char(ch, WEAR_WIELD);

          if (o == NULL)
            send_to_char( "You must wield a demon weapon to destroy it.\n\r", ch );
          
          else if (o->pIndexData->vnum < 1260 && o->pIndexData->vnum > 1265)
            send_to_char( "Only Demon Weapons can be returned to your body.\n\r", ch );

          else if (o->pIndexData->vnum >= 1260 && o->pIndexData->vnum <= 1265)
          {
             act( AT_RED, "You hold the weapon at arm's length, focusing exclusively on the fragment ", ch, NULL, NULL, TO_CHAR );
            actl( AT_RED, "of your soul held in the core of it. With a flash of red light, the weapon ", ch, NULL, NULL, TO_CHAR );
            actl( AT_RED, "implodes, returning the fragment to you.", ch, NULL, NULL, TO_CHAR );
             act( AT_RED, "$n holds a weapon out at arm's length suddenly, the instrument of destruction ", ch, NULL, NULL, TO_NOTVICT );
            actl( AT_RED, "suddenly imploding into nothingness with a flash of crimson light. ", ch, NULL, NULL, TO_NOTVICT );

            obj_from_char( o );
            extract_obj( o );          
          }
          return;
        }

    if ( ch->mana < ch->max_mana )
    {
        send_to_char( "You don't have enough energy.\n\r", ch );
        return;
    }
    if( ch->hit < 100 )
    {
	ch_printf(ch,"You don't have enough health.\n\r", ch );
	return;
    }
    if( ch->carry_number >= 3 )
    {
        ch_printf(ch,"You haven't got any room.\n\r");
        return;
    }

    WAIT_STATE( ch, skill_table[gsn_demonweapon]->beats );
    if ( can_use_skill(ch, number_percent(),gsn_demonweapon ) )
    {
        int a = 0;
        if( !str_cmp(argument,"scimitar") )
          a = 1260;
        else if( !str_cmp(argument,"longsword") )
          a = 1261;
        else if( !str_cmp(argument,"katana") )
          a = 1262;
        else if( !str_cmp(argument,"claymore") )
          a = 1263;
        else if( !str_cmp(argument,"lance") )
          a = 1264;
        else if( !str_cmp(argument,"maul") )
          a = 1265;
        if( a == 0 )
        {
          bug("Serious problem in function demon weapon",0);
          return;
        }
	if( !str_cmp(argument,"scimitar") )
	{
          act( AT_RED, "You begin to push a tremendous amount of energy into your arms; bloating your muscles up to a very large size. The moment your arms feel like they are going to explode, a twin pair of demon scimitars bursts out of them and into your hands; your arms healing back up almost instantly.", ch, NULL, NULL, TO_CHAR );
          act( AT_RED, "$n begins to push a tremendous amount of energy into $s arms; bloating $s muscles up to a very large size. The moment $s arms look like they are going to explode, a twin pair of demon scimitars bursts out of them and into $s hands; $s arms healing back up almost instantly.", ch, NULL, NULL, TO_NOTVICT );
	}
	if( !str_cmp(argument,"longsword") ||
	    !str_cmp(argument,"katana") ||
	    !str_cmp(argument,"claymore") )
	{
	  act( AT_RED, "The pupils of your eyes suddenly glow bright red as you grab a spike sticking out of your leg in one hand and begin to pull on it. Yelling out, your flesh is torn away as you pull a gleaming demon sword out of your leg. Your leg heals back up almost instantly.", ch, NULL, NULL, TO_CHAR );
	  act( AT_RED, "The pupils of $n's eyes suddenly glow bright red as $e grabs a spike sticking out of $s leg in one hand and begins to pull on it. Yelling out, $s flesh is torn away as $n pulls a gleaming demon sword out of $s leg. $n's leg heals back up almost instantly.", ch, NULL, NULL, TO_NOTVICT );
	}
	if( !str_cmp(argument,"lance") )
	{
	  act( AT_RED, "With a spray of demon blood you rip off your left arm with your right hand. The severed limb begins to bulge as you pump your own energy into it. It starts to stretch out from end to end, when all of a sudden it explodes, turning into a demon lance. Your left arm regenerates almost instantly after.", ch, NULL, NULL, TO_CHAR );
	  act( AT_RED, "With a spray of demon blood $n rips off $s left arm with $s right hand. The severed limb begins to bulge as $n pumps $s own energy into it. It starts to stretch out from end to end, when all of a sudden it explodes, turning into a demon lance. $n's left arm regenerates almost instantly after.", ch, NULL, NULL, TO_NOTVICT );
	}
	if( !str_cmp(argument,"maul") )
	{
	  act( AT_RED, "With a spray of demon blood you rip off your right arm with your left hand. The severed limb begins to bulge as you pump your own energy into it. It starts to stretch out from end to end, when all of a sudden it explodes, turning into a demon maul. Your right arm regenerates almost instantly after.", ch, NULL, NULL, TO_CHAR );
	  act( AT_RED, "With a spray of demon blood $n rips off $s right arm with $s left hand. The severed limb begins to bulge as $n pumps $s own energy into it. It starts to stretch out from end to end, when all of a sudden it explodes, turning into a demon maul. $n's right arm regenerates almost instantly after.", ch, NULL, NULL, TO_NOTVICT );
	}
        learn_from_success( ch, gsn_demonweapon );
        pObjIndex = get_obj_index( a );
        o = create_object_new( pObjIndex, 1 , ORIGIN_OINVOKE, ch->name );
        o = obj_to_char( o, ch );
	ch->hit -= 80;
        save_char_obj( ch );
    }
    else
    {
         act( AT_SKILL, "You fail to use your demon powers to create a weapon.", ch, NULL, NULL, TO_CHAR );
         act( AT_SKILL, "$n fails to use $s demon powers to create a weapon.", ch, NULL, NULL, TO_NOTVICT );
        learn_from_failure( ch, gsn_demonweapon );
    }
    ch->mana = 0;
    return;
}

void do_flamethrower( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    int dam = 0;

    if( !IS_NPC( ch ) && ch->exp < skill_table[gsn_flamethrower]->skill_level[ch->class] )
    {
	send_to_char( "You can't do that.\n\r", ch );
	return;
    }

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

    if( ch->mana < skill_table[gsn_flamethrower]->min_mana )
    {
	send_to_char( "You don't have enough energy.\n\r", ch );
	return;
    }

    if( ch->focus < skill_table[gsn_flamethrower]->focus )
    {
	send_to_char( "You need to focus more.\n\r", ch );
	return;
    }

    ch->focus -= skill_table[gsn_flamethrower]->focus;
    WAIT_STATE( ch, skill_table[gsn_flamethrower]->beats );

    if( can_use_skill( ch, number_percent(), gsn_flamethrower ) )
    {
	dam = get_attmod( ch, victim ) * number_range( 30, 50 );
	if( ch->charge > 0 )
	    dam = chargeDamMult( ch, dam );

            act( AT_RED, "You breathe in deeply, arcane magicks inside your lungs converting the", ch, num_punct(dam), victim, TO_CHAR );
            actl( AT_RED, "inhaled air into a mystical flame hundreds of degrees hotter than any", ch, num_punct(dam), victim, TO_CHAR );
            actl( AT_RED, "known to man. Lunging towards $N, you make a great exhalation and breathe", ch, num_punct(dam), victim, TO_CHAR );
            actl( AT_RED, "a steady, blazing hot stream of magical flame on $M! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

            act( AT_RED, "$n breathes in deeply, arcane magicks inside $s lungs converting the", ch, num_punct(dam), victim, TO_VICT );
            actl( AT_RED, "inhaled air into a mystical flame hundreds of degrees hotter than any", ch, num_punct(dam), victim, TO_VICT );
            actl( AT_RED, "known to man. Lunging towards you, $n makes a great exhalation and breathes", ch, num_punct(dam), victim, TO_VICT );
            actl( AT_RED, "a steady, blazing hot stream of magical flame on you! &W[$t]", ch, num_punct(dam), victim, TO_VICT );

 
            act( AT_RED, "$n breathes in deeply, arcane magicks inside $s lungs converting the", ch, num_punct(dam), victim, TO_NOTVICT );
            actl( AT_RED, "inhaled air into a mystical flame hundreds of degrees hotter than any", ch, num_punct(dam), victim, TO_NOTVICT );
            actl( AT_RED, "known to man. Lunging towards $N, $n makes a great exhalation and breathes", ch, num_punct(dam), victim, TO_NOTVICT );
            actl( AT_RED, "a steady, blazing hot stream of magical flame on $M! &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

        learn_from_success( ch, gsn_flamethrower);
        dam = ki_absorb( victim, ch, dam, gsn_flamethrower );
        dam = portal_counter(ch, victim, dam, gsn_flamethrower );
        
        if (dam > 0)
          global_retcode = damage( ch, victim, dam, gsn_flamethrower );
    }
    else
    {
	act( AT_SKILL, "You begin to inhale air, but cough and sputter as the magicks kick in too soon.", ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "$n starts inhaling air, but coughs and sputters suddenly.", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "$n starts inhaling air, but coughs and sputters suddenly.", ch, NULL, victim, TO_NOTVICT );
	learn_from_failure( ch, gsn_flamethrower );
	global_retcode = damage( ch, victim, 0, gsn_flamethrower );
    }

    ch->mana -= skill_table[gsn_flamethrower]->min_mana;
    return;
}

void do_shatterplane( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    int dam = 0;

    if( !IS_NPC( ch ) && ch->exp < skill_table[gsn_shatterplane]->skill_level[ch->class] )
    {
	send_to_char( "You can't do that.\n\r", ch );
	return;
    }

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

    if (ch->race == 6)
    {
      if (ch->pcdata->absorb_pl_mod != 8)
      {
	  act( AT_DGREY, "You raise one arm to the sky... anticlimatically.  ", ch, NULL, victim, TO_CHAR );
	  act( AT_DGREY, "You seem to be missing something... ", ch, NULL, victim, TO_CHAR );
	  act( AT_DGREY, "$n raises one arm to the sky... anticlimatically. ", ch, NULL, victim, TO_VICT );
	  act( AT_DGREY, "$n raises one arm to the sky... anticlimatically.  ", ch, NULL, victim, TO_NOTVICT );

        return;
      }
    }

    if( ch->mana < skill_table[gsn_shatterplane]->min_mana )
    {
	send_to_char( "You don't have enough energy.\n\r", ch );
	return;
    }

    if( ch->focus < skill_table[gsn_shatterplane]->focus )
    {
	send_to_char( "You need to focus more.\n\r", ch );
	return;
    }

    ch->focus -= skill_table[gsn_shatterplane]->focus;
    WAIT_STATE( ch, skill_table[gsn_shatterplane]->beats );

    if( can_use_skill( ch, number_percent(), gsn_shatterplane ) )
    {
	dam = get_attmod( ch, victim ) * number_range( 66, 76 );
	if( ch->charge > 0 )
	    dam = chargeDamMult( ch, dam );

          act( AT_DGREY, "Time for the finishing touch. Raising one arm high above your head, pointing", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "threateningly to the skies themselves, a narrow beam of energy crawls up to", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "several times over your own height and begins to widen. As the beam's width", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "increases it begins to flatten, until perched upon your outstretched arm is", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "a massive plane of paper-thin energy... which begins to quell... ", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "&r'GRAAWHHHH!'&z you scream unintelligibly as the plane shatters, clouds of", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "ethereal shards bursting towards, around, above, and &bthrough&z $N! &R[$t]", ch, num_punct(dam), victim, TO_CHAR);

          act( AT_DGREY, "This is gonna sting. A lot. Raising one arm high above $s head, pointing", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "threateningly to the skies themselves, a narrow beam of energy crawls up to", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "several times over $n's own height and begins to... widen. As the beam's width", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "increases it begins to flatten, until perched upon $s outstretched arm is", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "a massive plane of paper-thin energy... which begins to quell... ", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "&r'GRAAWHHHH!'&z $n screams unintelligibly as the plane shatters, clouds of", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "ethereal shards bursting towards, around, above, and &bthrough&z you! &R[$t]", ch, num_punct(dam), victim, TO_VICT );

          act( AT_DGREY, "That's gonna sting. A lot. Raising one arm high above $s head, pointing", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "threateningly to the skies themselves, a narrow beam of energy crawls up to", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "several times over $n's own height and begins to... widen. As the beam's width", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "increases it begins to flatten, until perched upon $s outstretched arm is", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "a massive plane of paper-thin energy... which begins to quell... ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "&r'GRAAWHHHH!'&z $n screams unintelligibly as the plane shatters, clouds of", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "ethereal shards bursting towards, around, above, and &bthrough&z $N! &R[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

	learn_from_success( ch, gsn_shatterplane );
	global_retcode = damage( ch, victim, dam, gsn_shatterplane );
    }
    else
    {
	act( AT_SKILL, "Raising a single arm to the sky, a beam of energy begins crawling above you to the sky...", ch, NULL, victim, TO_CHAR );
	actl( AT_SKILL, "and... crumbles. That bites.", ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "Raising a single arm to the sky, a beam of energy begins crawling above $n to the sky...", ch, NULL, victim, TO_VICT );
	actl( AT_SKILL, "and... crumbles. That bites.", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "Raising a single arm to the sky, a beam of energy begins crawling above $n to the sky...", ch, NULL, victim, TO_NOTVICT );
	actl( AT_SKILL, "and... crumbles. That bites.", ch, NULL, victim, TO_NOTVICT );

	learn_from_failure( ch, gsn_shatterplane );
	global_retcode = damage( ch, victim, 0, gsn_shatterplane );
    }

    ch->mana -= skill_table[gsn_shatterplane]->min_mana;
    return;
}

void do_portal( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    CHAR_DATA *fch, *fch_next;
    ROOM_INDEX_DATA *room;
    char arg[MAX_INPUT_LENGTH];

    argument = one_argument( argument, arg );

    if ( IS_NPC(ch) )
	return;

    if ( ch->mana < skill_table[gsn_portal]->min_mana )
    {
	send_to_char( "You don't have enough energy.\n\r", ch );
	return;
    }

    if ( ( who_fighting( ch ) ) != NULL )
    {
	send_to_char( "You can't do that while fighting.\n\r", ch );
	return;
    }

    if ( ( victim = get_char_world( ch, arg ) ) == NULL
	|| !can_astral( ch, victim )
	|| !in_soft_range( ch, victim->in_room->area )
	|| !in_hard_range( ch, victim->in_room->area )
	|| xIS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
	|| IS_IMMORTAL( victim )
	|| ( !IS_NPC( victim ) && !victim->desc ) )
    {
	send_to_char( "You can't seem to find them.\n\r", ch );
	return;
    }

    if ( !victim->in_room )
    {
	send_to_char( "Oh god, a bug! Tell Horus! (Because Krono stole his Teleport code! D:) \n\r", ch );
	return;
    }

    room = ch->in_room;
    WAIT_STATE( ch, skill_table[gsn_portal]->beats );
    if ( can_use_skill( ch, number_percent(), gsn_portal ) )
    {
	act( AT_PURPLE, "You tear open a short-lived hole in reality and hop through!", ch, NULL, NULL, TO_CHAR );
	act( AT_PURPLE, "$n tears open a short-lived hole in reality and hops through!", ch, NULL, NULL, TO_NOTVICT );
	char_from_room( ch );
	if ( ch->mount )
	{
	    char_from_room( ch->mount );
	    char_to_room( ch->mount, victim->in_room );
	}
	char_to_room( ch, victim->in_room );
	act( AT_PURPLE, "You leap out of a second portal, next to $N!", ch, NULL, victim, TO_CHAR );
	act( AT_PURPLE, "A violet portal opens up out of nowhere and spits out $n!", ch, NULL, NULL, TO_NOTVICT );
	do_look( ch, "auto" );
	for ( fch = room->first_person; fch; fch = fch_next )
	{
	    fch_next = fch->next_in_room;
	    if ( fch != ch && fch->master && fch->master == ch )
	    {
	      act( AT_PURPLE, "You tear open a short-lived hole in reality and leap through!", ch, NULL, NULL, TO_CHAR );
 	      act( AT_PURPLE, "$n tears open a short-lived hole in reality and leaps through!", ch, NULL, NULL, TO_NOTVICT );
		char_from_room( fch );
		char_to_room( fch, victim->in_room );
	      act( AT_PURPLE, "You leap out of a second portal, next to $N!", ch, NULL, victim, TO_CHAR );
	      act( AT_PURPLE, "A violet portal opens up out of nowhere and spits out $n!", ch, NULL, NULL, TO_NOTVICT );
		do_look( fch, "auto" );
	    }
	}
	learn_from_success( ch, gsn_portal );
    }
    else
    {
	act( AT_PURPLE, "Something is amiss. You cannot open a portal to there.", ch, NULL, NULL, TO_CHAR );
	act( AT_PURPLE, "$n fails to open a portal for one reason or another.", ch, NULL, NULL, TO_NOTVICT );
	learn_from_failure( ch, gsn_portal );
    }

    ch->mana -= skill_table[gsn_portal]->min_mana;
    return;
}

int portal_counter( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int attack_gsn )
{

    if ( victim->race != 8 )
    {
	return (dam);
    }

      if ( victim->position == POS_PORTAL )
      {
	  if ( dam > 1000 ) // So that instant kills cannot be blocked.
	    return (dam);

	  if( number_range(1,100) <= 90 ) // 90% chance of it not working.
          return (dam);

        // 10% of the PL Ratio + 20% of the SPD Ratio + 20% of the Portal skill percent = Base Success Chance

        int SuccessSubTotal = ((get_attmod(ch,victim) * 10) + (get_curr_dex(ch) / get_curr_dex(victim) * 20) + ( LEARNED(ch, gsn_portal) / 5));
	  int SuccessGrandTotal = 0;

        if ( victim->position == POS_BERSERK )
          SuccessGrandTotal = SuccessSubTotal + 25;
        else if ( victim->position == POS_AGGRESSIVE )
          SuccessGrandTotal = SuccessSubTotal + 10;
        else if ( victim->position == POS_DEFENSIVE )
        {
          SuccessGrandTotal = SuccessSubTotal - 10;
          learn_from_success( ch, gsn_style_defensive );
        }
        else if ( victim->position == POS_EVASIVE )
        {
          SuccessGrandTotal = SuccessSubTotal - 30;
          learn_from_success( ch, gsn_style_evasive );
        }
        else if ( victim->position == POS_PORTAL )
        {
          SuccessGrandTotal = SuccessSubTotal - 50;
          learn_from_success( ch, gsn_style_portal );
        }

	  if( SuccessGrandTotal < 1 )
              SuccessGrandTotal = 1;
	  if( SuccessGrandTotal > 100 )
	      SuccessGrandTotal = 100;

	  if( number_range(1,100) > SuccessGrandTotal )
	  {
          act( AT_BLUE, "You attempt to counter the attack with a portal, but you fail.", ch, NULL, victim, TO_VICT );
          act( AT_BLUE, "$N attempts to counter the attack with a portal, but fails.", ch, NULL, victim, TO_CHAR );
          act( AT_BLUE, "$N attempts to counter the attack with a portal, but fails.", ch, NULL, victim, TO_NOTVICT );
	    learn_from_failure( ch, gsn_portal );
	    return (dam);
	  }
	  else
	    learn_from_success( ch, gsn_portal );
	

	  int resultness = number_range(1,10);	
	  if( resultness < 6 )
	  {
	    //Deflect -- Attack is eaten by portal, costs energy and focus less than attack
          act( AT_PINK, "You tear an opening in the space-time continuum in the attack's path, ", ch, NULL, victim, TO_VICT );
          actl( AT_PINK, "sending it harmlessly into the ground in the distance.", ch, NULL, victim, TO_VICT );
          act( AT_PINK, "$N tears an opening in the space-time continuum in the attack's path, ", ch, NULL, victim, TO_CHAR );
          actl( AT_PINK, "sending it harmlessly into the ground at a distance.", ch, NULL, victim, TO_CHAR );
          act( AT_PINK, "$N tear an opening in the space-time continuum rips open in the attack's path, ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_PINK, "sending it harmlessly into the ground at a distance.", ch, NULL, victim, TO_NOTVICT );

          int WTFRandom = number_range(25,75);
          victim->mana -= (skill_table[attack_gsn]->min_mana - (skill_table[attack_gsn]->min_mana)/WTFRandom);
          victim->focus -= (skill_table[attack_gsn]->focus - (skill_table[attack_gsn]->focus)/WTFRandom);

	  }
	  else if( resultness > 8 )
	  {
	    //Return -- Attack is thrown back, costs energy and focus comparable to attack

          act( AT_RED, "A demonic grin grows upon your face as you see your opening. You charge towards ", ch, NULL, victim, TO_VICT );
          actl( AT_RED, "the oncoming attack full force, opening a dark violet portal directly in your ", ch, NULL, victim, TO_VICT );
          actl( AT_RED, "paths. The attack and you enter the opposing sides of the portal at virtually ", ch, NULL, victim, TO_VICT );
          actl( AT_RED, "the same time, the attack shot back at $n from an entirely new direction and  ", ch, NULL, victim, TO_VICT);
          actl( AT_RED, "you teleported behind $m where you deliver an earth-shattering kick to $s back, ", ch, NULL, victim, TO_VICT);
          actl( AT_RED, "sending $m hurtling into $s own attack. ", ch, NULL, victim, TO_VICT);

          act( AT_RED, "A demonic grin grows upon $N's face as $E sees $S opening. $N charge towards", ch, NULL, victim, TO_CHAR );
          actl( AT_RED, "the oncoming attack full force, opening a dark violet portal directly in your ", ch, NULL, victim, TO_CHAR);
          actl( AT_RED, "paths. The attack and $E enter the opposing sides of the portal at virtually  ", ch, NULL, victim, TO_CHAR);
          actl( AT_RED, "the same time, the attack shot back at you from an entirely new direction and  ", ch, NULL, victim, TO_CHAR);
          actl( AT_RED, "$n teleported behind you where $E delivers an earth-shattering kick to your back, ", ch, NULL, victim, TO_CHAR);
          actl( AT_RED, "sending you hurtling into your own attack. ", ch, NULL, victim, TO_CHAR);

          act( AT_RED, "A demonic grin grows upon $N's face as $E sees $S opening. $N charge towards ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_RED, "the oncoming attack full force, opening a dark violet portal directly in your ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_RED, "paths. The attack and $E enter the opposing sides of the portal at virtually ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_RED, "the same time, the attack shot back at $n from an entirely new direction and  ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_RED, "$N teleported behind $m where $E delivers an earth-shattering kick to $s back,, ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_RED, "sending $m hurtling into $s own attack. ", ch, NULL, victim, TO_NOTVICT );

          victim->mana -= skill_table[attack_gsn]->min_mana;
          victim->focus -= skill_table[attack_gsn]->focus;

  	    global_retcode = damage( victim, ch, dam, attack_gsn );
         }
	  else
        {
          //Evade -- Demon teleports, minimal energy and focus
          act( AT_PURPLE, "You dive through a system of portals, completely evading the attack!", ch, NULL, victim, TO_VICT );
          act( AT_PURPLE, "$N dives into an open portal, appearing elsewhere completely unscathed!", ch, NULL, victim, TO_CHAR );
          act( AT_PURPLE, "$N dives into an open portal, appearing elsewhere completely unscathed!", ch, NULL, victim, TO_NOTVICT );
          victim->mana -= 2500;
          victim->focus -= 5;
        }
      }
      else
        return (dam);

  return (0);
}


void do_weaponsoul(CHAR_DATA *ch, char *argument )
{
    OBJ_DATA *obj;
    CHAR_DATA *victim;
    int dam, dam2;
    bool shorts, longs, broads, scimitar, maul, lance, extra, claw, none;
    int ikchance = 0, sn = gsn_weaponsoul;

    none = shorts = longs = broads = scimitar = maul = lance = extra = claw = FALSE;
    dam = dam2 = 0;

    if (ch->race == 9)
      sn = gsn_genocide;

    if ( !IS_NPC(ch) && ch->exp < skill_table[gsn_weaponsoul]->skill_level[ch->class] )
    {
        send_to_char( "You can't do that.\n\r", ch );
        return;
    }

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

    if( ch->focus < skill_table[gsn_weaponsoul]->focus )
    {
	send_to_char( "You need to focus more.\n\r", ch );
	return;
    }
    else
      ch->focus -= skill_table[gsn_weaponsoul]->focus ;

    obj = get_eq_char(ch, WEAR_WIELD);

    if (obj != NULL)
    {
     if( obj->pIndexData->vnum == 1260 )
	scimitar = TRUE;
     if( obj->pIndexData->vnum == 1261 )
	shorts = TRUE;
     if( obj->pIndexData->vnum == 1262 )
	longs = TRUE;
     if( obj->pIndexData->vnum == 1263 )
	broads = TRUE;
     if( obj->pIndexData->vnum == 1264 )
	lance = TRUE;
     if( obj->pIndexData->vnum == 1265 )
	maul = TRUE;
     if( obj->pIndexData->vnum == 618 || obj->pIndexData->vnum == 100338)
	extra = TRUE;
     if( obj->pIndexData->vnum == 100813 )
      claw = TRUE;
    }

    if (scimitar == FALSE && shorts == FALSE && longs == FALSE && broads == FALSE && lance == FALSE 
     && maul == FALSE && extra == FALSE && claw == FALSE)
       none = TRUE;



    int EnergyReq = skill_table[gsn_weaponsoul]->min_mana;

    if (scimitar == TRUE)
      EnergyReq *= 3;
    if (shorts == TRUE)
    {
      EnergyReq *= 2;
      ikchance = 100;
    }
    if (longs == TRUE)
    {
      EnergyReq *= 3;
      ikchance = 50;
    }
    if (broads == TRUE)
    {
      EnergyReq *= 3.5;
      ikchance = 100;
    }
    if (lance == TRUE || claw == TRUE)
      EnergyReq *= 3.5;
    if (maul == TRUE)
      EnergyReq *= 5;
    if (extra == TRUE)
    {
      EnergyReq *= 3;
      ikchance = 150;
    }
     
      if ( ch->mana < EnergyReq)
      {
        send_to_char( "You don't have enough energy.\n\r", ch );
        return;
      }
      else
        ch->mana -= EnergyReq;


    WAIT_STATE( ch, skill_table[gsn_weaponsoul]->beats );

    if ( can_use_skill(ch, number_percent(),sn ) )
    {
      if (none == TRUE)
      {
        dam = number_range( 42, 52 );
       dam2 = dam/5;
       dam *= get_attmod(ch, victim);
        if (ch->charge > 0) 
          dam = chargeDamMult(ch, dam);
        
        
        act( AT_WHITE, "Without a weapon from whose soul to pull, you are forced to fuel the attack", ch, NULL, victim, TO_CHAR );
        actl( AT_WHITE, "with your own life force. Wincing, you pull a mass of ghostly white energy ", ch, NULL, victim, TO_CHAR );
        actl( AT_WHITE, "from the core of your being, empowering it with your ki as you turn and", ch, NULL, victim, TO_CHAR );
        actl( AT_WHITE, "throw it full force at $N! &R[$t]", ch, num_punct(dam), victim, TO_CHAR );
        act( AT_RED, "Gyah! That stings! &W[$t] ", ch, num_punct(dam2), victim, TO_CHAR );

        act( AT_WHITE, "Without a weapon from whose soul to pull, $n is forced to fuel the attack", ch, NULL, victim, TO_VICT );
        actl( AT_WHITE, "with $s own life force. Wincing, $e pulls a mass of ghostly white energy  ", ch, NULL, victim, TO_VICT );
        actl( AT_WHITE, "from the core of $s being, empowering it with $s ki as $e turns and ", ch, NULL, victim, TO_VICT );
        actl( AT_WHITE, "throw it full force at you! &R[$t]", ch, num_punct(dam2), victim, TO_VICT );

        act( AT_WHITE, "Without a weapon from whose soul to pull, $n is forced to fuel the attack", ch, NULL, victim, TO_NOTVICT );
        actl( AT_WHITE, "with $s own life force. Wincing, $e pulls a mass of ghostly white energy  ", ch, NULL, victim, TO_NOTVICT );
        actl( AT_WHITE, "from the core of $s being, empowering it with $s ki as $e turns and ", ch, NULL, victim, TO_NOTVICT );
        actl( AT_WHITE, "throw it full force at $N! &R[$t]", ch, num_punct(dam2), victim, TO_NOTVICT );
     
        if (ch->hit >= dam2)
          ch->hit -= dam2;
        else
        {
          dam = (ch->hit) * (dam/10);
          ch->hit = 0;
        }

     learn_from_failure( ch, sn );
     global_retcode = damage( ch, victim, dam, sn );
     return;
 
      }

      if (shorts == TRUE)
      {
        if ( (number_range(1,ikchance) == 1) && (!xIS_SET(ch->act, PLR_SPAR)) )
        {
          act( AT_RED, "You see your opening and lunge for it, drawing forth your longsword's soul ", ch, NULL, victim, TO_CHAR ); 
          actl( AT_RED, "in its entirety on the fly as you make a mad dash for $N. Super-charging ", ch, NULL, victim, TO_CHAR ); 
          actl( AT_RED, "the violet energy with your own ki, you force the soul back into your blade, ", ch, NULL, victim, TO_CHAR ); 
          actl( AT_RED, "pushing it to the very limit of its capacity. ", ch, NULL, victim, TO_CHAR ); 
          act( AT_RED, "You come to a sudden stop mere feet from $N, throwing from your longsword ", ch, NULL, victim, TO_CHAR ); 
          actl( AT_RED, "a violent blade of purplish energy! The blade shatters in your grip!", ch, NULL, victim, TO_CHAR ); 

          act( AT_RED, "$n sees $s opening and lunges for it, drawing forth $s longsword's soul ", ch, NULL, victim, TO_VICT ); 
          actl( AT_RED, "in its entirety on the fly as $e makes a mad dash for you. Super-charging ", ch, NULL, victim, TO_VICT ); 
          actl( AT_RED, "the violet energy with $s own ki, $n forces the soul back into $s blade, ", ch, NULL, victim, TO_VICT ); 
          actl( AT_RED, "pushing it to the very limit of its capacity. ", ch, NULL, victim, TO_VICT ); 
          act( AT_RED, "$n comes to a sudden stop mere feet from you, throwing from $s longsword ", ch, NULL, victim, TO_VICT ); 
          actl( AT_RED, "a violent blade of purplish energy! The blade shatters in $s grip!", ch, NULL, victim, TO_VICT ); 

          act( AT_RED, "$n sees $s opening and lunges for it, drawing forth $s longsword's soul ", ch, NULL, victim, TO_NOTVICT ); 
          actl( AT_RED, "in its entirety on the fly as $e makes a mad dash for $N. Super-charging ", ch, NULL, victim, TO_NOTVICT ); 
          actl( AT_RED, "the violet energy with $s own ki, $n forces the soul back into $s blade, ", ch, NULL, victim, TO_NOTVICT ); 
          actl( AT_RED, "pushing it to the very limit of its capacity. ", ch, NULL, victim, TO_NOTVICT ); 
          act( AT_RED, "$n comes to a sudden stop mere feet from $N, throwing from $s longsword ", ch, NULL, victim, TO_NOTVICT ); 
          actl( AT_RED, "a violent blade of purplish energy! The blade shatters in $s grip!", ch, NULL, victim, TO_NOTVICT ); 

            obj_from_char( obj );
            extract_obj( obj );

          if (victim->pl / ch->pl >= 2)
          {
            dam = 0;
            act( AT_BLUE, "$N bats the energy blade aside, detonating it harmlessly in the distance! &W[0]", ch, NULL, victim, TO_CHAR );
            act( AT_BLUE, "You bat the energy blade aside, detonating it harmlessly in the distance! &W[0]", ch, NULL, victim, TO_VICT );
            act( AT_BLUE, "$N bats the energy blade aside, detonating it harmlessly in the distance! &W[0]", ch, NULL, victim, TO_NOTVICT );  
          }
          else
          {
            dam = 999999999;
            act( AT_RED, "THE BLADE PASSES DIAGONALLY THROUGH THE TORSO! $N is dead before $S torso hits the ground! &W[IK]", ch, NULL, victim, TO_CHAR );
            act( AT_RED, "THE BLADE PASSES DIAGONALLY THROUGH YOUR TORSO! You are dead before your torso hits the ground! &W[IK]", ch, NULL, victim, TO_VICT );
            act( AT_RED, "THE BLADE PASSES DIAGONALLY THROUGH THE TORSO! $N is dead before $S torso hits the ground! &W[IK]", ch, NULL, victim, TO_NOTVICT );
          }       
        }
        else
        {
          dam = get_attmod(ch, victim) * number_range( 52, 60 );
          if (ch->charge > 0) 
            dam = chargeDamMult(ch, dam);

          act( AT_PURPLE, "Your longsword glows with an unholy violet light, after-images of its ", ch, NULL, victim, TO_CHAR ); 
          actl( AT_PURPLE, "blade following it like a shadow as you pull it back behind your head, ", ch, NULL, victim, TO_CHAR ); 
          actl( AT_PURPLE, "twisting the sword in your hand, channeling your ki into its violet energies. ", ch, NULL, victim, TO_CHAR ); 
          actl( AT_PURPLE, "Lunging forward, you swing the blade in a wide arc, sending a energy blade", ch, NULL, victim, TO_CHAR ); 
          actl( AT_PURPLE, "screaming at $N! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

          act( AT_PURPLE, "$n's longsword glows with an unholy violet light, after-images of its ", ch, NULL, victim, TO_VICT ); 
          actl( AT_PURPLE, "blade following it like a shadow as $e pulls it back behind $s head, ", ch, NULL, victim, TO_VICT ); 
          actl( AT_PURPLE, "twisting the sword in $s hand, channeling $s ki into its violet energies. ", ch, NULL, victim, TO_VICT ); 
          actl( AT_PURPLE, "Lunging forward, $e swings the blade in a wide arc, sending a energy blade", ch, NULL, victim, TO_VICT ); 
          actl( AT_PURPLE, "screaming at you! &W[$t]", ch, num_punct(dam), victim, TO_VICT );

          act( AT_PURPLE, "$n's longsword glows with an unholy violet light, after-images of its ", ch, NULL, victim, TO_NOTVICT ); 
          actl( AT_PURPLE, "blade following it like a shadow as $e pulls it back behind $s head, ", ch, NULL, victim, TO_NOTVICT ); 
          actl( AT_PURPLE, "twisting the sword in $s hand, channeling $s ki into its violet energies. ", ch, NULL, victim, TO_NOTVICT ); 
          actl( AT_PURPLE, "Lunging forward, $e swings the blade in a wide arc, sending a energy blade", ch, NULL, victim, TO_NOTVICT ); 
          actl( AT_PURPLE, "screaming at $N! &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );
        }

      }

      if (longs == TRUE || extra == TRUE)
      {
        if ( (number_range(1,ikchance) == 1) && (!xIS_SET(ch->act, PLR_SPAR)) )
        {
           act( AT_DGREY, "Diving back from the melee momentarily, you catch $N offguard and move to ", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "capitalize in a massive way. Bringing your katana back in a ready ", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "position, you pull forth from it the entirety of its soul's energy and ", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "charge it into a more stable form, then throw it back into the blade, ", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "nearly overloading the weapon with raw power. Finishing the entire exercise ", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "in the millimoments after diving backwards, your contact with the ground ", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "is short and fleeting as you throw yourself torwards $N. You approach with ", ch, NULL, victim, TO_CHAR );
          actl( AT_DGREY, "blinding speed and bring the blade screaming through $S torso. ", ch, NULL, victim, TO_CHAR );
           act( AT_DGREY, "Complete silence follows.   ", ch, NULL, victim, TO_CHAR );

           act( AT_DGREY, "Diving back from the melee momentarily, $n catches you offguard and moves to ", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "capitalize in a massive way. Bringing $s katana back in a ready ", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "position, $e pulls forth from it the entirety of its soul's energy and ", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "charges it into a more stable form, then throws it back into the blade, ", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "nearly overloading the weapon with raw power. Finishing the entire exercise ", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "in the millimoments after diving backwards, $s contact with the ground ", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "is short and fleeting as $e throws $mself torwards you. $n approaches with ", ch, NULL, victim, TO_VICT );
          actl( AT_DGREY, "blinding speed and brings the blade screaming through your torso. ", ch, NULL, victim, TO_VICT );
           act( AT_DGREY, "Complete silence follows.   ", ch, NULL, victim, TO_VICT );

           act( AT_DGREY, "Diving back from the melee momentarily, $n catches $N offguard and moves to ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "capitalize in a massive way. Bringing $s katana back in a ready ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "position, $e pulls forth from it the entirety of its soul's energy and ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "charges it into a more stable form, then throws it back into the blade, ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "nearly overloading the weapon with raw power. Finishing the entire exercise ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "in the millimoments after diving backwards, $s contact with the ground ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "is short and fleeting as $e throws $mself torwards $N. $n approaches with ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_DGREY, "blinding speed and brings the blade screaming through $S torso. ", ch, NULL, victim, TO_NOTVICT );
           act( AT_DGREY, "Complete silence follows.   ", ch, NULL, victim, TO_NOTVICT );

          if (longs == TRUE)
          {              
            obj_from_char( obj );
            extract_obj( obj );
          }

          if (victim->pl / ch->pl >= 2)
          {
            dam = 0;

            if (longs == TRUE)
            {  
              act( AT_DGREY, "Your katana implodes in your grip, but $N is... still standing... amazing... &W[0]", ch, NULL, victim, TO_CHAR );
              act( AT_DGREY, "$n's katana implodes in $s grip, but you are still standing. Weakling. &W[0]", ch, NULL, victim, TO_VICT );
              act( AT_DGREY, "$n's katana implodes in $s grip, but $N is... still standing... amazing... &W[0]", ch, NULL, victim, TO_NOTVICT );

            }
            else
            {
              act( AT_DGREY, "$N turns around, unscathed. How strong can $E possibly be?! &W[0]", ch, NULL, victim, TO_CHAR );  
              act( AT_DGREY, "You turn around, unscathed. How weak can $e possibly be? &W[0]", ch, NULL, victim, TO_VICT );  
              act( AT_DGREY, "$N turns around, unscathed. How strong can $E possibly be?! &W[0]", ch, NULL, victim, TO_NOTVICT );  

            }
          }
          else
          {
            dam = 999999999;

            if (longs == TRUE)
            {  
              act( AT_RED, "$N and your katana both IMPLODE INTO NOTHINGNESS! &W[INSTANT KILL!]", ch, NULL, victim, TO_CHAR );
              act( AT_RED, "You and $s katana both IMPLODE INTO NOTHINGNESS! &W[INSTANT KILL!]", ch, NULL, victim, TO_VICT );
              act( AT_RED, "$N and $n's katana both IMPLODE INTO NOTHINGNESS! &W[INSTANT KILL!]", ch, NULL, victim, TO_NOTVICT );

            }
            else
            {
              act( AT_RED, "It seems as if you have missed $N... until $E FALLS IN AN EXPLOSION OF BLOOD! &W[INSTANT KILL!]", ch, NULL, victim, TO_CHAR );
              act( AT_RED, "It seems as if $n has missed you... until you FALL IN AN EXPLOSION OF BLOOD! &W[INSTANT KILL!]", ch, NULL, victim, TO_VICT );
              act( AT_RED, "It seems as if $n has missed $N... until $E FALLS IN AN EXPLOSION OF BLOOD! &W[INSTANT KILL!]", ch, NULL, victim, TO_NOTVICT );

            }
          }       
        }
        else
        {
          dam = get_attmod(ch, victim) * number_range( 48, 60 );
          if (ch->charge > 0) 
            dam = chargeDamMult(ch, dam);

           act( AT_GREEN, "Your katana glows with an unholy jade light, its substance sharp and ", ch, NULL, victim, TO_CHAR );
          actl( AT_GREEN, "precise like a laser beam. As you step back, the blade of green energy", ch, NULL, victim, TO_CHAR ); 
          actl( AT_GREEN, "lengthens, becoming thin and two-dimensional at its point. Lunging forward, ", ch, NULL, victim, TO_CHAR );
          actl( AT_GREEN, "you slash the weapon horizontally across $N, the sudden expulsion of energy ", ch, NULL, victim, TO_CHAR );
          actl( AT_GREEN, "leaving a jade horizon that divides $M at the torso. &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

           act( AT_GREEN, "$n's katana glows with an unholy jade light, its substance sharp and ", ch, NULL, victim, TO_VICT );
          actl( AT_GREEN, "precise like a laser beam. As $e steps back, the blade of green energy", ch, NULL, victim, TO_VICT ); 
          actl( AT_GREEN, "lengthens, becoming thin and two-dimensional at its point. Lunging forward, ", ch, NULL, victim, TO_VICT );
          actl( AT_GREEN, "$e slashes the weapon horizontally across you, the sudden expulsion of energy ", ch, NULL, victim, TO_VICT );
          actl( AT_GREEN, "leaving a jade horizon that divides you at the torso. &W[$t]", ch, num_punct(dam), victim, TO_VICT );

           act( AT_GREEN, "$n's katana glows with an unholy jade light, its substance sharp and ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_GREEN, "precise like a laser beam. As $e steps back, the blade of green energy", ch, NULL, victim, TO_NOTVICT ); 
          actl( AT_GREEN, "lengthens, becoming thin and two-dimensional at its point. Lunging forward, ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_GREEN, "$e slashes the weapon horizontally across $N, the sudden expulsion of energy ", ch, NULL, victim, TO_NOTVICT );
          actl( AT_GREEN, "leaving a jade horizon that divides $M at the torso. &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );
        }

      }

      if (broads == TRUE)
      {
        if ( (number_range(1,ikchance) == 1) && (!xIS_SET(ch->act, PLR_SPAR)) )
        {
            act( AT_DGREY, "You spin a full 360 degrees, waving your claymore around you to give yourself", ch, NULL, victim, TO_CHAR );
           actl( AT_DGREY, "some distance from your opponent. Gaining just the kind of time you were", ch, NULL, victim, TO_CHAR );
           actl( AT_DGREY, "after, you quickly pull the fragment of your soul from your sword, converts", ch, NULL, victim, TO_CHAR );
           actl( AT_DGREY, "it into a usable form, and thrust it back into the blade.", ch, NULL, victim, TO_CHAR );
            act( AT_DGREY, "A mass of blue light in your hand, your claymore leaves after-images in", ch, NULL, victim, TO_CHAR );
           actl( AT_DGREY, "its wake as you lunge high above $N and bring it slashing down towards $M...", ch, NULL, victim, TO_CHAR ); 

            act( AT_DGREY, "$n spins a full 360 degrees, waving $s claymore around $m to give ", ch, NULL, victim, TO_VICT );
           actl( AT_DGREY, "$mself some distance from you. Gaining just the kind of time $e was", ch, NULL, victim, TO_VICT );
           actl( AT_DGREY, "after, $n quickly pulls the fragment of $s soul from $s sword, converts", ch, NULL, victim, TO_VICT );
           actl( AT_DGREY, "it into a usable form, and thrusts it back into the blade.", ch, NULL, victim, TO_VICT );
            act( AT_DGREY, "A mass of blue light in $s hand, $n's claymore leaves after-images in", ch, NULL, victim, TO_VICT );
           actl( AT_DGREY, "its wake as $e lunges high above you and brings it slashing down towards you...", ch, NULL, victim, TO_VICT ); 

            act( AT_DGREY, "$n spins a full 360 degrees, waving $s claymore around $m to give $mself", ch, NULL, victim, TO_NOTVICT );
           actl( AT_DGREY, "some distance from $s opponent. Gaining just the kind of time $e was", ch, NULL, victim, TO_NOTVICT );
           actl( AT_DGREY, "after, $n quickly pulls the fragment of $s soul from $s sword, converts", ch, NULL, victim, TO_NOTVICT );
           actl( AT_DGREY, "it into a usable form, and thrusts it back into the blade.", ch, NULL, victim, TO_NOTVICT );
            act( AT_DGREY, "A mass of blue light in $s hand, $n's claymore leaves after-images in", ch, NULL, victim, TO_NOTVICT );
           actl( AT_DGREY, "its wake as $e lunges high above $N and brings it slashing down towards $M...", ch, NULL, victim, TO_NOTVICT );   
  

            obj_from_char( obj );
            extract_obj( obj );

          if (victim->pl / ch->pl >= 2)
          {
            dam = 0;
            act( AT_DGREY, "...and hit $M dead-on! Only... $E isn't hurt. At all. That can't be good. &W[0]", ch, NULL, victim, TO_CHAR ); 
            act( AT_DGREY, "...and hit you dead-on! Only... you aren't hurt. At all. Owned. &W[0]", ch, NULL, victim, TO_VICT ); 
            act( AT_DGREY, "...and hit $M dead-on! Only... $E isn't hurt. At all. That can't be good. &W[0]", ch, NULL, victim, TO_NOTVICT ); 

          }
          else
          {
            dam = 999999999;
            act( AT_RED, "...and carve $M STRAIGHT DOWN THE MIDDLE! Your claymore shatters in your grip! &W[INSTANT KILL!]", ch, NULL, victim, TO_CHAR );
            act( AT_RED, "...and carve $M STRAIGHT DOWN THE MIDDLE! $n's claymore shatters in $s grip! &W[INSTANT KILL!]", ch, NULL, victim, TO_VICT );
            act( AT_RED, "...and carve $M STRAIGHT DOWN THE MIDDLE! $n's claymore shatters in $s grip! &W[INSTANT KILL!]", ch, NULL, victim, TO_NOTVICT );

          }      
        }
        else
        {
          dam = get_attmod(ch, victim) * number_range( 48, 68 );
          if (ch->charge > 0) 
            dam = chargeDamMult(ch, dam);

            act( AT_BLUE, "Your claymore glows with an unholy azure light, which takes the shape of", ch, NULL, victim, TO_CHAR );
           actl( AT_BLUE, "the blade and grows seemingly uncontrollably until it is taller than even", ch, NULL, victim, TO_CHAR );
           actl( AT_BLUE, "you. With minimal displacement, you slash the sword downwards, fated to", ch, NULL, victim, TO_CHAR );
           actl( AT_BLUE, "land solidly across $N's shoulders! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

            act( AT_BLUE, "$n's claymore glows with an unholy azure light, which takes the shape of", ch, NULL, victim, TO_VICT );
           actl( AT_BLUE, "the blade and grows seemingly uncontrollably until it is taller than even", ch, NULL, victim, TO_VICT );
           actl( AT_BLUE, "$e. With minimal displacement, $e slashes the sword downwards, fated to", ch, NULL, victim, TO_VICT );
           actl( AT_BLUE, "land solidly across your shoulders! &W[$t]", ch, num_punct(dam), victim, TO_VICT );

            act( AT_BLUE, "$n's claymore glows with an unholy azure light, which takes the shape of", ch, NULL, victim, TO_NOTVICT );
           actl( AT_BLUE, "the blade and grows seemingly uncontrollably until it is taller than even", ch, NULL, victim, TO_NOTVICT );
           actl( AT_BLUE, "$e. With minimal displacement, $e slashes the sword downwards, fated to", ch, NULL, victim, TO_NOTVICT );
           actl( AT_BLUE, "land solidly across $N's shoulders! &W[$t]", ch, num_punct(dam), victim, TO_VICT );

        }

      }
  
      if (scimitar == TRUE)
      {
        dam = get_attmod(ch, victim) * number_range( 50, 55 );
        if (ch->charge > 0) 
          dam = chargeDamMult(ch, dam);
        
             act( AT_YELLOW, "Whipping your twin scimitars about in a serpentine fury, a pale yellow light", ch, NULL, victim, TO_CHAR );
            actl( AT_YELLOW, "starts to glow forth from their blades. Like a cornered beast you suddenly", ch, NULL, victim, TO_CHAR );
            actl( AT_YELLOW, "lunge forward and strike, slashing them across $N's chest like a pincer! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );
             act( AT_YELLOW, "You think you hear a crack from $N's armor as the resulting explosion settles!", ch, NULL, victim, TO_CHAR );

             act( AT_YELLOW, "Whipping $s twin scimitars about in a serpentine fury, a pale yellow light", ch, NULL, victim, TO_VICT );
            actl( AT_YELLOW, "starts to glow forth from $n's blades. Like a cornered beast $e suddenly", ch, NULL, victim, TO_VICT );
            actl( AT_YELLOW, "lunges forward and strikes, slashing them across your chest like a pincer! &W[$t]", ch, num_punct(dam), victim, TO_VICT );
             act( AT_YELLOW, "You think you hear a crack from your armor as the resulting explosion settles...", ch, NULL, victim, TO_VICT );

             act( AT_YELLOW, "Whipping $s twin scimitars about in a serpentine fury, a pale yellow light", ch, NULL, victim, TO_NOTVICT );
            actl( AT_YELLOW, "starts to glow forth from $n's blades. Like a cornered beast $e suddenly", ch, NULL, victim, TO_NOTVICT );
            actl( AT_YELLOW, "lunges forward and strikes, slashing them across $N's chest like a pincer! &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );
             act( AT_YELLOW, "You think you hear a crack from $N's armor as the resulting explosion settles...", ch, NULL, victim, TO_NOTVICT );

     
        dam_armor_recalc(victim, (dam * 2)); 

      }

      if (lance == TRUE || claw == TRUE)
      {
        dam = get_attmod(ch, victim) * number_range( 50, 62 );

        if (ch->charge > 0) 
          dam = chargeDamMult(ch, dam);

	  if (claw == TRUE) 
        {       
		 act( AT_LBLUE, "You hold out your clawed hand as if grasping an imaginary lance, which forms as", ch, NULL, victim, TO_CHAR );
		 act( AT_LBLUE, "$n holds out $s clawed hand as if grasping an imaginary lance, which forms as", ch, NULL, victim, TO_VICT );
		 act( AT_LBLUE, "$n holds out $s clawed hand as if grasping an imaginary lance, which forms as", ch, NULL, victim, TO_NOTVICT );
        }
	  else
	  {
             act( AT_LBLUE, "Pointing your lance at $N, you enflare the weapon's internal energies until", ch, NULL, victim, TO_CHAR );
             act( AT_LBLUE, "Pointing $s lance at you, $n enflares $s weapon's internal energies until", ch, NULL, victim, TO_VICT );
             act( AT_LBLUE, "Pointing $s lance at $N, $n enflares $s weapon's internal energies until", ch, NULL, victim, TO_NOTVICT );
	  }

            actl( AT_LBLUE, "a very pale azure light envelopes it, making it seem as if a deadly spear of", ch, NULL, victim, TO_CHAR );
            actl( AT_LBLUE, "cloud. As if shot from a gun, you dash towards $N at mach speed and release ", ch, NULL, victim, TO_CHAR );
            actl( AT_LBLUE, "the lance from your grasp, launching it like a javelin straight for $M! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

            actl( AT_LBLUE, "a very pale azure light envelopes it, making it seem as if a deadly spear of", ch, NULL, victim, TO_VICT );
            actl( AT_LBLUE, "cloud. As if shot from a gun, $n dashes towards you at mach speed and releases ", ch, NULL, victim, TO_VICT );
            actl( AT_LBLUE, "the lance from $s grasp, launching it like a javelin straight for you! &W[$t]", ch, num_punct(dam), victim, TO_VICT );

            actl( AT_LBLUE, "a very pale azure light envelopes it, making it seem as if a deadly spear of", ch, NULL, victim, TO_NOTVICT );
            actl( AT_LBLUE, "cloud. As if shot from a gun, $n dashes towards $N at mach speed and releases ", ch, NULL, victim, TO_NOTVICT );
            actl( AT_LBLUE, "the lance from $s grasp, launching it like a javelin straight for $M! &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

        if (xIS_SET(victim->affected_by, AFF_FLYING))
        {
          dam += 10;
          act( AT_LBLUE, "$N is thrown from the sky like a bird shot with a rifle! &W[10]", ch, NULL, victim, TO_CHAR );
          act( AT_LBLUE, "You are thrown from the sky like a bird shot with a rifle! &W[10]", ch, NULL, victim, TO_VICT );
          act( AT_LBLUE, "$N is thrown from the sky like a bird shot with a rifle! &W[10]", ch, NULL, victim, TO_NOTVICT );
        }
        
      }

      if (maul == TRUE)
      {
        dam = get_attmod(ch, victim) * number_range( 38, 74 );

        if (ch->charge > 0) 
          dam = chargeDamMult(ch, dam);
        
             act( AT_ORANGE, "A thick, muddled light shines forth from your maul's head; you feel its weight", ch, NULL, victim, TO_CHAR );
            actl( AT_ORANGE, "quickly increasing as you prepare to execute its hidden technique. Lunging to", ch, NULL, victim, TO_CHAR );
            actl( AT_ORANGE, "one side, you successfully feint around $N and gain an opening. Performing a", ch, NULL, victim, TO_CHAR );
            actl( AT_ORANGE, "second lunge as you strike the ground behind $M, you swing your massive hammer", ch, NULL, victim, TO_CHAR );
            actl( AT_ORANGE, "about and slam it full force into $N's back! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

             act( AT_ORANGE, "A thick, muddled light shines forth from $n's maul's head; you see its weight", ch, NULL, victim, TO_VICT );
            actl( AT_ORANGE, "quickly increasing as $e prepares to execute its hidden technique. Lunging to", ch, NULL, victim, TO_VICT );
            actl( AT_ORANGE, "one side, $e successfully feints around you and gains an opening. Performing a", ch, NULL, victim, TO_VICT );
            actl( AT_ORANGE, "second lunge as $e strikes the ground behind you, $n swings $s massive hammer", ch, NULL, victim, TO_VICT );
            actl( AT_ORANGE, "about and slams it full force into your back! &W[$t]", ch, num_punct(dam), victim, TO_VICT );

             act( AT_ORANGE, "A thick, muddled light shines forth from $n's maul's head; you see its weight", ch, NULL, victim, TO_NOTVICT );
            actl( AT_ORANGE, "quickly increasing as $e prepares to execute its hidden technique. Lunging to", ch, NULL, victim, TO_NOTVICT );
            actl( AT_ORANGE, "one side, $e successfully feints around $N and gains an opening. Performing a", ch, NULL, victim, TO_NOTVICT );
            actl( AT_ORANGE, "second lunge as $e strikes the ground behind $M, $n swings $s massive hammer", ch, NULL, victim, TO_NOTVICT );
            actl( AT_ORANGE, "about and slams it full force into $N's back! &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

        if (!xIS_SET(victim->affected_by, AFF_FLYING))
        {
            dam += 10;
            act( AT_ORANGE, "The force throws $N to the ground, your maul close behind! &W[10]", ch, NULL, victim, TO_CHAR );
            act( AT_ORANGE, "The force throws you to the ground, $n's maul close behind! &W[10]", ch, NULL, victim, TO_VICT );
            act( AT_ORANGE, "The force throws $N to the ground, $n's maul close behind! &W[10]", ch, NULL, victim, TO_NOTVICT );

        }
      }
     learn_from_success( ch, sn );
     global_retcode = damage( ch, victim, dam, sn );
    }
    else
    {
       act( AT_BLUE, "You attempt to pull forth the fragment of your soul from your weapon... but fail.", ch, NULL, victim, TO_CHAR );
       act( AT_BLUE, "$n attempts to do something with his weapon, but fails.", ch, NULL, victim, TO_VICT );
       act( AT_BLUE, "$n attempts to do something with his weapon, but fails.", ch, NULL, victim, TO_NOTVICT );

        learn_from_failure( ch, sn );
        global_retcode = damage( ch, victim, 0, sn );

    }

  return;
}
