area/
/********************************************************************************* 
*This code written by Lustov of Aeternus Nox MUD, feel free to use it if you like*
*but please e-mail me if you do (mccauley@tiac.net).  Also... please send me any *
*improvements you make				   											 *
*********************************************************************************/

#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"
#include "warlock.h"



void do_eagleeye( 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_GLADIATOR) || ch->pcdata->powers[GPOWER_CORPUS] < 3)
	{
		send_to_char("Sorry, can't do that.\n\r", ch);
		return;
	}
	
	if (ch->hit < 1000)
	{
		send_to_char("You aren't powerful enough to use Eagleeye.\n\r",ch);
		return;
	}

if ( IS_SET(ch->act, PLR_HOLYLIGHT) )
    {
	REMOVE_BIT(ch->act, PLR_HOLYLIGHT);
	send_to_char( "Your senses return to normal.\n\r", ch );
    }
    else
    {
	SET_BIT(ch->act, PLR_HOLYLIGHT);
	send_to_char( "Your senses increase to incredible proportions.\n\r", ch );
    ch->hit -= 1000;
	return;
	}
	}

void do_vires( 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_GLADIATOR) || ch->pcdata->powers[GPOWER_PUGNARE] < 1)
    {
	send_to_char("Sorry, can't do that.\n\r",ch);
	return;
    }

	 
    if (IS_DEMPOWER(ch,DEM_MIGHT))
    {
	send_to_char("You already have Vires.\n\r",ch);
	return;
    }

	if (ch->hit < 1000)
    {
	send_to_char("You do not have enough power to use Vis.\n\r",ch);
	return;
    }

	if (!IS_DEMPOWER(ch,DEM_MIGHT))
    {
	act("$n looks stronger.",ch,NULL,NULL,TO_ROOM);
	send_to_char("You feel superhuman power rush through your veins.\n\r",ch);
	SET_BIT(ch->pcdata->powers[DPOWER_FLAGS],DEM_MIGHT);
	ch->hit -= 1000;
    }
}

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

    if (!IS_CLASS(ch,CLASS_GLADIATOR) || ch->pcdata->powers[GPOWER_PUGNARE] < 2)
    {
	send_to_char("Sorry, can't do that.\n\r",ch);
	return;
    }

    if (IS_DEMPOWER(ch,DEM_SPEED))
    {
	send_to_char("You already have Celeritas.\n\r",ch);
	return;
    }

    if (ch->hit < 1000)
    {
	send_to_char("You don't have enough power to use Celeritas.\n\r",ch);
	return;
    }

    if (!IS_DEMPOWER(ch,DEM_SPEED))
    {
	act("$n starts moving faster.",ch,NULL,NULL,TO_ROOM);
	send_to_char("You start moving faster.\n\r",ch);
	ch->hit -= 1000;
	SET_BIT(ch->pcdata->powers[DPOWER_FLAGS],DEM_SPEED);
    }
}

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

    if (!IS_CLASS(ch,CLASS_GLADIATOR) || ch->pcdata->powers[GPOWER_PUGNARE] < 3)
    {
	send_to_char("Huh?\n\r",ch);
	return;
    }

    if (IS_DEMPOWER(ch,DEM_TOUGH))
    {
	send_to_char("You already have Durus.\n\r",ch);
	return;
    }

    if (ch->hit < 1000)
    {
	send_to_char("You don't have enough power to use durus.",ch);
	return;
    }

    if (!IS_DEMPOWER(ch,DEM_TOUGH))
    {
	act("$n's muscles bulge.",ch,NULL,NULL,TO_ROOM);
	send_to_char("Your muscles bulge.\n\r",ch);
	SET_BIT(ch->pcdata->powers[DPOWER_FLAGS], DEM_TOUGH);
	ch->hit -= 1000;
    }
}




void do_solertiae( CHAR_DATA *ch, char *argument )
{
    char arg1[MAX_INPUT_LENGTH];
    char arg2[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];

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

    if (IS_NPC(ch)) return;

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

    if (arg1[0] == '\0' && arg2[0] == '\0')
    {
        sprintf(buf,"Skills: Pugnare (%d), Corpus (%d), Smithery (%d).\n\r",
        ch->pcdata->powers[GPOWER_PUGNARE], ch->pcdata->powers[GPOWER_CORPUS], ch->pcdata->powers[GPOWER_SMITHERY]);
        send_to_char(buf,ch);
        return;
    }
    if (arg2[0] == '\0')
    {
        if (!str_cmp(arg1,"pugnare"))
        {
            send_to_char("Pugnare - Combat Readiness.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_PUGNARE] < 1) 
                send_to_char("You have none of the pugnare skills.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_PUGNARE] > 0) 
                send_to_char("Vires - Strength.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_PUGNARE] > 1) 
                send_to_char("Celeritas - Speed.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_PUGNARE] > 2) 
                send_to_char("Durus - Toughness.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_PUGNARE] > 3) 
                send_to_char("Flank - The ability to sideswipe your opponent..\n\r",ch);
            
			return;
        }
        
		else if (!str_cmp(arg1,"Corpus"))
        {
            send_to_char("Corpus - Physical Training.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_CORPUS] < 1) 
                send_to_char("You have none of the Corpus skills.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_CORPUS] > 0) 
                send_to_char("Adreniline Rush - Increased Regeneraton.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_CORPUS] > 1) 
                send_to_char("Weight Training - Allows you to BodySlam your opponent.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_CORPUS] > 2)
				send_to_char("EagleEye - Allows you to see in the dark, and gives a one time +50 hitroll bonus.\n\r", ch);
		 
			return;
        }
        
		
		else if (!str_cmp(arg1,"Smithery"))
        {
            send_to_char("Smithery - The skill of invention and ingenuity.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_SMITHERY] < 1) 
                send_to_char("You do not know how to Forge.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_SMITHERY] > 0) 
                send_to_char("Wrist Guard - A small band worn on the wrist, to increase parrying.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_SMITHERY] > 1) 
                send_to_char("Arm Band - A small band worn on the upper arm to increase parrying.\n\r",ch);
            if (ch->pcdata->powers[GPOWER_SMITHERY] > 2) 
                send_to_char("Drop Forge - The ability to strengthen armour, resulting in -100 AC\n\r",ch);   
			if (ch->pcdata->powers[GPOWER_SMITHERY] > 3) 
                send_to_char("Brass Knuckles - The ability to make brass knuckles to uppercut your opponents with .\n\r",ch);
                
            return;
        }
        
		sprintf(buf,"Skills: Pugnare (%d), Corpus (%d), Smithery (%d)\n\r",
        ch->pcdata->powers[GPOWER_PUGNARE], ch->pcdata->powers[GPOWER_CORPUS], ch->pcdata->powers[GPOWER_SMITHERY]);
        send_to_char(buf,ch);
        return;
    }
    if (!str_cmp(arg2,"improve"))
    {
        int improve;
        int cost;
        int max;

             if (!str_cmp(arg1,"pugnare"   )) {improve = GPOWER_PUGNARE; max=4;}
			 else if (!str_cmp(arg1,"corpus")) {improve = GPOWER_CORPUS; max=3;}
        
			 else if (!str_cmp(arg1,"smithery"   )) {improve = GPOWER_SMITHERY; max=4;}
        
		else
        {
            send_to_char("Skills: Pugnare, Corpus, Smithery.\n\r",ch);
            return;
        }                                                       
        cost = (ch->pcdata->powers[improve]+1) * 10;
        arg1[0] = UPPER(arg1[0]);
        if ( ch->pcdata->powers[improve] >= max )
        {
            sprintf(buf,"You have already gained all the powers of the %s skill.\n\r", arg1);
            send_to_char(buf,ch);
            return;
        }
        if ( cost > ch->practice )
        {
            sprintf(buf,"It costs you %d primal to improve your %s skill.\n\r", cost, arg1);
            send_to_char(buf,ch);
            return;
        }
        ch->pcdata->powers[improve] += 1;
        ch->practice -= cost;
        sprintf(buf,"You improve your ability in the %s skill.\n\r",arg1);
        send_to_char(buf,ch);
    }
    else 
	{
		send_to_char("To improve a skill, type: Solertiae <skill type> improve.\n\r",ch);
        return;
	}
}

		




void do_spar( 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_GLADIATOR) )
        {
                send_to_char("Huh?\n\r", ch);
                return;
        }
            
   
     if ( arg[0] == '\0' )
    {
        send_to_char( "Spar with whom?\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 spar yourself.\n\r", ch );
        return;
    }

    if (IS_CLASS(victim, CLASS_GLADIATOR))
	{
		send_to_char( "They alread know how to fight.\n\r", ch);
		return;
	}

	if (IS_CLASS(victim, CLASS_NINJA))
    {
        send_to_char( "They already know how to fight.\n\r", ch );
        return;
    }

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

    if (IS_CLASS(victim, CLASS_VAMPIRE) || IS_SET(victim->pcdata->stats[UNI_AFF], VAM_MORTAL))
    {
        send_to_char( "You are unable to spar vampires!\n\r", ch );
        return;
    }

    if (IS_CLASS(victim, CLASS_WEREWOLF))
    {
        send_to_char( "You are unable to spar werewolves!\n\r", ch);
        return;
    }

    if (IS_CLASS(victim, CLASS_DEMON) || IS_SET(victim->special,SPC_CHAMPION))
    {
        send_to_char( "You are unable to spar demons!\n\r", ch );
        return;
    }


    if (IS_CLASS(victim, CLASS_HIGHLANDER))
    {
        send_to_char( "You are unable to spar highlanders.\n\r", ch );
        return;
    }
/*  No Drows - Krynn    
    if (IS_CLASS(victim, CLASS_DROW))
    {
    send_to_char( "Not on drows!\n\r",ch);
    return;
    }
    No Moogles - Krynn
    if (IS_CLASS(victim, CLASS_MOOGLE))
    {
    send_to_char( "Not on moogles!\n\r", ch);
    return;
    }
    No Paladins - Krynn
    if (IS_CLASS(victim, CLASS_PALADIN))
    {
    send_to_char("Not on paladins!\n\r", ch);
    return;
    }
*/
    if (!IS_IMMUNE(victim,IMM_VAMPIRE))
    {
        send_to_char( "You cannot spar an unwilling person.\n\r", ch );
        return;
    }

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

    if (victim->exp < 100000)
    {
        send_to_char("They cannot afford the 100000 exp required to spar with you.\n\r",ch);
        return;
    }

    ch->exp -= 100000;
    victim->exp -= 100000;

    act("You teach $N the ways of the gladiator.", ch, NULL, victim, TO_CHAR);
    act("$n teaches $N the ways of the gladiator.", ch, NULL, victim, TO_NOTVICT);
    act("$n teaches you the way of the gladiator.", ch, NULL, victim, TO_VICT);
    victim->class    = CLASS_GLADIATOR;
    
    
    send_to_char( "You are now a gladiator.\n\r", victim );
    free_string(victim->lord);
    victim->lord = str_dup(ch->name);
        free_string(victim->clan);
    victim->clan=str_dup(ch->clan);
    victim->pcdata->stats[UNI_GEN] = ch->pcdata->stats[UNI_GEN] + 1;
    save_char_obj(ch);
    save_char_obj(victim);
    return;
}