cotn25/area/
cotn25/src/
/* Scorpion Class Coded By: Dove *
 * all rihgt reserved, give      *
 * credit if used                */

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




  void do_insight(CHAR_DATA *ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  argument = one_argument(argument, arg);

  if (IS_NPC(ch)) return;

  if (!IS_CLASS(ch, CLASS_SCORPION))
{
  send_to_char("UmMmMM?\n\r",ch);
  return;
}
  if (arg[0] == '\0')
{
  send_to_char("Insight into what #0[#RL#0if#Re #0or #RD#0eat#Rh#n#0]#Y?#n\n\r",ch);
  return;
}

  if (!str_cmp(arg, "life"))
{

  if (ch->pcdata->powers[SCORPION_LIFE] > 4)
{
  send_to_char("You already have mastered all 5 levels.\n\r",ch);
  return;
}
  
  if (ch->exp < (ch->pcdata->powers[SCORPION_LIFE]+1)*20000000)
{
  send_to_char("You don't have enought exp.\n\r",ch);
  return;
}
  ch->pcdata->powers[SCORPION_LIFE]++;
  ch->exp -= ch->pcdata->powers[SCORPION_LIFE]*20000000;
  send_to_char("Ok.\n\r",ch);
}

  else if (!str_cmp(arg, "death"))
{
  if (ch->pcdata->powers[SCORPION_DEATH] > 4)
{
  send_to_char("You already have mastered all 5 levels.\n\r",ch);
  return;
}
  if (ch->exp < (ch->pcdata->powers[SCORPION_DEATH]+1)*20000000)
{
  send_to_char("You don't have enought exp.\n\r",ch);
  return;
}

  ch->pcdata->powers[SCORPION_DEATH]++;
  ch->exp -= ch->pcdata->powers[SCORPION_DEATH]*20000000;
  send_to_char("Ok.\n\r",ch);
}

  else
{
    send_to_char("Sorry, you cannot gain insight into this.\n\r",ch);
    return;
}
 
 return;
}


/* CLASS EQ */

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

    argument = one_argument( argument, arg );

    if (IS_NPC(ch)) return;
    if (!IS_CLASS(ch, CLASS_SCORPION))
    {
        send_to_char("#0UmMmMM#y?#n\n\r", ch );
        return;
    }
    if (arg[0] == '\0')
    {
        send_to_char("#0Scorpion Skins for sale#y: #LRing#y, #LCollar#y, #LPlate#y, #LHelmet#y, #LLeggings#y, #LBoots#y,#n\n\r"
                                                   "#LGauntlets#y, #LSleeves#y, #LCape#y, #LBelt#y, #LBracer#y, #LVisor#y, #LStinger#y.#n\n\r",ch);
        return;
    }

    else if (!str_cmp(arg,"ring"     ))   vnum = 37000;
    else if (!str_cmp(arg,"collar"   ))   vnum = 37001;
    else if (!str_cmp(arg,"plate"    ))   vnum = 37002;
    else if (!str_cmp(arg,"helmet"   ))   vnum = 37003;
    else if (!str_cmp(arg,"leggings" ))   vnum = 37004;
    else if (!str_cmp(arg,"boots"    ))   vnum = 37005;
    else if (!str_cmp(arg,"gauntlets"))   vnum = 37006;
    else if (!str_cmp(arg,"sleeves"  ))   vnum = 37007;
    else if (!str_cmp(arg,"cape"     ))   vnum = 37008;
    else if (!str_cmp(arg,"belt"     ))   vnum = 37009;
    else if (!str_cmp(arg,"bracer"   ))   vnum = 37010;
    else if (!str_cmp(arg,"visor"    ))   vnum = 37011;
    else if (!str_cmp(arg,"Stinger"  ))   vnum = 37012;
    else
    {
        do_scorpionskins(ch,"");
        return;
    }
    if (ch->practice < 120)
    {

    send_to_char("It costs 120 points of primal to create a Scorpion Skins.\n\r",ch);
     return;
    }

    if ( vnum == 0 || (pObjIndex = get_obj_index( vnum )) == NULL)
    {
        send_to_char("That object is M.I.A. lets the coders know.\n\r",ch);
        return;
    }
    ch->practice -= 120;
    obj = create_object(pObjIndex, 50);
    obj->questowner = str_dup(ch->pcdata->switchname);
    obj_to_char(obj, ch);
    act("$p appears in your hands in a blast of flames.",ch,obj,NULL,TO_CHAR);
    act("$p appears in $n's hands in a blast of flames.",ch,obj,NULL,TO_ROOM);
    return;
}

/* Powers */


void do_scorpionshell( CHAR_DATA *ch, char *argument )
{
  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_SCORPION))
{
  send_to_char("#0UmMmMM#y?#n\n\r",ch);
  return;
}
  if (ch->pcdata->powers[SCORPION_LIFE] < 2)
{
  send_to_char("#0You have not pleased the Scorpion King enuff#y.#n\n\r",ch);
  return;
}
  if (IS_SET(ch->pcdata->powers[SCORPION_GIFTS], SCORPION_SHELL))
{ 
  REMOVE_BIT(ch->pcdata->powers[SCORPION_GIFTS], SCORPION_SHELL);
  act("#0Your shell cracks and sheds away#y.#n", ch, NULL, NULL, TO_CHAR);
  act("$n #0is open to be attacked#y.#n", ch, NULL, NULL, TO_ROOM);
  return;
}
  SET_BIT(ch->pcdata->powers[SCORPION_GIFTS], SCORPION_SHELL);
  act("#0A thick black plasma hardens around you like a glove#y.#n", ch, NULL, NULL, TO_CHAR);
  act("$n groans, as the Scorpion King fills $s body.", ch, NULL, NULL, TO_ROOM);
  return;
}



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

    one_argument( argument, arg );

    if (IS_NPC(ch)) return;
    if (!IS_CLASS(ch, CLASS_SCORPION))
  {
    send_to_char("#0UmMmMM#y?#n\n\r", ch );
    return;
  }

    if (ch->pcdata->powers[SCORPION_DEATH] < 2)
  {
    send_to_char("#0You will have to earn a 2 in Death before scorpion pinch will work#y.#n\n\r",ch);
    return;
  }

    if (( victim = get_char_room( ch, arg )) == NULL)
  {

    if (ch->fighting == NULL)
  {
    send_to_char( "#0You can only hit what you can see#y.#n\n\r", ch );
    return;
  }

    else victim = ch->fighting;
  }

    if ( victim == ch )
  {
    send_to_char( "#0Attacking yourself could prove to be fatal#y.#n\n\r", ch );
    return;
  }

    if (is_safe( ch, victim )) return;

    one_hit(ch, victim, gsn_taillash, 1);
    one_hit(ch, victim, gsn_taillash, 1);
    one_hit(ch, victim, gsn_taillash, 1);
    one_hit(ch, victim, gsn_taillash, 1);

    WAIT_STATE( ch, 8 );

    return;
  }


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

    CHAR_DATA *gch;
    CHAR_DATA *gch_next;

    if (IS_NPC(ch)) return;
    if (!IS_CLASS(ch, CLASS_SCORPION))
  {
    send_to_char("#0UmMmMM#y?#n\n\r", ch );
    return;
  }

    if (ch->pcdata->powers[SCORPION_DEATH] < 1)
  {
    send_to_char("#0Mastering 1 in Death is the key to learning scorpion spin#y.#n\n\r",ch);
    return;
  }

    if (ch->move < 500)
  {
    send_to_char("#0You have#y'#0nt the juice to continue#y.#n\n\r",ch);
    return;
  }

    act("#0You summon the powers of the Scorpion King to crush your enemy#y.#n", ch, NULL, NULL, TO_CHAR);
    act("$n #0summons the powers of the Scorpion King to crush you#y.#n", ch, NULL, NULL, TO_ROOM);

    gch_next = ch->in_room->people;
    gch = ch->in_room->people;


    while (gch_next != NULL)
  {

    gch_next = gch->next_in_room;

    if (gch != ch)
  {

    if (is_safe(ch, gch)) break;

    one_hit(ch, gch, gsn_taillash, 2);
    one_hit(ch, gch, gsn_taillash, 1);
    one_hit(ch, gch, gsn_taillash, 2);
    one_hit(ch, gch, gsn_taillash, 1);

  }


    gch = gch_next;
  }

    ch->move -= 50;
    WAIT_STATE(ch, 12);

    return;
  }



void do_sspit(CHAR_DATA *ch, char *argument)
  {
    CHAR_DATA *victim;
    char arg [MAX_INPUT_LENGTH];
    int sn;
    int level;
    int spelltype; 

    one_argument( argument, arg );

if ((victim = get_char_room(ch, arg)) == NULL)
    {
      send_to_char("#0They arent here Jerky#y.#n\n\r", ch);
      return;
    }
    if (ch == victim)
    {
      send_to_char("#0Why would you spit on yourself#y?#n\n\r", ch);
      return;
    }
    

    if ((sn = skill_lookup( "web" )) < 0) return;

    spelltype = skill_table[sn].target;
    level = ch->spl[spelltype] * 1.00;
    (*skill_table[sn].spell_fun) ( sn, level, ch, victim );
 
    WAIT_STATE( ch, 10 );

    return;
  }

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

   if (!IS_CLASS(ch, CLASS_SCORPION))
   {
     send_to_char("Huh?\n\r",ch);
     return;
   }
   if (ch->pcdata->powers[SCORPION_DEATH] < 4)
   {
     send_to_char("You haven't mastered the skills abilities enough.\n\r",ch);
     return;
   }

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

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

    WAIT_STATE(ch, 5);
    do_say(ch,"#GThe sweet smell of #rBLOOD#7!#n");
    do_stance(victim, "");
}


void do_tailcleave(CHAR_DATA *ch, char *argument)
{
  CHAR_DATA *victim;
  char buf[MAX_STRING_LENGTH];
  int dam;

  if (IS_NPC(ch)) return;
 
  if (!IS_CLASS(ch, CLASS_SCORPION))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }
   if (ch->pcdata->powers[SCORPION_DEATH] < 4)
  {
    send_to_char("Your Scorpion Death Isnt High Enough..\n\r",ch);
    return;
  }

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

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


  WAIT_STATE( ch, 12 );
  if (!IS_NPC(victim)) dam = number_range(75000,95000);
  else dam = number_range(75000,95000);
  sprintf(buf,"#rYou #gS#rT#gI#rN#gG #7$N Penetrating Their Armor. [%d]\n\r",dam);
  act(buf,ch,NULL,victim,TO_CHAR);
  sprintf(buf,"$n's #gS#rT#gI#rN#gG #7STRIKES#n YOU!  [%d]\n\r",dam);
  act(buf,ch,NULL,victim,TO_VICT);
  sprintf(buf,"$n's #gS#rT#gI#rN#gG#rS#n $N #CP#cENETRATIN#CG#n Their Armor [%d]\n\r",dam);
  act(buf,ch,NULL,victim,TO_NOTVICT); 
  hurt_person(ch,victim, dam);
  return;
}






void do_crawl( CHAR_DATA *ch, char *argument )
{
  char arg[MAX_INPUT_LENGTH];
  ROOM_INDEX_DATA *location;
  CHAR_DATA *victim;
          
  one_argument (argument, arg);
  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_SCORPION))
  {
    send_to_char("Huh?\n\r", ch );
    return;
  }
  if (ch->pcdata->powers[SCORPION_DEATH] < 4)
  {
    send_to_char("#0You must learn to crawl before you can walk#y.#n\n\r",ch);  
    return;
  }
  if ((victim = get_char_world(ch, arg)) == NULL)
  {
    send_to_char("#0Crawl to which victim#y?#n\n\r", ch );
    return;
  }
  if (IS_SET(victim->in_room->room_flags, ROOM_ASTRAL))
  {
    stc( "#0Your senses cannot pinpoint them#y.#n\n\r",ch);
    return;
  }
  if (IS_IMMUNE(victim, IMM_TRAVEL) && !IS_NPC(victim))
  {
    send_to_char("#0They dont even like you#y, #0why would you think you can crawl to them#y?#n\n\r",ch);
    return;
  }
  if (IS_SET(ch->in_room->room_flags, ROOM_ASTRAL))
  {
    stc( "#0You are not connected to the astral sphere#y.#n\n\r",ch);
    return;
  }
  location = victim->in_room;
  if (ch->move < 500)
  {
    send_to_char("#0You have not the strength to crawl that far#y.#n\n\r", ch );
    return;
  }
  act("#0You dart into a hole in the ground#y.#n", ch, NULL, NULL, TO_CHAR);
  act("#L$n #0darts into a hole in the ground#y.#n", ch, NULL, NULL, TO_ROOM);
  ch->move -= 500;
  char_from_room(ch);
  char_to_room(ch, location);
  do_look(ch, "auto");
  act("You crawl out of a hole to suprise #L$N#y.#n", ch, NULL, victim, TO_CHAR);
  act("#n$n #0crawls out of a hole in the ground#y.#n", ch, NULL, NULL, TO_ROOM);
  return;
}