#library "Global"
#include "zcommon.acs"

int introchecker=0;
int scorecounter;

script 999 (void) // Speed changing properties for Hunter/Jitterskull.
{
if(PlayerClass(PlayerNumber())==1)
{
SetActorProperty(0, APROP_Speed, 0.5);
}
if(PlayerClass(PlayerNumber())==2)
{
SetActorProperty(0, APROP_Speed, 1.0);
}
if(PlayerClass(PlayerNumber())==4)
{
SetActorProperty(0, APROP_Speed, 0.0001);
}
}

script 998 (void) // Speed changing properties for Hunter/Jitterskull
{
if(PlayerClass(PlayerNumber())==1)
{
SetActorProperty(0, APROP_Speed, 1.0);
}
if(PlayerClass(PlayerNumber())==2)
{
SetActorProperty(0, APROP_Speed, 1.20);
}
if(PlayerClass(PlayerNumber())==4)
{
SetActorProperty(0, APROP_Speed, 0.40);
}
}

script 997 (void) { // The Creeper's pop up attack (Shortened for GVH)
SetHudSize(1280, 1024, 1);
SetFont("CREEC0");
HudMessage(s:"A"; HUDMSG_FADEOUT, 666, CR_UNTRANSLATED, 1180.0, 1720.0, 0.2, 0.5);
}

script 996 (void) // Cyborg recharge (executed when standing still)
{
if(scorecounter==666){
ACS_ExecuteAlways(976,0,1);
}
LocalAmbientSound("weapons/cyborgcharge",127);
fadeto(0, 0, 255, 0.03, 0.0);
Delay(5);
fadeto(0, 0, 255, 0.0, 0.0);
}

int botweapon=0;

script 995 ENTER // Bot weapon fixes
{
if(PlayerIsBot(PlayerNumber()))
{
if(PlayerClass(PlayerNumber())==0)
{
botweapon=random(0,2);
Delay(1);
	if(botweapon==1)
	{
	SetWeapon("Riotgun");
	}
	if(botweapon==2)
	{
	SetWeapon("Machinegun");
	}
}
if(PlayerClass(PlayerNumber())==1)
{
TakeInventory("Bow",1);
GiveInventory("BotBow",1);
GiveInventory("HunterMagic", random(0,3));
SetWeapon("BotBow");
}
}
if(PlayerClass(PlayerNumber())==1)
{
SetPlayerProperty(0,1,2);
}
}

script 994 RESPAWN // Bot weapon fixes
{
if(PlayerIsBot(PlayerNumber()))
{
if(PlayerClass(PlayerNumber())==0)
{
botweapon=random(0,2);
Delay(1);
	if(botweapon==1)
	{
	SetWeapon("Riotgun");
	}
	if(botweapon==2)
	{
	SetWeapon("Machinegun");
	}
}
if(PlayerClass(PlayerNumber())==1)
{
TakeInventory("Bow",1);
GiveInventory("BotBow",1);
SetWeapon("BotBow");
}
}
if(PlayerClass(PlayerNumber())==1)
{
SetPlayerProperty(0,1,2);
}
}

script 993 (int arrowtype) // Hunter arrow graphic display
{
if(arrowtype==0){
SetFont("NORARROW");
//LocalAmbientSound("weapons/bowup",127);
}
if(arrowtype==1){
SetFont("FIRARROW");
//LocalAmbientSound("weapons/bowfswitch",127);
}
if(arrowtype==2){
SetFont("ICEARROW");
//LocalAmbientSound("weapons/bowiswitch",127);
}
if(arrowtype==3){
SetFont("LITARROW");
//LocalAmbientSound("weapons/bowlswitch",127);
}
hudmessage(s:"a"; HUDMSG_PLAIN, 9, 0, 1.0, 0.95, 0); 
}

script 992 ENTER // Winning themes
{
if(GetCvar("teamlms")!=1){
if(RedScore() == GetCVar("fraglimit") - 5){
SetMusic("D_GWINNI",0);
terminate;
}
if(BlueScore() == GetCVar("fraglimit") - 5){
SetMusic("D_HWINNI",0);
terminate;
}
}
delay(1);
restart;
}

script 990 ENTER // Warns people about Jitterskull's wallrun issue
{
if(GetCvar("compat_wallrun")!=0){
Log(s:"\cgWarning: \ccserver's compat_wallrun must be false for Jitterskull to work correctly!");
}
if(PlayerClass(PlayerNumber())!=1)
{
SetFont("NULL");
hudmessage(s:"<!>"; HUDMSG_FADEOUT, 9, 0, 1.0, 0.95, 1, 1);
}
}


script 989 DEATH // Remove the arrow box when you die, and uncle jitterskull
{
SetFont("NORARROW");
hudmessage(s:""; HUDMSG_PLAIN, 9, 0, 1.0, 0.97, 0); 
SetFont("UNCLE2");
int uncle=0;
uncle = random(0,4);
if(uncle==4){
SetHudSize(800,600,1);
hudmessage(s:"A"; HUDMSG_FADEINOUT, 665, CR_RED, 540.1, 380.1, 3.0, 1.0, 1.0);}
}

script 988 RESPAWN // Other stuff
{
if (GameType () > 0){
if(PlayerClass(PlayerNumber())!=1)
{
SetFont("NORARROW");
hudmessage(s:""; HUDMSG_PLAIN, 9, 0, 1.0, 0.97, 0); 
}
}
}

script 987 (void) // Creeper recharge (executed when standing still)
{
LocalAmbientSound("weapons/creepercharge",127);
GiveInventory("GhoulAmmo",1);
fadeto(255, 255, 255, 0.03, 0.0);
Delay(5);
fadeto(255, 255, 255, 0.0, 0.0);
}

int Playerstun[32];

script 986 (void)
{
   SetPlayerProperty (0, 1, 0);
   fadeto(255, 255, 255, 0.03, 0.0);

   Playerstun[PlayerNumber()] = 48;

   for(int i = 48; i > 0; i--)
   {
      if(i != Playerstun[PlayerNumber()])
      {
         terminate;
      }
      Playerstun[PlayerNumber()] --;
      Delay(1);
   }

   fadeto(255, 255, 255, 0.0, 0.0);
   SetPlayerProperty (0, 0, 0);
}

script 985 OPEN // LMS Tense music start
{
if(GetCVar("winlimit") == 1){
Terminate;
}
if(Bluescore()==GetCVar("winlimit") - 1){
if(Redscore()==GetCVar("winlimit") - 1){
SetMusic("D_LTHING");
terminate;
}
}
Delay(8);
restart;
}

script 984 RESPAWN //Down with cheating. Play properly or gtfo
{
if(PlayerIsBot(PlayerNumber())){
Terminate;
}
//ConsoleCommand("puke 978");
If(GetCVar("r_drawtrans")==0){
ConsoleCommand("r_drawtrans 1");
}
}

script 979 (void) // Creeper Heal
{
if(GetActorProperty(0, APROP_HEALTH)<=5){
if(GetActorProperty(0, APROP_HEALTH)>0){
ACS_Execute(976,0,3);
}}
HealThing(70);
}

script 971 OPEN
{
if(BlueScore()>scorecounter){
scorecounter=666;
delay(500);
}
scorecounter=BlueScore();
Delay(10);
Restart;
}