block load
{
	wcs_xalias ulti_immunity1 "es_xset wcs_ok 0;es wcsgroup get ulti_immunity wcs_tmp server_var(wcs_target);if (server_var(wcs_tmp) == 0) then wcs_xalias ulti_immunity2"
	wcs_xalias ulti_immunity2 "es wcsgroup get ulti_immunity wcs_tmp server_var(wcs_target);if (server_var(wcs_tmp) == 0) then es_xset wcs_ok 1"
	wcs_xalias ulti_failed    "es wcs_xtell server_var(wcs_targetid) u_ulti_immunity_v;es wcs_xtell server_var(wcs_userid) u_ulti_immunity_a"
	wcs_xalias spec_checkwall "es_xexists ex command est_getwallbetween;if (server_var(ex) == 1) then est_getwallbetween wcs_wall server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2);if (server_var(ex) == 0) then es_xset wcs_wall 0"
}

block wcs_ulti_teleport
{
	es_xset wcs_ok 1
	//es wcsx get getViewCoord wcs_coord server_var(wcs_userid)
	//es wcsx split server_var(wcs_coord) wcs_x1 wcs_y1 wcs_z1
	es playerget viewcoord server_var(wcs_userid) wcs_x1 wcs_y1 wcs_z1
	//es est_GetViewCoord server_var(wcs_userid) wcs_x1 wcs_y1 wcs_z1
	es_getplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_userid)
	es_xcopy wcs_x wcs_x1
	es_xcopy wcs_y wcs_y1
	es_xcopy wcs_z wcs_z1
	es_math wcs_x - server_var(wcs_x2)
	es_math wcs_y - server_var(wcs_y2)
	es_math wcs_z - server_var(wcs_z2)
	if (server_var(wcs_x) < 0) then es_xmath wcs_x * -1
	if (server_var(wcs_y) < 0) then es_xmath wcs_y * -1
	if (server_var(wcs_z) < 0) then es_xmath wcs_z * -1
	ifx parse("(wcs_range < wcs_x) or (wcs_range < wcs_y) or (wcs_range < wcs_z)") do
	{
		es_xset wcs_ok 0
	}
	es wcsgroup get invisp wcs_tmp server_var(wcs_userid)
	if (server_var(wcs_tmp) != 0) do
	{
		//es_xmath wcs_tmp float
		//es_xmath wcs_tmp - 100
		//es_xmath wcs_tmp * -2.55
		//es est_rounddecimal wcs_tmp server_var(wcs_tmp) 0
		es wcs_setfx invisp server_var(wcs_userid) = server_var(wcs_tmp) 1
		//es est_setplayercolor server_var(wcs_userid) 255 255 255 0 1
		//es_delayed 1 est_setplayercolor server_var(wcs_userid) 255 255 255 server_var(wcs_tmp) 1
	}
	ifx true(wcs_ok) do
	{
		es wcsx create wcs_coord server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1)
		es wcs pushto server_var(wcs_userid) server_var(wcs_coord) 2
		//es est_PushTo server_var(wcs_userid) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) "2"
		es wcs_xtell server_var(wcs_userid) u_teleported
		es usermsg fade server_var(wcs_userid) 0 server_var(wcs_fadetimer) 1 0 0 0 250
		//es est_Fade server_var(wcs_userid) 0 server_var(wcs_fadetimer) 1 0 0 0 250
	}
	else do
	{
		if (server_var(wcs_range) < server_var(wcs_x)) do
		{
			if (server_var(wcs_x2) >= 0) do
			{
				if (server_var(wcs_x1) >= 0) do
				{
					if (server_var(wcs_x2) <= server_var(wcs_x1)) then es_xmath wcs_x2 + server_var(wcs_range)
					if (server_var(wcs_x2) > server_var(wcs_x1)) then es_xmath wcs_x2 - server_var(wcs_range)
				}
				else do
				{
					es_math wcs_x2 - server_var(wcs_range)
				}
			}
			else do
			{
				if (server_var(wcs_x1) < 0) do
				{
					if (server_var(wcs_x2) <= server_var(wcs_x1)) then es_xmath wcs_x2 + server_var(wcs_range)
					if (server_var(wcs_x2) > server_var(wcs_x1)) then es_xmath wcs_x2 - server_var(wcs_range)
				}
				else do
				{
					es_math wcs_x2 + server_var(wcs_range)
				}
			}
			es_xcopy wcs_x1 wcs_x2
		}
		if (server_var(wcs_range) < server_var(wcs_y)) do
		{
			if (server_var(wcs_y2) >= 0) do
			{
				if (server_var(wcs_y1) >= 0) do
				{
					if (server_var(wcs_y2) <= server_var(wcs_y1)) then es_xmath wcs_y2 + server_var(wcs_range)
					if (server_var(wcs_y2) > server_var(wcs_y1)) then es_xmath wcs_y2 - server_var(wcs_range)
				}
				else do
				{
					es_math wcs_y2 - server_var(wcs_range)
				}
			}
			else do
			{
				if (server_var(wcs_y1) < 0) do
				{
					if (server_var(wcs_y2) <= server_var(wcs_y1)) then es_xmath wcs_y2 + server_var(wcs_range)
					if (server_var(wcs_y2) > server_var(wcs_y1)) then es_xmath wcs_y2 - server_var(wcs_range)
				}
				else do
				{
					es_math wcs_y2 + server_var(wcs_range)
				}
			}
			es_xcopy wcs_y1 wcs_y2
		}
		if (server_var(wcs_range) < server_var(wcs_z)) do
		{
			if (server_var(wcs_z2) >= 0) do
			{
				if (server_var(wcs_z1) >= 0) do
				{
					if (server_var(wcs_z2) <= server_var(wcs_z1)) then es_xmath wcs_z2 + server_var(wcs_range)
					if (server_var(wcs_z2) > server_var(wcs_z1)) then es_xmath wcs_z2 - server_var(wcs_range)
				}
				else do
				{
					es_math wcs_z2 - server_var(wcs_range)
				}
			}
			else do
			{
				if (server_var(wcs_z1) < 0) do
				{
					if (server_var(wcs_z2) <= server_var(wcs_z1)) then es_xmath wcs_z2 + server_var(wcs_range)
					if (server_var(wcs_z2) > server_var(wcs_z1)) then es_xmath wcs_z2 - server_var(wcs_range)
				}
				else do
				{
					es_math wcs_z2 + server_var(wcs_range)
				}
			}
			es_xcopy wcs_z1 wcs_z2
		}
		es wcsx create wcs_coord server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1)
		es wcs pushto server_var(wcs_userid) server_var(wcs_coord) 1
		//es est_PushTo server_var(wcs_userid) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) "1"
		es wcs_xtell server_var(wcs_userid) u_teleport_failed
		es usermsg fade server_var(wcs_userid) 0 server_var(wcs_fadetimer) 0.2 0 0 0 220
		//es est_Fade server_var(wcs_userid) 0 server_var(wcs_fadetimer) 0.2 0 0 0 220
	}
}

block wcs_ulti_roots
{
	//es_xset wcs_team_target 0
	//es_getplayerteam wcs_team server_var(wcs_userid)
	//if (server_var(wcs_team) = 2) do
	//{
	//	es_xset wcs_team_target 3
	//	es_xset wcs_team_targetn "#ct,#alive"
	//}
	//if (server_var(wcs_team) = 3) do
	//{
	//	es_xset wcs_team_target 2
	//	es_xset wcs_team_targetn "#t,#alive"
	//}
	//if (server_var(wcs_team_target) != "0") do
	//{
	//	es_xset wcs_pcount 0
	//	es_getlivingplayercount wcs_pcount server_var(wcs_team_target)
	//	if (server_var(wcs_pcount) > 0) do
	//	{
	//		es usermsg fade server_var(wcs_userid) 0 1 1 10 55 5 200
	//		//es est_Fade server_var(wcs_userid) 0 1 1 10 55 5 200
	//		es_xset wcs_wall 1
	//		es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid)
	//		wcs_xalias wcs_run_ulti_roots1 "es_getplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid);es_xmath wcs_z1 + 50;es_xmath wcs_z2 + 50;wcs_xalias spec_checkwall;if (server_var(wcs_wall) = 0) then wcs_xalias wcs_run_ulti_roots2"
	//		wcs_xalias wcs_run_ulti_roots2 "es_set wcs_target server_var(wcs_targetid);wcs_xalias ulti_immunity1;if (server_var(wcs_ok) == 1) then wcs_xalias wcs_run_ulti_roots3;if (server_var(wcs_ok) == 0) then wcs_xalias ulti_failed"
	//		wcs_xalias wcs_run_ulti_roots3 "es_xmath wcs_counter + 1;es wcs_setfx freeze server_var(wcs_targetid) = 1 server_var(wcs_freezetime)"
	//		es_xset wcs_counter 0
	//		es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid)
	//		es wcs_nearcoord wcs_targetid server_var(wcs_team_targetn) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_radius) "es_exists ex userid server_var(wcs_targetid);if (server_var(ex) = 1) then wcs_xalias wcs_run_ulti_roots1"
	//		if (server_var(wcs_counter) > 0) then wcs_xcentertell server_var(wcs_userid) c_u_entanglingroots count server_var(wcs_counter)
	//		else es_xset wcs_ultinotexec 1
	//	}
	//	else do
	//	{
	//		es_xset wcs_ultinotexec 1
	//	}
	//}
	//if (server_var(wcs_ultinotexec) = 1) then wcs_xtell server_var(wcs_userid) u_roots_failed
	//if (server_var(wcs_ultinotexec) = 1) then wcs_cancelulti server_var(wcs_userid)
	es_xdoblock wcs/tools/ultimates/default2/wcs_ulti_roots
}

block wcs_ulti_chain
{
	//es_xset wcs_team_target 0
	//es_getplayerteam wcs_team server_var(wcs_userid)
	//if (server_var(wcs_team) = 2) do
	//{
	//	es_xset wcs_team_target 3
	//	es_xset wcs_team_targetn "#ct,#alive"
	//}
	//if (server_var(wcs_team) = 3) do
	//{
	//	es_xset wcs_team_target 2
	//	es_xset wcs_team_targetn "#t,#alive"
	//}
	//if (server_var(wcs_team_target) != "0") do
	//{
	//	es_xset wcs_pcount 0
	//	es_getlivingplayercount wcs_pcount server_var(wcs_team_target)
	//	if (server_var(wcs_pcount) > 0) do
	//	{
	//		es usermsg fade server_var(wcs_userid) 0 2 1 240 240 240 100
	//		//es est_Fade server_var(wcs_userid) 0 2 1 240 240 240 100
	//		es_xset wcs_wall 1
	//		es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid)
	//		wcs_xalias wcs_run_ulti_chain1 "es_getplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid);es_xmath wcs_z1 + 50;es_xmath wcs_z2 + 50;wcs_xalias spec_checkwall;if (server_var(wcs_wall) = 0) then wcs_xalias wcs_run_ulti_chain2"
	//		wcs_xalias wcs_run_ulti_chain2 "es_set wcs_target server_var(wcs_targetid);wcs_xalias ulti_immunity1;if (server_var(wcs_ok) == 1) then wcs_xalias wcs_run_ulti_chain3;if (server_var(wcs_ok) == 0) then wcs_xalias ulti_failed"
	//		wcs_xalias wcs_run_ulti_chain3 "es_xmath wcs_counter + 1;es wcs damage server_var(wcs_targetid) server_var(wcs_userid) 32"
	//		es_xset wcs_counter 0
	//		es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid)
	//		es wcs_nearcoord wcs_targetid server_var(wcs_team_targetn) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_radius) "es_exists ex userid server_var(wcs_targetid);if (server_var(ex) = 1) then es_xif (server_var(wcs_counter) < server_var(wcs_maxtargets)) then wcs_xalias wcs_run_ulti_chain1"
	//		if (server_var(wcs_counter) > 0) then wcs_xcentertell server_var(wcs_userid) c_u_chainglightning count server_var(wcs_counter)
	//		else es_xset wcs_ultinotexec 1
	//	}
	//	else do
	//	{
	//		es_xset wcs_ultinotexec 1
	//	}
	//}
	//if (server_var(wcs_ultinotexec) = 1) then wcs_xtell server_var(wcs_userid) u_chain_failed
	//if (server_var(wcs_ultinotexec) = 1) then wcs_cancelulti server_var(wcs_userid)
	es_xdoblock wcs/tools/ultimates/default2/wcs_ulti_chain
}

block wcs_ulti_suicide
{
	//es_xset wcs_team_target 0
	//es_getplayerteam wcs_team server_var(wcs_userid)
	//if (server_var(wcs_team) = 2) do
	//{
	//	es_xset wcs_team_target 3
	//	es_xset wcs_team_targetn "#ct,#alive"
	//}
	//if (server_var(wcs_team) = 3) do
	//{
	//	es_xset wcs_team_target 2
	//	es_xset wcs_team_targetn "#t,#alive"
	//}
	//if (server_var(wcs_team_target) != "0") do
	//{
	//	es_xset wcs_pcount 0
	//	es_getlivingplayercount wcs_pcount server_var(wcs_team_target)
	//	if (server_var(wcs_pcount) > 0) do
	//	{
	//		wcs_xalias wcs_run_ulti_suicide1 "es_set wcs_target server_var(wcs_targetid);wcs_xalias ulti_immunity1;if (server_var(wcs_ok) == 1) then wcs_xalias wcs_run_ulti_suicide2;if (server_var(wcs_ok) == 0) then wcs_xalias ulti_failed"
	//		wcs_xalias wcs_run_ulti_suicide2 "es wcs explode server_var(wcs_userid) server_var(wcs_targetid) server_var(wcs_magnitude) server_var(wcs_radius)"
	//		es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid)
	//		es wcs_nearcoord wcs_targetid server_var(wcs_team_targetn) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_radius) "wcs_xalias wcs_run_ulti_suicide1"
	//	}
	//}
	es_xdoblock wcs/tools/ultimates/default2/wcs_ulti_suicide
}
block wcs_ulti_burrow
{
	es wcsgroup get fb_bur wcs_tmp server_var(wcs_userid)
	es_getplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_userid)
	if (server_var(wcs_tmp) = 0) do
	{
		es_math wcs_z2 - server_var(wcs_earth)
		es wcs_setfx freeze server_var(wcs_userid) = 1 0
		es wcsgroup set fb_bur server_var(wcs_userid) 1
		es_tell server_var(wcs_userid) #multi #green: #lightgreenYou burrowed your self#default underground#lightgreen....
	}
	else do
	{
		es_math wcs_z2 + server_var(wcs_earth)
		es wcs_setfx freeze server_var(wcs_userid) = 0 0
		es wcsgroup set fb_bur server_var(wcs_userid) 0
		es_tell server_var(wcs_userid) #multi #green: #lightgreenYou burrowed your self#default aboveground#lightgreen....
	}
	es_setpos server_var(wcs_userid) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2)
}
block wcs_ulti_fly
{
   es_xset wcs_tmp 0
   es wcsgroup get wcs_fly wcs_tmp server_var(wcs_userid)
   if (server_var(wcs_tmp) = 0) do
   {
      es wcs_setfx speed server_var(wcs_userid) + server_var(wcs_speed) 0
      es wcs_setfx jetpack server_var(wcs_userid) = 1 0
      es wcsgroup set wcs_fly server_var(wcs_userid) 1
      es_tell server_var(wcs_userid) #multi #green: #lightgreenYou are now #defaultflying#lightgreen....
   }
   es_xelse do
   {
      es wcs_setfx speed server_var(wcs_userid) - server_var(wcs_speed) 0
      es wcs_setfx jetpack server_var(wcs_userid) = 1 1
      es wcsgroup set wcs_fly server_var(wcs_userid) 0
      es_tell server_var(wcs_userid) #multi #green: #lightgreenYou are now #defaultwalking#lightgreen....
   }
}
block iron_jet
{
	es_xset wcs_tmp 0
	es wcsgroup get iron_jet wcs_tmp server_var(wcs_userid)
	if (server_var(wcs_tmp) = 0) do
	{
		es wcs_setfx speed server_var(wcs_userid) + server_var(wcs_speed) 0
		es wcs_setfx jetpack server_var(wcs_userid) = 1 0
		es wcsgroup set iron_jet server_var(wcs_userid) 1
		es_tell server_var(wcs_userid) #multi #green[#lightgreenJet Pack#green] #darkgreenEnabled.
	}
	es_xelse do
	{
		es wcs_setfx speed server_var(wcs_userid) - server_var(wcs_speed) 0
		es wcs_setfx jetpack server_var(wcs_userid) = 1 1
		es wcsgroup set iron_jet server_var(wcs_userid) 0
		es_tell server_var(wcs_userid) #multi #green[#lightgreenJet Pack#green] #darkgreenDisabled.
	}
}
block wcs_spwn_warcry
{
	es_getplayerteam wcs_team event_var(userid)
	wcs_xalias racealias_ln40 "es wcs_setfx health server_var(wcs_userid) + server_var(wcs_rand) 0;es_tell server_var(wcs_userid) #multi #green: #lightgreenYou gained#default server_var(wcs_rand)#lightgreen health from a war cry...."
	if (server_var(wcs_team) = 2) then wcs_foreach player wcs_userid #t "wcs_xalias racealias_ln40" 
	if (server_var(wcs_team) = 3) then wcs_foreach player wcs_userid #ct "wcs_xalias racealias_ln40"
}
block wcs_spwn_flicker
{
   es_tell event_var(userid) #multi #green: #lightgreenYou are now#default flickering invis#lightgreen....
   es_fire event_var(userid) !self addoutput "renderfx 13"
   es_delayed .1 wcsgroup set rap_flick event_var(userid) 1
}
block wcs_ulti_freezeinvis
{
   es wcsgroup get rap_invis wcs_tmp server_var(wcs_userid)
   if (server_var(wcs_tmp) = 0) do
   {
      es wcsgroup get rap_flick wcs_tmp server_var(wcs_userid)
      if (server_var(wcs_tmp) = 1) then es_xfire server_var(wcs_userid) !self addoutput "renderfx 0"
      es_delayed 1.1 wcs_setfx invisp server_var(wcs_userid) = 100 0
      es wcs_setfx freeze server_var(wcs_userid) = 1 0
      es wcsgroup set rap_invis server_var(wcs_userid) 1
      es_tell server_var(wcs_userid) #multi #green: #lightgreenYou went #default invis frozen#lightgreen....
   }
   else do
   {
      es wcsgroup get rap_flick wcs_tmp server_var(wcs_userid)
      if (server_var(wcs_tmp) = 1) then es_xfire server_var(wcs_userid) !self addoutput "renderfx 13"
      es wcs_setfx invisp server_var(wcs_userid) = 0 0
      es wcs_setfx freeze server_var(wcs_userid) = 0 0
      es wcsgroup set rap_invis server_var(wcs_userid) 0
      es_tell server_var(wcs_userid) #multi #green: #lightgreenYou went #default uninvis unfrozen#lightgreen....
   }
} 
block wcs_ulti_zoom
{
	es wcsgroup get sg_zoom wcs_tmp server_var(wcs_userid)
	if (server_var(wcs_tmp) = 0) do
	{
		es_setplayerprop server_var(wcs_userid) "CBasePlayer.m_iDefaultFOV" server_var(wcs_zoom)
		es_setplayerprop server_var(wcs_userid) "CBasePlayer.m_iFOV" server_var(wcs_zoom)
		es wcsgroup set sg_zoom server_var(wcs_userid) 1
		es_tell server_var(wcs_userid) #multi #green: #lightgreenYou zoomed#default in#lightgreen....
	}
	else do
	{
		es_setplayerprop server_var(wcs_userid) "CBasePlayer.m_iDefaultFOV" 90
		es_setplayerprop server_var(wcs_userid) "CBasePlayer.m_iFOV" 90
		es wcsgroup set sg_zoom server_var(wcs_userid) 0
		es_tell server_var(wcs_userid) #multi #green: #lightgreenYou zoomed#default out#lightgreen....
	}
}
block wcs_spwn_fading
{
	es_tell event_var(userid) #multi #green: #lightgreenYou are now#default fading invis#lightgreen....
	es wcs_setfx invis event_var(userid) = 7 120 0
	es_fire event_var(userid) !self addoutput "renderfx 4"
	es_delayed .1 wcsgroup set vb_fade event_var(userid) 1
}
block wcs_ulti_freezetele
{
   es wcsgroup get vb_invis wcs_tmp server_var(wcs_userid)
   if (server_var(wcs_tmp) = 0) do
   {
      es_xset wcs_fadetimer 2
      es wcsgroup get vb_fade wcs_tmp server_var(wcs_userid)
      if (server_var(wcs_tmp) = 1) then es_xfire server_var(wcs_userid) !self addoutput "renderfx 0"
      es_delayed 1.1 wcs_setfx invisp server_var(wcs_userid) = 100 0
      es wcs removeweapon server_var(wcs_userid) 1
      es wcs_restrict server_var(wcs_userid) restrict scout
      es_xdoblock wcs/tools/ultimates/default/wcs_ulti_teleport
      es_delayed .8 wcs_setfx freeze server_var(wcs_userid) = 1 0
      es wcsgroup set vb_invis server_var(wcs_userid) 1
      es_tell server_var(wcs_userid) #multi #green: #lightgreenYou went #default invis frozen#lightgreen....
   }
   else do
   {
      es wcsgroup get vb_fade wcs_tmp server_var(wcs_userid)
      if (server_var(wcs_tmp) = 1) do
      {
         es wcs_setfx invis server_var(wcs_userid) = 120 0
         es_fire server_var(wcs_userid) !self addoutput "renderfx 4"
      }
      else do
      {
         es wcs_setfx invisp server_var(wcs_userid) = 0 0
      }
      es wcs_restrict server_var(wcs_userid) addallow scout
      es wcs give server_var(wcs_userid) weapon_scout
      es wcs_setfx freeze server_var(wcs_userid) = 0 0
      es wcsgroup set vb_invis server_var(wcs_userid) 0
      es_tell server_var(wcs_userid) #multi #green: #lightgreenYou went #default uninvis unfrozen#lightgreen....
   }
}