eod/
eod/changes/
eod/log/
eod/player/
eod/player/backup/
eod/player/store/
/* TITAN CLASS CODED BY DARRENS */


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


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

//  char buf[MAX_STRING_LENGTH];
  char arg[MAX_INPUT_LENGTH];

   argument = one_argument(argument, arg);

  if (IS_NPC(ch)) return;

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


  if (arg[0] == '\0')
  {
    send_to_char("Enhance what [combat knowledge or power]\n\r",ch);
    return;
  }


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

    if (ch->pcdata->powers[TITAN_COMBAT] > 4)
    {
      send_to_char("You already have all 5 levels of combat.\n\r",ch);
      return;
    }

    if (ch->practice < (ch->pcdata->powers[TITAN_COMBAT]+1)*150)
    {
      send_to_char("You don't have enough primal.\n\r",ch);
      return;
    }
    ch->pcdata->powers[TITAN_COMBAT]++;
    ch->practice -= ch->pcdata->powers[TITAN_COMBAT]*150;
    send_to_char("Your understanding of combat has become more powerful.\n\r",ch);
  }


  else if (!str_cmp(arg, "knowledge"))
  {
    if (ch->pcdata->powers[TITAN_KNOWLEDGE] > 4)
    {
      send_to_char("You already have all 5 levels of knowledge.\n\r",ch);
      return;
    }

    if (ch->practice < (ch->pcdata->powers[TITAN_KNOWLEDGE]+1)*150)
    {
      send_to_char("You don't have enough primal.\n\r",ch);
      return;
    }
    ch->pcdata->powers[TITAN_KNOWLEDGE]++;
    ch->practice -= ch->pcdata->powers[TITAN_KNOWLEDGE]*150;
    send_to_char("Your understanding of knowledge has become more powerful.\n\r",ch);
  }
  
   else if (!str_cmp(arg, "power"))
  {
    if (ch->pcdata->powers[TITAN_POWER] > 9)
    {
      send_to_char("You already have all 10 levels of power.\n\r",ch);
      return;
    }

    if (ch->practice < (ch->pcdata->powers[TITAN_POWER]+1)*150)
    {
      send_to_char("You don't have enough primal.\n\r",ch);
      return;
    }
    ch->pcdata->powers[TITAN_POWER]++;
    ch->practice -= ch->pcdata->powers[TITAN_POWER]*150;
    send_to_char("You have become more powerful.\n\r",ch);
  }

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

  return;
}


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

  char arg[MAX_INPUT_LENGTH];
  CHAR_DATA *victim;
  ROOM_INDEX_DATA *location;

  one_argument (argument, arg);


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


  if (ch->pcdata->powers[TITAN_KNOWLEDGE] < 1)
  {
    send_to_char("You need level 1 in knowledge before you can cloudhop.\n\r",ch);
    return;
  }


  if ((victim = get_char_world(ch, arg)) == NULL)
  {
    send_to_char("You are unable to find them.\n\r", ch );
    return;
  }


  if (IS_SET(victim->in_room->room_flags, ROOM_ASTRAL))
  {
    send_to_char( "You cannot enter the Astral sphere.\n\r",ch);
    return;
  }


  if (IS_SET(victim->immune, IMM_TRAVEL) && !IS_NPC(victim))
  {
    send_to_char("You cannot travel to them, they are immune.\n\r",ch);
    return;
  }


  if (ch->move < 250)
  {
    send_to_char("Your to tired to go cloudhopping.\n\r", ch );
    return;
  }


  location = victim->in_room;


  act("You concentrate on the journey ahead.", ch, NULL, NULL, TO_CHAR);


  act("$n hops away on a cloud and disappears.", ch, NULL, NULL, TO_ROOM);

  ch->move -= 250;


  char_from_room(ch); 
  char_to_room(ch, location);


  do_look(ch, "");


  act("You materialize.", ch, NULL, NULL, TO_CHAR);
  act("$n suddenly appears on a cloud.", ch, NULL, NULL, TO_ROOM);


  return;
}  


void do_crushingblow(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_TITAN))
  {
    send_to_char("Huh?\n\r", ch );
    return;
  }


  if (ch->pcdata->powers[TITAN_COMBAT] < 5)
  {
    send_to_char("You need level 5 in combat before you can use crushingblow.\n\r",ch);
    return;
  }


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

    if (ch->fighting == NULL)
    {
      send_to_char( "They aren't here.\n\r", ch );
      return;
    }

    else victim = ch->fighting;
  }

  if ( victim == ch )
  {
    send_to_char( "You really don't want to attack yourself.\n\r", ch );
    return;
  }


  if (is_safe( ch, victim )) return;


  multi_hit(ch, victim, gsn_sweepblow);

  WAIT_STATE( ch, 12 );


  return;
}



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

  CHAR_DATA *gch;
  CHAR_DATA *gch_next;


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

 
  if (ch->pcdata->powers[TITAN_COMBAT] < 2)
  {
    send_to_char("You need level 2 in combat before you can use flameburst.\n\r",ch);
    return;
  }


  if (ch->mana < 1000)
  {
    send_to_char("You cannot harness the magical energies.\n\r",ch);
    return;
  }

  act("You send a plea to the gods, calling for their almighty wrath to smite thos who oppose you.", ch, NULL, NULL, TO_CHAR);
  act("$n raises $s hands to the sky and call for the gods to smite $s enemies.", 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_fireball, 0);
      one_hit(ch, gch, gsn_fireball, 0);
      one_hit(ch, gch, gsn_fireball, 0);
    }


    gch = gch_next;
  }


   ch->mana -= 2000;
   WAIT_STATE(ch, 24);

  return;
}



void do_supermight(CHAR_DATA *ch, char *argument)
{
 
  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_TITAN))
  {
    send_to_char("Huh?\n\r", ch );
    return;
  }


  if (ch->pcdata->powers[TITAN_POWER] < 3)
  {
    send_to_char("You need level 3 in power before you can use supermight.\n\r",ch);
    return;
  }

 
  if (ch->pcdata->powers[TITAN_SUPERMIGHT] == 0)
  {
    ch->pcdata->powers[TITAN_SUPERMIGHT] = 1;
    act("The Titan called $n growls with insane glee, as the might of the Titans runs through it's vein", ch, NULL, NULL , TO_ROOM);
    act ("The might of the titans runs through your veins.",ch,NULL,NULL,TO_CHAR);
    
    }


  else
  {
    ch->pcdata->powers[TITAN_SUPERMIGHT] = 0;


    act("$n looks weaker, as if the power of the Titans have left $m.", ch, NULL, NULL, TO_ROOM);
    act("You grow weaker as you lessen your might.", ch, NULL, NULL, TO_CHAR);
  }
 return;
}

void do_tearthquake(CHAR_DATA *ch, char *argument)
{
  CHAR_DATA *victim;
  char buf[MAX_INPUT_LENGTH];

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

  if (ch->pcdata->powers[TITAN_KNOWLEDGE] < 5)
  {
    send_to_char("You need level 5 in knowledge before you can use earthquake.\n\r",ch);
    return;
  }

  if (ch->pcdata->powers[POWER_TICK] > 0)
  {
    send_to_char("This power can not be used again yet.\n\r", ch);
    return;
  }

  if ((victim = ch->fighting) == NULL)
  {
    send_to_char("You are not fighting anyone.\n\r", ch);
    return;
  }

 if (IS_NPC(victim))
{
send_to_char("You cannot do this to an NPC.\n\r",ch);
return;
}

  ch->pcdata->powers[POWER_TICK] = 3;

  sprintf(buf, "%s looks weaker as he drops from his stance.\n\r",victim->name);
 send_to_char(buf,ch);
  sprintf(buf, "You look weaker as %s knocks you out of your fighting stance.\n\r",ch->name);
  send_to_char(buf,victim); 
 do_stance(victim, "");
  WAIT_STATE(ch,10);
  return;
}

void do_titanarmor( 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_TITAN) )
  {
    send_to_char("You are not a titan!!!\n\r",ch);
    return;
  }
  if (arg[0] == '\0')
  {
    send_to_char("Please specify which piece of titan armor you wish to make: 
plate ring bracer collar helmet leggings boots gauntlets sleeves cape belt visor hammer.\n\r",ch);
    return;
  }
  if ( ch->practice < 150 )
  {
    send_to_char("It costs 150 points of primal to create a piece of titan armor.\n\r",ch);
    return;
  }
  if (!str_cmp(arg,"plate")) vnum = 33304;
  else if (!str_cmp(arg,"hammer")) vnum = 33300;
  else if (!str_cmp(arg,"ring")) vnum = 33301;
  else if (!str_cmp(arg,"bracer")) vnum = 33303;
  else if (!str_cmp(arg,"collar")) vnum = 33302;
  else if (!str_cmp(arg,"helmet")) vnum = 33305;
  else if (!str_cmp(arg,"leggings")) vnum = 33306;
  else if (!str_cmp(arg,"boots")) vnum = 33307;
  else if (!str_cmp(arg,"gauntlets")) vnum = 33308;
  else if (!str_cmp(arg,"sleeves")) vnum = 33309;
  else if (!str_cmp(arg,"cape")) vnum = 33310;
  else if (!str_cmp(arg,"belt")) vnum = 33311;
  else if (!str_cmp(arg,"visor")) vnum = 33312;
  else
  {
    send_to_char("Please specify which piece of titan armor you wish to make: 
plate ring bracer collar helmet leggings boots gauntlets sleeves cape belt visor hammer.\n\r",ch);
    return;
  }
  if ( vnum == 0 || (pObjIndex = get_obj_index( vnum )) == NULL)
  {
    send_to_char("Missing object, please inform Darrens.\n\r",ch);
    return;
  }
  obj = create_object(pObjIndex, 50);
  obj->questowner = str_dup(ch->pcdata->switchname);
  obj_to_char(obj, ch);
  act("$p appears in your hands.",ch,obj,NULL,TO_CHAR);
  act("$p appears in $n's hands.",ch,obj,NULL,TO_ROOM);
  ch->practice -=150;
  return;
}

void do_titanheal( CHAR_DATA *ch, char *argument )
{
  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_TITAN))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }
  if (ch->pcdata->powers[TITAN_KNOWLEDGE] < 5)
  {
    send_to_char("You need 5 in knowledge to use this.\n\r",ch);
    return;
  }
  if (ch->mana < 1500)
  {
    send_to_char("You don't have enough mana.\n\r",ch);
    return;
  }
  ch->mana -= 1500;
  ch->hit += ch->pcdata->powers[TITAN_KNOWLEDGE]*100;   
  if (ch->hit > ch->max_hit) ch->hit = ch->max_hit;
  act("You feel the healing power of the Titans come upon you as you regain hp.", ch, NULL, NULL, TO_CHAR);
  act("$n feels the healing power of the Titans as $s regenerates $s hp.", ch, NULL, NULL, TO_ROOM);
  WAIT_STATE(ch,18);
  return;
}

void do_hammersmash( CHAR_DATA *ch, char *argument )
{
  CHAR_DATA *victim;
  OBJ_DATA *obj;
  int limb;

  if (IS_NPC(ch)) return;
  if( !IS_CLASS(ch, CLASS_TITAN) )
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }
  if (ch->pcdata->powers[TITAN_COMBAT] < 5)
  {
    send_to_char("You need to train your combat to 5 before using this.\n\r",ch);
    return;
  }
  if (( victim = ch->fighting ) == NULL )
  {
    send_to_char( "You aren't fighting anyone.\n\r", ch );
    return;
  }
  act("You bring down your hammer on $N and smash $S til he can no longer move.",ch,NULL,victim,TO_CHAR);
  act("$n smashes you to the ground and #CSMASHES#n you.",ch,NULL,victim,TO_VICT);
  act("$n smashes $N with his hammer and crushes $S until he can no longer move.",ch,NULL,victim,TO_NOTVICT);
  hurt_person(ch,victim,500);
  limb = number_range(1,4);
  if (number_range(1,100) > 60 && !IS_NPC(victim)) {
  if (limb < 3)
  {
    if (!IS_ARM_R(victim,LOST_ARM))            SET_BIT(victim->loc_hp[3],LOST_ARM);
    if (!IS_BLEEDING(victim,BLEEDING_ARM_R))   SET_BIT(victim->loc_hp[6],BLEEDING_ARM_R);
    if (IS_BLEEDING(victim,BLEEDING_HAND_R))   REMOVE_BIT(victim->loc_hp[6],BLEEDING_HAND_R);
    if ((obj = get_eq_char( victim, WEAR_ARMS )) != NULL)     take_item(victim,obj);
    if ((obj = get_eq_char( victim, WEAR_WIELD )) != NULL)    take_item(victim,obj);
    if ((obj = get_eq_char( victim, WEAR_HANDS )) != NULL)    take_item(victim,obj);
    if ((obj = get_eq_char( victim, WEAR_WRIST_R )) != NULL)  take_item(victim,obj);
    if ((obj = get_eq_char( victim, WEAR_FINGER_R )) != NULL) take_item(victim,obj);
  }
  else
  {
    if (!IS_ARM_L(victim,LOST_ARM))            SET_BIT(victim->loc_hp[2],LOST_ARM);
    if (!IS_BLEEDING(victim,BLEEDING_ARM_L))   SET_BIT(victim->loc_hp[6],BLEEDING_ARM_L);
    if (IS_BLEEDING(victim,BLEEDING_HAND_L))   REMOVE_BIT(victim->loc_hp[6],BLEEDING_HAND_L);
    if ((obj = get_eq_char( victim, WEAR_ARMS )) != NULL)     take_item(victim,obj);
    if ((obj = get_eq_char( victim, WEAR_HOLD )) != NULL)     take_item(victim,obj);
    if ((obj = get_eq_char( victim, WEAR_HANDS )) != NULL)    take_item(victim,obj);
    if ((obj = get_eq_char( victim, WEAR_WRIST_L )) != NULL)  take_item(victim,obj);
    if ((obj = get_eq_char( victim, WEAR_FINGER_L )) != NULL) take_item(victim,obj);
  }
  }
  WAIT_STATE(ch,10);
  return;
}