#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));

bool removeGenieTrans( CHAR_DATA *ch )
{
  if( xIS_SET( ch->affected_by, AFF_EVIL_TRANS ) )
  {
    xREMOVE_BIT( ch->affected_by, AFF_EVIL_TRANS );
    transStatRemove( ch );
    return TRUE;
  }
  if( xIS_SET( ch->affected_by, AFF_SUPER_TRANS ) )
  {
    xREMOVE_BIT( ch->affected_by, AFF_SUPER_TRANS );
    transStatRemove( ch );
    return TRUE;
  }
  if( xIS_SET( ch->affected_by, AFF_KID_TRANS ) )
  {
    xREMOVE_BIT( ch->affected_by, AFF_KID_TRANS );
    transStatRemove( ch );
    return TRUE;
  }
  if( xIS_SET( ch->affected_by, AFF_ABSORB_FORM ) )
  {
    xREMOVE_BIT( ch->affected_by, AFF_ABSORB_FORM );
    transStatRemove( ch );
    return TRUE;
  }
  return FALSE;
}

void do_transform( CHAR_DATA *ch, char *argument )
{
//    char arg1 [MAX_INPUT_LENGTH];
//    char arg2 [MAX_INPUT_LENGTH];
//    double pl_mult;

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

    if( ch->race != RACE_GENIE )
    {
	send_to_char( "You can't do that.\n\r", ch );
	return;
    }

    if( !argument || argument[0] == '\0' )
    {
	send_to_char( "Syntax: transform [thin|super|kid/absorb]\n\r", ch );
	return;
    }

    if( !str_prefix( argument, "thin" ) )
    {
	if( ch->exp < skill_table[gsn_thin_trans]->min_level[ch->race] )
	{
	    send_to_char( "You can't do that at your level.\n\r", ch );
	    return;
	}

	if ( !IS_NPC(ch) && ch->pcdata->learned[gsn_thin_trans] <= 0 )
	{
	    send_to_char( "You can't do that.\n\r", ch );
	    return;
	}

	if( xIS_SET( ch->affected_by, AFF_EVIL_TRANS ))
	{
	    send_to_char( "You're already in Thin Form!\n\r", ch );
	    return;
	}

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

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

	if ( can_use_skill( ch, number_percent(), gsn_thin_trans ) )
	{
	    removeGenieTrans( ch );
	    act( AT_PINK, "Steam courses through the series of holes along your head, as you begin", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "to let out a high-pitched shriek.  Your rolling layers of pink flesh", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "rapidly compact, giving you a leaner, more sinister look.", ch, NULL, NULL, TO_CHAR );

	    act( AT_PINK, "Steam courses through the series of holes along $n's head as $e begins", ch, NULL, NULL, TO_NOTVICT );
	    act( AT_PINK, "to let out a high-pitched shriek.  $s rolling layers of pink flesh rapidly", ch, NULL, NULL, TO_NOTVICT );
	    act( AT_PINK, "compact, giving $m a leaner, more sinister look.", ch, NULL, NULL, TO_NOTVICT );
	    xSET_BIT( ch->affected_by, AFF_EVIL_TRANS );
	    ch->pl = ch->exp * 12;
	    transStatApply(ch, 9, 6, 6, 9);
	    learn_from_success( ch, gsn_thin_trans );
	}
	else
	{
	    act( AT_PLAIN, "You failed.", ch, NULL, NULL, TO_CHAR );
	    learn_from_failure( ch, gsn_thin_trans );
	}

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

    if( !str_prefix( argument, "super" ) )
    {
	if( ch->exp < skill_table[gsn_super_trans]->min_level[ch->race] )
	{
	    send_to_char( "You can't do that at your level.\n\r", ch );
	    return;
	}

        if ( !IS_NPC(ch) && ch->pcdata->learned[gsn_super_trans] <= 0 )
        {
            send_to_char( "You can't do that.\n\r", ch );
            return;
        }

	if( xIS_SET( ch->affected_by, AFF_SUPER_TRANS ))
	{
	    send_to_char( "You're already in Super Form!\n\r", ch );
	    return;
	}

	if( !xIS_SET( ch->affected_by, AFF_EVIL_TRANS ))
	{
	    send_to_char( "You must be in Thin Form to ascend to Super Form.\n\r", ch );
	    return;
	}

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

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

	if ( can_use_skill( ch, number_percent(), gsn_super_trans ) )
	{
	    removeGenieTrans( ch );
	    act( AT_PINK, "You utter a low-pitched growl, steam blasting through the porting in", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "your head, as you draw energy from your absorbed victims.  The tentacle", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "atop your head lengthens to mid-back level and your slender body bulks", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "up, taking on a powerful, muscular look.  An aura of dark purple energy", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "surrounds you.", ch, NULL, NULL, TO_CHAR );

	    act( AT_PINK, "$n utters a low-pitched growl, steam blasting through the porting", ch, NULL, NULL, TO_NOTVICT );
	    act( AT_PINK, "in $s head, as $e draws energy from $s absorbed victims.  The tentacle", ch, NULL, NULL, TO_NOTVICT );
	    act( AT_PINK, "atop $s head lengthens to mid-back level and $s slender body bulks up,", ch, NULL, NULL, TO_NOTVICT );
	    act( AT_PINK, "taking on a powerful, muscular look.  An aura of dark purple energy", ch, NULL, NULL, TO_NOTVICT );
	    act( AT_PINK, "surrounds $m.", ch, NULL, NULL, TO_NOTVICT );

	    xSET_BIT( ch->affected_by, AFF_SUPER_TRANS );
	    ch->pl = ch->exp * 20;
	    transStatApply(ch, 18, 12, 12, 18);
	    learn_from_success( ch, gsn_super_trans );
	}
	else
	{
	    act( AT_PLAIN, "You failed.", ch, NULL, NULL, TO_CHAR );
	    learn_from_failure( ch, gsn_super_trans );
	}

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

    if( !str_prefix( argument, "kid" ) )
    {
	if( ch->exp < skill_table[gsn_kid_trans]->min_level[ch->race] )
	{
	    send_to_char( "You can't do that at your level.\n\r", ch );
	    return;
	}

        if ( !IS_NPC(ch) && ch->pcdata->learned[gsn_kid_trans] <= 0 )
        {
            send_to_char( "You can't do that.\n\r", ch );
            return;
        }

      if (!IS_NPC(ch) && ch->pcdata->genieform < 11)
      {
        send_to_char( "You cannot use Kid Form with someone absorbed!\n\r", ch );
        return;
      } 

	if( (!xIS_SET(ch->affected_by, AFF_SUPER_TRANS))
       && (!xIS_SET(ch->affected_by, AFF_KID_TRANS)))
	{
	    send_to_char( "You must be in Super Form to ascend to Kid Form.\n\r", ch );
	    return;
	}

	if( xIS_SET( ch->affected_by, AFF_KID_TRANS ) )
	{
	    send_to_char( "You are already in Kid Form!\n\r", ch );
	    return;
	}

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

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

	if ( can_use_skill( ch, number_percent(), gsn_kid_trans ) )
	{
	    removeGenieTrans( ch );
	    act( AT_PINK, "You bellow loudly, your voice starting deep and gradually becoming more", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "shrill as the stolen energy gives way to a terrifying strength of your", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "own.  Steam shrieks through the holes along your head, completely masking", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "your presence.  Your form shrinks and compacts and when the steam finally", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "clears, you have transformed into a child-sized version of yourself,", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "radiating a horrifying power.", ch, NULL, NULL, TO_CHAR );

	    act( AT_PINK, "$n bellows loudly, $s voice starting deep and gradually becoming more", ch, NULL, NULL, TO_NOTVICT );
	    act( AT_PINK, "shrill as the stolen energy gives way to a terrifying strength of $s own.", ch, NULL, NULL, TO_NOTVICT );
	    act( AT_PINK, "Steam shrieks through the holes along $s head, completely masking $s", ch, NULL, NULL, TO_NOTVICT );
	    act( AT_PINK, "presence.  $s form shrinks and compacts and when the steam finally", ch, NULL, NULL, TO_NOTVICT );
	    act( AT_PINK, "clears, $e has transformed into a child-sized version of $mself,", ch, NULL, NULL, TO_NOTVICT );
	    act( AT_PINK, "radiating a horrifiyng power.", ch, NULL, NULL, TO_NOTVICT );

	    xSET_BIT( ch->affected_by, AFF_KID_TRANS );
	    ch->pl = ch->exp * 25;
	    transStatApply(ch, 20, 15, 15, 20);
	    learn_from_success( ch, gsn_kid_trans );
	}
	else
	{
	    act( AT_PLAIN, "You failed.", ch, NULL, NULL, TO_CHAR );
	    learn_from_failure( ch, gsn_kid_trans );
	}

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

    if( !str_prefix( argument, "absorb" ) )
    {
	if( ch->exp < skill_table[gsn_absorb_form]->min_level[ch->race] )
	{
	    send_to_char( "You can't do that at your level.\n\r", ch );
	    return;
	}

        if ( !IS_NPC(ch) && ch->pcdata->learned[gsn_absorb_form] <= 0 )
        {
            send_to_char( "You can't do that.\n\r", ch );
            return;
        }

      if (ch->pcdata->genieform >= 11)
      {
        send_to_char( "You have to absorb someone first!\n\r", ch );
        return;
      } 

 /*     if (((ch->pcdata->genieform == 3)
        && (arg2[0] == '\0')) || (atoi(arg2) <= 24) || (atoi(arg2) >= 28) )
      {
		send_to_char( "Syntax: transform absorb [25, 26, or 27]\n\r", ch );
		return;
   	}

      if (((ch->pcdata->genieform == 7)
       && (arg2[0] == '\0')) || (atoi(arg2) <= 24) || (atoi(arg2) >= 28) )
    	{
		send_to_char( "Syntax: transform absorb [25, 26, or 27]\n\r", ch );
		return;
    	}

      if (((ch->pcdata->genieform == 8)
       && (arg2[0] == '\0')) || (atoi(arg2) <= 22) || (atoi(arg2) >= 27) )
    	{
		send_to_char( "Syntax: transform absorb [23, 24, 25, or 26]\n\r", ch );
		return;
    	}
*/

	if( (!xIS_SET(ch->affected_by, AFF_SUPER_TRANS))
       && (!xIS_SET(ch->affected_by, AFF_ABSORB_FORM)))
	{
	    send_to_char( "You must be in Super Form to ascend to your Absorbed Form.\n\r", ch );
	    return;
	}

	if( xIS_SET( ch->affected_by, AFF_ABSORB_FORM ) )
	{
	    send_to_char( "You are already in your Absorbed Form!\n\r", ch );
	    return;
	}

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

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

	if ( can_use_skill( ch, number_percent(), gsn_absorb_form ) )
	{
        removeGenieTrans( ch );

 	  if (ch->pcdata->genieform == 0) /* Saiyan */
        {
	    act( AT_YELLOW, "You close your eyes, perception drifting inwards towards the formidable Saiyan you have captured. Held unconscious in your brain's membranes, the Saiyan being has no choice but to relinquish their power to you. The rage and determination of their soul merge with your semi-solid body, sending forth a powerful tingling sensation.", ch, NULL, NULL, TO_CHAR );
	    act( AT_YELLOW, "In sync with your internal energy, your external form compacts itself into a sinewy form, borrowing heavily from the encaged Saiyan's physique and giving you a form that looks startingly similar to the unlucky soul. Your eyes glow a deep teal and a golden yellow aura expands about you, completing the synchronization between your energy and the Saiyan's soul.", ch, NULL, NULL, TO_CHAR );

	    act( AT_YELLOW, "$n closes $s eyes, $s perception drifting inwards towards a powerful being held unconscious within $s brain's membrane. Within seconds, the physical and mental changes begin. $n's form becomes tight and sinewy, like a Saiyan's physique, and a pronounced cockiness seems to ooze into $s body language. Glowing, teal eyes and a bright gold aura give an illusion of Super Saiyan energies as the transformation finishes, leaving a much stronger -- albeit more than likely less patient -- $n.", ch, NULL, NULL, TO_NOTVICT );

	    ch->pl = ch->exp * 29;
	    transStatApply(ch, 28, 16, 13, 21);
        }
 	  if (ch->pcdata->genieform == 1) /* Human */
        {
	    act( AT_WHITE, "You close your eyes, perception drifting inwards towards the formidable Human you have captured. Held unconscious in your brain's membranes, the Human being has no choice but to relinquish their power to you. The courage and utter bravery of their soul merge with your semi-solid body, sending forth an encouraging tingling sensation.", ch, NULL, NULL, TO_CHAR );
	    act( AT_WHITE, "In sync with your internal energy, your external form shifts to a more human-like appearance, borrowing heavily from the encaged Human's physique and giving you a form that looks startingly similar to the unlucky soul. Faint white energy radiates you alongside a coming of enlightment known before to only the wisest of humans, completing the synchronization between your energy and the Human's soul.", ch, NULL, NULL, TO_CHAR );

	    act( AT_WHITE, "$n closes $s eyes, $s perception drifting inwards towards a powerful being held unconscious within $s brain's membrane. Within seconds, the physical and mental changes begin. $n's form becomes more human-like, less like a gooey monstrosity, and $s eyes become steely hard with determination. A faint white energy radiates forth from $n's body, leaving a feeling of intense enlightenment in the air.", ch, NULL, NULL, TO_NOTVICT );

	    ch->pl = ch->exp * 26;
	    transStatApply(ch, 23, 16, 15, 29);
        }
 	  if (ch->pcdata->genieform == 2) /* Halfbreed */
        {
	    act( AT_YELLOW, "You close your eyes, perception drifting inwards towards the formidable Halfbreed you have captured. Held unconscious in your brain's membranes, the half-Saiyan, half-Human being has no choice but to relinquish their power to you. The intense rage and potential for greatness of their soul merge with your semi-solid body, sending forth an adrenaline rush of a tingling sensation.", ch, NULL, NULL, TO_CHAR );
	    act( AT_YELLOW, "In sync with your internal energy, your external form shifts to a more sinewy, demi-Saiyan appearance, borrowing heavily from the encaged Halfbreed's physique and giving you a form that looks startingly similar to the unlucky soul. Your eyes glow a deep teal and a golden yellow aura expands about you, completing the synchronization between your energy and the Halfbreed's soul.", ch, NULL, NULL, TO_CHAR );

	    act( AT_YELLOW, "$n closes $s eyes, $s perception drifting inwards towards a powerful being held unconscious within $s brain's membrane. Within seconds, the physical and mental changes begin. $n's form becomes more human-like, although with a pronounce Saiyan edge, and $e stands with a great deal more confidence. Glowing, teal eyes and a bright gold aura give an illusion of Super Saiyan energies as the transformation finishes, leaving a stronger, faster $n with minor sacrifices in intelligence.", ch, NULL, NULL, TO_NOTVICT );

	    ch->pl = ch->exp * 25;
	    transStatApply(ch, 25, 15, 12, 20);
        }
 	  if (ch->pcdata->genieform == 3) /* Namek */
        {
	    act( AT_GREEN, "You close your eyes, perception drifting inwards towards the formidable Namek you have captured. Held unconscious in your brain's membranes, the Namek being has no choice but to relinquish their power to you. The mental clarity and inner calm of their soul merge with your semi-solid body, sending forth a transcendental sensation.", ch, NULL, NULL, TO_CHAR );
	    act( AT_GREEN, "In sync with your internal energy, your external form shifts to an alien appearance like that of a Namek, borrowing heavily from the encaged Namek's physique and giving you a form that looks startingly similar to the unlucky soul. Bright green energy flames curl up about you in place of an aura, completing the synchronization between your energy and the Namek's soul.", ch, NULL, NULL, TO_CHAR );

	    act( AT_GREEN, "$n closes $s eyes, $s perception drifting inwards towards a powerful being held unconscious within $s brain's membrane. Within seconds, the physical and mental changes begin. $n's form becomes closer to a Namek's, small nubs of antennae budding on $s forehead as fang-like teeth develop inside his mouth. Great, green energy flames curl up from about him, finishing $n's bonding with his Namek prisoner.", ch, NULL, NULL, TO_NOTVICT );

/*          pl_mult = atoi(arg2);
	    ch->pl = ch->exp * pl_mult;
          if (pl_mult == 25)
	      transStatApply(ch, 15, 14, 20, 15);
          if (pl_mult == 26)
	      transStatApply(ch, 16, 15, 21, 16);
          if (pl_mult == 27)
	      transStatApply(ch, 17, 16, 22, 17);*/

	    ch->pl = ch->exp * 26;
	      transStatApply(ch, 16, 15, 21, 16);
        }

 	  if (ch->pcdata->genieform == 4) /* Android */
        {
	    act( AT_DGREY, "You close your eyes, perception drifting inwards towards the fully mechanical Android you have captured. Held in a limbo before consciousness in your brain's membranes, the automaton has no choice but to relinquish their power to you. Their calculating cruelty and emotionless strength spread through your body, fine wires constructing themselves throughout your goo-like body.", ch, NULL, NULL, TO_CHAR );
	    act( AT_DGREY, "The goo of your body glows several shades a brighter silver, fine mechanical wires becoming readily apparent on your body as you assimilate the android completely. Your eyes take on a kind of dead emotion, feeling an empty anger tainted by a lack of emotion or caring. Bonding completely with the captured Android, you fully ascend to a sort of a Mecha Genie.", ch, NULL, NULL, TO_CHAR );

	    act( AT_DGREY, "$n closes $s eyes, $s perception drifting inwards towards a powerful being held unconscious within $s brain's membrane. Within seconds, the physical and mental changes begin. $n suddenly becomes a dozen shades closer to silver as fine electrical wires spread throughout $s body, poking out of $s gooey flesh at random points. $n's eyes take on a dead light that lends absolutely no emotion to $m, completing $s ascension to Mecha Genie.", ch, NULL, NULL, TO_NOTVICT );

	    ch->pl = ch->exp * 25;
	    transStatApply(ch, 25, 20, 20, 25);
        }

 	  if (ch->pcdata->genieform == 5) /* Icer */
        {
	    act( AT_PURPLE, "You close your eyes, perception drifting inwards towards the formidable Icer you have captured. Held unconscious in your brain's membranes, the Icerian being has no choice but to relinquish their power to you. The inherent cruelty and inability to surrender in their soul merge with your semi-solid body, sending forth a chilling, tingling sensation.", ch, NULL, NULL, TO_CHAR );
	    act( AT_PURPLE, "In sync with your internal energy, your external form becomes greatly compacted into an almost feminine form, your forelock extending to a great length behind your head, as if a tail. Your form borrows heavily from the encaged Icer's physique and giving you a form that looks startingly similar to the unlucky soul. Chilling, purple flames expand from you as your eyes fade to a deeper tone, completing the synchronization between your energy and the Icer's soul.", ch, NULL, NULL, TO_CHAR );

	    act( AT_PURPLE, "$n closes $s eyes, $s perception drifting inwards towards a powerful being held unconscious within $s brain's membrane. Within seconds, the physical and mental changes begin. $n's forelock extends to great lengths behind $s back like a prehensile tail while violent, purple energy flames plummet the temperature to near-freezing levels. With the power of a mighty Icer in completely in tune with $s energy, $n's transformation is finished.", ch, NULL, NULL, TO_NOTVICT );

	    ch->pl = ch->exp * 27;
	    transStatApply(ch, 20, 15, 12, 27);
        }

 	  if (ch->pcdata->genieform == 6) /* Bio-Android */
        {
	    act( AT_PURPLE, "You close your eyes, perception drifting inwards towards the Biological Android you have captured. You suck forth from them in their unconscious state the powers of both their and their victims' souls, combining your indestructible nature with the Bio-Android's cunning and natural intent to kill. The hunger for death builds on your lips as the physical changes set in.", ch, NULL, NULL, TO_CHAR );
	    act( AT_PURPLE, "In sync with your internal changes, your external features steadily change to an even more horrific, inhuman form, with large patches of darkened spots spattering your quickly deforming skin. Your new form so closely resembles your victim's, it is almost unsettling to look upon you and know why you look as you do. Transparent souls begin to orbit about you, long dead victims of your victim, their exponentially greater eternal hell giving birth to your new Bio-Android form.", ch, NULL, NULL, TO_CHAR );

	    act( AT_PURPLE, "$n closes $s eyes, $s perception drifting inwards towards a powerful being held unconscious within $s brain's membrane. Within seconds, the physical and mental changes begin. $n's skin deforms to a harder, shell-like covering while patches of darkened spots splatter across random sections of $s body. As transparent souls begin to orbit about $n in his doubly horrific form, the transformation is seen to be complete.", ch, NULL, NULL, TO_NOTVICT );

	    ch->pl = ch->exp * 27;
	    transStatApply(ch, 27, 23, 23, 27);
        }
 	  if (ch->pcdata->genieform == 7) /* Kaio */
        {
	    act( AT_WHITE, "You close your eyes, perception drifting inwards towards the formidable Kaio you have captured. Held unconscious in your brain's membranes, the Kaio being has no choice but to relinquish their power to you. The divine radiance of their soul merge with your semi-solid body, sending forth a heavenly tingling sensation.", ch, NULL, NULL, TO_CHAR );
	    act( AT_WHITE, "In sync with your internal energy, your external form shifts to a more Kaio-like appearance, becoming more frail and less imposing, borrowing heavily from the encaged Kaio's physique and giving you a form that looks startingly similar to the unlucky soul. Mystical white flames of energy flare up about you, completing the synchronization between your energy and the Kaio's soul.", ch, NULL, NULL, TO_CHAR );

	    act( AT_WHITE, "$n closes $s eyes, $s perception drifting inwards towards a powerful being held unconscious within $s brain's membrane. Within seconds, the physical and mental changes begin. $n's form becomes frail and less imposing, the Kaio inside $m breaking through, and $s eyes seem to soften with wisdom. Bright white energy flames flare about $n's body, leaving a feeling of heavenly divinity in the air.", ch, NULL, NULL, TO_NOTVICT );

/*          pl_mult = atoi(arg2);
	    ch->pl = ch->exp * pl_mult;
          if (pl_mult == 25)
	      transStatApply(ch, 16, 14, 20, 24);
          if (pl_mult == 26)
	      transStatApply(ch, 16, 15, 21, 25);
          if (pl_mult == 27)
	      transStatApply(ch, 17, 16, 23, 27);*/

	    ch->pl = ch->exp * 26;
	      transStatApply(ch, 16, 15, 21, 25);
        }
 	  if (ch->pcdata->genieform == 8) /* Demon */
        {
	    act( AT_RED, "You close your eyes, perception drifting inwards towards the formidable Demon you have captured. Held unconscious in your brain's membranes, the Demon being has no choice but to relinquish their power to you. The unholy damnation of their soul merges with your semi-solid body, sending forth a demonic tingling sensation.", ch, NULL, NULL, TO_CHAR );
	    act( AT_RED, "In sync with your internal energy, your external form shifts to a more Demon-like appearance, becoming more frightening and imposing, borrowing heavily from the encaged Demon's physique and giving you a form that looks startingly similar to the unlucky soul. Demonic red flames of energy flare up about you, completing the synchronization between your energy and the Demon's soul.", ch, NULL, NULL, TO_CHAR );

	    act( AT_RED, "$n closes $s eyes, $s perception drifting inwards towards a powerful being held unconscious within $s brain's membrane. Within seconds, the physical and mental changes begin. $n's form becomes frightening and more imposing, the Demon inside $m breaking through, and $s eyes seem to harden with unholy evil. Bloody, red energy flames flare about $n's body, leaving a feeling of demonic damnation in the air.", ch, NULL, NULL, TO_NOTVICT );

	    ch->pl = ch->exp * 26;
	      transStatApply(ch, 22, 20, 19, 19);
        }
 	  if (ch->pcdata->genieform == 9) /* Genie */
        {
	    act( AT_PINK, "The Genie brethren inside you pulses in its membrane cage, sending ripples of pure power throughout your body. Your mind rapidly deteriorates to your most primal instincts of destruction and mayhem, steam-like energy building up inside of you, threatening to burst inside you like a bomb.", ch, NULL, NULL, TO_CHAR );
	    act( AT_PINK, "With a high-pitched whistling sound like that of some demonic teapot, all of the steam inside you bursts forth from your massive arm and head pores, leaving your child-like body relatively unchanged but immensely empowered. ", ch, NULL, NULL, TO_CHAR );

	    act( AT_PINK, "$n roars with a primal fury as $s Genie brethren inside of $m bursts forth from its cage and throws $m back to his destructive instincts. $n's childlike body remains relatively unchanged, but you can feel it in the air that $e is massively changed on the inside. This level of power... it is almost frightening.", ch, NULL, NULL, TO_NOTVICT );

	    ch->pl = ch->exp * 28;
	    transStatApply(ch, 27, 18, 18, 27);
        }
 	  if (ch->pcdata->genieform == 10) /* Dragon */
        {
          act( AT_DGREY, "You close your eyes, perception drifting inwards towards the Shenlon Dragon ", ch, NULL, NULL, TO_CHAR );
          actl( AT_DGREY, "you have captured. Their mystical soul teems with delicious power, filling ", ch, NULL, NULL, TO_CHAR );
          actl( AT_DGREY, "you with the drunken fury of the all-powerful; it collects in your gut and ", ch, NULL, NULL, TO_CHAR );
          actl( AT_DGREY, "begins to glow with a furious power.", ch, NULL, NULL, TO_CHAR );
          actl( AT_DGREY, "In sync with your internal changes, your external features gradually morph ", ch, NULL, NULL, TO_CHAR );
          actl( AT_DGREY, "into that of the encaptured Dragon: the semi-solid goo that comprises your ", ch, NULL, NULL, TO_CHAR );
          actl( AT_DGREY, "body hardens and swells into a thick shell of armor, its color becoming a ", ch, NULL, NULL, TO_CHAR );
          actl( AT_DGREY, "deathly pale version of its former hue, and large spikes grow forth from it ", ch, NULL, NULL, TO_CHAR );
          actl( AT_DGREY, "sporadically. From your stomach, a circle of bright lights burst forth through ", ch, NULL, NULL, TO_CHAR );
          actl( AT_DGREY, "your flesh, the power of the eternal dragonballs in the palm of your hand.", ch, NULL, NULL, TO_CHAR );

          actl( AT_DGREY, "$n closes $s eyes, $s perception drifting inwards towards a powerful being ", ch, NULL, NULL, TO_NOTVICT );
          actl( AT_DGREY, "held unconscious within $s brain's membrane. Within seconds, the physical ", ch, NULL, NULL, TO_NOTVICT );
          actl( AT_DGREY, "and mental changes begin. $n's skin swells and hardens, large spikes shooting ", ch, NULL, NULL, TO_NOTVICT );
          actl( AT_DGREY, "forth from $s flesh, which soon becomes more like a Dragon's armor-like skin ", ch, NULL, NULL, TO_NOTVICT );
          actl( AT_DGREY, "than $s own gooey flesh. A circle of bright lights bursting forth from $s ", ch, NULL, NULL, TO_NOTVICT );
          actl( AT_DGREY, "stomach herald the end of the transformation...", ch, NULL, NULL, TO_NOTVICT );

	    ch->pl = ch->exp * 30;
	    transStatApply(ch, 16, 12, 12, 17);
        }

	  xSET_BIT( ch->affected_by, AFF_ABSORB_FORM );
	  learn_from_success( ch, gsn_absorb_form );
	}
	else
	{
	    act( AT_PLAIN, "The encaged being resists! Your transformation fails.", ch, NULL, NULL, TO_CHAR );
	    learn_from_failure( ch, gsn_absorb_form );
	}

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


    do_transform( ch, "" );

    return;
}

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

    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_vb]->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_vb]->min_mana )
        {
            send_to_char( "You don't have enough energy.\n\r", ch );
            return;
        }
        if (ch->focus < skill_table[gsn_vb]->focus)
    {
                send_to_char( "You need to focus more.\n\r", ch );
                return;
    }
    else
        ch->focus -= skill_table[gsn_vb]->focus;

    WAIT_STATE( ch, skill_table[gsn_vb]->beats );
    if ( can_use_skill(ch, number_percent(),gsn_vb ) )
    {
        switch (number_range( 1, 100 ))
        {
    case 100:
        if (IS_NPC(victim) || (!IS_NPC(victim) && (!xIS_SET(ch->act, PLR_SPAR) || !xIS_SET(ch->act, PLR_SPAR) )))
        {

                /* Redone so that instant death can't be abused to instant kill
                 * players over 2x their power. -- Islvin
                 */
                if (victim->pl / ch->pl >= 2)
                {
                        act( AT_SKILL, "You charge a large ball of energy above your head and hurl it towards $N.", ch, NULL, victim, TO_CHAR );
                        act( AT_SKILL, "The ball flys staight towards $N, but their damage is absorbed by $s powerful aura.", ch, NULL, victim, TO_CHAR );
                        act( AT_SKILL, "$n charges a large ball of energy above $s head and hurls it towards you.", ch, NULL, victim, TO_VICT );
                        act( AT_SKILL, "The ball flys staight towards $N, but their damage is absorbed by $s powerful aura.", ch, NULL, victim, TO_VICT );
                        act( AT_SKILL, "$n charges a large ball of energy above $s head and hurl it towards $N.", ch, NULL, victim, TO_NOTVICT);
                        act( AT_SKILL, "The ball flys staight towards $N, but their damage is absorbed by $s powerful aura.", ch, NULL, victim, TO_NOTVICT);
                        dam = 0;
                        break;
                }

/* Redone so it _is_ instant death -- Melora
 *      if (victim->max_hit >= victim->hit)
 *              dam = victim->max_hit * 2;
 *      else
 *              dam = victim->hit * 2;
 */
                dam = 999999999;
        act( AT_SKILL, "You throw you hands above your head and scream 'VANISHING BALL!' and launches it towards $N.\n\r", ch, NULL, victim, TO_CHAR );
        act( AT_RED, "THE LARGE BALL OF ENERGY HITS $N!!!  Killing $M instantly.\n\r", ch, NULL, victim, TO_CHAR );
        act( AT_SKILL, "$n thows $s hands above $s head and screams 'VANISHING BALL!' and launches it towards you.\n\r", ch, NULL, victim, TO_VICT );
        act( AT_RED, "THE LARGE BALL OF ENERGY HIT YOU!!!  Killing you instantly.\n\r", ch, NULL, victim, TO_VICT );
        act( AT_SKILL, "$n throws $s hands above $s head and screams 'VANISHING BALL!' and launches it towards $N.\n\r", ch, NULL, victim, TO_NOTVICT );
        act( AT_RED, "THE LARGE BALL OF ENERGY HITS $N!!!  Killing $M instantly.\n\r", ch, NULL, victim, TO_NOTVICT );

        learn_from_success( ch, gsn_vb );
        global_retcode = damage( ch, victim, dam, gsn_vb );
    break;
    }
        default:
        dam = get_attmod(ch, victim) * number_range( 24, 30 );
        if (ch->charge > 0)
                dam = chargeDamMult(ch, dam);
        act( AT_SKILL, "You charge a large ball of energy above your head and hurl it towards $N. &W[$t]", ch, num_punct(dam), victim, TO_CHAR );
        act( AT_SKILL, "$n charges a large ball of energy above $s head and hurls it towards you. &W[$t]", ch, num_punct(dam), victim, TO_VICT );
        act( AT_SKILL, "$n charges a large ball of energy above $s head and hurl it towards $N. &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

        learn_from_success( ch, gsn_vb);
        dam = ki_absorb( victim, ch, dam, gsn_vb );
        dam = portal_counter(ch, victim, dam, gsn_vb );
        
        if (dam > 0)
          global_retcode = damage( ch, victim, dam, gsn_vb );
    break;
    }
    }
    else
    {
        act( AT_SKILL, "You missed $N with your vanishing ball.", ch, NULL, victim, TO_CHAR );
        act( AT_SKILL, "$n misses you with $s vanishing ball.", ch, NULL, victim, TO_VICT );
        act( AT_SKILL, "$n missed $N with a vanishing ball.", ch, NULL, victim, TO_NOTVICT );
        learn_from_failure( ch, gsn_vb );
        global_retcode = damage( ch, victim, 0, gsn_vb );
    }
        ch->mana -= skill_table[gsn_vb]->min_mana;
    return;
}

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

    if(ch->race == 9 && !IS_NPC(ch))
    {
      if ((ch->pcdata->genieform != 9) && (ch->pcdata->genieform < 11))
      {
        do_genie_signature(ch, argument);
        return;
      }
    }


    if( !IS_NPC( ch ) && ch->exp < skill_table[gsn_demonwave]->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_demonwave]->min_mana )
    {
	send_to_char( "You don't have enough energy.\n\r", ch );
	return;
    }

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

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

    if( can_use_skill( ch, number_percent(), gsn_demonwave ) )
    {
	dam = get_attmod( ch, victim ) * number_range( 22, 28 );
	if( ch->charge > 0 )
	    dam = chargeDamMult( ch, dam );

	act( AT_SKILL, "You cup your hands and grin at $N, \"You go bye bye now!\"  A ball of", ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "sparkling purple energy appears in your palms and you push your hands", ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "forward, creating a massive wave of energy that flies at $N! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

	act( AT_SKILL, "$n cups $s hands and grins at you, \"You go bye bye now!\"  A ball of", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "sparkling purple energy appears in $s palms and $e pushes $s hands", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "forward, creating a massive wave of energy that flies at you! &W[$t]", ch, num_punct(dam), victim, TO_VICT );

	act( AT_SKILL, "$n cups $s hands and grins at $N, \"You go bye bye now!\"  A ball of", ch, NULL, victim, TO_NOTVICT );
	act( AT_SKILL, "sparkling purple energy appears in $s palms and $e pushes $s hands", ch, NULL, victim, TO_NOTVICT );
	act( AT_SKILL, "forward, creating a massive wave of energy that flies at $N! &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

        learn_from_success( ch, gsn_demonwave);
        dam = ki_absorb( victim, ch, dam, gsn_demonwave );
        dam = portal_counter(ch, victim, dam, gsn_demonwave );
        
        if (dam > 0)
          global_retcode = damage( ch, victim, dam, gsn_demonwave );
    }
    else
    {
	act( AT_SKILL, "You missed $N with your demon wave.", ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "$n misses you with $s demon wave.", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "$n missed $N with a demon wave.", ch, NULL, victim, TO_NOTVICT );
	learn_from_failure( ch, gsn_demonwave );
	global_retcode = damage( ch, victim, 0, gsn_demonwave);
    }

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

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

/*    if( is_namek( ch ) )
    {
	ch_printf( ch, "You are not allowed.\n\r" );
	return;
    }*/

    if ( xIS_SET( ch->affected_by, AFF_CANDY ) )
    {
	act( AT_PINK, "You are no longer a candy.", ch, NULL, NULL, TO_CHAR );
	act( AT_PINK, "$n is no longer a candy.", ch, NULL, NULL, TO_NOTVICT );
	if ( IS_NPC(ch) )
	    ch->exp *= 2;
	else
	    ch->pl *= 2;
	xREMOVE_BIT( ch->affected_by, AFF_CANDY );
	ch->substate = SUB_NONE;
	return;
    }

    if ( !IS_NPC(ch) && ch->pcdata->timestop > 0 )
    {
	ch_printf( ch, "You can't candy blast for another %d minutes.", ch->pcdata->timestop );
	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_candyblast]->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_candyblast]->min_mana )
    {
	send_to_char( "You don't have enough energy.\n\r", ch );
	return;
    }
    if( ch->focus < skill_table[gsn_candyblast]->focus )
    {
	send_to_char( "You need to focus more.\n\r", ch );
	return;
    }
    else
	ch->focus -= skill_table[gsn_candyblast]->focus;

    WAIT_STATE( ch, skill_table[gsn_candyblast]->beats );
    if( can_use_skill( ch, number_percent(), gsn_candyblast ) )
    {
/*	switch( number_range( 1, 100 ) )
	{
	    case 100:
		if( IS_NPC( victim ) || ( !IS_NPC( victim ) && ( !xIS_SET( ch->act, PLR_SPAR ) || !xIS_SET( ch->act, PLR_SPAR ) ) ) )
		{
		    if( victim->pl / ch->pl >= 5 )
		    {
			act( AT_SKILL, "You charge a huge ball of energy on the tip of your finger and then direct it quickly towards $n.", ch, NULL, victim, TO_CHAR );
			act( AT_SKILL, "$n is enveloped by the death ball, but when all is done, seems unaffected.", ch, NULL, victim, TO_CHAR );
			act( AT_SKILL, "$n charges a huge ball of energy on the tip of $s finger and then directs it quickly towards you.", ch, NULL, victim, TO_VICT );
			act( AT_SKILL, "You are enveloped by the death ball, but seem unaffected when it's over.", ch, NULL, victim, TO_VICT );
			act( AT_SKILL, "$n charges a huge ball of energy on the tip of $s finger and then directs it quickly towards $N.", ch, NULL, victim, TO_NOTVICT );
			act( AT_RED, "$N is enveloped by the death ball, but when all is done, seems unaffected.", ch, NULL, victim, TO_NOTVICT );
			dam = 0;
			break;
		    }

		    dam = 999999999;
		    act( AT_SKILL, "You charge a huge ball of energy on the tip of your finger and then direct it quickly towards $N.", ch, NULL, victim, TO_CHAR );
		    act( AT_RED, "$N is slowly enveloped by the death ball, killing $M instantly.", ch, NULL, victim, TO_CHAR );
		    act( AT_SKILL, "$n charges a huge ball of energy on the tip of $s finger and then directs it quickly towards you.", ch, NULL, victim, TO_VICT );
		    act( AT_RED, "You are slowly enveloped by the death ball, killing you instantly.", ch, NULL, victim, TO_VICT );
		    act( AT_SKILL, "$n charges a huge ball of energy on the tip of $s finger and then directs it quickly towards $N.", ch, NULL, victim, TO_NOTVICT );
		    act( AT_RED, "$N is slowly enveloped by the death ball, killing $M instantly.", ch, NULL, victim, TO_NOTVICT );

		    learn_from_success( ch, gsn_candyblast );
		    global_retcode = damage( ch, victim, dam, gsn_candyblast );
		    break;
		}
	    default:
*/		dam = get_attmod( ch, victim ) * number_range( 35, 45 );
		if( ch->charge > 0 )
		    dam = chargeDamMult( ch, dam );

		act( AT_SKILL, "Your head tentacle flips towards $N and fires a pink beam of energy.  The", ch, NULL, victim, TO_CHAR );
		act( AT_SKILL, "ray hits and engulfs $N in a pink blaze that electrifies $S body.  &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

		act( AT_SKILL, "$n's head tentacle flips towards you and fires a pink beam of energy.  The", ch, NULL, victim, TO_VICT );
		act( AT_SKILL, "ray hits and engulfs you in a pink blaze that electrifies your body. &W[$t]", ch, num_punct(dam), victim, TO_VICT );

		act( AT_SKILL, "$n's head tentacle flips towards $N and fires a pink beam of energy.  The", ch, NULL, victim, TO_NOTVICT );
		act( AT_SKILL, "ray hits and engulfs $N in a pink blaze that electrifies $S body. &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

		if ( !xIS_SET( victim->affected_by, AFF_CANDY ) )
		{
		    xSET_BIT( victim->affected_by, AFF_CANDY );
		    add_timer( victim, TIMER_DO_FUN, 5, do_candy_blast, 1 );
		    WAIT_STATE( victim, PULSE_VIOLENCE * 5 );
		    if ( IS_NPC(ch) )
			victim->exp /= 2;
		    else
			victim->pl /= 2;
		}
		if ( !IS_NPC(ch) )
		    ch->pcdata->timestop = 180;
		dam = ki_absorb( victim, ch, dam, gsn_candyblast );
		learn_from_success( ch, gsn_candyblast );
		global_retcode = damage( ch, victim, dam, gsn_candyblast );
//		break;
//	}
    }
    else
    {
	act( AT_SKILL, "You missed $N with your candy blast.", ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "$n misses you with $s candy blast.", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "$n missed $N with a candy blast.", ch, NULL, victim, TO_NOTVICT );
	learn_from_failure( ch, gsn_candyblast );
	global_retcode = damage( ch, victim, 0, gsn_candyblast );
    }
    ch->mana -= skill_table[gsn_candyblast]->min_mana;
    return;
}


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

    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_tentacle]->skill_level[ch->class] )
    {
	send_to_char( "You better leave the martial arts to fighters.\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_tentacle]->min_mana )
    {
	send_to_char( "You don't have enough energy.\n\r", ch );
	return;
    }

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

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

    if( can_use_skill( ch, number_percent(), gsn_tentacle ) )
    {
	learn_from_success( ch, gsn_tentacle );
	global_retcode = damage( ch, victim, ( get_attmod( ch, victim ) * number_range( 1, 5 ) ), gsn_tentacle );
    }
    else
    {
	learn_from_failure( ch, gsn_tentacle );
	global_retcode = damage( ch, victim, 0, gsn_tentacle );
    }

    ch->mana -= skill_table[gsn_tentacle]->min_mana;

    return;
}


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

    if( !IS_NPC( ch ) && ch->exp < skill_table[gsn_skin_trap]->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_skin_trap]->min_mana )
    {
	send_to_char( "You don't have enough energy.\n\r", ch );
	return;
    }

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

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

    if( can_use_skill( ch, number_percent(), gsn_skin_trap ) )
    {
	dam = get_attmod( ch, victim ) * number_range( 20, 25 );
	if (ch->charge > 0)
		dam = chargeDamMult(ch, dam);

	act( AT_SKILL, "A nodule of flesh detaches from you and soars towards $N, entrapping", ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "$m in its rubbery depths. &W[$t]", ch, num_punct(dam), victim, TO_CHAR );

	act( AT_SKILL, "Amidst the raging battle, a flicker of movement catches the corner", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "of your eye.  A large nodule of severed pink flesh soars towards", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "you, entrapping you within its rubbery depths. &W[$t]", ch, num_punct(dam), victim, TO_VICT );

	act( AT_SKILL, "A nodule of flesh detaches from $n and soars towards $N, entrapping", ch, NULL, victim, TO_NOTVICT );
	act( AT_SKILL, "$m in its rubbery depths. &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

	dam = ki_absorb( victim, ch, dam, gsn_skin_trap );
	learn_from_success( ch, gsn_skin_trap );
	global_retcode = damage( ch, victim, dam, gsn_skin_trap );
    }
    else
    {
	act( AT_SKILL, "You missed $N with your skin trap.", ch, NULL, victim, TO_CHAR );

	act( AT_SKILL, "A nodule of flesh detaches from you and soars towards $N,", ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "but $E manages to avoid it, and you re-absorb your skin. &W[$t]", ch, num_punct(0), victim, TO_CHAR );
	
	act( AT_SKILL, "Amidst the raging battle, a flicker of movement catches the", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "corner of your eye.  A large nodule of severed pink flesh soars", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "towards you.  You narrowly avoid it, and $N re-absorbs it into", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "self. &W[$t]", ch, num_punct(0), victim, TO_VICT );

	act( AT_SKILL, "A nodule of flesh detaches from $n and soars towards $N,", ch, NULL, victim, TO_NOTVICT );
	act( AT_SKILL, "but $E manages to avoid it, and you re-absorb your skin. &W[$t]", ch, num_punct(0), victim, TO_CHAR );

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

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

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

    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_illflash]->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_illflash]->min_mana )
        {
            send_to_char( "You don't have enough energy.\n\r", ch );
            return;
        }
        if (ch->focus < skill_table[gsn_illflash]->focus)
    {
                send_to_char( "You need to focus more.\n\r", ch );
                return;
    }
    else
        ch->focus -= skill_table[gsn_illflash]->focus;

    WAIT_STATE( ch, skill_table[gsn_illflash]->beats );
    if ( can_use_skill(ch, number_percent(), gsn_illflash ) )
    {
        dam = get_attmod(ch, victim) * number_range( 20, 25 );
        if (ch->charge > 0)
                dam = chargeDamMult(ch, dam);
        act( AT_SKILL, "You hold out your arms and arrogantly yell 'ILL FLASH!'", ch, NULL, victim, TO_CHAR );
        act( AT_SKILL, "You fire a massive beam of flowing pink energy at $N. &W[$t]", ch, num_punct(dam), victim, TO_CHAR );
        act( AT_SKILL, "$n holds out $s hands while yelling. 'ILL FLASH!'", ch, NULL, victim, TO_VICT );
        act( AT_SKILL, "$n hurls a massive beam of pink energy at you! &W[$t]", ch, num_punct(dam), victim, TO_VICT );
        act( AT_SKILL, "$n holds out $s arms and yells. 'ILL FLASH!'", ch, NULL, victim, TO_NOTVICT );
        act( AT_SKILL, "$n throws a pink wave of energy at $N. &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );
        dam = ki_absorb( victim, ch, dam, gsn_illflash );
        learn_from_success( ch, gsn_illflash );
        global_retcode = damage( ch, victim, dam, gsn_illflash );
    }
    else
    {
        act( AT_SKILL, "You missed $N with your ill flash.", ch, NULL, victim, TO_CHAR );
        act( AT_SKILL, "$n misses you with $s ill flash.", ch, NULL, victim, TO_VICT );
        act( AT_SKILL, "$n missed $N with a ill flash.", ch, NULL, victim, TO_NOTVICT );
        learn_from_failure( ch, gsn_illflash );
        global_retcode = damage( ch, victim, 0, gsn_illflash );
    }
        ch->mana -= skill_table[gsn_illflash]->min_mana;
    return;
} 

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

    if(ch->race == 9 && !IS_NPC(ch))
    {
      if ((ch->pcdata->genieform != 9) && (ch->pcdata->genieform < 11))
      {
        do_genie_finisher(ch, argument);
        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_genocide]->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_genocide]->min_mana )
    {
	send_to_char( "You don't have enough energy.\n\r", ch );
	return;
    }

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

    WAIT_STATE( ch, skill_table[gsn_genocide]->beats );
    if ( can_use_skill( ch, number_percent(), gsn_genocide ) )
    {
        dam = get_attmod(ch, victim) * number_range( 54, 58 );
        if (ch->charge > 0)
                dam = chargeDamMult(ch, dam);
	act( AT_SKILL, "You hold up a finger above your head and dozens of pink energy blasts fly into the air, zig zagging and flying around.", ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "The energy swirls around in an almost cloud like pattern before flying at $N! &W[$t]", ch, num_punct(dam), victim, TO_CHAR );
	act( AT_SKILL, "$n holds up a finger above $s head and dozens of pink energy blasts fly into the air, zig zagging and flying around.", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "The energy swirls around in an almost cloud like pattern before flying at you! &W[$t]", ch, num_punct(dam), victim, TO_VICT );
	act( AT_SKILL, "$n holds up a finger above $s head and dozens of pink energy blasts fly into the air, zig zagging and flying around.", ch, NULL, victim, TO_NOTVICT );
	act( AT_SKILL, "The energy swirls around in an almost cloud like pattern before flying at you! &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

        learn_from_success( ch, gsn_genocide);
        dam = ki_absorb( victim, ch, dam, gsn_genocide );
        dam = portal_counter(ch, victim, dam, gsn_genocide );
        
        if (dam > 0)
          global_retcode = damage( ch, victim, dam, gsn_genocide  );
    }
    else
    {
	act( AT_SKILL, "You missed $N with your genocide attack.", ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "$n missed you with $s genocide attack.", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "$n missed $N with $s genocide attack.", ch, NULL, victim, TO_NOTVICT );

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

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

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

    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_vacuumwave]->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 != 9)
      {
	  act( AT_PINK, "You try to suck in an ungodly amount of air, but end up coughing and sputtering.  ", ch, NULL, victim, TO_CHAR );
	  act( AT_PINK, "You seem to be missing something... ", ch, NULL, victim, TO_CHAR );
	  act( AT_PINK, "$n tries to suck in an ungodly amount of air, but ends up coughing and sputtering. ", ch, NULL, victim, TO_VICT );
	  act( AT_PINK, "$n tries to suck in an ungodly amount of air, but ends up coughing and sputtering. ", ch, NULL, victim, TO_NOTVICT );

        return;
      }
    }

	if ( ch->mana < skill_table[gsn_vacuumwave]->min_mana )
	{
	    send_to_char( "You don't have enough energy.\n\r", ch );
	    return;
	}
	if (ch->focus < skill_table[gsn_vacuumwave]->focus)
    {
		send_to_char( "You need to focus more.\n\r", ch );
		return;
    }
    else
    	ch->focus -= skill_table[gsn_vacuumwave]->focus;

    WAIT_STATE( ch, skill_table[gsn_vacuumwave]->beats );
    if ( can_use_skill(ch, number_percent(),gsn_vacuumwave ) )
    {
	dam = get_attmod(ch, victim) * number_range( 62, 72 );
	if (ch->charge > 0)
		dam = chargeDamMult(ch, dam);
	act( AT_SKILL, "You begin to suck up an ungodly amount of air. You almost pull $N towards you with your massive inhale, but $E manages to stand strong, as you start to puff up like a balloon." , ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "You hold the air in for a moment, and $N looks like $E is confused. You force the air out of your mouth quickly, forming a giant wave of raw energy. As it hits $N, it explodes on contact, causing a wall of destruction. &W[$t] ", ch, num_punct(dam), victim, TO_CHAR );
	act( AT_SKILL, "$n begins to suck up an ungodly amount of air. $e almost manages to pull you towards $m with $s massive inhale, but you manage to stand in place, as $e starts to puff up like a balloon.", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "$n holds in the air in for a moment, but it is not clear as to what $e is trying to do. $e forces the air out of $s mouth quickly, forming a giant wave of raw energy. As it hits you, it explodes on contact, causing a wall of destruction that rips you apart. &W[$t] ", ch, num_punct(dam), victim, TO_VICT );
	act( AT_SKILL, "$n begins to suck up an ungodly amount of air. $e almost manages to pull $N towards $m with $s massive inhale, but $N manages to stand in place, as $n starts to puff up like a balloon.", ch, NULL, victim, TO_NOTVICT );
	act( AT_SKILL, "$n holds in the air in for a moment, but it is not clear as to what $e is trying to do. $n forces the air out of $s mouth quickly, forming a giant wave of raw energy. As it hits $N, it explodes on contact, causing a wall of destruction that rips them apart. &W[$t] ", ch, num_punct(dam), victim, TO_NOTVICT );

	learn_from_success( ch, gsn_vacuumwave );
	global_retcode = damage( ch, victim, dam, gsn_vacuumwave );
    }
    else
    {
	act( AT_SKILL, "You missed $N with your vacuum wave.", ch, NULL, victim, TO_CHAR );
	act( AT_SKILL, "$n misses you with $s vacuum wave.", ch, NULL, victim, TO_VICT );
	act( AT_SKILL, "$n missed $N with a vacuum wave.", ch, NULL, victim, TO_NOTVICT );
	learn_from_failure( ch, gsn_vacuumwave );
	global_retcode = damage( ch, victim, 0, gsn_vacuumwave );
    }
	ch->mana -= skill_table[gsn_vacuumwave]->min_mana;
    return;
}

void do_genie_signature(CHAR_DATA *ch, char *argument )
{
    char buf[MAX_INPUT_LENGTH];
  
    if (ch->race == 9) 
    {
      if (ch->pcdata->genieform == 0)      /* Saiyan */
        do_kamehameha(ch, buf);
      else if (ch->pcdata->genieform == 1) /* Human */
        do_dodon_ray(ch, buf);
      else if (ch->pcdata->genieform == 2) /* Halfbreed */
        do_kamehameha(ch, buf);
      else if (ch->pcdata->genieform == 3) /* Namek */
        do_sbc(ch, buf);
      else if (ch->pcdata->genieform == 4) /* Android */
        do_genie_rocket_punch(ch, buf);
      else if (ch->pcdata->genieform == 5) /* Icer */
        do_finger_beam(ch, buf);
      else if (ch->pcdata->genieform == 6) /* Bio-Android */
        do_kamehameha(ch, buf);
      else if (ch->pcdata->genieform == 7) /* Kaio */
        do_shockwave(ch, buf);
      else if (ch->pcdata->genieform == 8) /* Demon */
        do_cleaver(ch, buf);
      else if (ch->pcdata->genieform == 10) /* Dragon */
        do_whirlwindspin(ch, buf);
      else					     /* Error */
        return;
    }
    else
    {
	if (!IS_NPC(ch))
        return;
      else
        do_absorb(ch, buf);
    }
}

void do_genie_finisher(CHAR_DATA *ch, char *arg )
{
    if (ch->race == 9) 
    {
      if (ch->pcdata->genieform == 0)      /* Saiyan */
        do_ff(ch, arg);
      else if (ch->pcdata->genieform == 1) /* Human */
        do_kakusanha(ch, arg);
      else if (ch->pcdata->genieform == 2) /* Halfbreed */
        do_super_ghost_kamikaze(ch, arg);
      else if (ch->pcdata->genieform == 3) /* Namek */
        do_heaven_splitter_cannon(ch, arg);
      else if (ch->pcdata->genieform == 4) /* Android */
        do_ssd_bomber(ch, arg);
      else if (ch->pcdata->genieform == 5) /* Icer */
        do_death_ball(ch, arg);
      else if (ch->pcdata->genieform == 6) /* Bio-Android */
        do_ki_burst(ch, arg);
      else if (ch->pcdata->genieform == 7) /* Kaio */
        do_divine_fate(ch, arg);
      else if (ch->pcdata->genieform == 8) /* Demon */
        do_weaponsoul(ch, arg);
      else if (ch->pcdata->genieform == 10) /* Dragon */
        do_flare(ch, arg);
      else					     /* Error */
        return;
    }
    else
    {
	if (!IS_NPC(ch))
        return;
      else
        do_absorb(ch, arg);
    }
}
 
void do_genie_rocket_punch(CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    int dam = 0;

    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_demonwave]->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 ( !IS_NPC(ch) && ch->mana < skill_table[gsn_genie_rocket_punch]->min_mana )
	{
	    send_to_char( "You don't have enough energy.\n\r", ch );
	    return;
	}

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

    WAIT_STATE( ch, skill_table[gsn_genie_rocket_punch]->beats );
    if ( can_use_skill(ch, number_percent(),gsn_demonwave ) )
    {
	dam = get_attmod(ch, victim) * number_range( 22, 27 );
	if (ch->charge > 0)
		dam = chargeDamMult(ch, dam);
	act( AT_PINK, "Your fists detach with a small explosion, sending your gooey fists toward $N.", ch, NULL, victim, TO_CHAR );
	act( AT_PINK, "$N is smashed by the flying fists, "
                       "which quickly return and reattach to your arms. &W[$t]", ch, num_punct(dam), victim, TO_CHAR );
	act( AT_PINK, "$n's fists detach with a small explosion, sending $s gooey fists toward you.", ch, NULL, victim, TO_VICT );
	act( AT_PINK, "You are smashed by the flying fists, "
                       "which quickly return and reattach to $n's arms. &W[$t]", ch, num_punct(dam), victim, TO_VICT );
	act( AT_PINK, "$n's fists detach with a small explosion, sending $s gooey fists toward $N.", ch, NULL, victim, TO_NOTVICT );
	act( AT_PINK, "$N is smashed by the flying fists, "
                       "which quickly return and reattach to $n's arms. &W[$t]", ch, num_punct(dam), victim, TO_NOTVICT );

        learn_from_success( ch, gsn_genie_rocket_punch);
        dam = portal_counter(ch, victim, dam, gsn_genie_rocket_punch );
        
        if (dam > 0)
          global_retcode = damage( ch, victim, dam, TYPE_HIT );
    }
    else
    {
	act( AT_PURPLE, "You missed $N with your rocket punch.", ch, NULL, victim, TO_CHAR );
	act( AT_PURPLE, "$n misses you with $s rocket punch.", ch, NULL, victim, TO_VICT );
	act( AT_PURPLE, "$n missed $N with a rocket punch.", ch, NULL, victim, TO_NOTVICT );
	learn_from_failure( ch, gsn_demonwave );
	global_retcode = damage( ch, victim, 0, TYPE_HIT );
    }
	ch->mana -= skill_table[gsn_genie_rocket_punch]->min_mana;
    return;
}

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

    if( !IS_NPC( ch ) && ch->exp < skill_table[gsn_absorption]->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_absorption]->min_mana )
    {
	send_to_char( "You don't have enough energy.\n\r", ch );
	return;
    }

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

    if( !IS_NPC( victim ))
      pkfight = 1;

    ch->focus -= skill_table[gsn_absorption]->focus;
    WAIT_STATE( ch, skill_table[gsn_absorption]->beats );
    if( can_use_skill( ch, number_percent(), gsn_absorption ) )
    {
      if( !IS_NPC( victim ))
      {
	  switch (number_range(1,15))
	  {
          default: success = 0;
            break;
          case 1: success = 2;
            break;
          case 2: success = 1;
            break;
          case 3: success = 1;
            break;
          case 4: success = 1;
            break;
          case 5: success = 1;
            break;
        }

        if(success == 2)
        {
          if((xIS_SET(ch->act, PLR_SPAR))
           || (victim->hit > 10 )
           || (ch->pl > victim->pl)
           || (ch->pl < ch->exp))
            success = 1;
        } 

	  act( AT_PINK, "You dig your fingers into your gooey flesh, tearing off an arm and throwing it as hard as you possibly can towards $N!", ch, NULL, victim, TO_CHAR );
	  act( AT_PINK, "$n digs $s fingers into $s gooey flesh, tearing off an arm and throwing it as hard as $e possibly can at you!", ch, NULL, victim, TO_VICT );
	  act( AT_PINK, "$n digs $s fingers into $s gooey flesh, tearing off an arm and throwing it as hard as $e possibly can towards $N!", ch, NULL, victim, TO_NOTVICT );

        if( success == 0)
        {
	  act( AT_PURPLE, "$N sidesteps the mass of goo easily, blasting it into oblivion! You quickly regenerate a new arm!", ch, NULL, victim, TO_CHAR );
	  act( AT_PURPLE, "You sidestep the mass of goo easily, blasting it into oblivion! $n quickly regenerates a new arm!", ch, NULL, victim, TO_VICT );
	  act( AT_PURPLE, "$N sidesteps the mass of goo easily, blasting it into oblivion! $n quickly regenerate a new arm!", ch, NULL, victim, TO_NOTVICT );

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

        if( success == 1)
        {
     	  dam = get_attmod( ch, victim ) * number_range( 2, 15 );

	  act( AT_PINK, "The mass of goo begins to envelop $N's arm, but only succeeds in slightly digesting it before $N violently tears it from $S arm! &W[$t] ", ch, num_punct(dam), victim, TO_CHAR );
	  act( AT_PINK, "The mass of goo begins to envelop your arm, but only succeeds in slightly digesting it before you violently tear it from your arm! &W[$t] ", ch, num_punct(dam), victim, TO_VICT );
	  act( AT_PINK, "The mass of goo begins to envelop $N's arm, but only succeeds in slightly digesting it before $N violently tears it from $S arm! &W[$t] ", ch, num_punct(dam), victim, TO_NOTVICT );

        learn_from_success( ch, gsn_absorption );
	  global_retcode = damage( ch, victim, dam, TYPE_HIT );
        }

        if( success == 2)
        {
     	  dam = 999999999;

	  act( AT_PINK, "The mass of goo slams into $N's stomach head-on, quickly expanding and devouring $M in a single swipe! $N's form can be seen struggling inside the thick goo, but they are quickly digested into the goo until it returns to its original size and returns to your body! &W[$t] ", ch, num_punct(dam), victim, TO_CHAR );
	  act( AT_RED, "You teem with power as $E is absorbed into your body!", ch, NULL, victim, TO_CHAR );
        act( AT_RED, "You may now call upon $S energies with 'transform absorb'!", ch, NULL, victim, TO_CHAR );
	  act( AT_PINK, "The mass of goo slams into your stomach head-on, quickly expanding and devouring you in a single swipe! Your consciousness begins to wane as you feel yourself drifting to sleep... &W[$t] ", ch, num_punct(dam), victim, TO_VICT );
	  act( AT_RED, "Your body is digested by $n!", ch, NULL, victim, TO_VICT );
	  act( AT_PINK, "The mass of goo slams into $N's stomach head-on, quickly expanding and devouring $M in a single swipe! $N's form can be seen struggling inside the thick goo, but they are quickly digested into the goo until it returns to its original size and returns to $n's body! &W[$t] ", ch, num_punct(dam), victim, TO_NOTVICT );
	  act( AT_RED, "$N's body is digested by $n!", ch, NULL, victim, TO_NOTVICT );

        ch->pcdata->genieform = victim->race;
        learn_from_success( ch, gsn_absorption );
	  global_retcode = damage( ch, victim, dam, TYPE_HIT );

	  if((xIS_SET(ch->affected_by, AFF_ABSORB_FORM))
        || (xIS_SET(ch->affected_by, AFF_KID_TRANS)))
	  {
   	    if(xIS_SET(ch->affected_by, AFF_ABSORB_FORM))
          {
	      act( AT_PINK, "Unable to hold more than one being at a time, you are forced to completely digest your previous victim! All traces of its soul are expelled in the form of scalding steam as your new catch is settled in...", ch, NULL, victim, TO_CHAR );
	      act( AT_PINK, "Unable to hold more than one being at a time, $n is forced to completely digest $s previous victim. A burst of scaldingly hot steam marks the discarding of $s previous catch...", ch, NULL, victim, TO_VICT );
	      act( AT_PINK, "Unable to hold more than one being at a time, $n is forced to completely digest $s previous victim. A burst of scaldingly hot steam marks the discarding of $s previous catch...", ch, NULL, victim, TO_NOTVICT );
	    }
   	    if(xIS_SET(ch->affected_by, AFF_KID_TRANS))
          {
	      act( AT_PINK, "You are unable to maintain your pure, childlike state with a victim absorbed. The energies around you fade as you return to your original form...", ch, NULL, victim, TO_CHAR );
	      act( AT_PINK, "$n is unable to maintain $s pure, childlike state with a victim absorbed. The energies around $m fade as $e returns to $s original form...", ch, NULL, victim, TO_VICT );
	      act( AT_PINK, "$n is unable to maintain $s pure, childlike state with a victim absorbed. The energies around $m fade as $e returns to $s original form...", ch, NULL, victim, TO_NOTVICT );
	    }
          removeGenieTrans( ch );
          ch->pl = ch->exp;
        }
        }
      }
      if( IS_NPC( victim ))
      {
	  switch (number_range(1,25))
	  {
          default: success = 0;
            break;
          case 1: success = 2;
            break;
          case 2: success = 1;
            break;
          case 3: success = 1;
            break;
          case 4: success = 1;
            break;
          case 5: success = 1;
            break;
        }

        if(success == 2)
        {
          if((xIS_SET(ch->act, PLR_SPAR))
           || (victim->hit > 10 )
           || (ch->pl > victim->exp)
           || (ch->pl < ch->exp))
            success = 1;
        } 
         

	  act( AT_PINK, "You dig your fingers into your gooey flesh, tearing off an arm and throwing it as hard as you possibly can towards $N!", ch, NULL, victim, TO_CHAR );
	  act( AT_PINK, "$n digs $s fingers into $s gooey flesh, tearing off an arm and throwing it as hard as $e possibly can at you!", ch, NULL, victim, TO_VICT );
	  act( AT_PINK, "$n digs $s fingers into $s gooey flesh, tearing off an arm and throwing it as hard as $e possibly can towards $N!", ch, NULL, victim, TO_NOTVICT );

        if( success == 0)
        {
	  act( AT_PURPLE, "$N sidesteps the mass of goo easily, blasting it into oblivion! You quickly regenerate a new arm!", ch, NULL, victim, TO_CHAR );
	  act( AT_PURPLE, "You sidestep the mass of goo easily, blasting it into oblivion! $n quickly regenerates a new arm!", ch, NULL, victim, TO_VICT );
	  act( AT_PURPLE, "$N sidesteps the mass of goo easily, blasting it into oblivion! $n quickly regenerate a new arm!", ch, NULL, victim, TO_NOTVICT );

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

        if( success == 1)
        {
     	  dam = get_attmod( ch, victim ) * number_range( 1, 10 );

	  act( AT_PINK, "The mass of goo begins to envelop $N's arm, but only succeeds in slightly digesting it before $N violently tears it from $S arm! &W[$t] ", ch, num_punct(dam), victim, TO_CHAR );
	  act( AT_PINK, "The mass of goo begins to envelop your arm, but only succeeds in slightly digesting it before you violently tear it from your arm! &W[$t] ", ch, num_punct(dam), victim, TO_VICT );
	  act( AT_PINK, "The mass of goo begins to envelop $N's arm, but only succeeds in slightly digesting it before $N violently tears it from $S arm! &W[$t] ", ch, num_punct(dam), victim, TO_NOTVICT );

        learn_from_success( ch, gsn_absorption );
	  global_retcode = damage( ch, victim, dam, TYPE_HIT );
        }

        if( success == 2)
        {
     	  dam = 999999999;

	  act( AT_PINK, "The mass of goo slams into $N's stomach head-on, quickly expanding and devouring $M in a single swipe! $N's form can be seen struggling inside the thick goo, but they are quickly digested into the goo until it returns to its original size and returns to your body! &W[$t] ", ch, num_punct(dam), victim, TO_CHAR );
	  act( AT_RED, "You teem with power as $E is absorbed into your body!", ch, NULL, victim, TO_CHAR );
        act( AT_RED, "You may now call upon $S energies with 'transform absorb'!", ch, NULL, victim, TO_CHAR );
	  act( AT_PINK, "The mass of goo slams into your stomach head-on, quickly expanding and devouring you in a single swipe! Your consciousness begins to wane as you feel yourself drifting to sleep... &W[$t] ", ch, num_punct(dam), victim, TO_VICT );
	  act( AT_RED, "Your body is digested by $n!", ch, NULL, victim, TO_VICT );
	  act( AT_PINK, "The mass of goo slams into $N's stomach head-on, quickly expanding and devouring $M in a single swipe! $N's form can be seen struggling inside the thick goo, but they are quickly digested into the goo until it returns to its original size and returns to $n's body! &W[$t] ", ch, num_punct(dam), victim, TO_NOTVICT );
	  act( AT_RED, "$N's body is digested by $n!", ch, NULL, victim, TO_NOTVICT );

        ch->pcdata->genieform = victim->race;
        learn_from_success( ch, gsn_absorption );
	  global_retcode = damage( ch, victim, dam, TYPE_HIT );

	  if((xIS_SET(ch->affected_by, AFF_ABSORB_FORM))
        || (xIS_SET(ch->affected_by, AFF_KID_TRANS)))
	  {
   	    if(xIS_SET(ch->affected_by, AFF_ABSORB_FORM))
          {
	      act( AT_PINK, "Unable to hold more than one being at a time, you are forced to completely digest your previous victim! All traces of its soul are expelled in the form of scalding steam as your new catch is settled in...", ch, NULL, victim, TO_CHAR );
	      act( AT_PINK, "Unable to hold more than one being at a time, $n is forced to completely digest $s previous victim. A burst of scaldingly hot steam marks the discarding of $s previous catch...", ch, NULL, victim, TO_VICT );
	      act( AT_PINK, "Unable to hold more than one being at a time, $n is forced to completely digest $s previous victim. A burst of scaldingly hot steam marks the discarding of $s previous catch...", ch, NULL, victim, TO_NOTVICT );
	    }
   	    if(xIS_SET(ch->affected_by, AFF_KID_TRANS))
          {
	      act( AT_PINK, "You are unable to maintain your pure, childlike state with a victim absorbed. The energies around you fade as you return to your original form...", ch, NULL, victim, TO_CHAR );
	      act( AT_PINK, "$n is unable to maintain $s pure, childlike state with a victim absorbed. The energies around $m fade as $e returns to $s original form...", ch, NULL, victim, TO_VICT );
	      act( AT_PINK, "$n is unable to maintain $s pure, childlike state with a victim absorbed. The energies around $m fade as $e returns to $s original form...", ch, NULL, victim, TO_NOTVICT );
	    }
          removeGenieTrans( ch );
          ch->pl = ch->exp;
        }
        }
      }
    }
    else
    {
    	act( AT_PURPLE, "You attempt to rip your arm off, but an unseen offensive from $N forces you back.", ch, NULL, victim, TO_CHAR );
	act( AT_PURPLE, "$n attempts to rip $s arm off, but an unseen offensive from you forces $m back.", ch, NULL, victim, TO_VICT );
	act( AT_PURPLE, "$n attempts to rip $s arm off, but an unseen offensive from $N forces $m back.", ch, NULL, victim, TO_NOTVICT );

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

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


