
/*
SKILL ID:
#deathgod
0 = white lightning
1 = shine brightly
2 = ice ring
3 = restrain
4 = cherry blossoms
5 = death sting
#hollow
0 = devour soul
1 = hollow bullet
2 = negation
3 = cero
4 = steel skin
5 = volcanic flame
*/

public skill_active_check(id,skill_level,skill_cost,skill_class)
{		
	static bool:skill_class_all;
	
	if(skill_class == 0)
	{
		skill_class_all=true;
	}
	else
	{
		skill_class_all=false;
	}
	
	if(skill_level == 0)
	{
		print_hud_status(id,"%L",id,"L_STATUS_SKILL_NOT");
	}
	else if(g_player_class[id] != skill_class && !skill_class_all)
	{
		print_hud_status(id,"%L",id,"L_STATUS_SKILL_REQ");
	}
	else if(g_player_spirit[id] < skill_cost)
	{
		print_hud_status(id,"%L",id,"L_STATUS_SKILL_SPIRIT");
	}
	else if(g_player_in_skill[id])
	{
		print_hud_status(id,"%L",id,"L_STATUS_SKILL_CAST");
	}
	else if(g_event_freeze_time)
	{
		print_hud_status(id,"%L",id,"L_STATUS_SKILL_FT");
	}
	else
	{
		return true;
	}
	
	return false;
}

public skill_passive_check(id,skill_level,skill_cost,skill_class,skill_chance)
{
	if((skill_level > 0) && (g_player_spirit[id] >= skill_cost) && (g_player_class[id] == skill_class) && (!g_event_freeze_time))
	{
		if(random_chance(skill_chance,100))
		{
			return true;
		}
	}
	
	return false;
}

public skill_passive(id,victim,type,damage,weapon,hitplace,ta)
{
	switch(type)
	{
		case 0:
		{
			if(skill_passive_check(id,g_skill[id][P_SKILL_1],1,CLASS_HOLLOW,BLEACH_SKILL_NOVICE_CHANCE*g_skill[id][P_SKILL_1]))
			{
				skill_devour_soul(id,victim);
			}
		}
		case 1:
		{
			if(skill_passive_check(id,g_skill[id][P_SKILL_2],5,CLASS_DEATHGOD,BLEACH_SKILL_NOVICE_CHANCE*g_skill[id][P_SKILL_2]))
			{
				skill_shine_brightly(id,victim);
			}
			
			if(skill_passive_check(victim,g_skill[victim][P_SKILL_3],10,CLASS_HOLLOW,BLEACH_SKILL_NORMAL_CHANCE*g_skill[victim][P_SKILL_3]))
			{
				skill_negation(id,victim);
			}
			
			if(skill_passive_check(victim,g_skill[id][P_SKILL_4],15,CLASS_DEATHGOD,BLEACH_SKILL_NOVICE_CHANCE*g_skill[id][P_SKILL_4]))
			{
				skill_restrain(id,victim,hitplace);
			}

			if(skill_passive_check(victim,g_skill[victim][P_SKILL_5],15,CLASS_HOLLOW,BLEACH_SKILL_GREATER_CHANCE*g_skill[victim][P_SKILL_5]))
			{
				skill_steel_skin(id,victim,damage,weapon,hitplace);
			}
			
			if(skill_passive_check(victim,g_skill[id][P_SKILL_6],15,CLASS_DEATHGOD,BLEACH_SKILL_GREATER_CHANCE*g_skill[id][P_SKILL_6]))
			{
				skill_death_sting(id,victim,weapon,hitplace);
			}
		}
	}
	
	return PLUGIN_CONTINUE;
}

public skill_select_check(id,skill,req_level,max_level)
{
	if(g_player_level[id] < req_level)
	{
		client_print(id,print_chat,"%L",id,"L_SKILL_REQ",PLUGIN_TAG,req_level);
	}
	else if(skill == max_level)
	{
		client_print(id,print_chat,"%L",id,"L_SKILL_MAX",PLUGIN_TAG,max_level);
	}
	else
	{
		return true;
	}
	
	return false;
}

public skill_deathmsg(id,victim)
{
	if(!is_user_alive(victim))
	{
		static frags;
		
		create_death_msg(id,victim,0,"skill");
			
		frags=get_user_frags(id)+1;
		set_user_frags(id,frags);
		
		if(id!=victim)
		{
			static xp;
			xp=xp_get(get_pcvar_num(cvar_xp_skill));
			
			client_print(id,print_chat,"%L",id,"L_XP_SKILL",PLUGIN_TAG,xp);
			xp_set(id,g_player_experience[id]+xp);
		}
	}
}

//---------------------------------------------------------------------

#include "skills\active\white-lightning.inl"
#include "skills\active\hollow-bullet.inl"
#include "skills\active\spirit-release.inl"
#include "skills\active\cero.inl"
#include "skills\active\ice-ring.inl"
#include "skills\active\cherry-blossoms.inl"
#include "skills\active\volcanic-flame.inl"

//---------------------------------------------------------------------

#include "skills\passive\devour-soul.inl"
#include "skills\passive\shine-brightly.inl"
#include "skills\passive\negation.inl"
#include "skills\passive\steel-skin.inl"
#include "skills\passive\restrain.inl"
#include "skills\passive\death-sting.inl"
