//
//Night Elf WCS:Python Race Coded in ESS By: J3ff Hoogland
//
block load
{
	wcs Race "Night Elf" registerSkill Evasion 5 2 "Have a chance to dodge damage from an attack."
	wcs Race "Night Elf" registerSkill Thorns 4 1 "Have a chance to reflect 30% damage back at your attacker."
	wcs Race "Night Elf" registerSkill "True Shot" 4 1 "Have a 30% change to deal bonus damage."
	wcs Race "Night Elf" registerUltimate Entangle 7 3 2 "Use your ultimate to stop all nearby enemies from moving."
	es_xset NE_Skill 0
	es_xset NE_Random 0
	es_xset NE_Damage 0
	es_xset NE_Filter 0
	es_xset NE_Team 0
	es_xset NE_Userid 0
}
event player_hurt
{
	es wcs GetLevel NE_Skill event_var(userid) "Night Elf" Evasion
	ifx true(NE_Skill) do
	{
		es_xmathparse NE_Skill "NE_Skill * 5"
		es_xrand NE_Random 1 100
		ifx parse("NE_Skill >= NE_Random") do
		{
			if (event_var(es_userdead) == 0) do
			{
				es wcs Heal event_var(userid) event_var(dmg_health)
				es_tell event_var(userid) #multi #lightgreenEvasion #default- #greenYou have dodged event_var(dmg_health) damage from an attack.
			}
		}
	}
	es wcs GetLevel NE_Skill event_var(userid) "Night Elf" Thorns
	ifx true(NE_Skill) do
	{
		es_xrand NE_Random 1 100
		es_xmathparse NE_Skill "rint(NE_Skill * 15)"
		ifx parse("NE_Skill >= NE_Random") do
		{
			es_set NE_Damage event_var(dmg_health)
			es_xmathparse NE_Damage "NE_Damage * .3"
			es wcs Damage event_var(attacker) server_var(NE_Damage) 32 event_var(userid)
			es_tell event_var(userid) #multi #lightgreenThorns #default- #greenYou have returned server_var(NE_Damage) damage to event_var(es_attackername).
			es wcs Beam1 event_var(userid) event_var(attacker) 1.5 0 255 0
		}
	}
	es wcs GetLevel NE_Skill event_var(attacker) "Night Elf" "True Shot"
	ifx true(NE_Skill) do
	{
		es_xrand NE_Random 1 100
		ifx parse("NE_Random <= 30") do
		{
			es_set NE_Damage event_var(dmg_health)
			es_xmathparse NE_Damage "rint(NE_Damage * (NE_Skill * .15))"
			es wcs Damage event_var(userid) server_var(NE_Damage) 32 event_var(attacker)
			es wcs Beam2 event_var(attacker) event_var(userid) 1.5 0 200 150
			es_tell event_var(attacker) #multi #lightgreenTrue Shot #default- #greenYou have dealt server_var(NE_Damage) extra damage.
		}
	}
}
event player_ultimate_on
{
	es wcs GetLevel NE_Skill event_var(userid) "Night Elf" Entangle
	ifx true(NE_Skill) do
	{
		es_GetPlayerTeam NE_Team event_var(userid)
		ifx parse("NE_Team == 2") do
		{
			es_xset NE_Filter #c
		}
		ifx parse("NE_Team == 3") do
		{
			es_xset NE_Filter #t
		}
		es_xmathparse NE_Skill "NE_Skill * 3"
		es est_Near NE_Userid server_var(NE_Filter) 640 event_var(userid) "es_xdoblock wcs/races/NightElf/Entangle"
		es wcs SetCoolDown event_var(userid) Entangle 8
	}
}
block Entangle
{
	es wcs Freeze server_var(NE_Userid) server_var(NE_Skill)
	es wcs Beam2 event_var(userid) server_var(NE_Userid) 1.5 0 255 0
	es_tell server_var(NE_Userid) #lightgreen You have been entangled!
}
