actor Patriarch : Weapon
{
  Game Doom
  Weapon.AmmoUse 1
  Weapon.AmmoUse2 0
  Weapon.AmmoGive 0
  Weapon.AmmoGive2 12
  Weapon.AmmoType "PatriarchClip"
  Weapon.AmmoType2 "GrenadeAmmo"
  Weapon.SlotNumber 5
  Weapon.SelectionOrder 5
  Weapon.UpSound "Patriarch/Up"
  Weapon.Kickback 150
  Inventory.PickupSound "misc/w_pkup"
  Inventory.PickupMessage "Obtained a ''Patriarch'' type 87 grenade launcher! Bless yourself! (5)"
  Obituary "%o was shown who's %p's daddy, thanks to %k's ''Patriarch''."
  Weapon.BobStyle InverseSmooth
  Weapon.BobSpeed 1.6
  Weapon.BobRangeY 0.5
  Weapon.BobRangeX 0.9
  +AMMO_CHECKBOTH
  +NOALERT
  +NOAUTOFIRE
  +NOAUTOAIM
  States
  {
  Ready:
	PTRU ABCD 1
  ReadyMain:
    PTRG A 0 A_JumpIfInventory("MacheteGoesFast",1,"CaberToss")
    PTRG A 1 A_WeaponReady(WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Loop
  Deselect:
	PTRU DCBA 1
    TNT1 A 0 SetPlayerProperty(0, 0, PROP_INSTANTWEAPONSWITCH)
    TNT1 AAAAAAAAAAAAAAA 0 A_Lower
    TNT1 A 1 A_Lower
    Wait
  Select:
    TNT1 A 0 SetPlayerProperty(0, 1, PROP_INSTANTWEAPONSWITCH)
    TNT1 A 0 A_Raise
    TNT1 A 1 A_Raise
    Loop
  Fire:
    PTRF A 0 A_JumpIfInventory("PatriarchClip",1,1)
	Goto DryFire
	PTRF A 0 A_PlaySound("Patriarch/Fire",1,0.7)
	PTRF A 0 A_PlaySound("Patriarch/Add",5,0.7)
	PTRF A 0 A_FireCustomMissile("GunsmokeSpawner_Medium2",0,0,4,5)
    PTRF A 0 A_FireCustomMissile("PatriarchProjectile",0.01*frandom(50,-50),1,6,0,0,0.01*frandom(25,-25))
	PTRF A 0 A_AlertMonsters
	PTRF A 0 A_GunFlash
	PTRF A 0 A_Recoil(2)
    PTRF A 1 Bright A_SetPitch(pitch-2.5)
	PTRF B 1 Bright A_SetPitch(pitch-1.5)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRT A 0 A_JumpIf(Health<75,1)
	PTRT A 1 A_SetPitch(pitch-0.25)
	PTRT BC 1 A_SetPitch(pitch-0.25)
	PTRT C 0 A_FireCustomMissile("GrenadeCasingSpawner",0,0,-1,2)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRT D 1 A_JumpIf(Health<50,1)
	PTRT EF 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRG A 2 A_JumpIf(Health<25,1)
	PTRG A 0 A_ReFire
	Goto ReadyMain
  AltFire:
    PTRF A 0 A_JumpIfInventory("PatriarchClip",1,1)
	Goto DryFire
	PTRF A 0 A_PlaySound("Patriarch/Fire",1,0.7)
	PTRF A 0 A_PlaySound("Patriarch/Add",5,0.7)
	PTRF A 0 A_TakeInventory("PatriarchClip",1)
	PTRF A 0 A_FireCustomMissile("GunsmokeSpawner_Medium2",0,0,4,5)
    PTRF A 0 A_FireCustomMissile("PatriarchBounceProjectile",0.01*frandom(50,-50),0,6,0,0,0.01*frandom(25,-25))
	PTRF A 0 A_AlertMonsters
	PTRF A 0 A_GunFlash
	PTRF A 0 A_Recoil(2)
    PTRF A 1 Bright A_SetPitch(pitch-2.5)
	PTRF B 1 Bright A_SetPitch(pitch-1.5)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRT A 0 A_JumpIf(Health<75,1)
	PTRT A 1 A_SetPitch(pitch-0.25)
	PTRT BC 1 A_SetPitch(pitch-0.25)
	PTRT C 0 A_FireCustomMissile("GrenadeCasingSpawner",0,0,-1,2)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRT D 1 A_JumpIf(Health<50,1)
	PTRT EF 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRG A 2 A_JumpIf(Health<25,1)
	PTRG A 0 A_ReFire
	Goto ReadyMain
  DryFire:
	PTRD A 0 A_PlaySound("Patriarch/Dry",4,0.9)
	PTRD ABCDCBA 1
	Goto ReadyMain
  DriedToBoot:
    PCFG B 0 A_GiveInventory("DryToken",1)
	Goto ReloadMainie
  Reload:
	TNT1 A 0 A_JumpIfInventory("PatriarchClip",0,"ReadyMain")
	TNT1 A 0 A_JumpIfInventory("GrenadeAmmo",1,1)
	Goto ReadyMain
  ReloadMain:
    PCFG B 0 A_JumpIfInventory("PatriarchClip",1,1)
	Goto DriedToBoot
  ReloadMainie:
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRH A 1 A_JumpIf(Health<75,1)
	PTRH B 1
	PTRH C 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRH D 1 A_JumpIf(Health<50,1)
	PTRH E 1
	PTRH F 1
	PTRH G 2
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRO A 1 A_JumpIf(Health<25,1)
	PTRO B 1
	PTRO C 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRO D 1 A_JumpIf(Health<75,1)
	PTRO E 1 
	PTRO F 1
	PTRO G 0 A_PlaySound("Patriarch/Out",4)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRO G 1 A_JumpIf(Health<50,1)
	PTRO H 1
	PTRO I 1
	PTRO J 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRO K 1 A_JumpIf(Health<25,1)
	PTRO L 1
	PTRO M 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRO N 1 A_JumpIf(Health<75,1)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRO N 1 A_JumpIf(Health<50,1)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRO N 1 A_JumpIf(Health<25,1)
	PTRO N 5
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRI A 1 A_JumpIf(Health<75,1)
	PTRI BCD 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRI E 1 A_JumpIf(Health<50,1)
	PTRI FG 1
	PTRO G 0 A_PlaySound("Patriarch/In",4)
	PTRI H 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRI I 1 A_JumpIf(Health<25,1)
	PTRI JK 1
	PTRI Z 0 A_SpawnItemEx("PatriarchClipDrop",0,0,20)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRI Z 1 A_JumpIf(Health<75,1)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRI Z 1 A_JumpIf(Health<50,1)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRI Z 1 A_JumpIf(Health<25,1)
	PTRI Z 5
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRI L 1 A_JumpIf(Health<75,1)
	PTRI M 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRI N 1 A_JumpIf(Health<50,1)
	PTRI O 1
	PTRO P 0 A_PlaySound("Patriarch/In2",4)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRI P 1 A_JumpIf(Health<25,1)
	PTRI Q 1
	PTRI R 1
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("GrenadeAmmo",1,TIF_NOTAKEINFINITE)
	TNT1 A 0 A_GiveInventory("PatriarchClip",1)
	TNT1 A 0 A_JumpIfInventory("PatriarchClip",0,"ReloadFinish")
	TNT1 A 0 A_JumpIfInventory("GrenadeAmmo",1,"ReloadWorking")
  ReloadFinish:
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
    PTRO F 1 A_JumpIf(Health<75,1)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
    PTRO F 1 A_JumpIf(Health<50,1)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
    PTRO F 1 A_JumpIf(Health<25,1)
    PTRO F 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
    PTRO F 1 A_JumpIf(Health<75,1)
	PTRO E 1
	PTRO D 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRO C 1 A_JumpIf(Health<50,1)
	PTRO B 1
	PTRO A 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRH G 1 A_JumpIf(Health<25,1)
	PTRH F 1
	PTRH E 1
	PTRH D 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	PTRH C 1 A_JumpIf(Health<25,1)
	PTRH B 1
	PTRH A 1
	PTRG A 0 A_JumpIfInventory("DryToken",1,"Kaczink")
	Goto ReadyMain
  Kaczink:
    PTRP A 0 A_TakeInventory("DryToken",1)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	PTRP A 1 A_JumpIf(Health<75,2)
	PTRP BCD 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	PTRP E 1 A_JumpIf(Health<50,2)
	PTRP FGH 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	PTRP I 1 A_JumpIf(Health<25,2)
	PTRP J 1
	PTRP A 0 A_PlaySound("Patriarch/Pull1",5,0.9)
	PTRP KL 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	PTRP M 1 A_JumpIf(Health<75,2)
	PTRP NOP 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	PTRP Q 1 A_JumpIf(Health<50,2)
	PTRP R 1
	PTRP S 1 A_PlaySound("Patriarch/Pull2",4,0.9)
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	PTRP T 1 A_JumpIf(Health<25,2)
	PTRP U 1
	PTRG A 1
	Goto ReadyMain
  Flash:
    TNT1 A 3 A_Light1
    TNT1 A 4 A_Light2
    TNT1 A 0 A_Light0
    Stop	
  Zoom:
    PCFN A 0 A_JumpIfInventory("ZoomReFire",1,"PunchDescendants")
	PTRH ABCDEFG 1 // Thanks Pillow! These frames are helpful!
				   // Pillow: Yur welcum
	SDKU A 0 A_GiveInventory("ZoomReFire",1)
  PunchDescendants:
	QML1 A 0 A_Gunflash("PunchFlash", GFF_NOEXTCHANGE)
	QML1 A 0 A_JumpIfInventory("PowerStrength2",1,2)
    QML1 A 0 A_Jump(256,3)
  	FML1 A 0 A_SetBlend("Orange",0.05,10)
	FML1 A 0 A_PlaySound("Melee/Firepunch",0)
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<75,2)
	"####" A 1 A_SetPitch(pitch-0.3)
	"####" B 1 A_SetPitch(pitch-0.3)
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<50,2)
	"####" C 1 A_SetPitch(pitch-0.3)
	"####" D 1 A_SetPitch(pitch-0.3)
	"####" A 0 A_JumpIfInventory("PowerStrength2",1,3)
	"####" A 0 A_CustomPunch(30, 1, 0, "PunchCracker", 100)
	"####" A 0 A_Jump(256,2)
	"####" A 0 A_CustomPunch(90, 1, 0, "FlamePunchCracker", 150)
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<25,2)
	"####" E 1 A_SetPitch(pitch+0.3)
	"####" F 1 A_SetPitch(pitch+0.3)
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<75,2)
	"####" G 1 A_SetPitch(pitch+0.3)
	"####" H 1 A_SetPitch(pitch+0.3)
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<50,2)
	"####" I 1
	"####" J 1
	"####" A 0 A_JumpIfInventory("PowerBlazing",1,3)
	"####" A 0 A_JumpIf(Health<25,2)
	"####" K 1
	TNT1 A 5
	TNT1 A 0 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH|WRF_ALLOWZOOM)
	PTRH GFEDCBA 1
	FMGU A 0 A_TakeInventory("ZoomReFire",1)
	Goto ReadyMain
  PunchFlash:
	PTRH G 1 A_PlaySound("Punch/Swing",6,1.0)
	PTRM ABC 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<75,2)
	PTRM BA 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<50,2)
	PTRH GG 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<25,2)
	PTRH GG 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<75,2)
	PTRH GG 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<50,2)
	PTRH GG 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,3)
	TNT1 A 0 A_JumpIf(Health<25,2)
	PTRH GG 1
	Stop
  CaberToss:
    PTRG A 1 A_JumpIfInventory("MacheteAmmo",1,1)
	Goto ReadyMain
	MCHT A 0 A_TakeInventory("MacheteAmmo",1)
	PTRU DCBA 1

    TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	TNT1 A 1 A_JumpIf(Health<75,1)
	TNT1 A 1
    TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	TNT1 A 1 A_JumpIf(Health<50,1)
	TNT1 A 1
    TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	TNT1 A 1 A_JumpIf(Health<25,1)
	TNT1 A 1
    MC4S A 0 A_PlaySound("Machete1/Slash",1,0.9)
    MC4S A 0 A_PlaySound("Machete2/Slash",5,0.2)
	MCHT ABC 1
	TNT1 A 0 A_JumpIfInventory("PowerStrength2",1,3)
	MCHT A 0 A_SpawnItemEX("MacheterangProjectile",cos(-pitch)*48,0,32+(sin(-pitch)*48),cos(-pitch)*35,0,sin(-pitch)*35,0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	TNT1 A 0 A_Jump(256,2)
	MCHT A 0 A_SpawnItemEX("MacheterangBerserkProjectile",cos(-pitch)*48,0,32+(sin(-pitch)*48),cos(-pitch)*25,0,sin(-pitch)*25,0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	// This solution is ten times better. Just let it bouncecount out.
    TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	MCHT D 1 A_JumpIf(Health<75,1)
	MCHT E 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	MCHT F 1 A_JumpIf(Health<50,1)
	MCHT G 1
	TNT1 A 0 A_JumpIfInventory("PowerBlazing",1,2)
	MCHT H 1 A_JumpIf(Health<25,1)
	MCHT I 1
	TNT1 A 3

	PTRU ABCD 1
	Goto ReadyMain
  Spawn:
    PTRG X -1
    Stop
  }
}

ACTOR PatriarchClip : Ammo
{
   Inventory.MaxAmount 12
   Inventory.Icon PTRGX0
   +IGNORESKILL
}

ACTOR PatriarchProjectile
{
  Radius 10
  Height 7
  Speed 40
  Damage 20
  Projectile
  -NOGRAVITY
  +FORCERADIUSDMG
  Gravity 0.25
  Obituary "%o was shown who's %p daddy, thanks to %k's ''Patriarch''."
  Scale 0.75
  Decal "BFGScorch"
  DamageType "Patriarch"
  Var Int User_Patriarch_Flight;
  States
  {
  Spawn:
    PATG AA 0 A_ChangeVelocity(0, 0, 2.75, CVF_RELATIVE)
	TNT1 A 0 A_SetUserVar("User_Patriarch_Flight",10)
  Looplo:
    PATG A 1 A_SpawnItemEx("Patriarch_Trail",FRandom(-2, 2),
									FRandom(-2, 2), FRandom(-2, 2),
									FRandom(1.5, -2.5), FRandom(-1.0, 1.0),
									FRandom(-1.0, 1.0), 0, SXF_CLIENTSIDE, 10)
	TNT1 A 0 A_SetUserVar("User_Patriarch_Flight", User_Patriarch_Flight - 1)
	TNT1 A 0 A_JumpIf(User_Patriarch_Flight <= 0, "Looplo2")								
	Loop
  Looplo2:
    PATG A 1				
	Loop
  Death:
    TNT1 A 0 A_PlaySound("Explosion/Init",5,0.8)
    TNT1 A 0 A_PlaySound("Explosion/Main",6,0.8)
    TNT1 A 0 A_PlaySound("Explosion/Layer",4,0.8)
    TNT1 A 0 A_PlaySound("Explosion/Flavor",7,0.8)
    TNT1 A 0 A_SpawnItemEx("Patriarch_Main",0,0,0,0,0,0,SXF_CLIENTSIDE,0)
	TNT1 A 0 A_Explode(175,148)
	TNT1 A 28 A_Quake(3,12,0,512,"none")
    Stop
  }
}

ACTOR PatriarchBounceProjectile : PatriarchProjectile
{
	BounceType "Doom"
	BounceCount 3
	BounceSound "Patriarch/Bounce"
}

/*

KeksDose's patented (not really) SFX-building method, hijacked by his best buddy (fucking traitor), PillowBlaster.
Use with cause.

*/

Actor KD_BaseParticle
{
	+NoInteraction
	+ForceXYBillboard
	RenderStyle Normal
	Alpha 0.99
	States
	{
		Spawn:				// Initialization goes here.
			TNT1 A 0
			Goto FadeIn
		FadeIn:				// Optional fading in.
			TNT1 A 0
			Goto Idle
		Idle:				// Fly around.
			TNT1 A 0
			Goto FadeOut
		FadeOut:			// Dissipate.
			TNT1 A 0
			Stop
	}
}

Actor KD_BaseParticleMultiple : KD_BaseParticle
{
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_Jump(256, "SpriteA", "SpriteB", "SpriteC", "SpriteD")
			Goto Spawn
		SpriteA:
			TNT1 A 0 A_Jump(256, "FadeIn")
		SpriteB:
			TNT1 A 0 A_Jump(256, "FadeIn")
		SpriteC:
			TNT1 A 0 A_Jump(256, "FadeIn")
		SpriteD:
			TNT1 A 0 A_Jump(256, "FadeIn")
		FadeIn:				// Optional fading in.
			TNT1 A 0
			Goto Idle
		Idle:				// Fly around.
			TNT1 A 0
			Goto FadeOut
		FadeOut:			// Dissipate.
			TNT1 A 0
			Stop
	}
}

Actor KD_BaseEmitter
{
	Var Int User_SpawnCount;
	
	+NoInteraction
	
	States
	{
		Spawn:				// Initialize particle counter.
			TNT1 AA 0 A_SetUserVar("User_SpawnCount", 10)
			Goto Emit
		Emit:				// Emit particles.
			TNT1 A 0 A_Jump(0xFF, "Count") // You MUST use A_Jump.
			Goto Count
		Count:				// Emit until SpawnCount <= 0.
			TNT1 A 0 A_SetUserVar("User_SpawnCount", User_SpawnCount - 1)
			TNT1 A 0 A_JumpIf(User_SpawnCount <= 0, "NULL")
			TNT1 A 0 A_Jump(0xFF, "Emit")
			Goto Emit
	}
}

Actor Patriarch_Cloud : KD_BaseParticleMultiple
{
	Alpha 0.65
	RenderStyle Add
	States
	{
		Spawn:
			TNT1 AA 0 A_Jump(256, "SpriteA", "SpriteB", "SpriteC", "SpriteD",
								 "SpriteE", "SpriteF", "SpriteG", "SpriteH")
		SpriteA:
			CLOD A 0 A_Jump(256, "FadeIn")
			Goto SpriteA
		SpriteB:
			CLOD B 0 A_Jump(256, "FadeIn")
			Goto SpriteB
		SpriteC:
			CLOD C 0 A_Jump(256, "FadeIn")
			Goto SpriteC
		SpriteD:
			CLOD D 0 A_Jump(256, "FadeIn")
			Goto SpriteD
		SpriteE:
			CLOD E 0 A_Jump(256, "FadeIn")
			Goto SpriteE
		SpriteF:
			CLOD F 0 A_Jump(256, "FadeIn")
			Goto SpriteF
		SpriteG:
			CLOD G 0 A_Jump(256, "FadeIn")
			Goto SpriteG
		SpriteH:
			CLOD H 0 A_Jump(256, "FadeIn")
			Goto SpriteH
		FadeIn:
			"####" "#" 0 Bright A_SetScale(FRandom(1.0, 0.9))
			Goto Idle
		Idle:
			"####" "#" 2 Bright A_Jump(190, "FadeOut")
			Loop
		FadeOut:
			"####" "#" 1 Bright A_FadeOut(0.035)
			"####" "#" 0 A_ScaleVelocity(FRandom(1.01, 1.03))
			"####" "#" 0 A_SetScale(ScaleX - FRandom(0.01, 0.03))
			Loop
	}
}

Actor Patriarch_Smoke : KD_BaseParticleMultiple
{
	Alpha 0.0
	RenderStyle Translucent
	States
	{
		Spawn:
		    TNT1 A 3
			TNT1 AA 0 A_Jump(256, "SpriteA", "SpriteB", "SpriteC", "SpriteD")
		SpriteA:
			DYMI A 0 A_Jump(256, "FadeIn")
			Goto SpriteA
		SpriteB:
			DYMI B 0 A_Jump(256, "FadeIn")
			Goto SpriteB
		SpriteC:
			DYMI C 0 A_Jump(256, "FadeIn")
			Goto SpriteC
		SpriteD:
			DYMI D 0 A_Jump(256, "FadeIn")
			Goto SpriteD
		FadeIn:
			"####" "#" 0 A_SetScale(FRandom(0.3, 0.4))
			Goto RealFadeIn
		RealFadeIn:
			"####" "#" 1 A_FadeIn(FRandom(0.01, 0.03))
			"####" "#" 0 A_JumpIf(Alpha >= 0.35, "Idle")
			Loop
		Idle:
			"####" "#" 5 A_Jump(200, "FadeOut")
			Loop
		FadeOut:
			"####" "#" 1 A_FadeOut(FRandom(0.01,0.015))
			"####" "#" 0 A_ScaleVelocity(0.96)
			"####" "#" 0 A_SetScale(ScaleX + FRandom(0.015, 0.025))
			Loop
	}
}

Actor Patriarch_Ember : KD_BaseParticleMultiple
{
	Alpha 0.99
	RenderStyle Add
	States
	{
		Spawn:
			TNT1 AA 0 A_Jump(256, "SpriteA", "SpriteB", "SpriteC", "SpriteD", "SpriteE", "SpriteF")
		SpriteA:
			EMBR A 0 A_Jump(256, "FadeIn")
			Goto SpriteA
		SpriteB:
			EMBR B 0 A_Jump(256, "FadeIn")
			Goto SpriteB
		SpriteC:
			EMBR C 0 A_Jump(256, "FadeIn")
			Goto SpriteC
		SpriteD:
			EMBR D 0 A_Jump(256, "FadeIn")
			Goto SpriteD
		SpriteE:
			EMBR E 0 A_Jump(256, "FadeIn")
			Goto SpriteE
		SpriteF:
			EMBR F 0 A_Jump(256, "FadeIn")
			Goto SpriteF
		FadeIn:
			"####" "#" 0 Bright A_SetScale(FRandom(0.035, 0.055))
			Goto Idle
		Idle:
			"####" "#" 2 Bright A_Jump(200, "FadeOut")
			Loop
		FadeOut:
			"####" "#" 1 Bright A_Weave(FRandom(0.9, 1.0), FRandom(0.9, 1.0),
										FRandom(70, 90), FRandom(70, 90))
			"####" "#" 0 A_JumpIf(ScaleX <= 0.0, "NULL")
			"####" "#" 0 A_ChangeVelocity(VelX * FRandom(0.93, 0.99),
										  VelY * FRandom(0.93, 0.99),
										  VelZ - FRandom(0.1, 0.2),
										  CVF_REPLACE)
			"####" "#" 0 A_SetScale(ScaleX - FRandom(0.003, 0.0015))
			Loop
	}
}

Actor Patriarch_Shockwave : KD_BaseParticle
{
	RenderStyle Add
	Scale 0.2
	States
	{
		Spawn:
			SHCK A 0
			SHCK A 0 A_SetScale(ScaleX + FRandom(0.15, 0.2))
			SHCK A 1 Bright A_FadeOut(0.1)
			Loop
	}
}

Actor Patriarch_Flare : KD_BaseParticle
{
	RenderStyle Add
	Scale 2.2
	States
	{
		Spawn:
			FLAR A 1 Bright A_FadeOut(0.04)
			FLAR A 0 A_SetScale(ScaleX - FRandom(0.05, 0.15))
			FLAR A 0 A_JumpIf(ScaleX <= 0.0, "NULL")
			Loop
	}
}

Actor Patriarch_Blast : KD_BaseParticle
{
	RenderStyle Add
	Scale 0.4
	Alpha 0.7
	States
	{
		Spawn:
			TNT1 AA 0 A_Jump(256, "SpriteA", "SpriteB", "SpriteC", "SpriteD",
								 "SpriteE", "SpriteF", "SpriteG", "SpriteH")
		SpriteA:
			BLAS A 0 A_Jump(256, "FadeIn")
			Goto SpriteA
		SpriteB:
			BLAS B 0 A_Jump(256, "FadeIn")
			Goto SpriteB
		SpriteC:
			BLAS C 0 A_Jump(256, "FadeIn")
			Goto SpriteC
		SpriteD:
			BLAS D 0 A_Jump(256, "FadeIn")
			Goto SpriteD
		SpriteE:
			BLAS E 0 A_Jump(256, "FadeIn")
			Goto SpriteE
		SpriteF:
			BLAS F 0 A_Jump(256, "FadeIn")
			Goto SpriteF
		SpriteG:
			BLAS G 0 A_Jump(256, "FadeIn")
			Goto SpriteG
		SpriteH:
			BLAS H 0 A_Jump(256, "FadeIn")
			Goto SpriteH
		FadeIn:
			"####" "#" 1 Bright A_FadeOut(0.05)
			"####" "#" 0 A_SetScale(ScaleX + FRandom(0.075, 0.1))
			Loop
	}
}

Actor Patriarch_Impact : KD_BaseEmitter
{
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_SetUserVar("User_SpawnCount", 17)
			Goto Emit
		Emit:
			TNT1 A 0 A_JumpIf(CallACS("SmokeCheck")==2, 4)			
		    TNT1 A 0 A_JumpIf(CallACS("SmokeCheck")==1, 2)	
			TNT1 AAAA 0 A_SpawnItemEx("Patriarch_Cloud", FRandom(-25, 25),
									FRandom(-25, 25), FRandom(-25, 25),
									FRandom(-2.0, -2.0), FRandom(-2.0, 2.0),
									FRandom(-2.0, 2.0), FRandom(0.0,360.0), SXF_CLIENTSIDE, 10)
			TNT1 A 0 A_JumpIf(CallACS("SmokeCheck")==2, 4)			
		    TNT1 A 0 A_JumpIf(CallACS("SmokeCheck")==1, 2)		
			TNT1 AAA 0 A_SpawnItemEx("Patriarch_Smoke", FRandom(-25, 25),
									FRandom(-25, 25), FRandom(-25, 25),
									FRandom(2.0, -1.0), FRandom(-0.9, 0.9),
									FRandom(-0.9, 0.9), FRandom(0.0,360.0), SXF_CLIENTSIDE, 10)
			TNT1 AA 0 A_SpawnItemEx("Patriarch_Ember", FRandom(-20, 20),
									FRandom(-20, 20), FRandom(-20, 20),
									FRandom(-2.0, -8.0), FRandom(-6.0, 6.0),
									FRandom(1.0, 5.0), FRandom(0.0,360.0), SXF_CLIENTSIDE, 10)
			/*TNT1 AA 0 A_SpawnItemEx("Patriarch_Flare", FRandom(-20, 20),
									FRandom(-20, 20), FRandom(-20, 20),
									0, 0, 0, 0, SXF_CLIENTSIDE)*/
			TNT1 A 1
			TNT1 A 0 A_Jump(0xFF, "Count")
			Goto Count
	}
}

Actor Patriarch_Main : KD_BaseParticle
{
	States
	{
	Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("Patriarch_Impact")
	TNT1 A 0 A_SpawnItemEx("Patriarch_Blast")
	TNT1 A 0 A_SpawnItemEx("Patriarch_Flare")
	TNT1 A 0 A_SpawnItemEx("Patriarch_Shockwave")
	Stop
	}
}

Actor Patriarch_Smoke2 : Patriarch_Smoke
{
	States
	{
		Spawn:
		    TNT1 A 3
			TNT1 AA 0 A_Jump(256, "SpriteA", "SpriteB", "SpriteC", "SpriteD")
		SpriteA:
			DYMI E 0 A_Jump(256, "FadeIn")
			Goto SpriteA
		SpriteB:
			DYMI F 0 A_Jump(256, "FadeIn")
			Goto SpriteB
		SpriteC:
			DYMI G 0 A_Jump(256, "FadeIn")
			Goto SpriteC
		SpriteD:
			DYMI H 0 A_Jump(256, "FadeIn")
			Goto SpriteD
	}
}

Actor Patriarch_Trail : Patriarch_Smoke2
{
	States
	{
		FadeIn:
			"####" "#" 0 A_SetScale(FRandom(0.2, 0.3))
			Goto RealFadeIn
		RealFadeIn:
			"####" "#" 1 A_FadeIn(FRandom(0.02, 0.05))
			"####" "#" 0 A_SetScale(ScaleX + FRandom(0.01,0.02))
			"####" "#" 0 A_JumpIf(Alpha >= 0.2, "Idle")
			Loop
		Idle:
			"####" "#" 5 A_Jump(200, "FadeOut")
			Loop
		FadeOut:
			"####" "#" 1 A_FadeOut(FRandom(0.03,0.04))
			"####" "#" 0 A_ScaleVelocity(0.96)
			"####" "#" 0 A_SetScale(ScaleX + FRandom(0.015, 0.025))
			Loop
	}
}