ACTOR GuncastSerpent : Demon1 replaces Demon1
{
  DropItem "Amber", 192
  DamageFactor Fire3, 0.8
  DamageFactor Ice, 1.1
  DamageFactor Manuel, 0.9
  States
  {
	Pain.SuperCloseCombat:
		TNT1 A 0 A_ChangeVelocity(frandom(-4.0,-8.0),0,frandom(1.0,3.0),CVF_RELATIVE)
		Goto Pain
	Pain.SuperShoelaces:
		TNT1 A 0 A_ChangeVelocity(frandom(-8.0,-12.0),0,frandom(7.0,9.0),CVF_RELATIVE)
		Goto Pain
	Death.SuperCloseCombat:
		TNT1 A 0 A_ChangeVelocity(frandom(-4.0,-8.0),0,frandom(1.0,3.0),CVF_RELATIVE)
		Goto XDeath
	Death.SuperShoelaces:
		TNT1 A 0 A_ChangeVelocity(frandom(-8.0,-12.0),0,frandom(7.0,9.0),CVF_RELATIVE)
		Goto XDeath
	Death.Acid:
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("Demon1Gib")
		Stop
	Crush:
		TNT1 AAAAAAAAAA 0 A_CustomMissile ("BloodTr255", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 0 A_PlaySound("misc/xdeath4")
		XBIG EEEEE 1 A_CustomMissile ("CeilBloodLauncherLong", 0, 0, random (0, 360), 2, random (50, 130))
		TNT1 A 0 A_CustomMissile ("GiantBloodSpot", 4, 0, random (0, 360), 2, random (0, 160))
		XBIG E -1
		Stop
	Death.Crow:
		TNT1 AA 0 A_SpawnItemEx("FlockOfCrows",0,0,0,0,0,0,0,0,128)
		Goto Super::Death
	Death:
		DEMN HI 6
		DEMN J 6 A_Scream
		DEMN K 6 A_NoBlocking
		DEMN L 6 A_QueueCorpse
		DEMN MNO 6
	Looplet1:
		DEMN P 0 A_JumpIfInventory("CorpseTrigger2",1,"CorpseBlastB")
		DEMN P 1 A_JumpIfInventory("CorpseTrigger",1,"CorpseBlastA")
		Loop
	XDeath:
		DEMN H 6
		DEMN I 0 A_SpawnItemEx("Demon1Chunk1", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle+90),
							   frandom[DemonChunks](1, 4.984375)*sin(angle+90), 8, 90, ChunkFlags)
		DEMN I 0 A_SpawnItemEx("Demon1Chunk2", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
							   frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		DEMN I 0 A_SpawnItemEx("Demon1Chunk3", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
							   frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		DEMN I 0 A_SpawnItemEx("Demon1Chunk4", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
							   frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		DEMN I 6 A_SpawnItemEx("Demon1Chunk5", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
							   frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		Goto Death+2
	CorpseBlastA:
		TNT1 A 0 A_SpawnItemEx("Demon2Blast")
		Stop
	CorpseBlastB:
		TNT1 A 0 A_SpawnItemEx("Demon2Blast")
		TNT1 A 0 A_TakeInventory("CorpseTrigger2",1)
		Goto Looplet1
  }
}

ACTOR Demon1Blast : BlastShared
{
	const int ChunkFlags = SXF_TRANSFERTRANSLATION|SXF_ABSOLUTEVELOCITY;
	States
	{
	Spawn:
		 TNT1 AA 0 A_Explode(250,192,0)
		 TNT1 A 0 A_PlaySound("Corpseblast/Hit")
		 DEMN I 0 A_SpawnItemEx("Demon1Chunk1", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle+90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle+90), 8, 90, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon1Chunk2", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon1Chunk3", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon1Chunk4", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 6 A_SpawnItemEx("Demon1Chunk5", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 TNT1 AAA 0 A_CustomMissile ("XDeath1", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAA 0 A_CustomMissile ("XDeath2", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAA 0 A_CustomMissile ("XDeath3", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AA 0 A_CustomMissile ("XDeath4", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAA 0 A_CustomMissile ("SuperWallRedBlood", 6, 0, random (0, 360), 2, random (-5, 5))
		 TNT1 AAAAAAA 0 A_CustomMissile ("Instestin", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBlood", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAAAA 0 A_CustomMissile ("SuperGoreSpawner", 6, 0, random (0, 360), 2, random (50, 130))
		 Stop
	 }
}

ACTOR Demon1Gib : GibShared
{
	const int ChunkFlags = SXF_TRANSFERTRANSLATION|SXF_ABSOLUTEVELOCITY;
	States
	{
		Spawn:
	     DEMN E 1
		"####" "#" 1 A_Playsound("Gumpop/Expand",5)
		"####" "###################################" 1 A_SetScale(ScaleX+frandom(0.01,0.025))
		"####" "#" 1 A_Playsound("Gumpop/Pop",5)
		 DEMN I 0 A_SpawnItemEx("Demon1Chunk1", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle+90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle+90), 8, 90, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon1Chunk2", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon1Chunk3", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon1Chunk4", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 6 A_SpawnItemEx("Demon1Chunk5", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 TNT1 AAA 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAA 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAA 0 A_CustomMissile ("XDeath3", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AA 0 A_CustomMissile ("XDeath4", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAA 0 A_CustomMissile ("SuperWallRedBlood", 40, 0, random (0, 360), 2, random (-5, 5))
		 TNT1 AAAAAAA 0 A_CustomMissile ("Instestin", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBlood", 35, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAAAA 0 A_CustomMissile ("SuperGoreSpawner", 32, 0, random (0, 360), 2, random (50, 130))
		TNT1 A 0 A_Gravity
		XBIG B 5 A_XScream
		XBIG C 5 A_BossDeath 
		XBIG D 5 A_NoBlocking
		XBIG E 5
		TNT1 A 0 A_CustomMissile ("GiantBloodSpot", 4, 0, random (0, 360), 2, random (0, 160))
		XBIG E -1
		Stop
	}
}

ACTOR GuncastBrownSerpent : Demon2 replaces Demon2
{
  DropItem "Ruby", 192
  DamageFactor Fire3, 0.9
  DamageFactor Ice, 1.1
  DamageFactor Manuel, 0.9
  DamageFactor Acid, 0.6
  States
  {
	Pain.SuperCloseCombat:
		TNT1 A 0 A_ChangeVelocity(frandom(-4.0,-8.0),0,frandom(1.0,3.0),CVF_RELATIVE)
		Goto Pain
	Pain.SuperShoelaces:
		TNT1 A 0 A_ChangeVelocity(frandom(-8.0,-12.0),0,frandom(7.0,9.0),CVF_RELATIVE)
		Goto Pain
	Death.SuperCloseCombat:
		TNT1 A 0 A_ChangeVelocity(frandom(-4.0,-8.0),0,frandom(1.0,3.0),CVF_RELATIVE)
		Goto XDeath
	Death.SuperShoelaces:
		TNT1 A 0 A_ChangeVelocity(frandom(-8.0,-12.0),0,frandom(7.0,9.0),CVF_RELATIVE)
		Goto XDeath
	Death.Acid:	
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("Demon2Gib")
		Stop
	Crush:
		TNT1 AAAAAAAAAA 0 A_CustomMissile ("BloodTr255", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 0 A_PlaySound("misc/xdeath4")
		XBIG EEEEE 1 A_CustomMissile ("CeilBloodLauncherLong", 0, 0, random (0, 360), 2, random (50, 130))
		TNT1 A 0 A_CustomMissile ("GiantBloodSpot", 4, 0, random (0, 360), 2, random (0, 160))
		XBIG E -1
		Stop
	Death.Crow:
		TNT1 AA 0 A_SpawnItemEx("FlockOfCrows",0,0,0,0,0,0,0,0,128)
		Goto Super::Death
	Death:
		DEM2 HI 6
		DEM2 J 6 A_Scream
		DEM2 K 6 A_NoBlocking
		DEM2 L 6 A_QueueCorpse
		DEM2 MNO 6
	Looplet1:
		DEMN P 0 A_JumpIfInventory("CorpseTrigger2",1,"CorpseBlastB")
		DEMN P 1 A_JumpIfInventory("CorpseTrigger",1,"CorpseBlastA")
		Loop
	XDeath:
		DEM2 H 6
		DEMN I 0 A_SpawnItemEx("Demon2Chunk1", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle+90),
							   frandom[DemonChunks](1, 4.984375)*sin(angle+90), 8, 90, ChunkFlags)
		DEMN I 0 A_SpawnItemEx("Demon2Chunk2", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
							   frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		DEMN I 0 A_SpawnItemEx("Demon2Chunk3", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
							   frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		DEMN I 0 A_SpawnItemEx("Demon2Chunk4", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
							   frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		DEM2 I 6 A_SpawnItemEx("Demon2Chunk5", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
							   frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		Goto Death+2
	CorpseBlastA:
		TNT1 A 0 A_SpawnItemEx("Demon2Blast")
		Stop
	CorpseBlastB:
		TNT1 A 0 A_SpawnItemEx("Demon2Blast")
		TNT1 A 0 A_TakeInventory("CorpseTrigger2",1)
		Goto Looplet1
  }
}

ACTOR Demon2Blast : BlastShared
{
	const int ChunkFlags = SXF_TRANSFERTRANSLATION|SXF_ABSOLUTEVELOCITY;
	States
	{
	Spawn:
		 TNT1 AA 0 A_Explode(250,192,0)
		 TNT1 A 0 A_PlaySound("Corpseblast/Hit")
		 DEMN I 0 A_SpawnItemEx("Demon2Chunk1", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle+90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle+90), 8, 90, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon2Chunk2", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon2Chunk3", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon2Chunk4", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon2Chunk5", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 TNT1 AAA 0 A_CustomMissile ("XDeath1", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAA 0 A_CustomMissile ("XDeath2", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAA 0 A_CustomMissile ("XDeath3", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AA 0 A_CustomMissile ("XDeath4", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAA 0 A_CustomMissile ("SuperWallRedBlood", 6, 0, random (0, 360), 2, random (-5, 5))
		 TNT1 AAAAAAA 0 A_CustomMissile ("Instestin", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBlood", 6, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAAAA 0 A_CustomMissile ("SuperGoreSpawner", 6, 0, random (0, 360), 2, random (50, 130))
		 Stop
	 }
}

ACTOR Demon2Gib : GibShared
{
	const int ChunkFlags = SXF_TRANSFERTRANSLATION|SXF_ABSOLUTEVELOCITY;
	States
	{
		Spawn:
	     DEM2 E 1
		"####" "#" 1 A_Playsound("Gumpop/Expand",5)
		"####" "###################################" 1 A_SetScale(ScaleX+frandom(0.01,0.025))
		"####" "#" 1 A_Playsound("Gumpop/Pop",5)
		 DEMN I 0 A_SpawnItemEx("Demon2Chunk1", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle+90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle+90), 8, 90, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon2Chunk2", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon2Chunk3", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon2Chunk4", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 DEMN I 0 A_SpawnItemEx("Demon2Chunk5", 0, 0, 45, frandom[DemonChunks](1, 4.984375)*cos(angle-90),
                           frandom[DemonChunks](1, 4.984375)*sin(angle-90), 8, 270, ChunkFlags)
		 TNT1 AAA 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAA 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAA 0 A_CustomMissile ("XDeath3", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AA 0 A_CustomMissile ("XDeath4", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAA 0 A_CustomMissile ("SuperWallRedBlood", 40, 0, random (0, 360), 2, random (-5, 5))
		 TNT1 AAAAAAA 0 A_CustomMissile ("Instestin", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBlood", 35, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAAAAAA 0 A_CustomMissile ("SuperGoreSpawner", 32, 0, random (0, 360), 2, random (50, 130))
		TNT1 A 0 A_Gravity
		XBIG B 5 A_XScream
		XBIG C 5 A_BossDeath 
		XBIG D 5 A_NoBlocking
		XBIG E 5
		TNT1 A 0 A_CustomMissile ("GiantBloodSpot", 4, 0, random (0, 360), 2, random (0, 160))
		XBIG E -1
		Stop
	}
}