//I wish luck to anyone who'll try to make anything out of this mess.

class SheepGuidance : Inventory { Default { Inventory.MaxAmount 1; } }
class SheepActive : SheepGuidance {}
class SheepOut : SheepGuidance { Default { Inventory.MaxAmount 25; } }
class SuperSheepOut : SheepGuidance { Default { Inventory.MaxAmount 3; } }
class SheepOut1 : SheepGuidance {}
class SheepOut2 : SheepGuidance {}
class SheepOut3 : SheepGuidance {}

class SheepCircleSpawner : Actor
{
	Default
	{
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	
	int Counter;
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIfInTargetInventory("SheepOut",0,"Null");
		TNT1 A 0 { Counter == 1; } //In case I'd like to spawn more sheeps at once.
	Looplet:
		TNT1 A 0 {
			A_SpawnItemEx("ExplosiveSheep",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_NOCHECKPOSITION);
			Counter--;
			Return A_JumpIf(Counter <= 0, "Null");
		}
		Loop;
	}
}

class SheepCollider : Actor
{
	Default
	{
		Radius 32;
		Height 26;
		Species "Rrerr";
		Projectile;
		+NOGRAVITY
		+MTHRUSPECIES
		+NOTONAUTOMAP
		+DONTSPLASH
	}
	
	States
	{
	Spawn:
		TNT1 A 5;
		Stop;
	Death:
		TNT1 A 0;
		Stop;
	}
}

class ExplosiveSheep : Actor
{
	Default
	{
		Radius 24;
		Height 20;
		Speed 20;
		Damage 20;
		MaxStepHeight 32;
		ProjectileKickback 200;
		Gravity 0.35;
		Scale 0.8;
		DamageType "Baaah";
		Species "Rrerr";
		+MISSILE
		+INVULNERABLE
		+STEPMISSILE
		+DROPOFF
		+NOEXPLODEFLOOR
		+FORCERADIUSDMG
		+FRIENDLY
		+NOINTERACTION
		+NOCLIP
		+THRUSPECIES
		+SKYEXPLODE
	}
	
	double Angler;
	int Frames;
	int Times;
	int Baa;
	int Released;
	int Superposition;
	
	States
	{
	Spawn:
    	"####" "#" 0 NoDelay {
			Superposition = 30.0+frandom(180.0,0.0);
			if(!(Master is "CasterFamiliar") || !(Master is "CasterFamiliar2")) { A_GiveToTarget("SheepOut",1); }
			Angler = frandom(0.0,360.0);
			Frames = 0;
		}
	ISetMySightsOnYou:
		"####" "#" 0 {
			A_Warp(AAPTR_TARGET, Superposition, 0, 7, Angler, WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE);
			A_SpawnItemEx("SheepSpawnGlow",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("SheepSpawnShock",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("SheepSpawnFX",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("SheepBlock",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_ORIGINATOR|SXF_TRANSFERPOINTERS);
			A_PlaySound("Sheep/Spawn",5,0.4);
		}
  	YouSpinMeRound:
		"####" "#" 0 {
			A_Warp(AAPTR_TARGET, Superposition, 0, 7, Angler, WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE); //
			Frames++;
			Angler = Angler + 10.0;
			A_Explode(8,64,0);
			//A_SpawnItemEx("SheepTrail",0,0,0,0,0,0,90,SXF_TRANSFERSPRITEFRAME);
		}
		"####" "#" 1 {
			A_SetAngle(Angle + 90);
			Baa = Baa + random(1,2);
			if(Baa >= 140) {
				if(random(0,1) == 1) { A_PlaySound("Sheep/Noise",6,0.6); }
				Baa = 0;
			}
		}
		"####" "#" 0 A_JumpIf(Master is "CasterFamiliar" || Master is "CasterFamiliar2",2);
		"####" "#" 0 A_JumpIf(CountInv("SheepActive",AAPTR_TARGET),2);
		Goto UnleashTheShitstorm;
	AlternateCheck:
		"####" "#" 0 A_JumpIf(CountInv("SheepActive",AAPTR_MASTER),1);
		Goto UnleashTheShitstorm;


		"####" "#" 0 A_JumpIf(Frames <= 4, "Frame1");
		"####" "#" 0 A_JumpIf(Frames <= 8, "Frame2");
		"####" "#" 0 A_JumpIf(Frames <= 12, "Frame3");
		"####" "#" 0 A_JumpIf(Frames <= 16, "Frame4");
		"####" "#" 0 A_JumpIf(Frames > 16, "Reset");

	UnleashTheShitstorm:
		"####" "#" 0 {
			if(target) { A_SetPitch(-target.pitch+frandom(20.0,-20.0)); }
			A_ChangeVelocity(cos(angle) * cos(pitch) * 20, sin(angle) * cos(pitch) * 20, sin(pitch) * 20, CVF_REPLACE);
			Times = random(210,245);
			Released = 1;
			bNOINTERACTION = 0;
			bNOCLIP = 0;
		}
	LikeARecordBaby: //RELEASE THE SHEEPS.
		"####" "#" 0 A_CheckFloor("IzSpeedCorrect");
	HereICome:
		"####" "#" 1 {
			Frames++;
			Times--;
			Baa = Baa + random(1,2);
			if(Baa >= 140) {
				if(random(0,1) == 1) { A_PlaySound("Sheep/Noise",6,0.6); }
				Baa = 0;
			}
			//A_SpawnItemEx("SheepCollider",25,0,-15,0,0,0,0,SXF_TRANSFERPOINTERS) //..hoped this would work, but it doesn't. Shame on me.
			//A_SpawnItemEx("SheepTrail",0,0,0,0,0,0,0,SXF_TRANSFERSPRITEFRAME)
			//If(CallACS("Large Sheep Collider") == true) { Return ResolveState("Jump"); }
			Return A_JumpIf(Times <= 0, "Death");
		}
		"####" "#" 0 A_JumpIf(Frames <= 4, "Frame1");
		"####" "#" 0 A_JumpIf(Frames <= 8, "Frame2");
		"####" "#" 0 A_JumpIf(Frames <= 12, "Frame3");
		"####" "#" 0 A_JumpIf(Frames <= 16, "Frame4");
		"####" "#" 0 A_JumpIf(Frames > 16, "Reset");
		Loop;
	Jump:
		"####" "#" 0 {
			A_PlaySound("Sheep/Noise",6);
			A_ChangeVelocity(25,0,25,CVF_RELATIVE);
		}
		Goto LikeARecordBaby;
	Frame1:
		SHEP A 0 A_JumpIf(Released >= 1, "LikeARecordBaby");
		Goto YouSpinMeRound;
	Frame2:
		SHEP B 0 A_JumpIf(Released >= 1, "LikeARecordBaby");
		Goto YouSpinMeRound;
	Frame3:
		SHEP C 0 A_JumpIf(Released >= 1, "LikeARecordBaby");
		Goto YouSpinMeRound;
	Frame4:
		SHEP D 0 A_JumpIf(Released >= 1, "LikeARecordBaby");
		Goto YouSpinMeRound;
	Reset:
		SHEP A 0 { frames = 0; }
		SHEP A 0 A_JumpIf(Released >= 1, "LikeARecordBaby");
		Goto YouSpinMeRound;
	IzSpeedCorrect:
		"####" "#" 0 A_JumpIf(Vel.x < 20,1);
		Goto HereICome;
		"####" "#" 0 {
			A_SetPitch(0);
			A_ChangeVelocity(cos(angle) * cos(pitch) * 20, sin(angle) * cos(pitch) * 20, sin(pitch) * 20, CVF_REPLACE);
		}
		Goto HereICome;
	Death:
		TNT1 A 0 {
			A_RemoveChildren(1,RMVF_EVERYTHING);
			if(!(Master is "CasterFamiliar") || !(Master is "CasterFamiliar2")) {
				A_TakeInventory("SheepOut",1,0,AAPTR_TARGET);
			}
			A_PlaySound("Sheep/Blast",4,0.6);
			A_SpawnItemEx("SheepBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
		}
		Stop;
	}
}

class SheepBlast : Actor
{
	Default
	{
		DamageType "Baaah";
		+NOINTERACTION
	}
	
	States
	{
	Spawn:
		TNT1 A 15 NoDelay {
			A_QuakeEx(3,3,3,15,0,384,"none",QF_SCALEDOWN);
			A_PlaySound("Matriarch/Hit",5,0.5);
			A_PlaySound("Matriarch/Exp",6,0.7);
			A_Explode((80*random(2,3)),192,0);
			A_AlertMonsters();
			A_SpawnItemEx("Matriarch_Blast",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("Sheep_Impact",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("Matriarch_Flare",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("Matriarch_Shockwave",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("MatriarchFX",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
		}
		Stop;
	}
}

class Sheep_Impact : Actor
{
	Default
	{
		+NOINTERACTION
	}
	
	int SpawnCount;
	int MT;
	
	States
	{
		Spawn:
			TNT1 A 0 NoDelay {
				SpawnCount = 7;
				if(GetCvar("GC_ToasterMode")) { MT = 64; }
				else { MT = 0; }
				A_SpawnItemEx("Matriarch_Flare", 0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			}
			Goto Emit;
		Emit:
			TNT1 A random(1,2) {
				for(int fuck = 0; fuck < 3; fuck++)
				{
					A_SpawnItemEx("Matriarch_Cloud", frandom(-35.0, 35.0),
						frandom(-35.0, 35.0), frandom(-35.0, 35.0),
						frandom(-2.0, -2.0), frandom(-2.0, 2.0),
						frandom(-2.0, 2.0), frandom(0.0,360.0), SXF_CLIENTSIDE, 10 + MT);
					A_SpawnItemEx("Matriarch_Smoke", frandom(-35.0, 35.0),
						frandom(-35.0, 35.0), frandom(-35.0, 35.0),
						frandom(1.5, -2.5), frandom(-1.0, 1.0),
						frandom(-1.0, 1.0), frandom(0.0,360.0), SXF_CLIENTSIDE, 10 + MT);
				}
				SpawnCount--; 
				A_SpawnItemEx("Matriarch_Ember", frandom(-25.0, 25.0),
						frandom(-25.0, 25.0), frandom(-25.0, 25.0),
						frandom(-3.0, -10.0), frandom(-6.0, 6.0),
						frandom(1.0, 6.0), frandom(0.0,360.0), SXF_CLIENTSIDE, 10 + MT);
				Return A_JumpIf(SpawnCount <= 0, "Null");
			}
			Loop;
	}
}

class SheepBlock : Actor
{
	Default
	{
		Health 0;
		Radius 48;
		Height 64;
		Species "Rrerr";
		+NOGRAVITY
		+INVULNERABLE
		+SHOOTABLE
		+THRUSPECIES
		+NOTONAUTOMAP
		+DONTBLAST
		+NOTARGETSWITCH
	}
	States
	{
	Spawn:
		TNT1 A 1 NoDelay {
			A_Warp(AAPTR_MASTER, 0, 0, 0, 0, WARPF_NOCHECKPOSITION);
			//Return A_JumpIf(!CountInv("SheepActive",AAPTR_TARGET),"Death");
		}
		Loop;
	Death:
		TNT1 A 0;
		Stop;
	}
}

class SheepTrail : Actor
{
	Default
	{
		Alpha 0.6;
		Scale 0.8;
		Renderstyle "Translucent";
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		"####" "#" 1 NoDelay A_FadeOut(0.1);
		Loop;
	}
}

class SheepSpawnGlow : Actor
{
	Default
	{
		Alpha 0.0;
		Scale 0.0;
		Renderstyle "Add";
		+NOINTERACTION
		+NOTONAUTOMAP
		+FORCEXYBILLBOARD
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_SetScale(frandom(0.35,0.3));
		TNT1 A 0 A_FadeIn(frandom(0.9,0.99));
		TNT1 A 0 A_Jump(256,"Spawn1","Spawn2","Spawn3","Spawn4");
	Spawn1:
		SHPS A 0;
		Goto Main;
	Spawn2:
		SHPS B 0;
		Goto Main;
	Spawn3:
		SHPS C 0;
		Goto Main;
	Spawn4:
		SHPS D 0;
		Goto Main;
	Main:
		"####" "#" 1 Bright {
			A_FadeOut(0.05);
			A_SetScale(Scale.X - frandom(0.01,0.03));
			Return A_JumpIf(Scale.X <= 0, "Null");
		}
		Loop;
	}
}

class SheepSpawnShock : Actor
{
	Default
	{
		Alpha 0.0;
		Scale 0.0;
		Renderstyle "Add";
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_SetScale(frandom(0.1,0.08));
			A_FadeIn(frandom(0.9,0.99));
		}
	Spawn1:
		SHCK B 0;
	Main:
		"####" "#" 1 Bright {
			A_FadeOut(0.1);
			A_SetScale(Scale.X + 0.07);
		}
		Loop;
	}
}

class SheepSpawnFX : Actor
{
	Default
	{
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		TNT1 A 20;
		Stop;
	}
}

//POWERED MODE
class SheepPointer : BulletPuff
{
	Default
	{
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	
	States
	{
		Spawn:
			TNT1 A 10;
			Stop;
	}
}

class SuperSheepCircleSpawner : Actor
{
	Default
	{
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	
	int Counter;
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIfInTargetInventory("SheepOut",0,"Null");
		TNT1 A 0 { Counter = 3; }
	Looplet:
		TNT1 A 0 {
			A_GiveToTarget("SheepOut",1);
			A_SpawnItemEx("SuperExplosiveSheep",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_NOCHECKPOSITION);
			Counter--;
			Return A_JumpIf(Counter <= 0, "Null");
		}
		Loop;
	}
}

class SuperSheepCircleSpawner1 : SuperSheepCircleSpawner
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIfInTargetInventory("SheepOut1",1,"Null");
		TNT1 A 0 {
			A_GiveInventory("SheepOut1",1,AAPTR_TARGET);
			A_SpawnItemEx("SuperExplosiveSheep1",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_NOCHECKPOSITION);
		}
		Stop;
	}
}

class SuperSheepCircleSpawner2 : SuperSheepCircleSpawner1
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIfInTargetInventory("SheepOut2",1,"Null");
		TNT1 A 0 {
			A_GiveInventory("SheepOut2",1,AAPTR_TARGET);
			A_SpawnItemEx("SuperExplosiveSheep2",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_NOCHECKPOSITION);
		}
		Stop;
	}
}

class SuperSheepCircleSpawner3 : SuperSheepCircleSpawner1
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIfInTargetInventory("SheepOut3",1,"Null");
		TNT1 A 0 {
			A_GiveInventory("SheepOut3",1,AAPTR_TARGET);
			A_SpawnItemEx("SuperExplosiveSheep3",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_NOCHECKPOSITION);
		}
		Stop;
	}
}

class SuperExplosiveSheep : ExplosiveSheep
{
	Default
	{
		Speed 25;
		Scale 0.8;
		Damage 200;
		-STEPMISSILE
		-DROPOFF
		-NOEXPLODEFLOOR
		-SHOOTABLE
		-ISMONSTER
		+NOGRAVITY
	}
	
	override void OnDestroy () {
		GuncasterSeeker.Remove(self, target);
	}
	
	//Int User_MaxSpeed;
	//Int User_Acceleration;
	
	States
	{
	Spawn:
    	"####" "#" 0 NoDelay { Superposition = 40.0+frandom(180.0,0.0); }
	ISetMySightsOnYou:
		"####" "#" 0 {
			if(!(Master is "CasterFamiliar") || !(Master is "CasterFamiliar2")) { A_GiveToTarget("SuperSheepOut",1); }
			A_Warp(AAPTR_TARGET, Superposition, 0, 15, Angler, WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE);
			A_SpawnItemEx("SuperSheepSpawnGlow",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("SuperSheepSpawnShock",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("SuperSheepSpawnFX",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("SheepReflector",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_ORIGINATOR|SXF_TRANSFERPOINTERS);
			A_PlaySound("Sheep/Spawn",5,0.4);
		}
  	YouSpinMeRound:
		"####" "#" 0 {
			A_PlaySound("SuperSheep/Whoosh",6,0.7,1);
			A_Warp(AAPTR_TARGET, Superposition, 0, 15, Angler, WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE);
			Frames++;
			Angler = Angler + 10.0;
			A_Explode(30,64,0);
			A_SpawnItemEx("SuperSheepStarTrail",frandom(10.0,-10.0),
				frandom(10.0,-10.0),frandom(10.0,-10.0),frandom(0.5,-0.5),
				frandom(0.5,-0.5),frandom(1.0,-0.5),frandom(225.0,315.0),
				SXF_CLIENTSIDE,64);
			//A_SpawnItemEx("SuperSheepTrail",0,0,0,0,0,0,90,SXF_TRANSFERSPRITEFRAME);
		}
		"####" "#" 1 A_SetAngle(Angle + 90);
		"####" "#" 0 A_JumpIf(Master is "CasterFamiliar" || Master is "CasterFamiliar2",2);
		"####" "#" 0 A_JumpIf(CountInv("SheepActive",AAPTR_TARGET),2);
		Goto UnleashTheShitstorm;
	AlternateCheck:
		"####" "#" 0 A_JumpIf(CountInv("SheepActive",AAPTR_MASTER),1);
		Goto UnleashTheShitstorm;

		"####" "#" 0 A_JumpIf(Frames <= 4, "Frame1");
		"####" "#" 0 A_JumpIf(Frames <= 8, "Frame2");
		"####" "#" 0 A_JumpIf(Frames <= 12, "Frame3");
		"####" "#" 0 A_JumpIf(Frames <= 16, "Frame4");
		"####" "#" 0 A_JumpIf(Frames > 16, "Reset");

	UnleashTheShitstorm:
		"####" "#" 0 {
			A_ChangeVelocity(cos(angle) * cos(pitch) * 25, sin(angle) * cos(pitch) * 25, sin(pitch) * 25, CVF_REPLACE);
			Released = 1;
			bNOINTERACTION = 0;
			bNOCLIP = 0;
			
			GuncasterSeeker.Make(self, target, 25, 4);
		}
	LikeARecordBaby:
	HereICome:
		"####" "#" 1 {
			for(int cunt = 0; cunt < 3; cunt++)
			{
				A_SpawnItemEx("SuperSheepStarTrail",frandom(10.0,-10.0),
					frandom(10.0,-10.0),frandom(10.0,-10.0),frandom(0.5,-0.5),
					frandom(0.5,-0.5),frandom(1.0,-0.5),frandom(225.0,315.0),
					SXF_CLIENTSIDE,64);
			}
			//A_SpawnItemEx("SheepTrail",0,0,0,0,0,0,0,SXF_TRANSFERSPRITEFRAME)
			Frames++;
			//A_FaceTracer();
		}
		
		"####" "#" 0 A_JumpIf(Frames <= 4, "Frame1");
		"####" "#" 0 A_JumpIf(Frames <= 8, "Frame2");
		"####" "#" 0 A_JumpIf(Frames <= 12, "Frame3");
		"####" "#" 0 A_JumpIf(Frames <= 16, "Frame4");
		"####" "#" 0 A_JumpIf(Frames > 16, "Reset");
		Loop;
	Frame1:
		SSHP A 0 A_JumpIf(Released == 1, "LikeARecordBaby");
		Goto YouSpinMeRound;
	Frame2:
		SSHP B 0 A_JumpIf(Released == 1, "LikeARecordBaby");
		Goto YouSpinMeRound;
	Frame3:
		SSHP C 0 A_JumpIf(Released == 1, "LikeARecordBaby");
		Goto YouSpinMeRound;
	Frame4:
		SSHP D 0 A_JumpIf(Released == 1, "LikeARecordBaby");
		Goto YouSpinMeRound;
	Reset:
		SSHP A 0 {
			Frames = 0;
			Return A_JumpIf(Released == 1, "LikeARecordBaby");
		}
		Goto YouSpinMeRound;
	Death:
		TNT1 A 0;
		Goto RestOfDeath;
	RestOfDeath:
		TNT1 A 0 {
			OnDestroy();
			A_RemoveChildren(1,RMVF_EVERYTHING);
			A_StopSound(6);
			if(!(Master is "CasterFamiliar") || !(Master is "CasterFamiliar2")) { A_TakeFromTarget("SuperSheepOut", 1); }
			A_SpawnItemEx("SuperSheepBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
		}
		Stop;
	}
}

class SuperSheepBlast : Actor
{
	Default
	{
		DamageType "Baaah";
		+NOINTERACTION
		+FORCERADIUSDMG
		+NOTONAUTOMAP
	}
	
	int Lifespan;
	
	States
	{
	Spawn:
			TNT1 A 0 NoDelay {
				Lifespan = 14;
				A_PlaySound("TNT/Explosion",5,0.9);
				A_PlaySound("TNT/Add",7);
				A_PlaySound("TNT/Far",6,0.8);
				A_SpawnItemEx("TNTMain",0,0,0,0,0,0,0,SXF_CLIENTSIDE,0);
				A_Quake(3,55,0,768,"none");
				A_Quake(7,55,0,384,"none");
				A_Explode(500,364,0,1); //Pretty hard to hit with them, so let's make it ridiculous.
				A_Explode(300,256,0);
			}
		DeathLoop:
			TNT1 A 4 {
				Lifespan--;
				A_Explode(40,364,0,1);
				A_Explode(20,256,0);
				Return A_JumpIf(Lifespan <= 0, 1);
			}
			Loop;
			TNT1 A 6;
			Stop;
	}
}

class SheepReflector : SheepBlock
{
	Default
	{
		+REFLECTIVE
		+MIRRORREFLECT
	}
}

class SuperSheepSpawnGlow : Actor
{
	Default
	{
		Alpha 0.0;
		Scale 0.0;
		Renderstyle "Add";
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_SetScale(frandom(0.35,0.3));
			A_FadeIn(frandom(0.9,0.99));
			Return A_Jump(256,"Spawn1","Spawn2","Spawn3","Spawn4");
		}
	Spawn1:
		BRWV A 0;
		Goto Main;
	Spawn2:
		BRWV B 0;
		Goto Main;
	Spawn3:
		BRWV C 0;
		Goto Main;
	Spawn4:
		BRWV D 0;
		Goto Main;
	Main:
		"####" "#" 1 Bright {
			A_SetScale(Scale.X - frandom(0.01,0.03));
			A_FadeOut(0.05);
			Return A_JumpIf(Scale.X <= 0, "Null");
		}
		Loop;
	}
}

class SuperSheepSpawnShock : Actor
{
	Default
	{
		Alpha 0.0;
		Scale 0.0;
		Renderstyle "Add";
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_SetScale(frandom(0.1,0.08));
			A_FadeIn(frandom(0.9,0.99));
		}
	Spawn1:
		SHCK D 0;
	Main:
		"####" "#" 1 Bright {
			A_SetScale(Scale.X + 0.07);
			A_FadeOut(0.1);
		}
		Loop;
	}
}

class SuperSheepSpawnFX : Actor
{
	Default
	{
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	States
	{
	Spawn:
		TNT1 A 20;
		Stop;
	}
}

class SuperExplosiveSheep1 : SuperExplosiveSheep
{
	States
	{
	Spawn:
    	SSHP A 0 NoDelay {
			Superposition = 60.0;
			Angler = 0;
		}
		Goto ISetMySightsOnYou;
	Death:
		TNT1 A 0 { if(!(Master is "CasterFamiliar") || !(Master is "CasterFamiliar2")) { A_TakeFromTarget("SheepOut1",1); } }
		Goto RestOfDeath;
	}
}

class SuperExplosiveSheep2 : SuperExplosiveSheep
{
	States
	{
	Spawn:
    	SSHP A 0 NoDelay {
			Superposition = 60.0;
			Angler = 120;
		}
		Goto ISetMySightsOnYou;
	Death:
		TNT1 A 0 { if(!(Master is "CasterFamiliar") || !(Master is "CasterFamiliar2")) { A_TakeFromTarget("SheepOut2",1); } }
		Goto RestOfDeath;
	}
}

class SuperExplosiveSheep3 : SuperExplosiveSheep
{
	States
	{
	Spawn:
    	SSHP A 0 NoDelay {
			Superposition = 60.0;
			Angler = 240;
		}
		Goto ISetMySightsOnYou;
	Death:
		TNT1 A 0 { if(!(Master is "CasterFamiliar") || !(Master is "CasterFamiliar2")) { A_TakeFromTarget("SheepOut3",1); } }
		Goto RestOfDeath;
	}
}

class SuperSheepStarTrail : Actor
{
	Default
	{
		Scale 0.0;
		Alpha 0.0;
		Renderstyle "Add";
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	
	int Frames;
	
	States
	{
	Spawn:
		REDS A 0 NoDelay {
			A_SetScale(Scale.X + frandom(0.04,0.06));
			A_FadeIn(frandom(0.8,1.0));
			Frames = random(1,8);
		}
	YouSpinMeRound:
		"####" "#" random(1,2) Bright {
			Frames++;
			A_SetScale(Scale.X - frandom(0.002,0.005));
			A_FadeOut(0.05);
			Return A_JumpIf(Scale.X <= 0, "Null");
		}
		"####" "#" 0 A_JumpIf(Frames <= 2, "Frame1");
		"####" "#" 0 A_JumpIf(Frames <= 4, "Frame2");
		"####" "#" 0 A_JumpIf(Frames <= 6, "Frame3");
		"####" "#" 0 A_JumpIf(Frames <= 8, "Frame4");
		"####" "#" 0 A_JumpIf(Frames > 8, "Reset");
	
	Frame1:
		REDS A 0;
		Goto YouSpinMeRound;
	Frame2:
		REDS B 0;
		Goto YouSpinMeRound;
	Frame3:
		REDS C 0;
		Goto YouSpinMeRound;
	Frame4:
		REDS D 0;
		Goto YouSpinMeRound;
	Reset:
		REDS A 0 { Frames = 0; }
		Goto YouSpinMeRound;
	}
}