#library "HEMACS2"
#include "zcommon.acs"

//I wonder what will happen if I actually keep the source file for the ACS
//can't have those pesky non-russians STEAL MAH CODE

int icanstealcodetoo;

Script "ResetSky" (void)
{
    ChangeSky("BASESKY1","BASESKY1");
	SetSkyScrollSpeed(1,0);
	SetSkyScrollSpeed(2,0);
	icanstealcodetoo = 0;
	While(icanstealcodetoo < 999)
	{	
		Sector_SetColor(icanstealcodetoo,255,255,255);
		Sector_SetFade(icanstealcodetoo,0,0,0);
		icanstealcodetoo++;
	}
}

bool heresky_changed = false;

Script "HeresiarchSky" (void) 
{
    if (heresky_changed == false) {
        ChangeSky("HERSKY00","HERSKY00");
		SetSkyScrollSpeed(1,128);
		SetSkyScrollSpeed(2,128);
        heresky_changed = true;
    }
	/*icanstealcodetoo = 0;
	While(icanstealcodetoo < 999)
	{	
		Sector_SetColor(icanstealcodetoo,255,210,240);
		Sector_SetFade(icanstealcodetoo,40,0,20);
		icanstealcodetoo++;
	}*/
}

Script "Melt" (VOID)
{

 If(GetActorProperty(0,APROP_HEALTH)>=1)
 {
 Delay(1);
 If(CheckInventory("MeltCount")>=1)
 {
  Thing_Damage2(0,8,"Acid");
  TakeInventory("MeltCount",1);
  SpawnSpotForced("MeltingFX",0,0,0);
  FadeTo(85,215,35,0.4,0.1);
  Delay(4);
  FadeTo(0,0,0,0,0.1);
  Delay(4);
  restart;
 }
 }
}

Script "Whirls" (void)
{
   SetResultValue(0);
 Int SoundMax = CheckInventory("WhirlTic2");
  If(CheckInventory("WhirlTic")>=((SoundMax)))
   { SetResultValue(1); }
}

str DFMarkArray[4] = { "DFWeaken", "DFWeaken", "DFEnfeeble", "DFFatigue" };

Script "Defiler's Mark" (int stg ,int lesser)
{
 int Count;
 int count2=1;
 
  if(lesser<1)
  {
   For(count=3;count > 0; Count2++)	
    {
     Delay(35);
	 Thing_Damage2(0,(STG*Count2)+5,"Impure");
	 PlaySound(0,"DFMarkC",0,1.0,0,ATTN_NORM);
	 GiveInventory(DFMarkArray[Count2],1);
	 SpawnSpotForced("DFMarkFX",0,0,0);
	 Count--;
    }
   PlaySound(0,"DFMarkEx",0,1.0,0,ATTN_NORM);
   SpawnSpotForced("DFMarkFXEX",0,0,0);
   GiveInventory("DFDisplace",1);
	
   if(!CheckInventory("NewMelee")) //any starting weapon or smth
     {
      Thing_Damage2(0,STG*125,"Impure");
     }
  }
  
 else
  {
   GiveInventory(DFMarkArray[1],1);
   SpawnSpotForced("DFMarkFX",0,0,0);
   if(!CheckInventory("NewMelee")) //any starting weapon or smth
     {
      Thing_Damage2(0,STG,"Impure");
     }
  }
}


Script "Slayer's Omen" (int duration)
{
     Delay(1);
   PlaySound(0,"OmenOn",0,1.0,0,ATTN_NORM);
   PlaySound(0,"OmenOn",0,1.0,0,ATTN_NORM);
   SpawnSpotForced("DFMarkFXEX",0,0,0);
int nothing;
 /*any starting weapon or smth*/
   For(nothing=1;duration > 0; nothing=1)	
    {
     Delay(1);
     TakeInventory("NewMelee",1);
	 duration--;
    }
 GiveInventory("NewMelee",1);
   PlaySound(0,"OmenOff",0,1.0,0,ATTN_NORM);
   PlaySound(0,"OmenOff",0,1.0,0,ATTN_NORM);
}