////////////////////////////////////////
// WCS - Warcraft:Source              //
// ---------------------------------- //
//  by kRypT0n!Te                     //
//      http://wcs.despo-clan.de      //
// ---------------------------------- //
// Content of this subscript          //
// - all ultimates                    //
////////////////////////////////////////
// commands:
// wcs_mole_activate <userid>
// wcs_regeneration <userid> <amount> <time> <maxHP> <maxHeal> <radius>
// wcs_warden	<userid> <duration> <damage> <radius> <target team> <team target name> <x> <y> <z> <round>
//
////////////////////////////////////////
// You can define here new ultimates, then use the command
// es_xdoblock wcs/WCSultimates/wcs_YOURSCRIPT
// to execute wcs_YOURSCRIPT block.
//

block load
{
  es_xexists wcs_exists command wcs_mole_activate
  es es_xif (server_var(wcs_exists) = 0) then es_xregcmd wcs_mole_activate wcs/WCSultimates/wcs_mole_activate "A player becomes a mole"
  es_xexists wcs_exists command wcs_regeneration
  es es_xif (server_var(wcs_exists) = 0) then es_xregcmd wcs_regeneration wcs/WCSultimates/wcs_regeneration "wcs_regeneration <userid> <amount> <time> <maxHP> <maxHeal> <radius> - Regenerate player for the current round"
  es_xexists wcs_exists command wcs_warden
  es es_xif (server_var(wcs_exists) = 0) then es_xregcmd wcs_warden wcs/WCSultimates/wcs_warden "Warden, deals damage on nearby enemies"
}

// >>>>>>>>>>>>>>>>> SPECIAL ULTIMATE SKILL CODE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
block wcs_ulti_teleport
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_ulti_teleport start
	// alot of calculations....does anyone know what I'm doing here ?
  es_xsetinfo wcs_ok 1
  es est_GetViewCoord server_var(wcs_userid) wcs_x1 wcs_y1 wcs_z1
  es es_xgetplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_userid)
  //es es_xmathparse wcs_x "abs ( wcs_x1 - wcs_x2 )"
  //es es_xmathparse wcs_y "abs ( wcs_y1 - wcs_y2 )"
  //es es_xmathparse wcs_z "abs ( wcs_z1 - wcs_z2 )"
  es_xcopy wcs_x wcs_x1
  es_xcopy wcs_y wcs_y1
  es_xcopy wcs_z wcs_z1
  es es_xmath wcs_x - server_var(wcs_x2)
  es es_xmath wcs_y - server_var(wcs_y2)
  es es_xmath wcs_z - server_var(wcs_z2)
  es es_xif (server_var(wcs_x) < 0) then es_xmath wcs_x * -1
  es es_xif (server_var(wcs_y) < 0) then es_xmath wcs_y * -1
  es es_xif (server_var(wcs_z) < 0) then es_xmath wcs_z * -1
  es es_xif (server_var(wcs_range) < server_var(wcs_x)) then es_xsetinfo wcs_ok 0
  es es_xif (server_var(wcs_range) < server_var(wcs_y)) then es_xsetinfo wcs_ok 0
  es es_xif (server_var(wcs_range) < server_var(wcs_z)) then es_xsetinfo wcs_ok 0
  es es_xif (server_var(wcs_ok) = 1) do
  {
    es es_xif (server_var(wcs_noskywalking) = "0") do
    {
    	es es_xexists wcs_exists command "ma_teleport"
    	es es_xif (server_var(wcs_exists) = 1) then ma_teleport server_var(wcs_userid) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1)
    	es es_xif (server_var(wcs_exists) != 1) then est_Teleport server_var(wcs_userid) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1)
    }
    es es_xif (server_var(wcs_noskywalking) = "1") then est_PushTo server_var(wcs_userid) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) "2"
    wcs_getlanguage "wcs_lng" "wcs_lng_teleported"
    es es_xtell server_var(wcs_userid) #multi server_var(wcs_lng)
    es est_Fade server_var(wcs_userid) 0 server_var(wcs_fadetimer) 1 0 0 0 250
  }
  es_xelse do
  {
  	// one or more vectors are too long to teleport .... damn math...
    es es_xif (server_var(wcs_range) < server_var(wcs_x)) do
    {
    	
      es es_xif (server_var(wcs_x2) >= 0) do
      {
      	es es_xif (server_var(wcs_x1) >= 0) do
      	{
	      	es es_xif (server_var(wcs_x2) <= server_var(wcs_x1)) then es_xmath wcs_x2 + server_var(wcs_range)
	      	es es_xif (server_var(wcs_x2) > server_var(wcs_x1)) then es_xmath wcs_x2 - server_var(wcs_range)
        }
        es_xelse do
        {
      		es es_xmath wcs_x2 - server_var(wcs_range)
        }
      }
      es_xelse do
      {
      	es es_xif (server_var(wcs_x1) < 0) do
      	{
	      	es es_xif (server_var(wcs_x2) <= server_var(wcs_x1)) then es_xmath wcs_x2 + server_var(wcs_range)
	      	es es_xif (server_var(wcs_x2) > server_var(wcs_x1)) then es_xmath wcs_x2 - server_var(wcs_range)
        }
        es_xelse do
        {
      		es es_xmath wcs_x2 + server_var(wcs_range)
        }      	
      }
      es_xcopy wcs_x1 wcs_x2
    }
    es es_xif (server_var(wcs_range) < server_var(wcs_y)) do
    {
      es es_xif (server_var(wcs_y2) >= 0) do
      {
      	es es_xif (server_var(wcs_y1) >= 0) do
      	{
	      	es es_xif (server_var(wcs_y2) <= server_var(wcs_y1)) then es_xmath wcs_y2 + server_var(wcs_range)
	      	es es_xif (server_var(wcs_y2) > server_var(wcs_y1)) then es_xmath wcs_y2 - server_var(wcs_range)
        }
        es_xelse do
        {
      		es es_xmath wcs_y2 - server_var(wcs_range)
        }
      }
      es_xelse do
      {
      	es es_xif (server_var(wcs_y1) < 0) do
      	{
	      	es es_xif (server_var(wcs_y2) <= server_var(wcs_y1)) then es_xmath wcs_y2 + server_var(wcs_range)
	      	es es_xif (server_var(wcs_y2) > server_var(wcs_y1)) then es_xmath wcs_y2 - server_var(wcs_range)
        }
        es_xelse do
        {
      		es es_xmath wcs_y2 + server_var(wcs_range)
        }      	
      }
      es_xcopy wcs_y1 wcs_y2
    }
    es es_xif (server_var(wcs_range) < server_var(wcs_z)) do
    {
      es es_xif (server_var(wcs_z2) >= 0) do
      {
      	es es_xif (server_var(wcs_z1) >= 0) do
      	{
	      	es es_xif (server_var(wcs_z2) <= server_var(wcs_z1)) then es_xmath wcs_z2 + server_var(wcs_range)
	      	es es_xif (server_var(wcs_z2) > server_var(wcs_z1)) then es_xmath wcs_z2 - server_var(wcs_range)
        }
        es_xelse do
        {
      		es es_xmath wcs_z2 - server_var(wcs_range)
        }
      }
      es_xelse do
      {
      	es es_xif (server_var(wcs_z1) < 0) do
      	{
	      	es es_xif (server_var(wcs_z2) <= server_var(wcs_z1)) then es_xmath wcs_z2 + server_var(wcs_range)
	      	es es_xif (server_var(wcs_z2) > server_var(wcs_z1)) then es_xmath wcs_z2 - server_var(wcs_range)
        }
        es_xelse do
        {
      		es es_xmath wcs_z2 + server_var(wcs_range)
        }      	
      }
      es_xcopy wcs_z1 wcs_z2
    }
    es es_xif (server_var(wcs_noskywalking) = "0") do
    {
    	es es_xexists wcs_exists command "ma_teleport"
    	es es_xif (server_var(wcs_exists) = 1) then ma_teleport server_var(wcs_userid) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1)
    	es es_xif (server_var(wcs_exists) != 1) then est_Teleport server_var(wcs_userid) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1)
    }
    es es_xif (server_var(wcs_noskywalking) = "1") then est_PushTo server_var(wcs_userid) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) "1"
    wcs_getlanguage "wcs_lng" "wcs_lng_toofaraway"
    es es_xtell server_var(wcs_userid) #multi server_var(wcs_lng)
    es est_Fade server_var(wcs_userid) 0 server_var(wcs_fadetimer) 0.2 0 0 0 220
  }
es es_xif (server_var(wcs_debug) = "1") then echo wcs_ulti_teleport end
}

block wcs_ulti_suicide
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_ulti_suicide start
  es_xsetinfo wcs_team_target 0
  es es_xgetplayerteam wcs_team server_var(wcs_userid)
  // check teams (T=2, CT=3)
  es es_xif (server_var(wcs_team) = 2) do
  {
    es_xsetinfo wcs_team_target 3
    es_xsetinfo wcs_team_targetn "#c!d"
  }
  es es_xif (server_var(wcs_team) = 3) do
  {
    es_xsetinfo wcs_team_target 2
    es_xsetinfo wcs_team_targetn "#t!d"
  }
  es es_xif (server_var(wcs_team_target) != "0") do
  {
    es_xsetinfo wcs_pcount 0
    es es_xgetlivingplayercount wcs_pcount server_var(wcs_team_target)
    es es_xif (server_var(wcs_pcount) > 0) do
    {
      alias wcs_run_ulti_suicide1 "es_xsetinfo wcs_immunity 0;es es_xkeygetvalue wcs_immunity WCSuserdata server_var(wcs_targetid) ulti_immunity;es es_xif (server_var(wcs_immunity) = 0) then wcs_run_ulti_suicide2;es es_xif (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_userid) #multi server_var(wcs_lng_ulti_immunity_a);es es_xif (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng_ulti_immunity_v)"
      alias wcs_run_ulti_suicide2 "es_xmath wcs_counter + 1;es wcs_explode server_var(wcs_userid) server_var(wcs_targetid) server_var(wcs_magnitude) server_var(wcs_radius)"
      es_xsetinfo wcs_counter 0
      es est_Near wcs_targetid server_var(wcs_team_targetn) server_var(wcs_radius) server_var(wcs_userid) "es es_xexists wcs_exists userid server_var(wcs_targetid);es es_xif (server_var(wcs_exists) = 1) then wcs_run_ulti_suicide1"
      // no more needed
      //es es_xif (server_var(wcs_counter) > 0) then wcs_explode server_var(wcs_userid) server_var(wcs_userid) server_var(wcs_magnitude) server_var(wcs_radius)
    }
  }
es es_xif (server_var(wcs_debug) = "1") then echo wcs_ulti_suicide end
}

block wcs_ulti_flash
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_ulti_flash start
  es_xsetinfo wcs_team_target 0
  es es_xgetplayerteam wcs_team server_var(wcs_userid)
  // check teams (T=2, CT=3)
  es es_xif (server_var(wcs_team) = 2) do
  {
    es_xsetinfo wcs_team_target 3
    es_xsetinfo wcs_team_targetn "#c!d"
  }
  es es_xif (server_var(wcs_team) = 3) do
  {
    es_xsetinfo wcs_team_target 2
    es_xsetinfo wcs_team_targetn "#t!d"
  }
  es es_xif (server_var(wcs_team_target) != "0") do
  {
    es_xsetinfo wcs_pcount 0
    es es_xgetlivingplayercount wcs_pcount server_var(wcs_team_target)
    es es_xif (server_var(wcs_pcount) > 0) do
    {
      alias wcs_run_ulti_flash1 "es_xsetinfo wcs_immunity 0;es es_xkeygetvalue wcs_immunity WCSuserdata server_var(wcs_targetid) ulti_immunity;es es_xif (server_var(wcs_immunity) = 0) then wcs_run_ulti_flash2;es es_xif (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_userid) #multi server_var(wcs_lng_ulti_immunity_a);es es_xif (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng_ulti_immunity_v)"
      alias wcs_run_ulti_flash2 "es_xmath wcs_counter + 1;es est_fade server_var(wcs_targetid) 0 1.5 0 255 255 255 255"
      es_xsetinfo wcs_counter 0
      es est_Near wcs_targetid server_var(wcs_team_targetn) server_var(wcs_radius) server_var(wcs_userid) "es es_xexists wcs_exists userid server_var(wcs_targetid);es es_xif (server_var(wcs_exists) = 1) then wcs_run_ulti_flash1"
    }
  }
es es_xif (server_var(wcs_debug) = "1") then echo wcs_ulti_flash end
}

block wcs_ulti_chain
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_ulti_chain start
  es_xsetinfo wcs_team_target 0
  es es_xgetplayerteam wcs_team server_var(wcs_userid)
  // check teams (T=2, CT=3)
  es es_xif (server_var(wcs_team) = 2) do
  {
    es_xsetinfo wcs_team_target 3
    es_xsetinfo wcs_team_targetn "#c!d"
  }
  es es_xif (server_var(wcs_team) = 3) do
  {
    es_xsetinfo wcs_team_target 2
    es_xsetinfo wcs_team_targetn "#t!d"
  }
  es es_xif (server_var(wcs_team_target) != "0") do
  {
    es_xsetinfo wcs_pcount 0
    es es_xgetlivingplayercount wcs_pcount server_var(wcs_team_target)
    es es_xif (server_var(wcs_pcount) > 0) do
    {
    	es est_Fade server_var(wcs_userid) 0 2 1 240 240 240 100
    	es_xsetinfo wcs_wall "1"
      alias wcs_run_ulti_chain1 "es es_xgetplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid);es es_xgetplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid);es_xmath wcs_z1 + 50;es_xmath wcs_z2 + 50;es 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);es es_xif (server_var(wcs_wall) = 0) then wcs_run_ulti_chain2"
      alias wcs_run_ulti_chain2 "es_xsetinfo wcs_immunity 0;es es_xkeygetvalue wcs_immunity WCSuserdata server_var(wcs_targetid) ulti_immunity;es es_xif (server_var(wcs_immunity) = 0) then wcs_run_ulti_chain3;es es_xif (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_userid) #multi server_var(wcs_lng_ulti_immunity_a);es es_xif (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng_ulti_immunity_v)"
      alias wcs_run_ulti_chain3 "es_xmath wcs_counter + 1;es es_xif (server_var(wcs_graphicfx) = 1) then est_effect 3 #a 0 sprites/lgtning.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 1 10 10 200 255 255 255;es wcs_dealdamage server_var(wcs_userid) server_var(wcs_targetid) 32"
      es_xsetinfo wcs_counter 0
      es est_Near wcs_targetid server_var(wcs_team_targetn) server_var(wcs_radius) server_var(wcs_userid) "es es_xexists wcs_exists userid server_var(wcs_targetid);es es_xif (server_var(wcs_exists) = 1) then es_xif (server_var(wcs_counter) < server_var(wcs_maxtargets)) then wcs_run_ulti_chain1"
      es es_xif (server_var(wcs_counter) > 0) do
      {
      	wcs_getlanguage "wcs_lng" "wcs_lng_chainlightning"
      	wcs_getlanguage "wcs_lng2" "wcs_lng_playersdamaged"
        esnq est_csay server_var(wcs_userid) server_var(wcs_lng) : server_var(wcs_counter) server_var(wcs_lng2)
      }
      es_xelse do
      {
        es_xsetinfo wcs_ultinotexec 1
      }
    }
    es_xelse do
    {
      es_xsetinfo wcs_ultinotexec 1
    }
  }
  wcs_getlanguage "wcs_lng" "wcs_lng_chainfailed"
  es es_xif (server_var(wcs_ultinotexec) = 1) then es_xtell server_var(wcs_userid) #multi server_var(wcs_lng)
es es_xif (server_var(wcs_debug) = "1") then echo wcs_ulti_chain end
}

block wcs_ulti_roots
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_ulti_roots start
  es_xsetinfo wcs_team_target 0
  es es_xgetplayerteam wcs_team server_var(wcs_userid)
  // check teams (T=2, CT=3)
  es es_xif (server_var(wcs_team) = 2) do
  {
    es_xsetinfo wcs_team_target 3
    es_xsetinfo wcs_team_targetn "#c!d"
  }
  es es_xif (server_var(wcs_team) = 3) do
  {
    es_xsetinfo wcs_team_target 2
    es_xsetinfo wcs_team_targetn "#t!d"
  }
  es es_xif (server_var(wcs_team_target) != "0") do
  {
    es_xsetinfo wcs_pcount 0
    es es_xgetlivingplayercount wcs_pcount server_var(wcs_team_target)
    es es_xif (server_var(wcs_pcount) > 0) do
    {
    	es est_Fade server_var(wcs_userid) 0 1 1 10 55 5 200
    	es_xsetinfo wcs_wall "1"
      alias wcs_run_ulti_roots1 "es es_xgetplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid);es es_xgetplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid);es_xmath wcs_z1 + 50;es_xmath wcs_z2 + 50;es 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);es es_xif (server_var(wcs_wall) = 0) then wcs_run_ulti_roots2"
      alias wcs_run_ulti_roots2 "es_xsetinfo wcs_immunity 0;es es_xkeygetvalue wcs_immunity WCSuserdata server_var(wcs_targetid) ulti_immunity;es es_xif (server_var(wcs_immunity) = 0) then wcs_run_ulti_roots3;es es_xif (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_userid) #multi server_var(wcs_lng_ulti_immunity_a);es es_xif (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng_ulti_immunity_v)"
      alias wcs_run_ulti_roots3 "es_xmath wcs_counter + 1;es est_Freeze server_var(wcs_targetid) 1;es es_xdelayed server_var(wcs_freezetime) wcs_removefx freeze server_var(wcs_targetid);es es_xif (server_var(wcs_graphicfx) = 1) then est_effect 3 #a 0 sprites/lgtning.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 1 10 10 0 255 0 255"
      es_xsetinfo wcs_counter 0
      es est_Near wcs_targetid server_var(wcs_team_targetn) server_var(wcs_radius) server_var(wcs_userid) "es es_xexists wcs_exists userid server_var(wcs_targetid);es es_xif (server_var(wcs_exists) = 1) then wcs_run_ulti_roots1"
      es es_xif (server_var(wcs_counter) > 0) do
      {
      	wcs_getlanguage "wcs_lng" "wcs_lng_entangleroots"
        esnq est_csay server_var(wcs_userid) server_var(wcs_lng) : server_var(wcs_counter)
      }
      es_xelse do
      {
        es_xsetinfo wcs_ultinotexec 1
      }
    }
    es_xelse do
    {
      es_xsetinfo wcs_ultinotexec 1
    }
  }
  wcs_getlanguage "wcs_lng" "wcs_lng_entanglefailed"
  es es_xif (server_var(wcs_ultinotexec) = 1) then es_xtell server_var(wcs_userid) #multi server_var(wcs_lng)
es es_xif (server_var(wcs_debug) = "1") then echo wcs_ulti_roots end
}

block wcs_regeneration
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_regeneration start
  es_xsetinfo wcs_uid 0
  es_xsetinfo wcs_amount 0
  es_xsetinfo wcs_time 0
  es_xsetinfo wcs_maxhp 0
  es_xsetinfo wcs_maxheal 0
  es_xsetinfo wcs_radius 0
  es_xgetargv wcs_uid 1
  es_xgetargv wcs_amount 2
  es_xgetargv wcs_time 3
  es_xgetargv wcs_maxhp 4
  es_xgetargv wcs_maxheal 5
  es_xgetargv wcs_radius 6
  es es_xexists wcs_exists userid server_var(wcs_uid)
  es es_xif (server_var(wcs_time) < 1) then es_xsetinfo wcs_exists 0
  es es_xif (server_var(wcs_exists) = 1) do
  {
    es es_xexists wcs_exists key WCSuserdata server_var(wcs_uid)
    es es_xif (server_var(wcs_exists) = 1) do
    {
      es_xsetinfo wcs_regenerate 0
      es es_xkeygetvalue wcs_regenerate WCSuserdata server_var(wcs_uid) regeneration
      es es_xif (server_var(wcs_regenerate) = "1") do
      {
        es es_xkeygetvalue wcs_round WCSuserdata server_var(wcs_uid) regen_round
        es es_xif (server_var(wcs_roundcounter) = server_var(wcs_round)) do
        {
          es es_xgetplayerprop wcs_dead server_var(wcs_uid) "CCSPlayer.baseclass.pl.deadflag"
          es es_xif (server_var(wcs_maxheal) = "0") then es_xsetinfo wcs_dead "1"
          es es_xif (server_var(wcs_dead) = "0") do
          {
						es es_xgetplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_uid)
						// check for team healing
            es es_xif (server_var(wcs_radius) > 0) do
            {
              es es_xgetplayerteam wcs_team server_var(wcs_uid)
              // check teams (T=2, CT=3)
	            es es_xif (server_var(wcs_team) = 2) then es_xsetinfo wcs_team "#t!d"
	            es es_xif (server_var(wcs_team) = 3) then es_xsetinfo wcs_team "#c!d"
	            es_xmath wcs_z1 + 50
	            wcs_getlanguage "wcs_lng" "wcs_lng_healed"
              alias wcs_run_heal "es est_sethealth server_var(wcs_targetid) server_var(wcs_health);es es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng);es est_fade server_var(wcs_targetid) 0 0.4 0 0 200 25 50;es es_xgetplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid);es_xmath wcs_z2 + 50;es est_effect 3 #a 0 sprites/lgtning.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 1 2 2 0 255 0 255"
              es est_Near wcs_targetid server_var(wcs_team) server_var(wcs_radius) server_var(wcs_uid) "es est_gethealth wcs_health server_var(wcs_targetid);es es_xmath wcs_health + server_var(wcs_amount);es es_xif (server_var(wcs_maxhp) > 0) then es_xif (server_var(wcs_maxhp) >= server_var(wcs_health)) then wcs_run_heal;es es_xif (server_var(wcs_maxhp) = 0) then wcs_run_heal"
              es_xmath wcs_maxheal - 1
              es es_xdelayed server_var(wcs_time) wcs_regeneration server_var(wcs_uid) server_var(wcs_amount) server_var(wcs_time) server_var(wcs_maxhp) server_var(wcs_maxheal) server_var(wcs_radius)
            }
            es_xelse do
            {
              es est_GetHealth wcs_health server_var(wcs_uid)
              es es_xmath wcs_health + server_var(wcs_amount)
              es es_xif (server_var(wcs_maxhp) > 0) then es_xif (server_var(wcs_maxhp) >= server_var(wcs_health)) then est_SetHealth server_var(wcs_uid) server_var(wcs_health)
              es es_xif (server_var(wcs_maxhp) = 0) then est_SetHealth server_var(wcs_uid) server_var(wcs_health)
              es es_xgetplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_uid)
              es_xmath wcs_z2 + 200
              es est_effect 3 #a 0 sprites/lgtning.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 1 2 2 0 255 0 255
              wcs_getlanguage "wcs_lng" "wcs_lng_healed"
              es es_xtell server_var(wcs_uid) #multi server_var(wcs_lng)
              es_xmath wcs_maxheal - 1
              es es_xdelayed server_var(wcs_time) wcs_regeneration server_var(wcs_uid) server_var(wcs_amount) server_var(wcs_time) server_var(wcs_maxhp) server_var(wcs_maxheal) "0"
            }
          }
        }
        es_xelse do
        {
          es es_xkeysetvalue WCSuserdata server_var(wcs_uid) regen_round 0
        }
      }
    }
  }
es es_xif (server_var(wcs_debug) = "1") then echo wcs_regeneration end
}

block wcs_warden
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_warden start
	es_xsetinfo wcs_uid 0
	es_xsetinfo wcs_duration 0
	es_xsetinfo wcs_dmg 0
	es_xsetinfo wcs_radius 0
	es_xsetinfo wcs_team_target 0
	es_xsetinfo wcs_wardenround 0
	es_xgetargv wcs_uid 1
	es_xgetargv wcs_duration 2
	es_xgetargv wcs_dmg 3
	es_xgetargv wcs_radius 4
	es_xgetargv wcs_team_target 5
	es_xgetargv wcs_team_targetn 6
	es_xgetargv wcs_x1 7
	es_xgetargv wcs_y1 8
	es_xgetargv wcs_z1 9
	es_xgetargv wcs_wardenround 10
  es es_xexists wcs_exists userid server_var(wcs_uid)
  es es_xgetlivingplayercount wcs_alive server_var(wcs_team_target)
  es es_xif (server_var(wcs_alive) < 1) then es_xsetinfo wcs_exists 0
  es es_xif (server_var(wcs_wardenround) != server_var(wcs_roundcounter)) then es_xsetinfo wcs_duration 0
	es es_xif (server_var(wcs_exists) = 1) do
	{
		es es_xif (server_var(wcs_duration) > 0) do
		{
			es es_xif (server_var(wcs_radius) != "0") do
			{
				es es_xif (server_var(wcs_team_targetn) != "0") do
				{
					es est_Effect 10 #a 0 sprites/lgtning.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) 20 server_var(wcs_radius) 1 20 100 1 255 150 70 100 10
				  //es est_Near wcs_targetid server_var(wcs_team_targetn) server_var(wcs_radius) server_var(wcs_uid) "es wcs_dealdamage server_var(wcs_uid) server_var(wcs_targetid) server_var(wcs_dmg);es es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng_wardenhit);es es_xgetplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid);es est_effect 3 #a 0 sprites/lgtning.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 1 10 20 255 150 70 255"
				  es_xsetinfo wcs_wall "1"
				  wcs_getlanguage "wcs_lng" "wcs_lng_wardenhit"
				  alias wcs_run_warden "es es_xgetplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid);es 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);es es_xif (server_var(wcs_wall) = 0) then wcs_run_warden2"
				  alias wcs_run_warden2 "es est_speed server_var(wcs_targetid) 0.7;es es_xif (server_var(wcs_speed) != 0) then es_xdelayed 2 wcs_removefx speed server_var(wcs_targetid);es wcs_dealdamage server_var(wcs_uid) server_var(wcs_targetid) server_var(wcs_dmg);es es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng);es est_effect 3 #a 0 sprites/lgtning.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 1 10 20 255 150 70 255"
				  es nearcoord wcs_targetid server_var(wcs_team_targetn) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_radius) server_var(wcs_radius) server_var(wcs_radius) "es es_xgetplayerprop wcs_dead server_var(wcs_targetid) CCSPlayer.baseclass.pl.deadflag;es es_xif (server_var(wcs_dead) = 0) then wcs_run_warden"
				  es_xmath wcs_duration - 1
				  es es_xdelayed 1 wcs_warden server_var(wcs_uid) server_var(wcs_duration) server_var(wcs_dmg) server_var(wcs_radius) server_var(wcs_team_target) server_var(wcs_team_targetn) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_wardenround)
			  }
			}
		}
	}
es es_xif (server_var(wcs_debug) = "1") then echo wcs_warden end
}

block wcs_mole_activate
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_mole_activate start
	es_xsetinfo wcs_uid 0
	es_xgetargv wcs_uid 1
	es es_xexists wcs_exists userid server_var(wcs_uid)
	es es_xif (server_var(wcs_exists) = 1) do
	{
		es_xsetinfo wcs_team_target 0
    es es_xgetplayerteam wcs_team server_var(wcs_uid)
		// check teams (T=2, CT=3)
    es es_xif (server_var(wcs_team) = 2) do
    {
      es_xsetinfo wcs_team_target 3
      es_xsetinfo wcs_team_targetn "#c!d"
    }
    es es_xif (server_var(wcs_team) = 3) do
    {
      es_xsetinfo wcs_team_target 2
      es_xsetinfo wcs_team_targetn "#t!d"
    }
    es es_xif (server_var(wcs_team_target) != "0") do
    {
    	es_xsetinfo wcs_pcount 0
      es es_xgetlivingplayercount wcs_pcount server_var(wcs_team_target)
      es es_xif (server_var(wcs_pcount) > 0) do
      {
			  es_xsetinfo wcs_player 0
			  es es_xif(server_var(wcs_game) = server_var(wcs_game_css)) then es_xif (server_var(wcs_team) = 3) then est_SetModel server_var(wcs_uid) "player/t_phoenix"
			  es es_xif(server_var(wcs_game) = server_var(wcs_game_css)) then es_xif (server_var(wcs_team) = 2) then est_SetModel server_var(wcs_uid) "player/ct_urban"
			  es es_xif(server_var(wcs_game) = server_var(wcs_game_dods)) then es_xif (server_var(wcs_team) = 2) then est_SetModel server_var(wcs_uid) "player/german_assault"
			  es es_xif(server_var(wcs_game) = server_var(wcs_game_dods)) then es_xif (server_var(wcs_team) = 3) then est_SetModel server_var(wcs_uid) "player/american_assault"
			  es est_RandPlayer wcs_player server_var(wcs_team_targetn)
			  es es_xexists wcs_exists userid server_var(wcs_player)
			  es es_xif (server_var(wcs_exists) = 1) do
			  {
          //es es_xgetplayerlocation wcs_x wcs_y wcs_z server_var(wcs_player)
          //es_xmath wcs_x + 40
          //es_xmath wcs_y + 40
          // new pos
          es es_xif (server_var(wcs_team) = 2) do
          {
            es es_xif (server_var(wcs_location_c) != "0") do
            {
            es es_xtoken wcs_x server_var(wcs_location_c) 1 |
            es es_xtoken wcs_y server_var(wcs_location_c) 2 |
            es es_xtoken wcs_z server_var(wcs_location_c) 3 |
            }
            es_xelse do
            {
			  	es es_xgetplayerlocation wcs_x wcs_y wcs_z server_var(wcs_player)
            }
          }
          es es_xif (server_var(wcs_team) = 3) do
          {
            es es_xif (server_var(wcs_location_t) != "0") do
            {
            es es_xtoken wcs_x server_var(wcs_location_t) 1 |
            es es_xtoken wcs_y server_var(wcs_location_t) 2 |
            es es_xtoken wcs_z server_var(wcs_location_t) 3 |
            }
            es_xelse do
            {
              es es_xgetplayerlocation wcs_x wcs_y wcs_z server_var(wcs_player)
            }
          }
			  	// new, delayed teleport
			  	es es_xsetinfo wcs_tmp server_var(mp_freezetime)
			  	es_xmath wcs_tmp + 3
			  	wcs_getlanguage "wcs_lng" "wcs_lng_moledelay"
			  	es es_xtell server_var(wcs_uid) #multi server_var(wcs_lng)
			  	es es_xdelayed server_var(mp_freezetime) es_xtell server_var(wcs_uid) #multi server_var(wcs_lng)
			  	es es_xdelayed server_var(wcs_tmp) est_Teleport server_var(wcs_uid) server_var(wcs_x) server_var(wcs_y) server_var(wcs_z)
			  	es es_xkeysetvalue "WCSuserdata" server_var(wcs_uid) "ismole" "1"
			  }
			  wcs_getlanguage "wcs_lng" "wcs_lng_mole"
			  es es_xdelayed server_var(mp_freezetime) es_xtell server_var(wcs_uid) #multi server_var(wcs_lng)
	  	}
	  	es_xelse do
	  	{
	  		wcs_getlanguage "wcs_lng" "wcs_lng_molefailed"
	  		es es_xtell server_var(wcs_uid) #multi server_var(wcs_lng)
	  	}
		}
		es_xelse do
		{
			wcs_getlanguage "wcs_lng" "wcs_lng_molefailed"
			es es_xtell server_var(wcs_uid) #multi server_var(wcs_lng)
		}
  }
es es_xif (server_var(wcs_debug) = "1") then echo wcs_mole_activate end
}
// <<<<<<<<<<<<<<<<< END ULTIMATE SKILL CODE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
