#region Poweroops
//$Color 10

//Inventory
class DraughTomeBringer : BaseBringer
{
	Default
	{
		//$Title Draugh Tome
		Tag "\c[untranslated]Tome of the Draugh";
		Inventory.PickupSound "Tome/Pickup";
		Inventory.PickupMessage "You've got the \c[untranslated]Tome of the Draugh\c-!";
		Inventory.Amount 20000;
		+COUNTITEM +INVENTORY.AUTOACTIVATE +FLOATBOB //+INVENTORY.ALWAYSPICKUP
		BaseBringer.ItemIsShared TRUE;
		BaseBringer.ItemToBring "DraughTome";
		//BaseBringer.AltItemToBring "DraughAbsorbItem";
		//BaseBringer.MessageToA_Print "";
		BaseBringer.SharedItemSound "Tome/Pickup";
		BaseBringer.SharedItemMessage "\c[white]You've received a shared \c[untranslated]Draugh Tome\c-!";
		BaseBringer.ItemToUnlock Gcs_BaseShop.draughtome;
	}
	
	States
	{
	Spawn:
		DTOM A 0 NoDelay {
			If(multiplayer && !(self.SpawnFlags & MTF_SINGLE) && sv_noweaponspawn)
			{
				Return ResolveState("Null");
			}
			A_SpawnItemEx("BFGMarker",0,0,0,0,0,0,0,SXF_SETTRACER);
			A_PlaySound("DraughTome/Loop",2,0.5,1);
			Return ResolveState(Null);
		}
	Looplet:
		DTOM A 1 {
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("TomeParticleBlack",
					frandom(15.0,-15.0),frandom(15.0,-15.0),30+frandom(15.0,-15.0),
					frandom(0.6,-0.6),frandom(0.6,-0.6),frandom(1.2,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,64);
				A_SpawnItemEx("DraughTomeFade",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			}
		}
		Loop;
	}
}

class DraughTomeFade : Actor
{
	Default
	{
		Renderstyle "Translucent";
		+NOINTERACTION
	}
	
	States
	{
	Spawn:
		DTOM A 1 {
			A_FadeOut(0.25);
			A_SetScale(Scale.X + 0.05);
		}
		Loop;
	}
}
	  
class DraughTome : CustomInventory
{
	Default
	{
		Inventory.PickupSound "Tome/Pickup";
		Inventory.PickupMessage "You've got the \c[untranslated]Tome of the Draugh\c-!";
		Inventory.Icon "ARTIDTOM";
		Inventory.Amount 1;
		Inventory.MaxAmount 1;
		Inventory.InterHubAmount 0x7FFFFFFF;
		Inventory.UseSound "";
		Tag "Tome of the Draugh";
		+INVENTORY.INVBAR +FLOATBOB //+INVENTORY.KEEPDEPLETED
	}
	
	override void AttachToOwner(actor user)
	{
		user.GiveInventory("DraughRepresent",1); // An item for chest to track.
		Super.AttachToOwner(User);
		return;
	}
	
	States
	{  
	Spawn:
		DTOM A 1 NoDelay {
			A_PlaySound("DraughTome/Loop",2,0.5,1);
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("TomeParticleBlack",
					frandom(15.0,-15.0),frandom(15.0,-15.0),30+frandom(15.0,-15.0),
					frandom(0.6,-0.6),frandom(0.6,-0.6),frandom(1.2,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,64);
				A_SpawnItemEx("DraughTomeFade",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			}
		}
		Loop;
	Use:
		//TNT1 A 0 A_JumpIf(CountInv("DraughOut") >= 3, "Nope")
		TNT1 A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USE && !A_JumpIfInventory("DraughToken",0,"Null"),"Use2");
		TNT1 A 0 {
			A_GiveInventory("DraughOut",1);
			A_SpawnItemEx("Draugh",25,0,0,50.0,0,0,0,SXF_SETMASTER|SXF_TRANSFERTRANSLATION|SXF_NOCHECKPOSITION);
			if(!CountInv("DraughWithdraw")) { A_GiveInventory("DraughWithdraw",1); }
			A_PlaySound("Tome/Use",3);
			A_QuakeEx(2,2,5,35,0,64,"none",QF_SCALEDOWN);
			A_SetBlend("Black",0.5,50);
			if(!CountInv("DraughInstructed")) {
				A_GiveInventory("DraughInstructed");
				A_Print("$DRAUGHINSTRUCT", 7);
			}
		}
		Stop;
	Use2:
		TNT1 A 0 A_JumpIf(CountInv("PowerSuitDraugh") && !GetCvar("GC_UnlimitedAbsorb"),"Nope");
		TNT1 A 0 {
			A_GiveInventory("DraughsuitItem",1);
			If(CountInv("PowerSuitDraugh",AAPTR_MASTER)) { A_GiveInventory("DraughCounter",1); }
			Else { A_GiveInventory("DraughAbsorbItem",1); }
		}
		Stop;
	Nope:
		TNT1 A 0;
		Fail;
	}
}

class DraughInstructed : Inventory { Default { Inventory.MaxAmount 1; } }
class DraughRepresent : Inventory { Default { Inventory.MaxAmount 1; } }
class DraughCounter : Inventory { Default { Inventory.MaxAmount 999999; } }

class DraughSpawner : Actor
{
	Default
	{
		Radius 18;
		Height 24;
		Speed 50;
		Projectile;
	}
	
	States
	{
	Spawn:
		TNT1 A 3;
	Death:
		TNT1 A 0 A_SpawnItemEx("Draugh",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_TRANSFERTRANSLATION|SXF_NOCHECKPOSITION);
		Stop;
	}
}

class DraughWithdraw : DraughTome
{
	Default
	{
		Inventory.Icon "ARTIDTM2";
		Inventory.Amount 1;
		Inventory.MaxAmount 1;
		Inventory.InterHubAmount 1;
		Tag "Tome of the Draugh (Withdraw)";
		+INVENTORY.UNDROPPABLE
	}
	
	States
	{  
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(GetCVar("GC_PickupParticleChoker"), "DZIADZICIWSADZI");
		TNT1 A 0 A_Jump(128, 2);
		TNT1 A 0 A_SpawnItemEx("TomeParticleBlack",frandom(15.0,-15.0),frandom(15.0,-15.0),30+frandom(15.0,-15.0),
												frandom(0.6,-0.6),frandom(0.6,-0.6),frandom(1.2,0.4),
												frandom(0.0,360.0),SXF_CLIENTSIDE,64);
		TNT1 A 0 A_SpawnItemEx("DraughTomeFade",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
	DZIADZICIWSADZI:
		DTOM B 1 Bright;
		Goto Spawn;
	Use:
		TNT1 A 0 A_SetBlend("Black",0.4,25);
		TNT1 A 0 A_SpawnItemEx("DraughWithdrawal",0,0,0,0,0,0,0,SXF_SETTARGET); //As I can't make a loop inside an item.
		TNT1 A 0 A_TakeInventory("DraughWithdraw",1); //To make sure it'll do the damn thing, as on sv_infiniteinventory 1, it won't.
		Stop;
	}
}

class DraughWithdrawal : Actor
{
	Default
	{
		Projectile; //I... probably set this for a reason? Uhhhh... I'll just leave it as-is.
		+NOINTERACTION
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_TakeInventory("DraughOut", 1, 0, AAPTR_TARGET);
		TNT1 A 0 A_GiveInventory("DraughTome", 1, AAPTR_TARGET);
		TNT1 A 0 A_JumpIf(CountInv("DraughOut",AAPTR_TARGET), "Spawn");
		Stop;
	}
}

//The man(dragon) himself.

class DraughOut : Inventory { Default { Inventory.MaxAmount 3; } }
class DraughToken : Inventory { Default { Inventory.MaxAmount 1; } }

class DraughLonghornCooldown : DraughToken {}
class DraughShotgunCooldown : DraughToken {}
class DraughChaingunCooldown : DraughToken {}
class DraughIronblastCooldown : DraughToken {}
class DraughCannonCooldown : DraughToken {}
class DraughAugurCooldown : DraughToken {}
class DraughDreadfulCooldown : DraughToken {} //
class DraughTNTCooldown : DraughToken {}

class DraughArmCannonCooldown : DraughToken {}
class DraughStompCooldown : DraughToken {}

class DraughSkullfireCooldown : DraughToken {}
class DraughFlamewaveCooldown : DraughToken {}
class DraughSkypunchCooldown : DraughToken {}
class DraughFrostbiteCooldown : DraughToken {}
class DraughSpiritcannonCooldown : DraughToken {}
class DraughCorpseCooldown : DraughToken {}
class DraughChillgraspCooldown : DraughToken {}
class DraughMeteorfistCooldown : DraughToken {}
class DraughAnnihilationCooldown : DraughToken {}
class DraughCrowsCooldown : DraughToken {}
class DraughBreathCooldown : DraughToken {}
class DraughKnivesCooldown : DraughToken {}
class DraughFirebreathCooldown : DraughToken {}
class DraughGumpopCooldown : DraughToken {}
class DraughThunderCooldown : DraughToken {}
class DraughApocalypseCooldown : DraughToken {}
class DraughDragonshoutCooldown : DraughToken {}
class DraughDarkpathCooldown : DraughToken {}
class DraughHammersmiteCooldown : DraughToken {}
class DraughSheepCooldown : DraughToken {}
class DraughPrismCooldown : DraughToken {}

class DraughMegabreathCooldown : DraughToken {}

class Draugh : Actor
{
	Default
	{
		Health 100;
		Radius 16;
		Height 56;
		Mass 1000;
		Speed 10;
		PainChance 0;
		MaxStepHeight 0x7FFFFFFF; //To simulate noclip's climbing without noclip.
		Monster;
		Gravity 0.6;
		SeeSound ""; //Draugh/Sight //He has a tendency to get spammy.
		PainSound "Guncaster/Pain/100";
		DeathSound "Guncaster/Meh";
		ActiveSound "Draugh/Active";
		HitObituary "%o got violently eliminated by Draugh's hand.";
		Obituary "%o didn't think hatred spirits can sport such firepower.";
		Species "Rrerr";
		Renderstyle "OptFuzzy";
		DamageType "Draugh";
		+FLOORCLIP
		//+NOCLIP
		+NODAMAGE
		+DONTBLAST
		+NOBLOOD
		+NOPAIN
		+DONTMORPH
		+LOOKALLAROUND
		+THRUSPECIES
		+DONTHARMCLASS
		+DONTHARMSPECIES
		+DROPOFF
		+FRIENDLY
		+TELESTOMP
		+QUICKTORETALIATE
		+THRUACTORS //Hon hon hon hon~
		+MBFBOUNCER //Well, how to deal with the impassable lines? How nice that you've asked~
		//+DONTDRAIN //Got berserk? Punch him, lol. That's when you'll deactivate thruActors, that is.
	}
	
	//General stuff.
	int User_IdleToken;
	double User_StrafeMul;
	int User_TurnDirection;
	int User_TurnDistance;
	int User_OutOfRange;
	int User_AttackHeight;
	int User_StompCooldown;
	int User_AttackLoop;
	
	//Guided stuff.
	Seekers Shepherd;			//Sheep\Annhilation guidance control.
	// Seekers RoyalShepherd;		//Golden Emperor guidance control.
	
	void HandleSeekers () {
		GuidePos guide_pos;
		guide_pos.FromMonsterTarget(self);
		vector3 seek_pos = guide_pos.Get();
		
		// For sheep:
		// Shepherd.EnsureNoNulls();
		Shepherd.All3d(seek_pos);
		Shepherd.AllFaceMoveDir();
		
		// For the emperor:
		// RoyalShepherd.EnsureNoNulls();
		// RoyalShepherd.All3d(seek_pos);
	}
	
	//Spiritcannon stuff.
	int user_TurretIDs[3];
	
	//Prism Lazer stuff.
	Gc_Prism Left_Prism;
	Gc_Prism Right_Prism;
	Gc_Prism Prism;
	
	//Chillgrasp stuff.
	Gc_GraspThinker grasp;
	
	//Brimstone stuff.
	float				projangle;
	
	Gc_CleaveScan		scanner;
	Gc_SwordCleave		cleave;
	bool				is_cleaving;
	
	override void Tick () {
		//Deadmaker handle. Things like these are for checkers to properly work, like dynamite toss strength on projectile.
		if(CountInv("PowerDeadmaker",AAPTR_MASTER) && !CountInv("PowerDeadmaker")) {
			A_GiveInventory("DeadmakerMorpher");
		}
		
		//Powersuit handle.
		if(CountInv("PowerSuitToken",AAPTR_MASTER) && !CountInv("PowerSuitToken")) {
			A_GiveInventory("CygborgPower");
		}
	
		//Berserk handle.
		if(CountInv("PowerBerserkDamage",AAPTR_MASTER) && !CountInv("PowerBerserkDamage")) {
			A_GiveInventory("PowerBerserking",1);
		} else {
			A_TakeInventory("PowerBerserkDamage",1);
			A_TakeInventory("PowerSpeeding",1);
		}
		
		//Gunzerk handle.
		if(CountInv("PowerGunzerking", AAPTR_MASTER) || GetCvar("GC_Gunslinger"))
		{
			A_GiveInventory("DraughZerk");
		}
		else
		{
			A_GiveInventory("IronblastRevert");
			A_TakeInventory("AnotherIronblast");
			A_TakeInventory("PowerGunzerking");
		}
	
		//Amplifier handle.
		if(CountInv("PowerTomeEffect",AAPTR_MASTER) && !CountInv("PowerTomeEffect")) {
			A_GiveInventory("Amplify",1);
		} else {
			A_TakeInventory("PowerTomeEffect",1);
		}
		
		//Possessed Ironblast handle.
		if(CountInv("IronblastStratActive",AAPTR_MASTER) && !CountInv("FloaterblastActive")) {
			A_SpawnItemEx("FloatingIronblastD",0,0,0,0,0,0,0,SXF_SETTARGET);
		}
		if(!CountInv("IronblastRevert",AAPTR_MASTER)) {
			A_TakeInventory("Ironblast");
			A_TakeInventory("IronblastRevert");
			A_TakeInventory("IronblastStratActive");
		}
		
		if(CountInv("SupermagJohnson",AAPTR_MASTER) && !CountInv("SupermagJohnson")) {
			A_GiveInventory("SupermagJohnson");
		} else {
			A_TakeInventory("SupermagJohnson");
		}
		
		//Height handle.
		if(CountInv("PowerDeadmaker",AAPTR_MASTER)) {
			User_AttackHeight = 70; User_StrafeMul = 0.2;
		} else if(CountInv("PowerSuitToken",AAPTR_MASTER) && Master && Master.GetCvar("GC_NoExtraHeight")) {
			User_AttackHeight = 55; User_StrafeMul = 1.0;
		} else {
			User_AttackHeight = 35; User_StrafeMul = 1.0;
		}
		
		//Brimstone handle.
		if(self && is_cleaving) { // Might need something else than self.
			// console.printf("lul");
			scanner.NextBatch();
			cleave.CleaveOnBrother(scanner);
			
			if(scanner.IsDone()) {
				is_cleaving = false;
			}
		}
		
		//SEEK DA WAE OUT, DO YOU KNOW DA WAE~
		HandleSeekers();
		
		Super.Tick();
		return;
	}
	
	override void BeginPlay () {
		super.BeginPlay();
		
		grasp = new("Gc_GraspThinker");
		grasp.Init(self);
	}
	
	bool A_StartGrasp (int aaptr) {
		Actor to_grasp = GetPointer(aaptr);
		
		if(to_grasp) {
			if(grasp.IsGrasping(to_grasp) || grasp.IsGrasped(to_grasp)) {
				return false;
			}
			
			grasp.BeginHold(to_grasp);
			return true;
		}
		
		return false;
	}
	
	bool A_IsHolding () {
		return grasp.IsHolding();
	}
	
	bool A_IsHoldingSomethingAlive () {
		return grasp.TargetIsHeldAndAlive();
	}
	
	void A_EndGrasp () {
		grasp.EndHold();
	}
	
	States
	{
	//Set up all tokens, set up all extra stuff.
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("TurretLimitCounter",3);
			User_IdleToken = 0;
			User_TurnDirection = random(1,-1);
			User_TurnDistance = 0;
			User_OutOfRange = 0;
			User_StompCooldown = 0;
			User_AttackLoop = 0;
		}
		TNT1 A 0 A_SpawnItemEx("DraughAura",0,0,0,0,0,0,0,SXF_SETMASTER);
		
	//Idle stance.
	Idle:
		CYGG A 0 A_JumpIf(CountInv("HereticCounter", AAPTR_MASTER), "IdleHereticSet");
		CYG2 A 0 A_JumpIf(CountInv("DoomCounter", AAPTR_MASTER), "IdleDoomSet");
		CYG3 A 0 A_JumpIf(CountInv("HexenCounter", AAPTR_MASTER), "IdleHexenSet");
		CYG4 A 0 A_JumpIf(CountInv("StrifeCounter", AAPTR_MASTER), "IdleStrifeSet");
	IdleHereticSet:
		CBGG A 0 A_JumpIf(CountInv("PowerSuitToken", AAPTR_MASTER), "IdleMain");
		UBGG A 0 A_JumpIf(CountInv("PowerSuitProtect", AAPTR_MASTER), "IdleMain");
		YYGG A 0 A_JumpIf(CountInv("PowerSuitDraugh", AAPTR_MASTER), "IdleMain");
		CYGG A 0 A_Jump(256,"IdleMain");
	IdleDoomSet:
		CBG2 A 0 A_JumpIf(CountInv("PowerSuitToken", AAPTR_MASTER), "IdleMain");
		UBG2 A 0 A_JumpIf(CountInv("PowerSuitProtect", AAPTR_MASTER), "IdleMain");
		YYG2 A 0 A_JumpIf(CountInv("PowerSuitDraugh", AAPTR_MASTER), "IdleMain");
		CYG2 A 0 A_Jump(256,"IdleMain");
	IdleHexenSet:
		CBG3 A 0 A_JumpIf(CountInv("PowerSuitToken", AAPTR_MASTER), "IdleMain");
		UBG3 A 0 A_JumpIf(CountInv("PowerSuitProtect", AAPTR_MASTER), "IdleMain");
		YYG3 A 0 A_JumpIf(CountInv("PowerSuitDraugh", AAPTR_MASTER), "IdleMain");
		CYG3 A 0 A_Jump(256,"IdleMain");
	IdleStrifeSet:
		CBG4 A 0 A_JumpIf(CountInv("PowerSuitToken", AAPTR_MASTER), "IdleMain");
		UBG4 A 0 A_JumpIf(CountInv("PowerSuitProtect", AAPTR_MASTER), "IdleMain");
		YYG4 A 0 A_JumpIf(CountInv("PowerSuitDraugh", AAPTR_MASTER), "IdleMain");
		CYG4 A 0 A_Jump(256,"IdleMain");
	IdleMain:
		"####" A 0 {
			If(Master && CountInv("PowerDeadmaker",AAPTR_MASTER)) {
				A_SetScale(2.0);
			}
			Else If(Master && !Master.GetCvar("GC_NoExtraHeight") && CountInv("PowerSuitToken",AAPTR_MASTER)) {
				A_SetScale(1.4);
			}
			Else {
				A_SetScale(1.0);
			}
			Return A_JumpIf(CountInv("DraughOut",AAPTR_MASTER) || (Master && Master.GetCvar("GC_UnlimitedAbsorb") && CountInv("DraughWithdraw",AAPTR_MASTER)),1);
		}
		Goto Death;
		"####" A 1 A_Look();
		/*"####" A 0 {
			if(A_JumpIfTargetInLOS("Null",0,JLOSF_CHECKMASTER,48) &&
			CallACS("Dragon of the Darkness Flame")) { Return ResolveState("Absorb"); }
			Return ResolveState(Null);
		}*/
		"####" A 0 A_JumpIf(User_IdleToken >= 140, "Boredom");
		"####" A 0 {
			User_StompCooldown--;
			User_IdleToken++;
		}
		"####" A 0 A_JumpIfTargetInLOS("Idle",0,JLOSF_CHECKMASTER,256);
		Goto See;
	Absorb:
		"####" A 0 {
			If((!CountInv("PowerSuitDraugh",AAPTR_MASTER) && !A_JumpIfInventory("DraughToken",0,"Null",AAPTR_MASTER)) || 
			(Master && Master.GetCvar("GC_UnlimitedAbsorb") && CountInv("DraughWithdraw",AAPTR_MASTER) && !A_JumpIfInventory("DraughToken",0,"Null",AAPTR_MASTER)))
			{
				A_GiveInventory("DraughsuitItem",1,AAPTR_MASTER);
				A_TakeInventory("DraughOut",1,0,AAPTR_MASTER);
				If(CountInv("DraughOut",AAPTR_MASTER) < 1) {
					A_TakeInventory("DraughWithdraw",1,0,AAPTR_MASTER);
				}
				If(CountInv("PowerSuitDraugh",AAPTR_MASTER)) { A_GiveInventory("DraughCounter",1,AAPTR_MASTER); }
				Else { A_GiveInventory("DraughAbsorbItem",1,AAPTR_MASTER); }
			}
			Else { Return ResolveState("Idle"); }
			Return ResolveState(Null);
		}
		Goto Death;
	//Jump/flight.
	JumpflightInPlace:
		"####" A 0 A_ChangeVelocity(0.0,0,12.0,CVF_RELATIVE|CVF_REPLACE);
		Goto JumpflightMain;
	JumpflightInMove:
		"####" A 0 A_ChangeVelocity(10.0,0,12.0,CVF_RELATIVE|CVF_REPLACE);
		Goto JumpflightMain;
	JumpflightMain:
		"####" A 0 {
			If(A_CheckFloor("Null"))
			{
				A_PlaySound("Guncaster/Jump",5);
			}
			Else
			{
				A_PlaySound("Wings/Movement",5);
			}
		}
		"####" AAAAAAA 1 {
			If(IsPointerEqual(AAPTR_TARGET,AAPTR_TARGET))
			{
				A_FaceTarget();
			}
			Else
			{
				A_FaceMaster();
			}
			A_Chase();
		}
		Goto See;
		
	//Idle stuff.
	Boredom:
		"####" A 0 {
			User_IdleToken = 0;
			Return A_Jump(256,"RollingAround", "Wandering", "CarltonDragon");
		}
	RollingAround:
		"####" A 0 {
			User_TurnDirection = random(1,-1);
			User_TurnDistance = random(1,8);
		}
	RollingLoop:
		"####" A 5 {
			A_SetAngle(Angle + 45.0 * User_StrafeMul * User_TurnDirection);
			//A_Look();
			User_TurnDistance--;
		}
		"####" A 0 A_JumpIf(User_TurnDistance > 0, "RollingLoop");
		Goto Idle;
		
	Wandering:
		"####" A 0 A_JumpIf(CountInv("PowerDeadmaker",AAPTR_MASTER) && Master && !Master.GetCvar("GC_ForceNormalSteps"), "WanderingBigBoy");
		"####" A 0 A_JumpIf(CountInv("PowerSuitToken",AAPTR_MASTER) && Master && !Master.GetCvar("GC_ForceNormalSteps"), "WanderingSuit");
		
		//Step one.
		"####" A 0 { 
			if(!CountInv("PowerSuitDraugh",AAPTR_MASTER) || CountInv("PowerSuitProtect",AAPTR_MASTER)) { A_PlaySound("Guncaster/Move",0,0.3); }
			else if(random(0,3) == 0) { A_PlaySound("Draughcaster/Move",0,0.3); }
			A_SetSpeed(4);
		}
		"####" AAAAABBBBB 1 {
			A_Wander();
			A_ChangeVelocity(0.5,0,0,CVF_RELATIVE);
			A_Look();
		}
		"####" A 0 {
			If(CountInv("PowerBerserkDamage",AAPTR_MASTER)) { A_SpawnItemEx("BerserkStep",0,0,0,0,0,-10,0,SXF_CLIENTSIDE|SXF_TRANSFERPOINTERS,0); } 
			Else											{ A_SpawnItemEx("GuncasterStep",0,0,0,0,0,-10,0,SXF_CLIENTSIDE,0); }
		}
		//Step two.
		"####" A 0 {
			if(!CountInv("PowerSuitDraugh",AAPTR_MASTER) || CountInv("PowerSuitProtect",AAPTR_MASTER)) { A_PlaySound("Guncaster/Move",0,0.3); }
			else if(random(0,3) == 0) { A_PlaySound("Draughcaster/Move",0,0.3); }
		}
		"####" CCCCCDDDDD 1 {
			A_Wander();
			A_ChangeVelocity(0.5,0,0,CVF_RELATIVE);
			A_Look();
		}
		"####" A 0 {
			If(CountInv("PowerBerserkDamage",AAPTR_MASTER)) { A_SpawnItemEx("BerserkStep",0,0,0,0,0,-10,0,SXF_CLIENTSIDE|SXF_TRANSFERPOINTERS,0); } 
			Else											{ A_SpawnItemEx("GuncasterStep",0,0,0,0,0,-10,0,SXF_CLIENTSIDE,0); }
		}
		"####" A 0 A_Jump(32, "Wandering");
		Goto Idle;
		
	WanderingSuit:
		//Step one.
		"####" A 0 {
			A_PlaySound("Bishop/Move",0,0.6);
			A_SetSpeed(4);
			If(Master && !Master.GetCvar("GC_NoExtraHeight") && CountInv("PowerSuitToken",AAPTR_MASTER)) {
				A_SetScale(1.4);
			}
			Else {
				A_SetScale(1.0);
			}
		}
		"####" AAAAAAABBBBBBB 1 {
			A_Wander();
			A_ChangeVelocity(0.5,0,0,CVF_RELATIVE);
			A_Look();
		}
		"####" A 0 {
			If(CountInv("PowerBerserkDamage",AAPTR_MASTER)) { A_SpawnItemEx("BishopZerkStepRight",0,0,0,0,0,-10,0,SXF_CLIENTSIDE|SXF_TRANSFERPOINTERS,0); } 
			Else											{ A_SpawnItemEx("BishopStepRight",0,0,0,0,0,-10,0,SXF_CLIENTSIDE,0); }
		}
		//Step two.
		"####" A 0 A_PlaySound("Bishop/Move",0,0.6);
		"####" CCCCCDDDDD 1 {
			A_Wander();
			A_ChangeVelocity(0.5,0,0,CVF_RELATIVE);
			A_Look();
		}
		"####" A 0 {
			If(CountInv("PowerBerserkDamage",AAPTR_MASTER)) { A_SpawnItemEx("BishopZerkStepLeft",0,0,0,0,0,-10,0,SXF_CLIENTSIDE|SXF_TRANSFERPOINTERS,0); } 
			Else											{ A_SpawnItemEx("BishopStepLeft",0,0,0,0,0,-10,0,SXF_CLIENTSIDE,0); }
		}
		"####" A 0 A_Jump(32, "Wandering");
		Goto Idle;
		
	WanderingBigBoy:
		//Step one.
		"####" A 0 {
			A_SetSpeed(4);
			If(Master && CountInv("PowerDeadmaker",AAPTR_MASTER)) {
				A_SetScale(2.0);
			}
			Else {
				A_SetScale(1.0);
			}
			if(CountInv("PowerSuitDraugh") && random(0,3) == 0) { A_PlaySound("Draughcaster/Move",0,0.3); }
		}
		"####" AAAAAAAAAABBBBBBBBBB 1 {
			A_Wander();
			A_ChangeVelocity(0.5,0,0,CVF_RELATIVE);
			A_Look();
		}
		"####" A 0 A_SpawnItemEx("DeadmakerStep",0,0,0,0.2,0,-15,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
		
		//Step two.
		"####" A 0 { if(CountInv("PowerSuitDraugh") && random(0,3) == 0) { A_PlaySound("Draughcaster/Move",0,0.3); } }
		"####" CCCCCCCCCCDDDDDDDDDD 1 {
			A_Wander();
			A_ChangeVelocity(0.5,0,0,CVF_RELATIVE);
			A_Look();
		}
		"####" A 0 A_SpawnItemEx("DeadmakerStep",0,0,0,0.2,0,-15,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
		
		"####" A 0 A_Jump(32, "Wandering");
		Goto Idle;
	
	//IT'S NOT UNUSUAL TO BE HIT WITH COPYRIGHT STRIKE~
	CarltonDragon:
		"####" A 0 A_Jump(64,1);
		Goto Idle;
		"####" A 0 A_PlaySound("Guncaster/Unusual",5,1.0,1);
		"####" A 0 A_JumpIf(CountInv("StrifeCounter", AAPTR_MASTER), "Strife");
		"####" A 0 A_JumpIf(CountInv("HexenCounter", AAPTR_MASTER), "Hexen");
		"####" A 0 A_JumpIf(CountInv("DoomCounter", AAPTR_MASTER), "Doom");
	Heretic:
		CBDG A 0 A_JumpIf(CountInv("PowerSuitToken", AAPTR_MASTER), 4);
		UBDG A 0 A_JumpIf(CountInv("PowerSuitProtect", AAPTR_MASTER), 3);
		YYDG A 0 A_JumpIf(CountInv("PowerSuitDraugh", AAPTR_MASTER), 2);
		CYDG A 0;
		"####" "#" 0;
		Goto DanceDanceDergvolution;
	Doom:
		CBD2 A 0 A_JumpIf(CountInv("PowerSuitToken", AAPTR_MASTER), 4);
		UBD2 A 0 A_JumpIf(CountInv("PowerSuitProtect", AAPTR_MASTER), 3);
		YYD2 A 0 A_JumpIf(CountInv("PowerSuitDraugh", AAPTR_MASTER), 2);
		CYD2 A 0;
		"####" "#" 0;
		Goto DanceDanceDergvolution;
	Hexen:
		CBD3 A 0 A_JumpIf(CountInv("PowerSuitToken", AAPTR_MASTER), 4);
		UBD3 A 0 A_JumpIf(CountInv("PowerSuitProtect", AAPTR_MASTER), 3);
		YYD3 A 0 A_JumpIf(CountInv("PowerSuitDraugh", AAPTR_MASTER), 2);
		CYD3 A 0;
		"####" "#" 0;
		Goto DanceDanceDergvolution;
	Strife:
		CBD4 A 0 A_JumpIf(CountInv("PowerSuitToken", AAPTR_MASTER), 4);
		UBD4 A 0 A_JumpIf(CountInv("PowerSuitProtect", AAPTR_MASTER), 3);
		YYD4 A 0 A_JumpIf(CountInv("PowerSuitDraugh", AAPTR_MASTER), 2);
		CYD4 A 0;
		"####" "#" 0;
	DanceDanceDergvolution:
		"####" A 0  {
			If(Master && CountInv("PowerDeadmaker",AAPTR_MASTER)) {
				A_SetScale(2.0);
			}
			Else If(Master && !Master.GetCvar("GC_NoExtraHeight") && CountInv("PowerSuitToken",AAPTR_MASTER)) {
				A_SetScale(1.4);
			}
			Else {
				A_SetScale(1.0);
			}
		}
		"####" CDEF 3 A_Look();
		"####" A 0 A_JumpIfTargetInLOS(1,0,JLOSF_CHECKMASTER,192);
		Goto StopDance;
		"####" A 0 A_JumpIf(CountInv("DraughOut",AAPTR_MASTER) || ((Master && Master.GetCvar("GC_UnlimitedAbsorb")) && CountInv("DraughWithdraw",AAPTR_MASTER)),1);
		Goto Death;
		
		"####" GH 6 A_Look();
		"####" A 0 A_JumpIfTargetInLOS(1,0,JLOSF_CHECKMASTER,192);
		Goto StopDance;
		"####" A 0 A_JumpIf(CountInv("DraughOut",AAPTR_MASTER) || ((Master && Master.GetCvar("GC_UnlimitedAbsorb")) && CountInv("DraughWithdraw",AAPTR_MASTER)),1);
		Goto Death;
		
		"####" FEDC 3 A_Look();
		"####" A 0 A_JumpIfTargetInLOS(1,0,JLOSF_CHECKMASTER,192);
		Goto StopDance;
		"####" A 0 A_JumpIf(CountInv("DraughOut",AAPTR_MASTER) || ((Master && Master.GetCvar("GC_UnlimitedAbsorb")) && CountInv("DraughWithdraw",AAPTR_MASTER)),1);
		Goto Death;
		
		"####" AB 6 A_Look();
		"####" A 0 A_JumpIfTargetInLOS("DanceDanceDergvolution",0,JLOSF_CHECKMASTER,192);
	StopDance:
		"####" A 0 A_StopSound(5);
		Goto Idle;
		
	//Chase.
	See:
		"####" A 0 {
			If(Master && CountInv("PowerDeadmaker",AAPTR_MASTER)) {
				A_SetScale(2.0);
			}
			If(Master && !Master.GetCvar("GC_NoExtraHeight") && CountInv("PowerSuitToken",AAPTR_MASTER)) {
				A_SetScale(1.4);
			}
			Else {
				A_SetScale(1.0);
			}
		}
		"####" A 0 A_JumpIf(CountInv("PowerDeadmaker",AAPTR_MASTER), "SeeTheMaker");
		"####" A 0 A_JumpIf(CountInv("PowerSuitToken",AAPTR_MASTER) && Master && !Master.GetCvar("GC_ForceNormalSteps"), "SeeSuit");
		
		//Step one.
		"####" A 0 {
			A_SetSpeed(10); //Reset speed after wandering.
			if(!CountInv("PowerSuitDraugh",AAPTR_MASTER) || CountInv("PowerSuitProtect",AAPTR_MASTER)) { A_PlaySound("Guncaster/Move",0,0.3); }
			else if(random(0,3) == 0) { A_PlaySound("Draughcaster/Move",0,0.3); } } //Had some sound for it but I didn't like it. Gotta find something else.
			
		"####" AAAAABBBBB 1 {
			
			//Chasing stuff
			A_Chase();
			A_ChangeVelocity(1.25,0,0, CVF_RELATIVE);
			A_FaceTarget(65.0);
			User_StompCooldown--;
			
			//Unstuck
			If(A_CheckSightOrRange(768,"Null"))
			{
				User_OutOfRange++;
				Return A_JumpIf(User_OutOfRange >= 210, "Unstuck");
			}
			
			//Token check
			If(CountInv("DraughOut",AAPTR_MASTER) || (Master && Master.GetCvar("GC_UnlimitedAbsorb") && CountInv("DraughWithdraw",AAPTR_MASTER)))
			{
				Return ResolveState(Null);
			}
			Else
			{
				Return ResolveState("Death");
			}
			Return ResolveState(Null);
		}
		"####" A 0 {
			If(CountInv("PowerBerserkDamage",AAPTR_MASTER))
			{
				A_SpawnItemEx("BerserkStep",0,0,0,0,0,-10,0,SXF_CLIENTSIDE|SXF_TRANSFERPOINTERS,0);
			} 
			Else
			{
				A_SpawnItemEx("GuncasterStep",0,0,0,0,0,-10,0,SXF_CLIENTSIDE,0);
			}
		}
		
		"####" A 0 A_JumpIfTargetInLOS("Idle",0,JLOSF_CHECKMASTER,256);
		
		//Step two.
		"####" A 0 {
			if(!CountInv("PowerSuitDraugh",AAPTR_MASTER) || CountInv("PowerSuitProtect",AAPTR_MASTER)) { A_PlaySound("Guncaster/Move",0,0.3); }
			else if(random(0,3) == 0) { A_PlaySound("Draughcaster/Move",0,0.3); }
		}
		"####" CCCCCDDDDD 1 {
			
			//Chasing stuff
			A_Chase();
			A_ChangeVelocity(1.25,0,0, CVF_RELATIVE);
			A_FaceTarget(65.0);
			
			//Unstuck
			If(A_CheckSightOrRange(768,"Null"))
			{
				User_OutOfRange++;
				Return A_JumpIf(User_OutOfRange >= 210, "Unstuck");
			}
			
			//Token check
			If(CountInv("DraughOut",AAPTR_MASTER) || ((Master && Master.GetCvar("GC_UnlimitedAbsorb")) && CountInv("DraughWithdraw",AAPTR_MASTER)))
			{
				Return ResolveState(Null);
			}
			Else
			{
				Return ResolveState("Death");
			}
			Return ResolveState(Null);
		}
		"####" A 0 {
			If(CountInv("PowerBerserkDamage",AAPTR_MASTER))
			{
				A_SpawnItemEx("BerserkStep",0,0,0,0,0,-10,0,SXF_CLIENTSIDE|SXF_TRANSFERPOINTERS,0);
			} 
			Else
			{
				A_SpawnItemEx("GuncasterStep",0,0,0,0,0,-10,0,SXF_CLIENTSIDE,0);
			}
		}
		
		//"####" A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS, AAPTR_MASTER) & (BT_JUMP), "Jumpflight");
		//"####" A 0 A_JumpIf(A_JumpIf(GetZAt(0) != Z); && GetPlayerInput(INPUT_BUTTONS, AAPTR_MASTER) & (BT_JUMP), "Stomp");
		
		"####" A 0 A_JumpIfTargetInLOS("Idle",0,JLOSF_CHECKMASTER,256);
		Loop;
		
	SeeSuit:
		"####" A 0  {
			If(Master && !Master.GetCvar("GC_NoExtraHeight")  && CountInv("PowerSuitToken",AAPTR_MASTER)) {
				A_SetScale(1.4);
			}
			Else {
				A_SetScale(1.0);
			}
		}
		//Step one.
		"####" A 0 {
			A_SetSpeed(20); //Reset speed after wandering.
			A_PlaySound("Bishop/Move",0,0.6);
		}
		"####" AAAAAAABBBBBBB 1 {
			
			//Chasing stuff
			A_Chase();
			A_ChangeVelocity(1.5,0,0, CVF_RELATIVE);
			A_FaceTarget(95.0);
			
			//Unstuck
			If(A_CheckSightOrRange(768,"Null"))
			{
				User_OutOfRange++;
				Return A_JumpIf(User_OutOfRange >= 210, "Unstuck");
			}
			
			//Token check
			If(CountInv("DraughOut",AAPTR_MASTER) || (Master && Master.GetCvar("GC_UnlimitedAbsorb") && CountInv("DraughWithdraw",AAPTR_MASTER)))
			{
				Return ResolveState(Null);
			}
			Else
			{
				Return ResolveState("Death");
			}
			Return ResolveState(Null);
		}
		"####" A 0 {
			If(CountInv("PowerBerserkDamage",AAPTR_MASTER))
			{
				A_SpawnItemEx("BishopZerkStepRight",0,0,0,0,0,-10,0,SXF_CLIENTSIDE|SXF_TRANSFERPOINTERS,0);
			} 
			Else
			{
				A_SpawnItemEx("BishopStepRight",0,0,0,0,0,-10,0,SXF_CLIENTSIDE,0);
			}
		}
		
		"####" A 0 A_JumpIfTargetInLOS("Idle",0,JLOSF_CHECKMASTER,256);
		
		"####" A 0 A_PlaySound("Bishop/Move",0,0.6);
		"####" CCCCCCCDDDDDDD 1 {
			
			//Chasing stuff
			A_Chase();
			A_ChangeVelocity(1.5,0,0, CVF_RELATIVE);
			A_FaceTarget(95.0);
			
			//Unstuck
			If(A_CheckSightOrRange(768,"Null"))
			{
				User_OutOfRange++;
				Return A_JumpIf(User_OutOfRange >= 210, "Unstuck");
			}
			
			//Token check
			If(CountInv("DraughOut",AAPTR_MASTER) || ((Master && Master.GetCvar("GC_UnlimitedAbsorb")) && CountInv("DraughWithdraw",AAPTR_MASTER)))
			{
				Return ResolveState(Null);
			}
			Else
			{
				Return ResolveState("Death");
			}
			Return ResolveState(Null);
		}
		
		//"####" A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS, AAPTR_MASTER) & (BT_JUMP), "Jumpflight");
		//"####" A 0 A_JumpIf(A_JumpIf(GetZAt(0) != Z); && GetPlayerInput(INPUT_BUTTONS, AAPTR_MASTER) & (BT_JUMP), "Stomp");
		
		"####" A 0 A_JumpIfTargetInLOS("Idle",0,JLOSF_CHECKMASTER,256);
		Goto See;
	
	SeeTheMaker:
		"####" A 0  {
			If(Master && !Master.GetCvar("GC_NoExtraHeight")  && CountInv("PowerDeadmaker",AAPTR_MASTER)) {
				A_SetScale(2.0);
			}
			Else {
				A_SetScale(1.0);
			}
		}
		//Step one.
		"####" A 0 {
			A_SetSpeed(10); //Reset speed after wandering.
			if(random(0,3) == 0) { A_PlaySound("Draughcaster/Move",0,0.3); }
		}
		"####" AAAAAAAAAABBBBBBBBBB 1 {
			
			//Chasing stuff
			A_Chase();
			A_FaceTarget(95.0);
			
			//Unstuck
			If(A_CheckSightOrRange(768,"Null"))
			{
				User_OutOfRange++;
				Return A_JumpIf(User_OutOfRange >= 210, "Unstuck");
			}
			
			//Token check
			If(CountInv("DraughOut",AAPTR_MASTER) || (Master && Master.GetCvar("GC_UnlimitedAbsorb") && CountInv("DraughWithdraw",AAPTR_MASTER)))
			{
				Return ResolveState(Null);
			}
			Else
			{
				Return ResolveState("Death");
			}
			Return ResolveState(Null);
		}
		"####" A 0 A_SpawnItemEx("DeadmakerStep",0,0,0,0.2,0,-15,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
		"####" A 0 A_JumpIfTargetInLOS("Idle",0,JLOSF_CHECKMASTER,256);
		
		"####" A 0 { if(random(0,3) == 0) { A_PlaySound("Draughcaster/Move",0,0.3); } }
		"####" CCCCCCCCCCDDDDDDDDDD 1 {
			
			//Chasing stuff
			A_Chase();
			A_ChangeVelocity(1.5,0,0, CVF_RELATIVE);
			A_FaceTarget(95.0);
			
			//Unstuck
			If(A_CheckSightOrRange(768,"Null"))
			{
				User_OutOfRange++;
				Return A_JumpIf(User_OutOfRange >= 210, "Unstuck");
			}
			
			//Token check
			If(CountInv("DraughOut",AAPTR_MASTER) || ((Master && Master.GetCvar("GC_UnlimitedAbsorb")) && CountInv("DraughWithdraw",AAPTR_MASTER)))
			{
				Return ResolveState(Null);
			}
			Else
			{
				Return ResolveState("Death");
			}
			Return ResolveState(Null);
		}
		"####" A 0 A_SpawnItemEx("DeadmakerStep",0,0,0,0.2,0,-15,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
		
		//"####" A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS, AAPTR_MASTER) & (BT_JUMP), "Jumpflight");
		//"####" A 0 A_JumpIf(A_JumpIf(GetZAt(0) != Z); && GetPlayerInput(INPUT_BUTTONS, AAPTR_MASTER) & (BT_JUMP), "Stomp");
		
		"####" A 0 A_JumpIfTargetInLOS("Idle",0,JLOSF_CHECKMASTER,256);
		Goto See;
	
	//Teleport to player.
	Unstuck:
		"####" A 0 {
			User_OutOfRange = 0;
			A_ClearTarget();
			A_Warp(AAPTR_MASTER,0,0,0,0,WARPF_NOCHECKPOSITION);
			A_PlaySound("Ironspirit/Release",5,0.8);
			A_SpawnItemEx("IronblastRelease",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
		}
		Goto See;
	
	//Melee stuff.
	Melee:
		"####" E 0  {
			A_StopSound(5);
			User_TurnDirection = random(1,-1);
		}
		
		"####" E 0 A_JumpIf(CountInv("PowerDeadmaker", AAPTR_MASTER), "MakerMelee");
		"####" E 0 A_JumpIf(CountInv("PowerSuitToken", AAPTR_MASTER), "SuitMelee");
		"####" E 0 A_JumpIf(CountInv("PowerBerserkDamage", AAPTR_MASTER), "BerserkMelee");
		"####" E 0 A_JumpIf(CountInv("PowerMidasMode", AAPTR_MASTER), "MidasMelee");
		
	//Regular melee.
		"####" E 0 A_Jump(32,"Roundhouse","Kick"/*,"Brimstone"*/,"Firebreath");
		"####" E random(10,12) {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(1.0,3.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" E 0 A_CustomBulletAttack(0,0,1,12,"PawnchPuff",64);
		Goto See;
	Kick:
		"####" E 8 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			A_FaceTarget();
			if(!CountInv("PowerSuitToken",AAPTR_MASTER) || CountInv("PowerSuitProtect",AAPTR_MASTER)) { A_PlaySound("Kick/Extra",5,0.7); }
			else { A_PlaySound("Draughcaster/Move",0,0.6); }
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" E 15 A_SpawnProjectile("KickProjectile",35);
		Goto See;
	Roundhouse:
		"####" E 0 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			User_TurnDirection = random(1,-1);
			A_FaceTarget();
			if(!CountInv("PowerSuitToken",AAPTR_MASTER) || CountInv("PowerSuitProtect",AAPTR_MASTER)) { A_PlaySound("Kick/Extra",5,0.7); }
			else { A_PlaySound("Draughcaster/Move",0,0.6); }
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" AAAAAAAA 1 A_SetAngle(Angle + 45 * User_TurnDirection);
		"####" E 15 {
			If(User_TurnDirection < 0)
			{
				A_SpawnProjectile("KickProjectileRight", 35);
			}
			Else
			{
				A_SpawnProjectile("KickProjectileLeft", 35);
			}
		}
		Goto See;
		
	//Midas melee.
	MidasMelee:
		"####" E 0 A_Jump(32,"MidasRoundhouse","MidasKick"/*,"Brimstone"*/,"Firebreath");
		"####" E random(10,12) {
			A_FaceTarget();
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" E 0 A_CustomBulletAttack(0,0,1,10,"MidasPawnchPuff",64);
		Goto See;
	MidasKick:
		"####" E 8 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			A_FaceTarget();
			A_PlaySound("Kick/Extra",5,0.7);
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" E 15 A_SpawnProjectile("MidasKickProjectile",35);
		Goto See;
	MidasRoundhouse:
		"####" E 0 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			User_TurnDirection = random(1,-1);
			A_FaceTarget();
			A_PlaySound("Kick/Extra",5,0.7);
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" AAAAAAAA 1 A_SetAngle(Angle + 45 * User_TurnDirection);
		"####" E 15 {
			If(User_TurnDirection < 0)
			{
				A_SpawnProjectile("MidasKickProjectileRight", 35);
			}
			Else
			{
				A_SpawnProjectile("MidasKickProjectileLeft", 35);
			}
		}
		Goto See;
		
	//Zerk melee.
	BerserkMelee:
		"####" E 0 A_JumpIf(CountInv("PowerMidasMode", AAPTR_MASTER), "MidasBerserkMelee");
	
		"####" E 0 A_Jump(32,"BerserkRoundhouse","BerserkKick"/*,"Brimstone"*/);
		"####" E random(10,12) {
			A_FaceTarget();
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" E 0 A_CustomBulletAttack(0,0,1,40,"SuperPawnchPuff",64);
		Goto See;
	BerserkKick:
		"####" E 8 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			A_FaceTarget();
			A_PlaySound("Kick/Extra",5,0.7);
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" E 15 A_SpawnProjectile("SuperKickProjectile",35);
		Goto See;
	BerserkRoundhouse:
		"####" E 0 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			User_TurnDirection = random(1,-1);
			A_FaceTarget();
			A_PlaySound("Kick/Extra",5,0.7);
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" AAAAAAAA 1 A_SetAngle(Angle + 45 * User_TurnDirection);
		"####" E 15 {
			If(User_TurnDirection < 0)
			{
				A_SpawnProjectile("SuperKickProjectileRight", 35);
			}
			Else
			{
				A_SpawnProjectile("SuperKickProjectileLeft", 35);
			}
		}
		Goto See;
		
	//Midas zerk melee.
	MidasBerserkMelee:
		"####" E 0 A_Jump(32,"MidasBerserkRoundhouse","MidasBerserkKick"/*,"Brimstone"*/);
		"####" E random(10,12) {
			A_FaceTarget();
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" E 0 A_CustomBulletAttack(0,0,1,40,"SuperMidasPawnchPuff",64);
		Goto See;
	MidasBerserkKick:
		"####" E 8 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			A_FaceTarget();
			A_PlaySound("Kick/Extra",5,0.7);
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" E 15 A_SpawnProjectile("SuperMidasKickProjectile",35);
		Goto See;
	MidasBerserkRoundhouse:
		"####" E 0 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			User_TurnDirection = random(1,-1);
			A_FaceTarget();
			A_PlaySound("Kick/Extra",5,0.7);
			A_PlaySound("Melee/Swing",0,0.6);
		}
		"####" AAAAAAAA 1 A_SetAngle(Angle + 45 * User_TurnDirection);
		"####" E 15 {
			If(User_TurnDirection < 0)
			{
				A_SpawnProjectile("SuperMidasKickProjectileRight", 35);
			}
			Else
			{
				A_SpawnProjectile("SuperMidasKickProjectileLeft", 35);
			}
		}
		Goto See;
		
		
	//Suit melee.
	SuitMelee:
		"####" E 0 A_JumpIf(CountInv("PowerBerserkDamage", AAPTR_MASTER), "SuitBerserkMelee");
		"####" E 0 A_JumpIf(CountInv("PowerMidasMode", AAPTR_MASTER), "SuitMidasMelee");
	
		"####" E 0 A_Jump(32,"SuitRoundhouse","SuitKick","Firebreath"/*,"Brimstone"*/);
		"####" E 0 A_PlaySound("Bishop/Fist",6,0.7);
		"####" EEEEE 1 {
			A_FaceTarget();
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_Chase(null,null);
			A_ChangeVelocity(0,frandom(3.0,4.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		"####" E 0 A_CustomBulletAttack(0,0,1,(300),"PowerPunchPuff",64);
		"####" EEEEEEEEEEEEEEEEEEEE 1 {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(3.0,4.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		Goto See;
	SuitKick:
		"####" E 8 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			A_FaceTarget();
			A_PlaySound("Bishop/Kick",5,0.9);
		}
		"####" E 15 A_SpawnProjectile("PowerKickProjectile",35);
		Goto See;
	SuitRoundhouse:
		"####" E 0 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			User_TurnDirection = random(1,-1);
			A_FaceTarget();
			A_PlaySound("Bishop/Kick",5,0.9);
		}
		"####" AAAAAAAA 1 A_SetAngle(Angle + 45 * User_TurnDirection);
		"####" E 15 {
			If(User_TurnDirection < 0)
			{
				A_SpawnProjectile("PowerKickProjectileRight", 35);
			}
			Else
			{
				A_SpawnProjectile("PowerKickProjectileLeft", 35);
			}
		}
		Goto See;
		
	//Suit berserk melee.
	SuitBerserkMelee:
		"####" E 0 A_JumpIf(CountInv("PowerMidasMode", AAPTR_MASTER), "SuitBerserkMidasMelee");
	
		"####" E 0 A_Jump(32,"SuitBerserkRoundhouse","SuitBerserkKick");
		"####" E 0 A_PlaySound("Bishop/Fist",6,0.7);
		"####" EEEEE 1 {
			A_FaceTarget();
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_Chase(null,null);
			A_ChangeVelocity(0,frandom(3.0,4.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		"####" E 0 A_CustomBulletAttack(0,0,1,(400),"SuperPowerPunchPuff",64);
		"####" EEEEEEEEEEEEEEEEEEEE 1 {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(3.0,4.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		Goto See;
	SuitBerserkKick:
		"####" E 8 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			A_FaceTarget();
			A_PlaySound("Bishop/Kick",5,0.9);
		}
		"####" E 15 A_SpawnProjectile("SuperPowerKickProjectile",35);
		Goto See;
	SuitBerserkRoundhouse:
		"####" E 0 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			User_TurnDirection = random(1,-1);
			A_FaceTarget();
			A_PlaySound("Bishop/Kick",5,0.9);
		}
		"####" AAAAAAAA 1 A_SetAngle(Angle + 45 * User_TurnDirection);
		"####" E 15 {
			If(User_TurnDirection < 0)
			{
				A_SpawnProjectile("SuperPowerKickProjectileRight", 35);
			}
			Else
			{
				A_SpawnProjectile("SuperPowerKickProjectileLeft", 35);
			}
		}
		Goto See;
	
	//Suit midas melee.
	SuitMidasMelee:
		"####" E 0 A_Jump(32,"SuitMidasRoundhouse","SuitMidasKick"/*,"Brimstone"*/);
		"####" E 0 A_PlaySound("Bishop/Fist",6,0.7);
		"####" EEEEE 1 {
			A_FaceTarget();
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_Chase(null,null);
			A_ChangeVelocity(0,frandom(3.0,4.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		"####" E 0 A_CustomBulletAttack(0,0,1,(300),"PowerMidasPunchPuff",64);
		"####" EEEEEEEEEEEEEEEEEEEE 1 {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(3.0,4.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		Goto See;
	SuitMidasKick:
		"####" E 8 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			A_FaceTarget();
			A_PlaySound("Bishop/Kick",5,0.9);
		}
		"####" E 15 A_SpawnProjectile("PowerMidasKickProjectile",35);
		Goto See;
	SuitMidasRoundhouse:
		"####" E 0 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			User_TurnDirection = random(1,-1);
			A_FaceTarget();
			A_PlaySound("Bishop/Kick",5,0.9);
		}
		"####" AAAAAAAA 1 A_SetAngle(Angle + 45 * User_TurnDirection);
		"####" E 15 {
			If(User_TurnDirection < 0)
			{
				A_SpawnProjectile("PowerMidasKickProjectileRight", 35);
			}
			Else
			{
				A_SpawnProjectile("PowerMidasKickProjectileLeft", 35);
			}
		}
		Goto See;
		
	//...Suit berserk midas melee. Oof, I thought this would never end.
	SuitBerserkMidasMelee:
		"####" E 0 A_Jump(32,"SuitBerserkMidasRoundhouse","SuitBerserkMidasKick"/*,"Brimstone"*/);
		"####" E 0 A_PlaySound("Bishop/Fist",6,0.7);
		"####" EEEEE 1 {
			A_FaceTarget();
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_Chase(null,null);
			A_ChangeVelocity(0,frandom(3.0,4.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		"####" E 0 A_CustomBulletAttack(0,0,1,(400),"SuperPowerMidasPunchPuff",64);
		"####" EEEEEEEEEEEEEEEEEEEE 1 {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(3.0,4.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		Goto See;
	SuitBerserkMidasKick:
		"####" E 8 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			A_FaceTarget();
			A_PlaySound("Bishop/Kick",5,0.9);
		}
		"####" E 15 A_SpawnProjectile("SuperPowerMidasKickProjectile",35);
		Goto See;
	SuitBerserkMidasRoundhouse:
		"####" E 0 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			User_TurnDirection = random(1,-1);
			A_FaceTarget();
			A_PlaySound("Bishop/Kick",5,0.9);
		}
		"####" AAAAAAAA 1 A_SetAngle(Angle + 45 * User_TurnDirection);
		"####" E 15 {
			If(User_TurnDirection < 0)
			{
				A_SpawnProjectile("SuperPowerMidasKickProjectileRight", 35);
			}
			Else
			{
				A_SpawnProjectile("SuperPowerMidasKickProjectileLeft", 35);
			}
		}
		Goto See;
		
	//Deadmaker melee.
	MakerMelee:
		"####" E 0 A_Jump(32,"MakerKick","MakerRoundhouse","Megabreath"/*,"Brimstone"*/);
		"####" EEEEEEEE 1 {
			A_FaceTarget();
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_Chase(null,null);
		}
		"####" E 0 A_PlaySound("Deadmaker/Woosh",6);
		"####" EEEE 1 {
			A_FaceTarget();
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_Chase(null,null);
		}
		"####" E 0 {
			if(!CountInv("PowerMidasMode",AAPTR_MASTER)) { A_CustomBulletAttack(0,0,1,(500+randompick(0,25,50,75,100)),"DeadmakerPunchPuff",275); }
			else										 { A_CustomBulletAttack(0,0,1,(500+randompick(0,25,50,75,100)),"DeadmakerMidasPunchPuff",275); }
		}
		"####" EEEEEEEEEEEEEEEEEEEEEEEEE 1 {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(1.0,2.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		"####" EEEEEEEE 1 {
			A_FaceTarget();
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_Chase(null,null);
		}
		Goto See;
		
	MakerKick:
		"####" E 8 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			A_FaceTarget();
			A_PlaySound("Deadmaker/Woosh",6);
		}
		"####" E 15 {
			if(!CountInv("PowerMidasMode",AAPTR_MASTER)) { A_SpawnProjectile("DeadmakerKickProjectile",35); }
			else										 { A_SpawnProjectile("MidasDeadmakerKickProjectile",35); }
		}
		"####" E 15 ;
		Goto See;
	MakerRoundhouse:
		"####" E 0 {
			If(A_Jump(164,"Null")) {
				A_PlaySound("Guncaster/Kick",6,0.6);
			}
			User_TurnDirection = random(1,-1);
			A_FaceTarget();
			A_PlaySound("Deadmaker/Woosh",6);
		}
		"####" AAAAAAAA 1 A_SetAngle(Angle + 45 * User_TurnDirection);
		"####" E 15 {
			If(User_TurnDirection < 0)
			{
				if(!CountInv("PowerMidasMode",AAPTR_MASTER)) { A_SpawnProjectile("DeadmakerKickProjectileRight",35); }
				else										 { A_SpawnProjectile("MidasDeadmakerKickProjectileRight",35); }
			}
			Else
			{
				if(!CountInv("PowerMidasMode",AAPTR_MASTER)) { A_SpawnProjectile("DeadmakerKickProjectileLeft",35); }
				else										 { A_SpawnProjectile("MidasDeadmakerKickProjectileLeft",35); }
			}
		}
		Goto See;

	Megabreath:
		"####" E 0 A_JumpIf(CountInv("DraughMegabreathCooldown"), "See");
		"####" E 0 A_JumpIf(CountInv("FirebreathTome",AAPTR_MASTER),1);
		Goto See;
		"####" E 0 A_JumpIfTargetInLOS(1,0,0,64);
		Goto See;
		"####" E 4 {
			A_FaceTarget();
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_QuakeEx(3,3,3,100,0,512,"none");
			User_AttackLoop = 100;
			int randomese = random(0,3);
			switch(randomese)
			{
				default:
				case 0:
					A_PlaySound("Deadmaker/Firebreath1",5);
					A_PlaySound("Deadmaker/Firebreath1",6);
					A_PlaySound("Deadmaker/Firebreath1",7);
					break;
				case 1:
					A_PlaySound("Deadmaker/Firebreath2",5);
					A_PlaySound("Deadmaker/Firebreath2",6);
					A_PlaySound("Deadmaker/Firebreath2",7);
					break;
				case 2:
					A_PlaySound("Deadmaker/Firebreath3",5);
					A_PlaySound("Deadmaker/Firebreath3",6);
					A_PlaySound("Deadmaker/Firebreath3",7);
					break;
				case 3:
					A_PlaySound("Deadmaker/Firebreath4",5);
					A_PlaySound("Deadmaker/Firebreath4",6);
					A_PlaySound("Deadmaker/Firebreath4",7);
					break;
			}
		}
	MegabreathGoingOff:
		"####" E 1 {
			A_FaceTarget();
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_Chase(null,null);
			for(int ducks = 0; ducks <= 3; ducks++)
			{
				A_SpawnProjectile("SuperIgnitionSnort",User_AttackHeight,0,frandom(7.0,-7.0),CMF_OFFSETPITCH,frandom(4.0,-4.0));
			}
			for(int ducks = 0; ducks <= 2; ducks++)
			{
				A_SpawnProjectile("SuperIgnitionSmoke",User_AttackHeight,0,frandom(7.0,-7.0),CMF_OFFSETPITCH,frandom(4.0,-4.0));
			}
			A_SpawnProjectile("SuperIgnitionParticle",User_AttackHeight,0,frandom(7.0,-7.0),CMF_OFFSETPITCH,frandom(4.0,-4.0));
			User_AttackLoop--;
		}
		"####" E 1 A_JumpIf(User_AttackLoop > 0, "MegabreathGoingOff");
	MegabreathDone:
		"####" EEEEEEEEEEEEEEEE 1 {
			A_SpawnItemEx("MegabreathCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_QuakeEx(3,3,3,16,0,512,"none",QF_SCALEDOWN);
			A_FaceTarget();
			A_Chase(null,null);
		}
		Goto See;
	
	Firebreath:
		"####" E 0 A_JumpIf(CountInv("DraughFirebreathCooldown"), "See");
		"####" E 0 A_JumpIf(CountInv("FirebreathTome",AAPTR_MASTER),1);
		Goto See;
		"####" E 0 A_JumpIfTargetInLOS(1,0,0,64);
		Goto See;
		"####" E 8 {
			A_FaceTarget();
			A_SpawnItemEx("FirebreathCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("TNT/Ignition",5,0.9);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
		}
		"####" EEEEEE 1 {
			if(CountInv("PowerTomeEffect",AAPTR_MASTER)) {
				if(CountInv("PowerSuitToken",AAPTR_MASTER) && CountInv("TibCore",AAPTR_MASTER))
				{
					for(int ducks = 0; ducks < 3; ducks++) {
						A_SpawnProjectile("BlueTiberianIgnitionSnort",User_AttackHeight,0,frandom(32.0,-32.0),CMF_OFFSETPITCH,frandom(2.0,-2.0));
					}
					for(int ducks = 0; ducks < 5; ducks++) {
						A_SpawnProjectile("BlueTiberianIgnitionSmoke",User_AttackHeight,0,frandom(32.0,-32.0),CMF_OFFSETPITCH,frandom(4.0,-4.0));
					}
				}
				else if(CountInv("PowerSuitToken",AAPTR_MASTER) && CountInv("TibCore",AAPTR_MASTER))
				{
					for(int ducks = 0; ducks < 3; ducks++) {
						A_SpawnProjectile("TiberianIgnitionSnort",User_AttackHeight,0,frandom(32.0,-2.0),CMF_OFFSETPITCH,frandom(2.0,-2.0));
					}
					for(int ducks = 0; ducks < 5; ducks++) {
						A_SpawnProjectile("TiberianIgnitionSmoke",User_AttackHeight,0,frandom(32.0,-2.0),CMF_OFFSETPITCH,frandom(4.0,-4.0));
					}
				}
				else
				{
					for(int ducks = 0; ducks < 3; ducks++) {
						A_SpawnProjectile("FiresweepSnort",User_AttackHeight,0,frandom(32.0,-32.0),CMF_OFFSETPITCH,frandom(2.0,-2.0));
					}
					for(int ducks = 0; ducks < 5; ducks++) {
						A_SpawnProjectile("IgnitionSmoke",User_AttackHeight,0,frandom(32.0,-32.0),CMF_OFFSETPITCH,frandom(4.0,-4.0));
					}
				}
			}
			else {
				if(CountInv("PowerSuitToken",AAPTR_MASTER) && CountInv("TibCore",AAPTR_MASTER))
				{
					A_SpawnProjectile("BlueTiberianIgnitionSnort",User_AttackHeight,0,frandom(2.0,-2.0),CMF_OFFSETPITCH,frandom(2.0,-2.0));
					for(int ducks = 0; ducks < 2; ducks++) {
						A_SpawnProjectile("BlueTiberianIgnitionSmoke",User_AttackHeight,0,frandom(2.0,-2.0),CMF_OFFSETPITCH,frandom(4.0,-4.0));
					}
				}
				else if(CountInv("PowerSuitToken",AAPTR_MASTER) && CountInv("TibCore",AAPTR_MASTER))
				{
					A_SpawnProjectile("TiberianIgnitionSnort",User_AttackHeight,0,frandom(2.0,-2.0),CMF_OFFSETPITCH,frandom(2.0,-2.0));
					for(int ducks = 0; ducks < 2; ducks++) {
						A_SpawnProjectile("TiberianIgnitionSmoke",User_AttackHeight,0,frandom(2.0,-2.0),CMF_OFFSETPITCH,frandom(4.0,-4.0));
					}
				}
				else
				{
					A_SpawnProjectile("IgnitionSnort",User_AttackHeight,0,frandom(2.0,-2.0),CMF_OFFSETPITCH,frandom(2.0,-2.0));
					for(int ducks = 0; ducks < 2; ducks++) {
						A_SpawnProjectile("IgnitionSmoke",User_AttackHeight,0,frandom(2.0,-2.0),CMF_OFFSETPITCH,frandom(4.0,-4.0));
					}
				}
			}
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(3.0,4.0) * User_StrafeMul * User_TurnDirection,0,CVF_RELATIVE);
		}
		Goto See;
		
	//Sord.
	/*Brimstone:
		"####" E 3 {
			A_PlaySound("Brimstone/Woosh",5,0.9);
			
			invoker.scanner.AttachTo(AAAAIDS);
			invoker.is_cleaving = false;
			
			if(CountInv("BrimstoneSide")) {
				A_TakeInventory("BrimstoneSide",1);
				invoker.scanner.RightToLeft(
					angle_covered:	30,
					pitch_covered:	110,
					swing_tics:		15,
					distance:		250 + (CountInv("PowerSuitToken",AAPTR_MASTER) * 25) + (CountInv("PowerDeadmaker",AAPTR_MASTER) * 50));
			}
			
			else {
				A_GiveInventory("BrimstoneSide",1);
				invoker.scanner.LeftToRight(
					angle_covered:	30,
					pitch_covered:	110,
					swing_tics:		15,
					distance:		250 + (CountInv("PowerSuitToken",AAPTR_MASTER) * 25) + (CountInv("PowerDeadmaker",AAPTR_MASTER) * 50));
			}
			
			invoker.cleave.Begin(
				puff:					"BrimstonePuff",
				squishy_hit_class:		"BrimstoneSquishySounder",
				bloodless_hit_class:	"BrimstoneBloodlessSounder");
			
			// invoker.scanner.Print();
			invoker.is_cleaving = true;
		}
		"####" EEEEEEEEEEEEE 1 {
			A_FaceTarget();
			A_AlertMonsters(512,AMF_TARGETEMITTER);
			A_Chase(null,null);
		}
		"####" EEEEEEEEEEEE 1 {
			A_FaceTarget();
			A_Chase(null,null);
		}
		Goto See;*/
	
	//Ranged attacks.
	Missile:
		"####" FFFF 1 Bright {
			A_FaceTarget();
		}
		"####" E 0 {
			User_TurnDirection = random(1,-1);
			//Temporary fixes due to one bug.
			if(CountInv("SheepActive")) { A_PlaySound("Sheepshield/Stop",5,0.7); A_TakeInventory("SheepActive",1); }
			if(Invoker.Left_Prism) { Invoker.Left_Prism.End(); }
			if(Invoker.Right_Prism) { Invoker.Right_Prism.End(); }
			if(Invoker.Prism) { Invoker.Prism.End(); }
			//Note that if you'll end up with no skill for him to use from on cooldown, somehow, expect a neat infinite loop crash!
			Return A_Jump(256,"Longhorn","Shotgun","Chaingun","Cannon","Ironblast","TNT",
				"Augur","Dreadful","Skullfire","Gumpop","Kitchendorf","Crows","Breath",
				"Thunderstruck","Apocalypse","Dragonshout","Darkpath","Hammersmite","Sheepshield",
				"Prism","Flamewave","Frostbite","Spiritcannon","Corpse","Chillgrasp",
				"Skypunch","Meteorfist","Annihilation","Stomp","ArmCannons");
		}
		Goto See;
	Longhorn:
		"####" E 0 A_JumpIf(CountInv("DraughLonghornCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("Longhorn",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 0 A_Jump(128,3); //Random extra delay to make him feel more organic.
		"####" E 4 A_FaceTarget();
		"####" E 0 A_Jump(256,5);
		"####" EEEE 1 {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); //MOVE IT MOVE IT MOOOOVE IIIIT~
		}
		"####" F 0 {
			A_FaceTarget();
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_SpawnItemEx("LonghornCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Longhorn/Fire",4,0.4);
			A_PlaySound("Longhorn/Alt",5,0.4);
			A_PlaySound("Longhorn/Add",6,0.4);
			A_CustomBulletAttack(0.5,0.25,5,9*random(1,3),"InvisPuff");
			A_CustomBulletAttack(0.5,0.25,1,9*random(1,3),"HuegPuff");
			Return A_Jump(128,2);
		}
		"####" F 8 Bright;
		Goto See;
		"####" FFFFFFFF 1 Bright {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		Goto See;
		
	Shotgun: 
		"####" E 0 A_JumpIf(CountInv("DraughShotgunCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("Strucker",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 0 A_JumpIfTargetInLOS(1,0,0,256);
		Goto Missile;
	ShotgunReFire:
		"####" E 0 A_Jump(128,3);
		"####" E 4 A_FaceTarget();
		"####" E 0 A_Jump(256,5);
		"####" EEEE 1 {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		"####" E 0 {
			A_SpawnItemEx("ShotgunCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Strucker/Fire",4,0.6);
			A_PlaySound("Strucker/Add",5,0.4);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_CustomBulletAttack(5.0,2.0,12,6*random(1,3),"DraughPuff");
			Return A_Jump(128,2);
		}
		"####" F 13 Bright;
		Goto See;
		"####" FFFFFFFFFFFFF 1 Bright {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		"####" A 0 A_MonsterReFire(48,"See");
		Goto ShotgunRefire;
	
	Chaingun:
		"####" E 0 A_JumpIf(CountInv("DraughChaingunCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("Pulverizer",AAPTR_MASTER),1);
		Goto Missile;
		"####" E 0 {
			A_SpawnItemEx("ChaingunCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			User_AttackLoop = 105;
		}
		"####" EEEE 1 {
			A_FaceTarget();
			A_Chase(null,null);
		}
		"####" E 0 {
			A_PlaySound("Pulverizer/Fire",5,0.8,1);
			A_PlaySound("Pulverizer/Add",6,0.6,1);
		}
	ChaingunLoop:
		"####" F 1 Bright {
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_FaceTarget();
			A_CustomBulletAttack(4.0,1.75,1,4*random(1,3),"DraughPuff");
			A_Chase(null,null);
			A_SpawnItemEx("BuellerCasing",0,0,User_AttackHeight,frandom(4.0,-4.0),0,frandom(8.0,1.0),frandom(0.0,360.0),SXF_CLIENTSIDE);
			User_AttackLoop--;
		}
		"####" E 0 A_JumpIf(User_AttackLoop > 0 && IsPointerEqual(AAPTR_TARGET, AAPTR_NULL) == False, "ChaingunLoop");
		"####" E 0 A_PlaySound("Pulverizer/Down",5,0.9);
		
		"####" E 0 A_StopSound(6);
		Goto See;
	
	Ironblast:
		"####" E 0 A_JumpIf(CountInv("DraughIronblastCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("Ironblast",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 0 A_JumpIfTargetInLOS(1,0,0,256);
		Goto Missile;
		"####" E 0 A_Jump(128,3);
		"####" E 4 A_FaceTarget();
		"####" E 0 A_Jump(256,5);
		"####" EEEE 1 {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		"####" E 0 {
			A_SpawnItemEx("IronblastCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Ironblast/Fire",6,0.5);
			A_PlaySound("Ironblast/Add",5,0.5);
			A_ChangeVelocity(Cos(Pitch) * -22, 0, Sin(Pitch) * 22, CVF_RELATIVE);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			for(int BaconBlaster = 0; BaconBlaster < 20; BaconBlaster++) {
				A_SpawnProjectile("IronblastProjectile",User_AttackHeight,0,frandom(8.5,-8.5),CMF_OFFSETPITCH,frandom(3.0,-3.0));
			}
			Return A_Jump(128,2);
		}
		"####" F 8 Bright;
		Goto See;
		"####" FFFFFFFF 1 Bright {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		Goto See;
		
	Cannon:
		"####" E 0 A_JumpIf(CountInv("DraughCannonCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("Matriarch",AAPTR_MASTER),1);
		Goto Missile;
		"####" E 4 A_FaceTarget();
	CannonRefire:
		"####" E 0 {
			A_SpawnItemEx("CannonSequence",0,0,0,0,0,0,0,SXF_ORIGINATOR|SXF_SETTARGET);
			A_PlaySound("Matriarch/Fire",4,0.8);
			A_PlaySound("Matriarch/Add",5,0.5);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_FaceTarget();
			if(CountInv("GladiusBarrel") >= 3) { A_SpawnProjectile("MatriarchSlug4",User_AttackHeight,0,frandom(1.0,-1.0),CMF_OFFSETPITCH,frandom(1.0,-1.0)); }
			if(CountInv("GladiusBarrel") >= 2) { A_SpawnProjectile("MatriarchSlug3",User_AttackHeight,0,frandom(1.0,-1.0),CMF_OFFSETPITCH,frandom(1.0,-1.0)); }
			if(CountInv("GladiusBarrel") >= 1) { A_SpawnProjectile("MatriarchSlug2",User_AttackHeight,0,frandom(1.0,-1.0),CMF_OFFSETPITCH,frandom(1.0,-1.0)); }
			else { A_SpawnProjectile("MatriarchSlug",User_AttackHeight,0,frandom(1.0,-1.0),CMF_OFFSETPITCH,frandom(1.0,-1.0)); }
			Return A_Jump(128,2);
		}
		"####" F 8 Bright;
		Goto See;
		"####" FFFFFFFF 1 Bright {
			A_FaceTarget();
			A_ChangeVelocity(frandom(-2.0,-3.0), frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection, 0, CVF_RELATIVE);
		}
		"####" EEEE 1 {
			A_FaceTarget();
			A_ChangeVelocity(frandom(-2.0,-3.0), frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection, 0, CVF_RELATIVE);
		}
		"####" A 0 A_MonsterReFire(48,"CannonEnd");
		Goto CannonRefire;
	CannonEnd:
		"####" A 0 A_SpawnItemEx("CannonCooldown",0,0,0,0,0,0,0,SXF_ORIGINATOR|SXF_SETTARGET);
		Goto See;
		
	Augur:
		"####" E 0 A_JumpIf(CountInv("DraughAugurCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("Augur",AAPTR_MASTER),1);
		Goto Missile;
		"####" E 4 A_FaceTarget();
	AugurRefire:
		"####" E 0 {
			A_SpawnItemEx("AugurCooldown",0,0,0,0,0,0,0,SXF_ORIGINATOR|SXF_SETTARGET);
			A_PlaySound("Augur/Fire",1,0.8);
			A_PlaySound("Augur/Add",5,0.8);
			A_QuakeEx(9,4,4,35,0,128,"none",QF_SCALEDOWN|QF_WAVE,1.0,1.0,4.0);
			A_QuakeEx(9,4,4,35,0,128,"none",QF_SCALEDOWN);
			A_ChangeVelocity (Cos(Pitch) * -32, 0, Sin(Pitch) * 32, CVF_RELATIVE);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_FaceTarget();
			A_SpawnProjectile("AugurProjectile",User_AttackHeight,0,frandom(1.0,-1.0),CMF_OFFSETPITCH,frandom(1.0,-1.0));
			Return A_Jump(128,2);
		}
		"####" F 8 Bright;
		Goto See;
		"####" FFFFFFFF 1 Bright {
			A_FaceTarget();
			A_ChangeVelocity(frandom(-2.0,-3.0), frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection, 0, CVF_RELATIVE);
		}
		"####" F 0 { User_AttackLoop = 95; }
		"####" E 1 {
			User_AttackLoop--;
			A_FaceTarget();
			A_Chase(null,null);
			Return A_JumpIf(User_AttackLoop <= 0, "See");
		}
		Wait;
		
	Dreadful:
		"####" E 0 A_JumpIf(CountInv("DraughDreadfulCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("OldDreadful",AAPTR_MASTER),1);
		Goto Missile;
		"####" E 0 {
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_PlaySound("Dreadful/Fire",1,0.4);
		}
		"####" EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 1 {
			A_FaceTarget();
			A_Chase(null,null);
		}
		"####" A 0 {
			A_FaceTarget(0,0,0,0,FAF_BOTTOM);
			A_PlaySound("Dreadful/Add",5,0.5);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_QuakeEx(7, 7, 7, 25, 0, 24, "none", QF_SCALEDOWN);
			A_ChangeVelocity (Cos(Pitch) * -32, 0, Sin(Pitch) * 32, CVF_RELATIVE);
			A_SpawnItemEx("DreadfulCooldown",0,0,0,0,0,0,0,SXF_ORIGINATOR|SXF_SETTARGET);
			if(!CountInv("Tibcore",AAPTR_MASTER)) {
				A_SpawnProjectile("Dreadball",User_AttackHeight,0,0,CMF_AIMDIRECTION|CMF_OFFSETPITCH,invoker.pitch);
			} else {
				A_SpawnProjectile("CoreDreadball1",User_AttackHeight,15.000,-12.0,CMF_AIMDIRECTION|CMF_OFFSETPITCH,invoker.pitch);
				A_SpawnProjectile("CoreDreadball2",User_AttackHeight, 4.608,  6.0,CMF_AIMDIRECTION|CMF_OFFSETPITCH,invoker.pitch);
				A_SpawnProjectile("CoreDreadball3",User_AttackHeight,25.392,  6.0,CMF_AIMDIRECTION|CMF_OFFSETPITCH,invoker.pitch);
			}
		}
		"####" EEEEEEEEEEE 1 {
			A_FaceTarget();
			A_Chase(null,null);
		}
		Goto See;
	TNT:
		"####" E 0 A_JumpIf(CountInv("DraughTNTCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("TNTAmmo",AAPTR_MASTER),1);
		Goto Missile;
		"####" E 8 {
			A_FaceTarget();
			A_SpawnItemEx("TNT2Cooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("TNT/Ignition",4,0.9);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
		}
		"####" EEEEEE 1 {
			A_SpawnProjectile("IgnitionSnort",User_AttackHeight,0,frandom(2.0,-2.0),CMF_OFFSETPITCH,frandom(2.0,-2.0));
			A_SpawnProjectile("IgnitionSmoke",User_AttackHeight,0,frandom(2.0,-2.0),CMF_OFFSETPITCH,frandom(4.0,-4.0));
			A_SpawnProjectile("IgnitionSmoke",User_AttackHeight,0,frandom(2.0,-2.0),CMF_OFFSETPITCH,frandom(4.0,-4.0));
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(3.0,4.0) * User_StrafeMul * User_TurnDirection,0,CVF_RELATIVE);
		}
		"####" E 0 A_PlaySound("TNT/Burn",5,0.7,1);
		"####" EEEEEEEEEEEEEEEEEEEEEEEEEEEEE 1 {
			//bFrightened = 1;
			//A_Chase(null,null);
			A_FaceTarget();
		}
		"####" E 0 {
			if(random(0,256) >= 164) { A_PlaySound("Guncaster/Kick",6,0.6); }
			A_FaceTarget(0,0,0,0,FAF_MIDDLE);
			A_PlaySound("TNT/Toss",5,0.9);
			//bFrightened = 0;
		}
		"####" E 0 {
			If(CountInv("PowerBerserkDamage",AAPTR_MASTER) || CountInv("PowerSuitToken",AAPTR_MASTER))
			{
				//Could make him use the toss power instead, but it'd make them frighteningly short-fused.
				A_SpawnProjectile("DynamiteProjectile",User_AttackHeight,0,0,CMF_OFFSETPITCH,0.0); //DynamiteProjectile2
			}
			Else
			{
				A_SpawnProjectile("DynamiteProjectile",User_AttackHeight,0,0,CMF_OFFSETPITCH,1.0); //DynamiteProjectile1
			}
		}
		Goto See;
		
	ArmCannons:
		"####" E 0 A_JumpIf(CountInv("DraughArmCannonCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("PowerSuitToken",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 0 A_Jump(128,3);
		"####" E 4 A_FaceTarget();
		"####" E 0 A_Jump(256,5);
		"####" EEEE 1 {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		"####" E 0 A_SpawnItemEx("ArmCannonCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
	ArmCannonLooplet:
		"####" E 4 {
			 User_TurnDirection = random(1,-1);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_PlaySound("Bishop/Fire",5);
		}
		"####" E 0 {
			if(!CountInv("TibCore",AAPTR_MASTER))
			{
				A_SpawnProjectile("BishArmcanProjectile",User_AttackHeight,0,frandom(3.0,-3.0),CMF_OFFSETPITCH,frandom(3.0,-3.0)); //DraughArmcanProjectile
			}
			else
			{
				A_SpawnProjectile("CoreBishArmcanProjectile",User_AttackHeight,0,frandom(3.0,-3.0),CMF_OFFSETPITCH,frandom(3.0,-3.0)); //DraughCoreArmcanProjectile
			}
		}
		"####" FFFFFFFF 1 Bright {
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE);
		}
		Goto See;
		
	Cooldown:
		"####" EEEEEEEE 1 {
			A_FaceTarget();
			A_Chase(null,null);
		}
		Goto See;
		
	Crows:
		"####" E 0 A_JumpIf(CountInv("DraughCrowsCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("CrowsTome",AAPTR_MASTER),1);
		Goto Missile;
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("CrowsCooldown",0,0,0,0,0,0,0,SXF_ORIGINATOR|SXF_SETTARGET);
			A_PlaySound("Crows/Launch",5,0.8);
			A_PlaySound("Crows/Scream",6,0.4);
			A_PlaySound("Crows/Add",4,0.7);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
		}
		"####" E 0 A_JumpIf(CountInv("PowerDeadmaker",AAPTR_MASTER),"DeadmakerBirdstravaganza");
		"####" EEEEEEEEEEEEEEE 1 {
			if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { A_SpawnProjectile("CrowLauncher",User_AttackHeight,0,frandom(3.0,-3.0),CMF_OFFSETPITCH,frandom(3.0,-3.0)); }
			else 										 { A_SpawnProjectile("CrowLauncher2",User_AttackHeight,0,frandom(3.0,-3.0),CMF_OFFSETPITCH,frandom(3.0,-3.0)); }
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection,0,CVF_RELATIVE);
		}
		Goto Cooldown;
	DeadmakerBirdstravaganza:
		"####" EEEEEEEEEEEEEEEEEEE 1 {
			for(int Birdshitstorm = 0; Birdshitstorm < 2; Birdshitstorm++) {
				A_SpawnProjectile("CrowLauncher",User_AttackHeight,0,frandom(3.0,-3.0),CMF_OFFSETPITCH,frandom(3.0,-3.0));
			}
			A_FaceTarget();
			A_ChangeVelocity(0,frandom(7.0,9.0) * User_StrafeMul * User_TurnDirection,0,CVF_RELATIVE);
		}
		Goto Cooldown;
		
	Breath:
		"####" E 0 A_JumpIf(CountInv("DraughBreathCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("BreathTome",AAPTR_MASTER),1);
		Goto Missile;
		"####" E 0 A_JumpIfTargetInLOS(1,0,0,256);
		Goto Missile;
		"####" E 0 {
			A_PlaySound("Breath/Start",6,0.8);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerTomeEffect",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER)) { User_AttackLoop = 170; }
			else 																	   { User_AttackLoop = 105; }
		}
		"####" EEEEEEEEEEEEEEEEEEE 1 {
			A_FaceTarget();
			A_Chase(null,null);
		}
		"####" E 0 A_PlaySound("Breath/Loop",5,0.7,1);
	BreathLoop:
		"####" E 1 {
			A_FaceTarget();
			A_Chase(null,null);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) { A_SpawnProjectile("SuperBreathProjectile",User_AttackHeight,0,frandom(1.0,-1.0),CMF_OFFSETPITCH,frandom(1.0,-1.0)); }
			else 										{ A_SpawnProjectile("BreathProjectile",User_AttackHeight,0,frandom(1.0,-1.0),CMF_OFFSETPITCH,frandom(1.0,-1.0)); }
			User_AttackLoop--;
		}
		"####" E 0 A_JumpIf(User_AttackLoop > 0, "BreathLoop");
		"####" E 0 {
			A_PlaySound("Breath/End",5,0.8);
			A_SpawnItemEx("BreathCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
		}
		Goto Cooldown;
		
	Kitchendorf:
		"####" E 0 A_JumpIf(CountInv("DraughKnivesCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("ThreadcutterTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 0 A_JumpIfTargetInLOS(1,0,0,256);
		Goto Missile;
		"####" E 0 A_JumpIf(CountInv("PowerDeadmaker",AAPTR_MASTER),"DeadmakerKitchenHell");
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("KnivesCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Threadcutter/Use",5,0.9);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerTomeEffect",AAPTR_MASTER)) {
				For(User_AttackLoop = 0; User_AttackLoop < 20; User_AttackLoop++)
				{
					A_SpawnProjectile("ThreadcutterKnife2",User_AttackHeight,0,frandom(7.5,-7.5),CMF_OFFSETPITCH,frandom(3.5,-3.5));
				}
				For(User_AttackLoop = 0; User_AttackLoop < 10; User_AttackLoop++)
				{
					A_SpawnProjectile("ThreadcutterCleaver2",User_AttackHeight,0,frandom(7.5,-7.5),CMF_OFFSETPITCH,frandom(3.5,-3.5));
				}
			}
			else {
				For(User_AttackLoop = 0; User_AttackLoop < 20; User_AttackLoop++)
				{
					A_SpawnProjectile("ThreadcutterKnife1",User_AttackHeight,0,frandom(7.5,-7.5),CMF_OFFSETPITCH,frandom(3.5,-3.5));
				}
				For(User_AttackLoop = 0; User_AttackLoop < 10; User_AttackLoop++)
				{
					A_SpawnProjectile("ThreadcutterCleaver1",User_AttackHeight,0,frandom(7.5,-7.5),CMF_OFFSETPITCH,frandom(3.5,-3.5));
				}
			}
			if(random(0,1) == 0) { A_ChangeVelocity(0,frandom(22.0,25.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); }
		}
		Goto Cooldown;
	DeadmakerKitchenHell:
		"####" E 0 {
			A_SpawnItemEx("KnivesCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			if(random(0,1) == 0) { A_ChangeVelocity(0,frandom(22.0,25.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); }
		}
		"####" EEEE 9 {
			A_FaceTarget();
			A_PlaySound("Threadcutter/Use",5,0.9);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			For(User_AttackLoop = 0; User_AttackLoop < 15; User_AttackLoop++)
			{
				A_SpawnProjectile("ThreadcutterKnife2",User_AttackHeight,0,frandom(7.5,-7.5),CMF_OFFSETPITCH,frandom(3.5,-3.5));
			}
			For(User_AttackLoop = 0; User_AttackLoop < 8; User_AttackLoop++)
			{
				A_SpawnProjectile("ThreadcutterCleaver2",User_AttackHeight,0,frandom(7.5,-7.5),CMF_OFFSETPITCH,frandom(3.5,-3.5));
			}
		}
		Goto Cooldown;
		
	Sheepshield:
		"####" E 0 A_JumpIf(CountInv("DraughSheepCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("SheepshieldTome",AAPTR_MASTER),1);
		Goto Missile;
		"####" E 0 {
			A_PlaySound("Breath/Start",6,0.8);
			A_PlaySound("Sheepshield/Loop",5,0.7,1);
			A_GiveInventory("SheepActive",1);
			A_SpawnItemEx("SheepCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			User_AttackLoop = 0;
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) {
				A_SpawnItemEx("SuperDeadmakerSheep1",0,0,20,0,0,0,0,SXF_SETTARGET|SXF_ORIGINATOR);
				A_SpawnItemEx("SuperDeadmakerSheep2",0,0,20,0,0,0,0,SXF_SETTARGET|SXF_ORIGINATOR);
				A_SpawnItemEx("SuperDeadmakerSheep3",0,0,20,0,0,0,0,SXF_SETTARGET|SXF_ORIGINATOR);
				A_SpawnItemEx("SuperDeadmakerSheep4",0,0,20,0,0,0,0,SXF_SETTARGET|SXF_ORIGINATOR);
				A_SpawnItemEx("SuperDeadmakerSheep5",0,0,20,0,0,0,0,SXF_SETTARGET|SXF_ORIGINATOR);
				Return ResolveState("SheepTimer");
			}
			if(CountInv("PowerTomeEffect",AAPTR_MASTER)) {
				A_SpawnItemEx("SuperExplosiveSheep1",0,0,0,0,0,0,0,SXF_SETTARGET|SXF_ORIGINATOR);
				A_SpawnItemEx("SuperExplosiveSheep2",0,0,0,0,0,0,0,SXF_SETTARGET|SXF_ORIGINATOR);
				A_SpawnItemEx("SuperExplosiveSheep3",0,0,0,0,0,0,0,SXF_SETTARGET|SXF_ORIGINATOR);
				Return ResolveState("SheepTimer");
			}
			Return ResolveState(Null);
		}
	SheepStack:
		"####" E 1 {
			A_FaceTarget();
			A_Chase(null,null);
			A_SpawnItemEx("ExplosiveSheep",0,0,0,0,0,0,0,SXF_SETTARGET|SXF_ORIGINATOR);
			User_AttackLoop++;
		}
		"####" "#" 0 A_JumpIf(User_AttackLoop >= 25, 1);
		Loop;
	SheepTimer:
		"####" "#" 0 { User_AttackLoop = 140; }
	SheepMain:
		"####" E 1 {
			A_FaceTarget();
			A_Chase(null,null);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			User_AttackLoop--;
		}
		"####" E 0 A_JumpIf(User_AttackLoop <= 0, "SheepshieldStop");
		Loop;
	SheepshieldStop:
		"####" "#" 0 {
			A_PlaySound("Sheepshield/Stop",5,0.7);
			A_TakeInventory("SheepActive",1);
		}
		Goto Cooldown;
		
	Skullfire:
		"####" E 0 A_JumpIf(CountInv("DraughSkullfireCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("SkullfireTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 0 A_JumpIf(CountInv("PowerDeadmaker",AAPTR_MASTER),"DeadmakerSkullfire");
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("SkullfireCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Skullfire/Launch",5);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { A_SpawnProjectile("SkullfireTomedProjectile",User_AttackHeight,0,0,0); A_PlaySound("Skullfire/Whizz",6,0.55); }
			else 										 { A_SpawnProjectile("SkullfireProjectile",User_AttackHeight,0,0,0); }
			if(random(0,1) == 0) { A_ChangeVelocity(0,frandom(22.0,25.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); }
		}
		Goto Cooldown;
	DeadmakerSkullfire:
		"####" E 0 {
			A_PlaySound("Breath/Start",6,0.8);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerTomeEffect",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER)) { User_AttackLoop = 100; }
		}
		"####" EEEEEEEEEEEEEEEEEEE 1 {
			A_FaceTarget();
			A_Chase(null,null);
		}
		"####" E 0 A_PlaySound("Breath/Loop",5,0.7,1);
	DeadmakerSkullfireLoop:
		"####" E 1 {
			A_FaceTarget();
			A_Chase(null,null);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(User_AttackLoop & 10 == 0) { A_SpawnProjectile("DeadmakerMeteorShowerSpawner",User_AttackHeight,0); }
			User_AttackLoop--;
		}
		"####" E 0 A_JumpIf(User_AttackLoop > 0, "DeadmakerSkullfireLoop");
		"####" E 0 {
			A_PlaySound("Breath/End",5,0.8);
			A_SpawnItemEx("SkullfireCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
		}
		Goto Cooldown;
		
	Flamewave:
		"####" E 0 A_JumpIf(CountInv("DraughFlamewaveCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("FlamewaveTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("FlamewaveCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Skullfire/Launch",5);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { A_CustomBulletAttack(0,0,1,0,"FlamewallSpawner",16384); }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { A_SpawnProjectile("SuperFlamewaveSpawner",User_AttackHeight,0,0,0); A_PlaySound("Skullfire/Whizz",6,0.55); }
			else 										 	  { A_SpawnProjectile("FlamewaveSpawner",User_AttackHeight,0,0,0); }
			if(random(0,1) == 0) { A_ChangeVelocity(0,frandom(22.0,25.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); }
		}
		Goto Cooldown;
		
	Skypunch:
		"####" E 0 A_JumpIf(CountInv("DraughSkypunchCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("SkypunchTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("SkypunchCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Skypunch/Layer",6,0.9);
			A_PlaySound("Skypunch/Blast",5,1.0);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerTomeEffect",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER))
															  { A_SpawnProjectile("SkypunchLauncher2",User_AttackHeight,0,0,0); }
			else 										 	  { A_SpawnProjectile("SkypunchWave",User_AttackHeight,0,0,0); }
			if(random(0,1) == 0) { A_ChangeVelocity(0,frandom(22.0,25.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); }
		}
		Goto Cooldown;
		
	Frostbite:
		"####" E 0 A_JumpIf(CountInv("DraughFrostbiteCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("FrostbiteTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("FrostbiteCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Frostbite/Launch",5);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER))  	  { A_SpawnProjectile("FrozenOrbDoubler",User_AttackHeight,0,0,0); }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { A_SpawnProjectile("FrozenOrbProjectile",User_AttackHeight,0,0,0); }
			else 											  { A_SpawnProjectile("FrostbiteProjectile",User_AttackHeight,0,0,0); }
			if(random(0,1) == 0) { A_ChangeVelocity(0,frandom(22.0,25.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); }
		}
		Goto See;
		
	Spiritcannon:
		"####" E 0 A_JumpIf(CountInv("DraughSpiritcannonCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("SpiritcannonTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("SpiritcannonCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Spiritcannon/Use",0);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			If(CountInv("PowerDeadmaker",AAPTR_MASTER))
			{
				//A_SpawnItemEx("SpiritCannonXLSpawner",0,0,height*0.6,cos(pitch)*300,0,-sin(pitch)*300,0,SXF_TRANSFERTRANSLATION|SXF_TRANSFERPOINTERS);
				Actor SpawnedCannon = A_SpawnProjectile("SpiritCannonXLSpawner",User_AttackHeight,0,0,0);
				if(multiplayer && SpawnedCannon) SpawnedCannon.Translation = self.Translation;

			}
			Else If(!CountInv("PowerTomeEffect",AAPTR_MASTER))
			{
				//A_SpawnItemEx("SpiritCannonSpawner",0,0,height*0.6,cos(pitch)*300,0,-sin(pitch)*300,0,SXF_TRANSFERTRANSLATION|SXF_TRANSFERPOINTERS);
				Actor SpawnedCannon = A_SpawnProjectile("SpiritCannonSpawner",User_AttackHeight,0,0,0);
				if(multiplayer && SpawnedCannon) SpawnedCannon.Translation = self.Translation;

			}
			Else
			{
				//A_SpawnItemEx("FloaterCannonSpawner",0,0,height*0.6,cos(pitch)*300,0,-sin(pitch)*300,0,SXF_TRANSFERTRANSLATION|SXF_TRANSFERPOINTERS);
				Actor SpawnedCannon = A_SpawnProjectile("FloaterCannonSpawner",User_AttackHeight,0,0,0);
				if(multiplayer && SpawnedCannon) SpawnedCannon.Translation = self.Translation;

			}
			if(random(0,1) == 0) { A_ChangeVelocity(0,frandom(22.0,25.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); }
		}
		Goto Cooldown;
		
	Corpse:
		"####" E 0 A_JumpIf(CountInv("DraughCorpseCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("CorpseTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("CorpseCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Corpseblast/Use",5,0.9);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerTomeEffect",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER)) { A_SpawnProjectile("CorpseblastProjectile2",User_AttackHeight,0,0,0); }
			else 										 							   { A_SpawnProjectile("CorpseblastProjectile",User_AttackHeight,0,0,0); }
			if(random(0,1) == 0) { A_ChangeVelocity(0,frandom(22.0,25.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); }
		}
		Goto Cooldown;
		
	Chillgrasp:
		"####" E 0 A_JumpIf(CountInv("DraughChillgraspCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("ChillgraspTome",AAPTR_MASTER) && A_JumpIfTargetInLOS("Null",0,0,350), 1);
		Goto Missile;
		"####" E 4 {
			User_AttackLoop = 105;
			A_PlaySound("Chillgrasp/Loop",5,1.0,1);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_FaceTarget();
			if(!A_IsHolding()) { A_StartGrasp(AAPTR_TARGET); }
		}
	ChillgraspLoop:
		"####" E 1 Bright;
		"####" E 0 { if(A_IsHoldingSomethingAlive() && User_AttackLoop) { Return ResolveState("ChillgraspLoop"); User_AttackLoop--; } Return ResolveState(Null); }
		"####" E 0 {
			A_EndGrasp();
			A_SpawnItemEx("ChillgraspCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Chillgrasp/End",5);
		}
		Goto Cooldown;
		
	Meteorfist:
		"####" E 0 A_JumpIf(CountInv("DraughMeteorfistCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("MeteorfistTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 0 {
			if(random(1,3) == 1) { A_PlaySound("Guncaster/Kick",2); }
			A_PlaySound("Stomp/Use",6,1);
			A_PlaySound("SuperSheep/Whoosh",5,0.7,1);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
		}
	MeteorfistLoop:
		"####" E 1;
		"####" E 0 {
			if(target) {
				A_FaceTarget(0,0,0,0,FAF_MIDDLE);
				A_ChangeVelocity(Cos(Pitch) * 90, 0, Sin(Pitch) * -90, CVF_RELATIVE|CVF_REPLACE);
				A_FaceTarget(0,0,0,0,FAF_MIDDLE);
				A_SpawnItemEx("DraughAfterimageDark",0,0,0,0,0,0,0,SXF_TRANSFERSPRITEFRAME|SXF_TRANSFERSCALE|SXF_TRANSFERTRANSLATION|SXF_CLIENTSIDE);
				if(A_JumpIfTargetInLOS("Null",0,0,96)) { Return ResolveState("MeteorfistImpact"); }
				Return ResolveState("MeteorfistLoop");
			}
			Return ResolveState(Null);
		}
		Goto MeteorfistEnd;
	MeteorfistImpact:
		"####" E 4 {
			if(CountInv("PowerTomeEffect",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER)) { A_SpawnItemEx("SuperMeteorfistImpact",0,0,0,0,0,0,0,SXF_SETTARGET); }
			else 																					{ A_SpawnItemEx("MeteorfistImpact",0,0,0,0,0,0,0,SXF_SETTARGET); }
		}
		Goto MeteorfistEnd;
	MeteorfistEnd:
		"####" E 0 {
			A_StopSound(5);
			A_SpawnItemEx("MeteorfistCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
		}
		Goto Cooldown;
		
	Gumpop:
		"####" E 0 A_JumpIf(CountInv("DraughGumpopCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("GumpopTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("GumpopCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Gumpop/Cast",5,0.6);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { A_CustomBulletAttack(0,0,1,0,"GumpopSpreaderSpawner",16384); }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { A_SpawnProjectile("GumpopProjectile2",User_AttackHeight,0,0,0); }
			else 										 	  { A_SpawnProjectile("GumpopProjectile",User_AttackHeight,0,0,0); }
			if(random(0,1) == 0) { A_ChangeVelocity(0,frandom(22.0,25.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); }
		}
		"####" EEEE 1 {
			A_FaceTarget();
			A_Chase(null,null);
		}
		Goto See;
		
	Thunderstruck:
		"####" E 0 A_JumpIf(CountInv("DraughThunderCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("ThunderTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("ThunderCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Thunderstruck/Use",5,0.9);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { A_CustomBulletAttack(0,0,1,1000,"DeadmakerThunderSpawner",16384); }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { A_SpawnProjectile("TomedThunderSpawner",User_AttackHeight,0,0,0); }
			else 										 	  { A_SpawnProjectile("ThunderSpawner",User_AttackHeight,0,0,0); }
			if(random(0,1) == 0) { A_ChangeVelocity(0,frandom(22.0,25.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); }
		}
		Goto Cooldown;
		
	Apocalypse:
		"####" E 0 A_JumpIf(CountInv("DraughApocalypseCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("ApocalypseTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 0 A_JumpIfTargetInLOS(1,0,0,256);
		Goto Missile;
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("ApocalypseCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Apocalypse/Use",5,0.9);
			A_PlaySound("Apocalypse/Aftermath",6,0.9);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER))  { for(int Blastmaster = 0; Blastmaster < 3; Blastmaster++) { A_SpawnProjectile("ApocalypseMinor",User_AttackHeight,0,0,0); } }
			if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { A_SpawnProjectile("ApocalypseMajor",User_AttackHeight,0,0,0); }
			else 										 { A_SpawnProjectile("ApocalypseMinor",User_AttackHeight,0,0,0); }
			A_SpawnProjectile("CorpseEffect",0,0,CMF_OFFSETPITCH,0);
			A_QuakeEx(1,1,2,35,0,128,"none",QF_SCALEDOWN);
		}
		Goto Cooldown;
		
	Annihilation:
		"####" E 0 A_JumpIf(CountInv("DraughAnnihilationCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("AnnihilationTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("AnnihilationCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Annihilation/Use",5,0.8);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerTomeEffect",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER)) { A_SpawnProjectile("TomedAnnihilationShot",User_AttackHeight,0,0,0); }
			else 										 							   				{ A_SpawnProjectile("AnnihilationShot",User_AttackHeight,0,0,0); }
			if(random(0,1) == 0) { A_ChangeVelocity(0,frandom(22.0,25.0) * User_StrafeMul * User_TurnDirection,0, CVF_RELATIVE); }
		}
		Goto Cooldown;
		
	Dragonshout:
		"####" E 0 A_JumpIf(CountInv("DraughDragonshoutCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("DragonshoutTome",AAPTR_MASTER) && !CountInv("HexenCounter",AAPTR_MASTER), 1); //You do not want to enter terminal velocity in hexen by being pushed around with that thing, trust me.
		Goto Missile;
		"####" E 0 A_PlaySound("Dragonshout/Use",7,0.9);
		"####" E 0 A_AlertMonsters(0,AMF_TARGETEMITTER);
		"####" EEEEEEEEEEEEEEEEEEEEE 1 {
			A_FaceTarget();
			A_Chase(null,null);
		}
		"####" E 0 {
			A_SpawnItemEx("DragonshoutCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_SpawnProjectile("Dragonshout",User_AttackHeight,0,0,CMF_OFFSETPITCH,0);
		}
		Goto Cooldown;
		
	Darkpath:
		"####" E 0 A_JumpIf(CountInv("DraughDarkpathCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("DarkpathTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 4 A_SpawnItemEx("DarkpathIn",0,0,0,0,0,0,0,SXF_SETTARGET);
		"####" E 4 {
			A_Warp(AAPTR_TARGET,-32.0,0,0,0,WARPF_NOCHECKPOSITION);
			A_FaceTarget();
			A_SpawnItemEx("DarkpathCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Darkpath/Use",5,0.9);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerTomeEffect",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER)) {
				A_CustomRailgun(0,0,"","purple",RGF_SILENT,1,0.0,"DarkpathPuffRail",0,0,0,0,24.0,0,"DarkpathRail");
				A_SpawnProjectile("DarkpathSlash3",User_AttackHeight,0,0,CMF_OFFSETPITCH,0);
				A_SpawnProjectile("DarkpathSlash3",User_AttackHeight,0,60,CMF_OFFSETPITCH,0);
				A_SpawnProjectile("DarkpathSlash3",User_AttackHeight,0,120,CMF_OFFSETPITCH,0);
				A_SpawnProjectile("DarkpathSlash3",User_AttackHeight,0,180,CMF_OFFSETPITCH,0);
				A_SpawnProjectile("DarkpathSlash3",User_AttackHeight,0,240,CMF_OFFSETPITCH,0);
				A_SpawnProjectile("DarkpathSlash3",User_AttackHeight,0,300,CMF_OFFSETPITCH,0);
			} else {
				A_SpawnProjectile("DarkpathSlash",User_AttackHeight,0,0,CMF_OFFSETPITCH,0);
				A_SpawnProjectile("DarkpathSlash2",User_AttackHeight,0,0,CMF_OFFSETPITCH,0);
			}
			A_SpawnItemEx("DarkpathOut",0,0,0,0,0,0,0,SXF_SETTARGET);
		}
		Goto Cooldown;
		
	Hammersmite:
		"####" E 0 A_JumpIf(CountInv("DraughHammersmiteCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("HammersmiteTome",AAPTR_MASTER), 1);
		Goto Missile;
		"####" E 0 A_JumpIfTargetInLOS(1,0,0,256);
		Goto Missile;
		"####" E 4 {
			A_FaceTarget();
			A_SpawnItemEx("HammersmiteCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Hammersmite/Use",5,0.9);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) { A_SpawnProjectile("HammersmiteProjectileDeadmaker",User_AttackHeight,0,0,CMF_OFFSETPITCH,10); }
			else 										{ A_SpawnProjectile("HammersmiteProjectile",User_AttackHeight,0,0,CMF_OFFSETPITCH,10); }
		}
		Goto Cooldown;
		
	Prism:
		"####" E 0 A_JumpIf(CountInv("DraughPrismCooldown"), "Missile");
		"####" E 0 A_JumpIf(CountInv("PrismTome",AAPTR_MASTER),1);
		Goto Missile;
		"####" "#" 0 {
			A_PlaySound("Prism/Start",4,0.8);
			A_QuakeEx(1,1,1,9,0,128,"none",QF_SCALEUP);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			A_FaceTracer();
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) {
				if(!Invoker.Left_Prism) {
					Invoker.Left_Prism = new("Gc_Prism");
				}
				if(!Invoker.Right_Prism) {
					Invoker.Right_Prism = new("Gc_Prism");
				}
			} else {
				if(!Invoker.Prism) {
					Invoker.Prism = new("Gc_Prism");
				}
			}
			/*A_GiveInventory("PrismRadius",70);
			A_GiveInventory("PrismSpin",360);*/
			A_SpawnItemEx("PrismLightBlue",192,0,0,0,0,0,0,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_NOCHECKPOSITION|SXF_ORIGINATOR);
			A_SpawnItemEx("PrismLightCyan",192,0,0,0,0,0,45,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_NOCHECKPOSITION|SXF_ORIGINATOR);
			A_SpawnItemEx("PrismLightGreen",192,0,0,0,0,0,90,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_NOCHECKPOSITION|SXF_ORIGINATOR);
			A_SpawnItemEx("PrismLightLime",192,0,0,0,0,0,135,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_NOCHECKPOSITION|SXF_ORIGINATOR);
			A_SpawnItemEx("PrismLightYellow",192,0,0,0,0,0,180,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_NOCHECKPOSITION|SXF_ORIGINATOR);
			A_SpawnItemEx("PrismLightOrange",192,0,0,0,0,0,225,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_NOCHECKPOSITION|SXF_ORIGINATOR);
			A_SpawnItemEx("PrismLightRed",192,0,0,0,0,0,270,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_NOCHECKPOSITION|SXF_ORIGINATOR);
			A_SpawnItemEx("PrismLightPurple",192,0,0,0,0,0,315,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_NOCHECKPOSITION|SXF_ORIGINATOR);
			User_AttackLoop = 175;
		}
		"####" EEEEEEEEE 1 {
			A_FaceTarget();
			A_Chase(null,null);
		}
		"####" "#" 0 {
			A_PlaySound("Prism/Loop",5,1.0,1);
			if(random(1,100) <= GetCvar("GC_PrismRave")) { A_PlaySound("Prism/RaveParty",6,1.0,1); }
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) {
			Invoker.Left_Prism.Start(
				self,
				count:		8,
				start_rad:	1,
				end_rad:	0,
				start_w:	50,
				end_w:		8,
				start_s:	0,
				end_s:		12.5,
				offset_h: -25,
				attackzoffset: 56
				);
			Invoker.Right_Prism.Start(
				self,
				count:		8,
				start_rad:	1,
				end_rad:	0,
				start_w:	50,
				end_w:		8,
				start_s:	0,
				end_s:		12.5,
				offset_h: 25,
				attackzoffset: 56
				);
			} else {
			Invoker.Prism.Start(
				self,
				count:		8,
				start_rad:	1,	// Start opening size (sine of angle) / final
				end_rad:	0,	// (1 means 45°, higher will go towards 90°)
				start_w:	50,	// Disc radius when appearing / final
				end_w:		8,
				start_s:	0,	// Scale when appearing / final
				end_s:		12.5,
				offset_h: -25,
				attackzoffset: 6
				);
			}
		}
	PrismLoop:
		"####" E 1 {
			A_FaceTarget();
			A_Chase(null,null);
			A_AlertMonsters(0,AMF_TARGETEMITTER);
			User_AttackLoop--;
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) {
			Invoker.Left_Prism.Tick(
				self,
				rot_speed: 10,
				closing_f: 0.07,
				scaling_f: 0.15);
			Invoker.Right_Prism.Tick(
				self,
				rot_speed: -10,
				closing_f: 0.07,
				scaling_f: 0.15);
			} else {
			Invoker.Prism.Tick(
				self,
				rot_speed: 10,		// Spin speed in degrees per tic
				closing_f: 0.07,	// Higher means faster closing rate
				scaling_f: 0.15);	// Higher means reaches max width faster
			}
		}
		/*"####" "#" 0 A_GiveInventory("PrismPower",1); //Increases power consumption.
	  	"####" "#" 0 A_JumpIf(CountInv("PrismRadius") < 2,2); // Make sure we wind up with one in the end.
	  	"####" "#" 0 A_TakeInventory("PrismRadius",1); // Skipped when only one is left.
	  	"####" "#" 0 A_TakeInventory("PrismSpin",10); // Go ten degrees at a time.
	  	"####" "#" 0 A_JumpIfInventory("PrismSpin",1,2); // Make sure we loop over the spin amounts.
	  	"####" "#" 0 A_GiveInventory("PrismSpin",360);*/
		/*"####" "#" 0 {
			A_CustomRailgun(CountInv("PrismPower") * 0.2, 0, "", "FF0000", RGF_SILENT | RGF_EXPLICITANGLE | RGF_FULLBRIGHT, 0, 0, "PrismImpactBlue",
				atan(sin(CountInv("PrismSpin") + 0.0) * CountInv("PrismRadius") / 70),
				atan(cos(CountInv("PrismSpin") + 0.0) * CountInv("PrismRadius") / 70), 0, 2, 48.0,
				0,"PrismBeamBlue",-5);
			A_CustomRailgun(CountInv("PrismPower") * 0.2, 0, "", "FF8000", RGF_SILENT | RGF_EXPLICITANGLE | RGF_FULLBRIGHT, 0, 0, "PrismImpactCyan",
				atan(sin(CountInv("PrismSpin") + 45.0) * CountInv("PrismRadius") / 70),
				atan(cos(CountInv("PrismSpin") + 45.0) * CountInv("PrismRadius") / 70), 0, 2, 48.0, //7.0 + (CountInv("PrismRadius") * 0.75)
				0,"PrismBeamCyan",-5);
			A_CustomRailgun(CountInv("PrismPower") * 0.2, 0, "", "FFFF00", RGF_SILENT | RGF_EXPLICITANGLE | RGF_FULLBRIGHT, 0, 0, "PrismImpactGreen",
				atan(sin(CountInv("PrismSpin") + 90.0) * CountInv("PrismRadius") / 70),
				atan(cos(CountInv("PrismSpin") + 90.0) * CountInv("PrismRadius") / 70), 0, 2, 48.0,
				0,"PrismBeamGreen",-5);
			A_CustomRailgun(CountInv("PrismPower") * 0.2, 0, "", "00FF00", RGF_SILENT | RGF_EXPLICITANGLE | RGF_FULLBRIGHT, 0, 0, "PrismImpactLime",
				atan(sin(CountInv("PrismSpin") + 135.0) * CountInv("PrismRadius") / 70),
				atan(cos(CountInv("PrismSpin") + 135.0) * CountInv("PrismRadius") / 70), 0, 2, 48.0,
				0,"PrismBeamLime",-5);
			A_CustomRailgun(CountInv("PrismPower") * 0.2, 0, "", "00FFFF", RGF_SILENT | RGF_EXPLICITANGLE | RGF_FULLBRIGHT, 0, 0, "PrismImpactYellow",
				atan(sin(CountInv("PrismSpin") + 180.0) * CountInv("PrismRadius") / 70),
				atan(cos(CountInv("PrismSpin") + 180.0) * CountInv("PrismRadius") / 70), 0, 2, 48.0,
				0,"PrismBeamYellow",-5);
			A_CustomRailgun(CountInv("PrismPower") * 0.2, 0, "", "0000FF", RGF_SILENT | RGF_EXPLICITANGLE | RGF_FULLBRIGHT, 0, 0, "PrismImpactOrange",
				atan(sin(CountInv("PrismSpin") + 225.0) * CountInv("PrismRadius") / 70),
				atan(cos(CountInv("PrismSpin") + 225.0) * CountInv("PrismRadius") / 70), 0, 2, 48.0,
				0,"PrismBeamOrange",-5);
			A_CustomRailgun(CountInv("PrismPower") * 0.2, 0, "", "8000FF", RGF_SILENT | RGF_EXPLICITANGLE | RGF_FULLBRIGHT, 0, 0, "PrismImpactRed",
				atan(sin(CountInv("PrismSpin") + 270.0) * CountInv("PrismRadius") / 70),
				atan(cos(CountInv("PrismSpin") + 270.0) * CountInv("PrismRadius") / 70), 0, 2, 48.0,
				0,"PrismBeamRed",-5);
			A_CustomRailgun(CountInv("PrismPower") * 0.2, 0, "", "FF00FF", RGF_SILENT | RGF_EXPLICITANGLE | RGF_FULLBRIGHT, 0, 0, "PrismImpactPurple",
				atan(sin(CountInv("PrismSpin") + 315.0) * CountInv("PrismRadius") / 70),
				atan(cos(CountInv("PrismSpin") + 315.0) * CountInv("PrismRadius") / 70), 0, 2, 48.0,
				0,"PrismBeamPurple",-5);
		}
		"####" "#" 0 A_SpawnProjectile("PrismProjectileBlue",0,0, atan(sin(CountInv("PrismSpin") + 0.0) * CountInv("PrismRadius") / 70), CMF_TRACKOWNER|CMF_OFFSETPITCH, atan(cos(CountInv("PrismSpin") + 0.0) * CountInv("PrismRadius") / 70))
		"####" "#" 0 A_SpawnProjectile("PrismProjectileCyan",0,0, atan(sin(CountInv("PrismSpin") + 45.0) * CountInv("PrismRadius") / 70), CMF_TRACKOWNER|CMF_OFFSETPITCH, atan(cos(CountInv("PrismSpin") + 45.0) * CountInv("PrismRadius") / 70))
		"####" "#" 0 A_SpawnProjectile("PrismProjectileLime",0,0, atan(sin(CountInv("PrismSpin") + 90.0) * CountInv("PrismRadius") / 70), CMF_TRACKOWNER|CMF_OFFSETPITCH, atan(cos(CountInv("PrismSpin") + 90.0) * CountInv("PrismRadius") / 70))
		"####" "#" 0 A_SpawnProjectile("PrismProjectileLime",0,0, atan(sin(CountInv("PrismSpin") + 135.0) * CountInv("PrismRadius") / 70), CMF_TRACKOWNER|CMF_OFFSETPITCH, atan(cos(CountInv("PrismSpin") + 135.0) * CountInv("PrismRadius") / 70))
		"####" "#" 0 A_SpawnProjectile("PrismProjectileYellow",0,0, atan(sin(CountInv("PrismSpin") + 180.0) * CountInv("PrismRadius") / 70), CMF_TRACKOWNER|CMF_OFFSETPITCH, atan(cos(CountInv("PrismSpin") + 180.0) * CountInv("PrismRadius") / 70))
		"####" "#" 0 A_SpawnProjectile("PrismProjectileOrange",0,0, atan(sin(CountInv("PrismSpin") + 225.0) * CountInv("PrismRadius") / 70), CMF_TRACKOWNER|CMF_OFFSETPITCH, atan(cos(CountInv("PrismSpin") + 225.0) * CountInv("PrismRadius") / 70))
		"####" "#" 0 A_SpawnProjectile("PrismProjectileRed",0,0, atan(sin(CountInv("PrismSpin") + 270.0) * CountInv("PrismRadius") / 70), CMF_TRACKOWNER|CMF_OFFSETPITCH, atan(cos(CountInv("PrismSpin") + 270.0) * CountInv("PrismRadius") / 70))
		"####" "#" 0 A_SpawnProjectile("PrismProjectilePurple",0,0, atan(sin(CountInv("PrismSpin") + 315.0) * CountInv("PrismRadius") / 70), CMF_TRACKOWNER|CMF_OFFSETPITCH, atan(cos(CountInv("PrismSpin") + 315.0) * CountInv("PrismRadius") / 70))*/
		"####" E 0 A_JumpIf(User_AttackLoop > 0, "PrismLoop");
		"####" E 0 {
			A_SpawnItemEx("PrismCooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
			A_PlaySound("Prism/End",5);
			A_StopSound(6);
			if(Invoker.Left_Prism) { Invoker.Left_Prism.End(); }
			if(Invoker.Right_Prism) { Invoker.Right_Prism.End(); }
			if(Invoker.Prism) { Invoker.Prism.End(); }
			/*A_TakeInventory("PrismRadius",999);
			A_TakeInventory("PrismSpin",999);*/
		}
		Goto Cooldown;
		
	//Stomp attack.
	Stomp:
		"####" A 0 A_JumpIf(CountInv("DraughStompCooldown"), "See");
		"####" A 0 A_SpawnItemEx("StompSounder",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
		"####" A 0 A_SpawnItemEx("Stomp2Cooldown",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_SETTARGET);
		"####" A 0 A_SpawnItemEx("IronblastRelease",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
		//So it won't take him forever to fall down onto target in case of obscenely tall rooms.
		"####" A 0 {
			if(CeilingZ > 384.0)
			{
				A_Warp(AAPTR_TARGET,0,0,320.0,0,WARPF_NOCHECKPOSITION);
			}
			Else
			{
				A_Warp(AAPTR_TARGET,0,0,CeilingZ,0,WARPF_NOCHECKPOSITION);
			}
		}
		"####" A 2 {
			A_PlaySound("Stomp/Use",5);
			User_StompCooldown = 105;
			A_ChangeVelocity(0,0,-50.0,CVF_RELATIVE|CVF_REPLACE);
		}
	StompLoop:
		"####" A 0 A_ChangeVelocity(0,0,-2.0, CVF_RELATIVE);
		"####" A 0 A_SetAngle(Angle - 45.0);
		"####" A 0 {
			If(CountInv("PowerMidasMode",AAPTR_MASTER))
			{
				A_SpawnItemEx("DraughMidasAfterimage",0,0,0,0,0,0,0,SXF_TRANSFERSPRITEFRAME|SXF_TRANSFERTRANSLATION|SXF_TRANSFERSCALE|SXF_CLIENTSIDE);
			}
			Else If(CountInv("PowerBerserkDamage",AAPTR_MASTER))
			{
				A_SpawnItemEx("DraughBerserkAfterimage",0,0,0,0,0,0,0,SXF_TRANSFERSPRITEFRAME|SXF_TRANSFERTRANSLATION|SXF_TRANSFERSCALE|SXF_CLIENTSIDE);
			}
			Else
			{
				A_SpawnItemEx("DraughAfterimageDark",0,0,0,0,0,0,0,SXF_TRANSFERSPRITEFRAME|SXF_TRANSFERTRANSLATION|SXF_TRANSFERSCALE|SXF_CLIENTSIDE);
			}
		}
		"####" AA 1 A_JumpIf(Vel.Z == 0, "Impact"); //VelZ == 0 && Z <= FloorZ
		Loop;
	Impact:
		"####" A 0 { If(CountInv("HeavyDutyStompers",AAPTR_MASTER)) { A_SpawnItemEx("DraughImpalerSpawner",0,0,0,0,0,0,0,SXF_SETTARGET|SXF_TRANSFERPOINTERS); } }
		"####" A 0 A_JumpIf(CountInv("PowerSuitToken",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER), "SuitStomp");
		"####" A 0 A_JumpIf(CountInv("PowerBerserkDamage",AAPTR_MASTER), "BerserkStomp");
		"####" A 0 A_JumpIf(CountInv("PowerMidasMode",AAPTR_MASTER), "MidasStomp");
	Regular:
		"####" A 0 {
			A_SpawnItemEx("StompityStomp",0,0,-30,0,0,0,0,SXF_SETTARGET);
			A_ChangeVelocity(0,0,15.0,CVF_REPLACE);
		}
		Goto See;
	MidasStomp:
		"####" A 0 {
			A_SpawnItemEx("MidasStompityStomp",0,0,-30,0,0,0,0,SXF_SETTARGET);
			A_ChangeVelocity(0,0,15.0,CVF_REPLACE);
		}
		Goto See;
	
	BerserkStomp:
		"####" A 0 A_JumpIf(CountInv("PowerMidasMode",AAPTR_MASTER), "MidasBerserkStomp");
		"####" A 0 {
			A_SpawnItemEx("BerserkStomp",0,0,-30,0,0,0,0,SXF_SETTARGET);
			A_ChangeVelocity(0,0,40,CVF_REPLACE);
		}
		Goto See;
	MidasBerserkStomp:
		"####" A 0 {
			A_SpawnItemEx("MidasBerserkStomp",0,0,-30,0,0,0,0,SXF_SETTARGET);
			A_ChangeVelocity(0,0,40,CVF_REPLACE);
		}
		Goto See;
	
	SuitStomp:
		"####" A 0 A_JumpIf(CountInv("PowerBerserkDamage",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER), "SuitBerserkStomp");
		"####" A 0 A_JumpIf(CountInv("PowerMidasMode",AAPTR_MASTER), "SuitMidasStomp");
		
		"####" A 0 {
			A_SpawnItemEx("PowerStomp",0,0,-30,0,0,0,0,SXF_SETTARGET);
			A_ChangeVelocity(0,0,25.0,CVF_REPLACE);
		}
		Goto See;
	SuitMidasStomp:
		"####" A 0 {
			A_SpawnItemEx("PowerMidasStomp",0,0,-30,0,0,0,0,SXF_SETTARGET);
			A_ChangeVelocity(0,0,25.0,CVF_REPLACE);
		}
		Goto See;
		
	SuitBerserkStomp:
		"####" A 0 A_JumpIf(CountInv("PowerMidasMode",AAPTR_MASTER), "SuitMidasBerserkStomp");
		"####" A 0 {
			A_SpawnItemEx("PowerBerserkStomp",0,0,-30,0,0,0,0,SXF_SETTARGET);
			A_ChangeVelocity(0,0,50,CVF_REPLACE);
		}
		Goto See;
	SuitMidasBerserkStomp:
		"####" A 0 {
			A_SpawnItemEx("PowerMidasBerserkStomp",0,0,-30,0,0,0,0,SXF_SETTARGET);
			A_ChangeVelocity(0,0,50,CVF_REPLACE);
		}
		Goto See;
		
	Pain:
		"####" G 2;
		"####" G 2 A_Pain();
		Goto See;
	Death:
		"####" G 0 {
			A_NoBlocking();
			A_Scream();
			A_KillChildren("Normal",KILS_KILLMISSILES,"DraughAura");
		}
		"####" G 1 A_FadeOut(0.05);
		Wait;
	}
}

//Stuff

//The aura around the Draugh.
class DraughAura : Actor
{
	Default
	{
		Projectile;
		+NOTONAUTOMAP
		+NOINTERACTION
		+NOTIMEFREEZE
		+DONTBLAST
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_PlaySound("Ironspirit/Loop",5,0.2,1);
			A_SpawnItemEx("IronblastRelease",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
			A_PlaySound("Ironspirit/Spawn",6);
		}
	Main:
		TNT1 A 1 {
			A_Warp(AAPTR_MASTER,0,0,30,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION);
			If(!GetCvar("GC_ToasterMode")) {
				If(Master && Master.CountInv("PowerDeadmaker")) {
					A_SpawnItemEx("IronEffectParticle",frandom(26.0,-26.0),frandom(26.0,-26.0),frandom(75.0,-25.0),frandom(2.0,-2.0),frandom(2.0,-2.0),frandom(2.0,-2.0),frandom(0.0,360.0),SXF_CLIENTSIDE,64);
					A_SpawnItemEx("IronEffectLightning",frandom(25.0,-25.0),frandom(25.0,-25.0),frandom(75.0,-25.0),0,0,0,0,SXF_CLIENTSIDE,64);
					for(int Duck = 0; Duck < 2; Duck++) {
						A_SpawnItemEx("IronEffectCloud",frandom(25.0,-10.0),frandom(25.0,-25.0),frandom(75.0,-25.0),frandom(1.0,-1.0),frandom(1.0,-1.0),frandom(1.0,-1.0),frandom(0.0,360.0),SXF_CLIENTSIDE);
					}
				} else {
					A_SpawnItemEx("IronEffectParticle",frandom(6.0,-6.0),frandom(6.0,-6.0),frandom(25.0,-25.0),frandom(2.0,-2.0),frandom(2.0,-2.0),frandom(2.0,-2.0),frandom(0.0,360.0),SXF_CLIENTSIDE,64);
					A_SpawnItemEx("IronEffectLightning",frandom(15.0,-15.0),frandom(15.0,-15.0),frandom(25.0,-25.0),0,0,0,0,SXF_CLIENTSIDE,64);
					for(int Duck = 0; Duck < 2; Duck++) {
						A_SpawnItemEx("IronEffectCloud",frandom(15.0,-10.0),frandom(15.0,-15.0),frandom(25.0,-25.0),frandom(1.0,-1.0),frandom(1.0,-1.0),frandom(1.0,-1.0),frandom(0.0,360.0),SXF_CLIENTSIDE);
					}
				}
			}
			
		}
		Loop;
	Death:
		TNT1 A 0 {
			A_PlaySound("Ironspirit/Release",7,0.8);
			A_SpawnItemEx("IronblastRelease",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
		}
		Stop;
	}
}

class DraughPuff : Actor
{
	Default
	{
		DamageType "Draugh";
		Species "Rrerr";
		Decal "BulletChip";
		+PUFFGETSOWNER
		+ALLOWTHRUFLAGS
		+THRUSPECIES
		+MTHRUSPECIES
		+NOBLOCKMAP
		+NOTONAUTOMAP
	}

	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			for(int Bollocks = 0; Bollocks < 2; Bollocks++)
			{
				A_SpawnItemEx("BuellerPuff_Main", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE, 0);
				A_SpawnItemEx("BuellerPuff_Flash", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE, 0);
			}
			A_SpawnItemEx("BuellerPuff_Spark1", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE, 0);
			A_SpawnItemEx("BuellerPuff_Spark2", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE, 0);
		}
		TNT1 AAA 1 A_SpawnItemEx("BuellerPuff_Smoke", 0, 0, 0, frandom(0.15,0.25), 0, frandom(-0.1,0.45), 0, SXF_CLIENTSIDE, 0);
		Stop;
	}
}


//Stomp attack.
class StompSounder : Actor
{
	Default
	{
		+NOINTERACTION
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_PlaySound("Ironspirit/Release",5,0.8);
		Stop;
	}
}

class DraughAfterimage : Actor
{
	Default
	{
		Renderstyle "Translucent";
		+NOTONAUTOMAP
		+NOINTERACTION
		+DONTBLAST
		+NOTIMEFREEZE
	}
	
	States
	{
	Spawn:
		"####" "#" 1 {
			A_FadeOut(0.1);
			A_SetScale(Scale.X + 0.1);
		}
		Loop;
	}
}

class DraughAfterimageDark : DraughAfterimage
{
	Default
	{
		Renderstyle "Stencil";
		StencilColor "Black";
	}
}

class DraughBerserkAfterimage : DraughAfterimageDark
{
	Default
	{
		StencilColor "FF 22 22";
	}
}

class DraughMidasAfterimage : DraughAfterimageDark
{
	Default
	{
		StencilColor "FF FF 22";
	}
}

class DraughImpalerSpawner : Actor
{
	Default
	{
		Radius 8;
		Height 12;
		Projectile;
		+NOINTERACTION
		+NOCLIP
	}
	
	int user_c;
	int user_a;
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(Pos.Z > FloorZ + 140.0 + (CountInv("PowerDeadmaker",AAPTR_MASTER) * 52.0), "Null");
		TNT1 A 0 {
			A_PlaySound("Stompers/Blast",5,1.0);
			user_c = 4 + CountInv("HeavyDutyStompers",AAPTR_MASTER);
			user_a = 360.0 / user_c;
		}
	Looplet:
		TNT1 A 0 {
			A_SpawnItemEx("DraughImpalerLiner",0,0,0,25,0,0,0,SXF_TRANSFERPOINTERS); //A_SpawnProjectile("ImpalerLiner",0,0,0,CMF_AIMDIRECTION|CMF_TRACKOWNER);
			user_c--;
			A_SetAngle(Angle + user_a);
			return A_JumpIf(user_c <= 0, "null");
		}
		Loop;
	}
}

class DraughImpalerLiner : Actor
{
	Default
	{
		Speed 25;
		Radius 8;
		Height 12;
		+MISSILE
		+THRUACTORS
		+FLOORHUGGER
	}
	
	int user_c;
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			user_c = CountInv("HeavyDutyStompers",AAPTR_MASTER);
		}
	Looplet:
		TNT1 A 5;
		TNT1 A 0 {
			user_c--;
			A_SpawnItemEx("ImpalerCaber",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
			//Powersuit block.
			if(CountInv("PowersuitToken",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER))
			{
				if(CountInv("PowerMidasMode",AAPTR_MASTER))
				{
					if(CountInv("PowerBerserkDamage",AAPTR_MASTER)|| CountInv("PowerDeadmaker",AAPTR_MASTER))
					{
						A_SpawnItemEx("PowerMidasBerserkStompDustless",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
						return resolvestate(null);
					}
					A_SpawnItemEx("PowerMidasStompDustless",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
					return resolvestate(null);
				}
				if(CountInv("PowerBerserkDamage",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER))
					{
					A_SpawnItemEx("PowerBerserkStompDustless",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
					return resolvestate(null);
				}
				A_SpawnItemEx("PowerStompDustless",32,0,0,0,0,0,0,AAPTR_MASTER);
				return resolvestate(null);
			}
			
			//Regular block.
			if(CountInv("PowerMidasMode",AAPTR_MASTER))
			{
				if(CountInv("PowerBerserkDamage",AAPTR_MASTER))
				{
					A_SpawnItemEx("MidasBerserkStompQuieter",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
					return resolvestate(null);
				}
				A_SpawnItemEx("MidasStompityStompQuieter",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
				return resolvestate(null);
			}
			if(CountInv("PowerBerserkDamage",AAPTR_MASTER))
			{
				A_SpawnItemEx("BerserkStompQuieter",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
				return resolvestate(null);
			}
			A_SpawnItemEx("StompityStompQuieter",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
			return resolvestate(null);
		}
		TNT1 A 0 A_JumpIf(user_c <= 0, "null");
		Loop;
	Death:
		TNT1 A 0;
		Stop;
	}
}
			
//Gunzerk faking.
class DraughZerk : PowerupGiver
{
	Default
	{
		Powerup.Duration -0x7FFFFFFF;
		Powerup.Strength 7;
		Powerup.Type "PowerGunzerking";
		+INVENTORY.AUTOACTIVATE
		//+INVENTORY.ADDITIVETIME
	}
}

//Attack cooldowns.
class DraughCooldown : Actor
{
	Default
	{
		+NOTONAUTOMAP
		+NOINTERACTION
		+DONTBLAST
		+NOTIMEFREEZE
	}
	
	int User_Counter;
}

class LonghornCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughLonghornCooldown",1,AAPTR_TARGET);
			User_Counter = 24;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughLonghornCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class ShotgunCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughShotgunCooldown",1,AAPTR_TARGET);
			User_Counter = 17;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughShotgunCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class ChaingunCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughChaingunCooldown",1,AAPTR_TARGET);
			User_Counter = 280;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughChaingunCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class IronblastCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughIronblastCooldown",1,AAPTR_TARGET);
			User_Counter = 36;
		}
	PartOne:
		TNT1 A 1 {
			A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION);
			User_Counter--;
		}
		TNT1 A 0 A_JumpIf(User_Counter > 0, "PartOne");
		TNT1 A 0 {
			User_Counter = 14;
			A_PlaySound("Ironblast/Pump/In",6,0.6);
		}
	PartTwo:
		TNT1 A 1 {
			A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION);
			User_Counter--;
		}
		TNT1 A 0 A_JumpIf(User_Counter > 0, "PartTwo");
		TNT1 A 0 {
			User_Counter = 40;
			A_PlaySound("Ironblast/Pump/Out",6,0.6);
			if(Target) {
			for(int Borger = 0; Borger < 8; Borger++) { A_SpawnItemEx("ShottyCasing",0,0,Draugh(Target).User_AttackHeight,frandom(2.0,-2.0),0,frandom(8.0,3.0),frandom(0.0,360.0),SXF_CLIENTSIDE); }
			}
		}
	PartThree:
		TNT1 A 1 {
			A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION);
			User_Counter--;
		}
		TNT1 A 0 A_JumpIf(User_Counter > 0, "PartThree");
		TNT1 A 0 A_TakeInventory("DraughIronblastCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class CannonSequence : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			User_Counter = 3;
		}
	PartOne:
		TNT1 A 1 {
			A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION);
			User_Counter--;
		}
		TNT1 A 0 A_JumpIf(User_Counter > 0, "PartOne");
		TNT1 A 0 {
			A_PlaySound("Matriarch/Reload",6,0.3);
			User_Counter = 5;
		}
	PartTwo:
		TNT1 A 1 { 
			A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION);
			User_Counter--;
		}
		TNT1 A 0 A_JumpIf(User_Counter > 0, "PartTwo");
		TNT1 A 0 {
			User_Counter = 24;
			if(Target) {
			A_SpawnItemEx("TankShellCasing",0,0,Draugh(Target).User_AttackHeight,frandom(2.0,-2.0),0,frandom(8.0,3.0),frandom(0.0,360.0),SXF_CLIENTSIDE);
			}
		}
	PartThree:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "PartThree");
		Stop;
	}
}

class CannonCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughCannonCooldown",1,AAPTR_TARGET);
			User_Counter = 210;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughCannonCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class AugurCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughAugurCooldown",1,AAPTR_TARGET);
			User_Counter = 43;
		}
	PartOne:
		TNT1 A 1 {
			A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION);
			User_Counter--;
		}
		TNT1 A 0 A_JumpIf(User_Counter > 0, "PartOne");
		TNT1 A 0 {
			A_PlaySound("Augur/BoltIn",6,0.6);
			User_Counter = 25;
		}
	PartTwo:
		TNT1 A 1 {
			if(Target && User_Counter == 13)  {
				A_SpawnItemEx("AugurCasing",0,0,Draugh(Target).User_AttackHeight,frandom(2.0,-2.0),0,frandom(8.0,3.0),frandom(0.0,360.0),SXF_CLIENTSIDE);
			}
			A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION);
			User_Counter--;
		}
		TNT1 A 0 A_JumpIf(User_Counter > 0, "PartTwo");
		TNT1 A 0 {
			A_PlaySound("Augur/BoltOut",6,0.6);
			User_Counter = 35;
		}
	PartThree:
		TNT1 A 1 {
			A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION);
			User_Counter--;
		}
		TNT1 A 0 A_JumpIf(User_Counter > 0, "PartThree");
		TNT1 A 0 A_TakeInventory("DraughAugurCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class DreadfulCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughDreadfulCooldown",1,AAPTR_TARGET);
			User_Counter = 1050;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughDreadfulCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class TNT2Cooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughTNTCooldown",1,AAPTR_TARGET);
			User_Counter = 525;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughTNTCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class ArmCannonCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughArmCannonCooldown",1,AAPTR_TARGET);
			User_Counter = 210;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughArmCannonCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class CrowsCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughCrowsCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { User_Counter = 270; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 245; }
			else 									   		  { User_Counter = 175; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughCrowsCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class BreathCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughBreathCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { User_Counter = 455; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 175; }
			else 									   		  { User_Counter = 350; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughBreathCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class KnivesCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughKnivesCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { User_Counter = 175; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 270; }
			else 									   		  { User_Counter = 140; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughKnivesCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class FirebreathCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughFirebreathCooldown",1,AAPTR_TARGET);
			//Handled in separate cooldown for... whatever reasons. I probably had a one.
			if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 140; }
			else 									   	 { User_Counter = 70; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughFirebreathCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class SkullfireCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughSkullfireCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { User_Counter = 500; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 105; }
			else 									   		  { User_Counter = 35; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughSkullfireCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class FlamewaveCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughFlamewaveCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER))		  { User_Counter = 315; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 245; }
			else 									   		  { User_Counter = 175; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughFlamewaveCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class SkypunchCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughSkypunchCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerTomeEffect",AAPTR_MASTER) || CountInv("PowerDeadmaker",AAPTR_MASTER))
															  { User_Counter = 140; }
			else 									   		  { User_Counter = 70; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughSkypunchCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class FrostbiteCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughFrostbiteCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER))		  { User_Counter = 350; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 270; }
			else 									   		  { User_Counter = 140; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughFrostbiteCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class SpiritcannonCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughSpiritcannonCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER))		  { User_Counter = 500; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 455; }
			else 									   		  { User_Counter = 350; }
			User_Counter = 350;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughSpiritcannonCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class CorpseCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughCorpseCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER) || CountInv("PowerTomeEffect",AAPTR_MASTER))
															 { User_Counter = 105; }
			else 									   		 { User_Counter = 35; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughCorpseCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class ChillgraspCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughChillgraspCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER) || CountInv("PowerTomeEffect",AAPTR_MASTER))
															 { User_Counter = 235; }
			else 									   		 { User_Counter = 175; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughChillgraspCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class MeteorfistCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughMeteorfistCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER))		  { User_Counter = 245; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 500; }
			else 									   		  { User_Counter = 315; }
			User_Counter = 315;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughMeteorfistCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class GumpopCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughGumpopCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { User_Counter = 210; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 105; }
			else 									   		  { User_Counter = 35; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughGumpopCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class ThunderCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughThunderCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER))		  { User_Counter = 350; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 210; }
			else 									   		  { User_Counter = 175; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughThunderCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class Stomp2Cooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughStompCooldown",1,AAPTR_TARGET);
			User_Counter = 210;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughStompCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class ApocalypseCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughApocalypseCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { User_Counter = 350; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 500; }
			else 									   		  { User_Counter = 350; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughApocalypseCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class DragonshoutCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughDragonshoutCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER) || CountInv("PowerTomeEffect",AAPTR_MASTER))
															 { User_Counter = 350; }
			else 									   		 { User_Counter = 455; }
			User_Counter = 455;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughDragonshoutCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class DarkpathCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughDarkpathCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER) || CountInv("PowerTomeEffect",AAPTR_MASTER))
															 { User_Counter = 170; }
			else 									   		 { User_Counter = 135; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughDragonshoutCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class HammersmiteCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughHammersmiteCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { User_Counter = 350; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 500; }
			else 									   		  { User_Counter = 350; }
			User_Counter = 280;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughHammersmiteCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class AnnihilationCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughAnnihilationCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER) || CountInv("PowerTomeEffect",AAPTR_MASTER))
															 { User_Counter = 500; }
			else 									   		 { User_Counter = 350; }
			User_Counter = 350;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughAnnihilationCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class SheepCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughSheepCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { User_Counter = 450; }
			else if(CountInv("PowerTomeEffect",AAPTR_MASTER)) { User_Counter = 350; }
			else 									   		  { User_Counter = 280; }
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughSheepCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class PrismCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughPrismCooldown",1,AAPTR_TARGET);
			if(CountInv("PowerDeadmaker",AAPTR_MASTER)) 	  { User_Counter = 425; }
			else 									   		  { User_Counter = 315; }
			User_Counter = 315;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughPrismCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

class MegabreathCooldown : DraughCooldown
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_GiveInventory("DraughMegabreathCooldown",1,AAPTR_TARGET);
			User_Counter = 700;
		}
	Main:
		TNT1 A 1 { User_Counter--; }
		TNT1 A 0 A_JumpIf(User_Counter > 0, "Main");
		TNT1 A 0 A_TakeInventory("DraughMegabreathCooldown",1,0,AAPTR_TARGET);
		Stop;
	}
}

#endregion
