atd/area/
atd/build/
atd/clans/
atd/log/
atd/player/store/
atd/site/
atd/src/bin/
/***************************************************************************
 *  God Wars Mud originally written by KaVir aka Richard Woolcock.         *
 *  Changes done to the code done by Sage aka Walter Howard, this mud is   *
 *  for the public, however if you run this code it means you agree        *
 *  to the license.low, license.gw, and license.merc have fun. :)          *
***************************************************************************/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "player.h"

COMMAND( do_look )

void do_guide( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    int ch_age = years_old(ch);
    char      arg [MAX_INPUT_LENGTH];

    argument = one_argument( argument, arg );

    if (IS_NPC(ch)) return;

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

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

    if ( ch_age < 50 )
    {
       send_to_char("They must be 50 to become a monk!\n\r", ch);
       return;
    }
    
    if ( ( victim = get_char_room( ch, arg ) ) == NULL )
    {
	send_to_char( "They aren't here.\n\r", ch );
	return;
    }

    if ( IS_NPC(victim) )
    {
	send_to_char( "Not on NPC's.\n\r", ch );
	return;
    }

    if ( IS_IMMORTAL(victim) )
    {
	send_to_char( "Not on Immortals's.\n\r", ch );
	return;
    }

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

    if (IS_CLASS(victim, CLASS_MONK))
    {
	send_to_char( "They are already guided.\n\r", ch );
	return;
    }


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

    if ( victim->class != 0 )
    {
      stc("They are already classed.\n\r",ch);
      return;
    }


    if (!IS_IMMUNE(victim,IMM_VAMPIRE))
    {
	send_to_char( "You cannot guide an unwilling person.\n\r", ch );
	return;
    }

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


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

    ch->exp -= 50000;
    victim->exp -= 50000;

    act("You guide $N in the ways of god.", ch, NULL, victim, TO_CHAR);
    act("$n guide $N in the ways of god.", ch, NULL, victim, TO_NOTVICT);
    act("$n guide you in the way of god.", ch, NULL, victim, TO_VICT);
    send_to_char( "You are now a monk.\n\r", victim );
    free_string(victim->lord);
    victim->lord = str_dup(ch->name);
    victim->class    = CLASS_MONK;
    save_char_obj(ch);
    save_char_obj(victim);
    return;
}

/*
 * Awareness
 * 1 - nightsight
 * 2 - shadowsight
 * 3 - truesight
 * 4 - scry
 *
 * Code for these are included in clan.c
 */


/*
 * Body
 * 1 - Adamantium hands
 * 2 - Flaming hands
 * 3 - Chaos hands
 * 4 - ?
 */

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

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

    if (ch->monkab[BODY] < 1)
    {
	  send_to_char("You have not learned this ability yet.\n\r",ch);
	  return;
    }

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

    if (!IS_SET(ch->newbits, NEW_MONKADAM))
    {
	  SET_BIT(ch->newbits, NEW_MONKADAM);
	  send_to_char("Your hands turn as hard as adamantium!\n\r",ch);
	  act("$n's hands turn as hard as adamantium!\n\r",ch,NULL,NULL,TO_ROOM);
	  return;
    }
}

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

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

    if (ch->monkab[BODY] < 2)
    {
	  send_to_char("You require 2 body to use  Flaming Hands.\n\r",ch);
	  return;
    }

    if (IS_SET(ch->newbits, NEW_MONKFLAME))
    {
	  REMOVE_BIT(ch->newbits, NEW_MONKFLAME);
        send_to_char("Your hands are no longer engulfed by flames.\n\r",ch);
	  act("$n's hands are no longer engulfed by flames.\n\r",ch,NULL,NULL,TO_ROOM);
	  return;
    }
    if (!IS_SET(ch->newbits, NEW_MONKFLAME))
    {
	  SET_BIT(ch->newbits, NEW_MONKFLAME);
	  send_to_char("Your hands are engulfed by flames!\n\r",ch);
	  act("$n's hands are engulfed by flames!\n\r",ch,NULL,NULL,TO_ROOM);
	  return;
    }
}

void do_chands(CHAR_DATA *ch, char *argument )
{
  if(IS_NPC(ch)) return;
  if(!IS_CLASS(ch, CLASS_MONK))
  {
    stc("Huh?\n\r", ch);
    return;
  }
  
  if ( ch->monkab[BODY] < 3 )
  {
    stc("You need 3 body for Chaos hands.\n\r", ch);
    return;
  }

  if(IS_ITEMAFF(ch, ITEMA_CHAOSHANDS))
  {
    if(IS_ITEMAFF(ch, ITEMA_FIRESHIELD))
      REMOVE_BIT(ch->itemaffect, ITEMA_FIRESHIELD); 
    if(IS_ITEMAFF(ch, ITEMA_ACIDSHIELD))
      REMOVE_BIT(ch->itemaffect, ITEMA_ACIDSHIELD); 
    if(IS_ITEMAFF(ch, ITEMA_SHOCKSHIELD))
      REMOVE_BIT(ch->itemaffect, ITEMA_SHOCKSHIELD);  
    if(IS_ITEMAFF(ch, ITEMA_ICESHIELD))
      REMOVE_BIT(ch->itemaffect, ITEMA_ICESHIELD);  
    if(IS_ITEMAFF(ch, ITEMA_CHAOSSHIELD))
      REMOVE_BIT(ch->itemaffect, ITEMA_CHAOSSHIELD);  
    REMOVE_BIT(ch->itemaffect, ITEMA_CHAOSHANDS);
    act("The swirling colors around your hands disappear.",ch,NULL,NULL,TO_CHAR);
    act("The swirling colors around $n's hands disappear.",ch,NULL,NULL,TO_ROOM);
    return;
  }
  else
  {
    if(!IS_ITEMAFF(ch, ITEMA_FIRESHIELD))
      SET_BIT(ch->itemaffect, ITEMA_FIRESHIELD);  
    if(!IS_ITEMAFF(ch, ITEMA_ACIDSHIELD))
      SET_BIT(ch->itemaffect, ITEMA_ACIDSHIELD);  
    if(!IS_ITEMAFF(ch, ITEMA_SHOCKSHIELD))
      SET_BIT(ch->itemaffect, ITEMA_SHOCKSHIELD); 
    if(!IS_ITEMAFF(ch, ITEMA_ICESHIELD))
      SET_BIT(ch->itemaffect, ITEMA_ICESHIELD); 
    if(!IS_ITEMAFF(ch, ITEMA_CHAOSSHIELD))
      SET_BIT(ch->itemaffect, ITEMA_CHAOSSHIELD); 
    SET_BIT(ch->itemaffect, ITEMA_CHAOSHANDS);
    act("Swirling colors appear around your hands bringing up shields.",ch,NULL,NULL,TO_CHAR);
    act("Swirling colors appear around $n's hands.",ch,NULL,NULL,TO_ROOM);
    return;
  }
}



/*
 * Spirit
 * 1 - healingtouch
 * 2 - Spiritpower
 * 3 - godbless
 * 4 - darktouch
 */

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

    argument = one_argument( argument, arg );

    if (IS_NPC(ch)) return;

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

    if ( ch->monkab[SPIRIT] < 1 )
    {
        stc("You need to obtain level 1 spirit to use Healing touch.\n\r",ch);
       return;
    }

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

    WAIT_STATE(ch, 12);
 
    if ( victim == ch )
    {
        stc("You focus your energy, and magical sparks leap out of your body.\n\r", ch );
        act("$n concentrates, and magical sparks leap out of $s body.",ch,NULL,NULL,TO_ROOM);
        SET_BIT(ch->monkstuff, MONK_HEAL);
        return;
    }

    act("You place your hands on $N's head and focus your energy on $M.",ch,NULL,victim,TO_CHAR);
    act("$n places $s hands on your head and you feel warmer.",ch,NULL,victim,TO_VICT);
    act("$n places $s hands on $N's head and concentrates.",ch,NULL,victim,TO_ROOM);
    SET_BIT(victim->monkstuff, MONK_HEAL);
    return;

}

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

    if (IS_NPC(ch)) return;

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

    if( ch->monkab[SPIRIT] < 2 )
    {
        stc("You require spirit 3 for spirit power.\n\r", ch );
        return;    
    }

    if ( IS_SET(ch->newbits, NEW_POWER) )
    {
        stc("Your spiritual power fades.\n\r",ch);
        REMOVE_BIT(ch->newbits, NEW_POWER);
        return;
    }

   if ( ch->move < 100 )
    {
        stc("You are too exhausted.\n\r",ch);
        return;
    }

    SET_BIT(ch->newbits, NEW_POWER);
    ch->move -= 50;
    stc("Your body pulses with spiritual energy.\n\r",ch);
    return;

 return;

}


void do_godsbless( CHAR_DATA *ch, char *argument )
{
  int sn;
  AFFECT_DATA af;

  if (IS_NPC(ch)) 
    return;
  if (!IS_CLASS(ch, CLASS_MONK))
  {
    send_to_char("Huh?\n\r", ch);
    return;
  }
  if ( ch->monkab[SPIRIT] < 3 )
  {
    send_to_char("You need atleast 3 spirit to use Almighty Favor\n\r", ch);
    return;
  }
  if (ch->mana < 3000) 
  {
    send_to_char("You don't have enough mana.\n\r", ch );
    return;
  }
 
  sn = skill_lookup( "godbless" );
  
  if ( is_affected( ch, sn ) )
  {
	send_to_char("You are already affected by godbless", ch );
	return;
  }

    af.type      = sn;
    af.duration  = 150;
    af.location  = APPLY_HITROLL;
    af.modifier  = 100;
    af.bitvector = 0;
    affect_to_char( ch, &af );

    af.location  = APPLY_SAVING_SPELL;
    af.modifier  = 0 - 150;
    affect_to_char( ch, &af );

    af.location  = APPLY_DAMROLL;
    af.modifier  = 100;
    affect_to_char( ch, &af );
    act( "$n is filled with God's Blessing.", ch, NULL, NULL, TO_ROOM );
    send_to_char( "You are filled with God's Blessing.\n\r", ch);

  WAIT_STATE( ch, 12 );
  ch->mana = ch->mana - 3000;
  return;
}


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

    argument = one_argument( argument, arg );

    if (IS_NPC(ch)) return;

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


    if ( ch->monkab[SPIRIT] < 4 )
    {
        stc("You need to obtain level 4 spirit to use Death touch.\n\r",ch);
        return;
    }

    if ( ch->focus[CURRENT] < 20 )
    {
       stc("You need atleast 20 focus points to use th is power.\n\r", ch);
       return;
    }

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

     if( victim == ch )
     {
	stc("You cannot do that to yourself.\n\r", ch );
	return;
     }

    if ( is_safe( ch, victim ) )
      return;

    WAIT_STATE(ch, 12);
    act("You place your hands on $N's head and channel negative energy into $m.",ch,NULL,victim,TO_CHAR);
    act("$n places $s hands on your head, and you scream in utter pain.",ch,NULL,victim,TO_VICT);
    act("$n places $s hands on $N's head and $N screams in pain.",ch,NULL,victim,TO_ROOM);
    SET_BIT(victim->monkstuff, MONK_DEATH);
        update_pos(victim);
    ch->focus[CURRENT] -= 20;
    return;
}


/*
 * Combat
 * 1 - Blinding
 * 2 - Steelskin
 * 3 - ?
 * 4 - Godshold
 */
void do_blinding( CHAR_DATA *ch, char *argument )
{
  CHAR_DATA *victim;
  char arg[MAX_INPUT_LENGTH];

  argument = one_argument( argument, arg );
  if ( IS_NPC(ch)) return;

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

  if ( ch->monkab[COMBAT] < 1 )
  {
    stc("You need a level one mastery of the combat to use Blinding Agony.\n\r", ch );
    return;
  }

  if ( arg[0] == '\0' )
  {
    stc("Who do you wish to use Blinding Agony on?\n\r",ch);
    return;
  }

  if ( ch->move < 200 )
  {
    stc("You are far too exhausted to use Blinding Agony.\n\r",ch);
    stc("Try getting 200 movement points.\n\r",ch);
    return;
  }

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

  if ( is_safe(ch,victim) ) return;

  if ( IS_SET(victim->affected_by, AFF_TOTALBLIND) )
  {
    act("You hurl a ball of blinding light at $N.",ch,NULL,victim,TO_CHAR);
    act("$n hurls a ball of blinding light at you.",ch,NULL,victim,TO_VICT);
    act("$n hurls a ball of blinding light at $N.",ch,NULL,victim,TO_ROOM);
    stc("Nothing happens.\n\r",ch);
    ch->move -= 100;
    return;
  }

  else
  {
    act("You hurl a ball of blinding light at $N.",ch,NULL,victim,TO_CHAR);
    act("$n hurls a ball of blinding light at you.",ch,NULL,victim,TO_VICT);
    act("$n hurls a ball of blinding light at $N.",ch,NULL,victim,TO_ROOM);
    spell_totalblind( gsn_totalblind, ch->spl[TAR_CHAR_OFFENSIVE], ch, victim );
    ch->move -= 200;
    stc("The searing heat of the ball blinds you.\n\r",victim);
    return;
  }
 return;
}

void do_steelskin( CHAR_DATA *ch, char *argument )
{
  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_MONK))
  {
    send_to_char("Huh?\n\r", ch);
    return;
  }
  if (ch->monkab[SPIRIT] < 2 )
  {
    send_to_char("You need 2 spirit to use the skin of steel.\n\r", ch);
    return;
  }
  if ( IS_AFFECTED(ch, AFF_STEELSHIELD))
  {
    REMOVE_BIT(ch->affected_by, AFF_STEELSHIELD);
    send_to_char( "Your steel shield disappears.\n\r", ch );
  }
  else
  {
    SET_BIT(ch->affected_by, AFF_STEELSHIELD);
    send_to_char( "You are surrounded by a steel shield\n\r", ch );
  }
  return;
}


void do_ghold( CHAR_DATA *ch,char *argument )
{
  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch,CLASS_MONK))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }
  if ( ch->monkab[COMBAT] < 4 )
  {
    send_to_char("You need combat 4 to use gods hold.\n\r",ch);
    return;
  }
  if (!IS_SET(ch->newbits, NEW_COIL))
  {
    send_to_char("God joins you at your side to hold your foe.\n\r",ch);
    SET_BIT(ch->newbits, NEW_COIL);
    return;
  }
  else if (IS_SET(ch->newbits, NEW_COIL))
  { 
    send_to_char("God leaves your side.\n\r",ch);
    REMOVE_BIT(ch->newbits,NEW_COIL);
    return;
  }
}