//  Cyberdemon
//  Spider Mastermind


ACTOR SatanRocquette : Rocquette
{
	Damage 30
	Speed 36
	Scale 1
	decal "Scorch"
	seesound "weapons/rocklf"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySoundEx("weapons/rocklf","voice")
		TNT1 A 0 A_JumpIf(velx+vely!=0,"Spawn2")
		TNT1 A 0 A_Recoil(-2)
	Spawn2:
		MISL A 4
		TNT1 A 0 A_JumpIf ((velx*velx+vely*vely+velz*velz)>9000,2)
		TNT1 A 0 A_SpawnItemEx ("SatanRocquette2", 0,0,0, (velx*1.3),(vely*1.3),(velz*1.3), 0,8)
		stop
		TNT1 A 0 ThrustThing (random(0,256), random(0,2), 0,0)
		TNT1 A 0 ThrustThingZ (0,random(0,2),random(0,1),1)
		loop
	Death:
		TNT1 A 0 bright A_SetTranslucent (1, 1)
		TNT1 AAA 1 A_SpawnItemEx ("HDExplosion", random(-1,1),random(-1,1),random(-1,1), 0,0,random(1,3), 0,32)
		TNT1 A 2 bright A_Explode (200,  random(112,256))
		TNT1 AAAAAAAAAAAAAAAAA 0 A_SpawnItemEx ("HugeWallChunk", 0, 0, 0, random(-12,12),random(-12,12),random(8,20),random(0,360),160)
		TNT1 AAA 0 A_SpawnItemEx ("HDSmoke", random(-6,6),random(-6,6),random(-2,6), 0,0,0, 0,160)
		TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx ("BigWallChunk", 0, 0, 0, random(-6,6),random(-6,6),random(4,18),random(0,360),160)
	Death2:
		TNT1 A 2 bright Radius_Quake (3, 28, 1, 4, 0)
		TNT1 A 0 A_SpawnItem ("DistantRocket", 1, 1, 0, 0)
		Stop
	}
}
ACTOR SatanRocquette2 : SatanRocquette
{
	States
	{
	Spawn:
		TNT1 A 0
		goto Spawn2
	}
}
ACTOR SatanDelayedRocquette : SatanRocquette
{
	speed 20
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 ThrustThingZ(0,4,1,1)
		goto Spawn2
	}
}
ACTOR SatanRocquetteLauncher
{
	PROJECTILE
	+nointeraction
	Speed 1
	States
	{
	Spawn:
		TNT1 A 0
	Death:
		TNT1 A 0 A_SpawnItemEx ("HDSmoke", 34, 0, 0, random(-1,1),random(-1,1), random(1,3), 0, 160, 0)
		TNT1 A 0 A_SpawnItemEx("SatanRocquette",0,0,0,velx*16,vely*16,velz*16,0,SXF_TRANSFERPOINTERS|SXF_ABSOLUTEMOMENTUM|SXF_NOCHECKPOSITION,0)
		stop
	}
}
ACTOR SatanRocquetteLauncher8 : SatanRocquetteLauncher
{
	States
	{
	Spawn:
		TNT1 A 8
		Goto Death
	}
}
ACTOR SatanRocquetteLauncher26 : SatanRocquetteLauncher
{
	States
	{
	Spawn:
		TNT1 A 26
		Goto Death
	}
}
ACTOR SatanRocquetteLauncher44 : SatanRocquetteLauncher
{
	States
	{
	Spawn:
		TNT1 A 44
		Goto Death
	}
}
ACTOR SatanRobo : Cyberdemon replaces Cyberdemon
{
	damagefactor "Thermal", 0.5
	damagefactor "SmallArms0", 0.6
	damagefactor "SmallArms1", 0.7
	damagefactor "SmallArms2", 0.8
	damagefactor "SmallArms3", 0.9
	gibhealth 900
	health 4000
	mass 12000
	Speed 8
	deathheight 110
	painChance 3
	maxtargetrange 16384
	+missileevenmore
	+avoidmelee
	-noradiusdmg
	radiusdamagefactor 0.1
	obituary "%o was minced by a cyberdemon."
	States
	{
	See:
		CYBR E 0 A_ChangeFlag ("nopain",0)
		CYBR E 0 A_JUmpIfHealthLower (0, "Death")
		CYBR E 0 A_JUmpIfHealthLower (1600, "See2")

		CYBR AAA 2 A_Chase
		CYBR B 0 A_PlaySoundEx ("spider/walk","soundslot5")
		CYBR BBBBB 1 A_Chase

		CYBR C 0 A_PlaySoundEx ("cyber/hoof","soundslot6")
		CYBR CCC 2 A_Chase
		CYBR DDDDD 1 A_Chase
		Loop
	See2:
		CYBR E 0 A_JumpIfHealthLower (0, "Death")
		CYBR E 0 A_SpawnItemEx ("HDSmoke", random(-32,32),random(-32,32),random(46,96),0,0,random(1,4),0,160,64)
		CYBR E 0 A_SpawnItemEx ("HDSmoke", random(-32,32),random(-32,32),random(46,96),0,0,random(1,4),0,160,64)
		CYBR AAAAA 1 A_Chase
		CYBR B 0 A_PlaySoundEx ("spider/walk","soundslot5")
		CYBR E 0 A_SpawnItemEx ("HDSmoke", random(-32,32),random(-32,32),random(46,96),0,0,random(1,4),0,160,64)
		CYBR BBBB 1 A_Chase

		CYBR E 0 A_SpawnItemEx ("HDSmoke", random(-32,32),random(-32,32),random(46,96),0,0,random(1,4),0,160,64)
		CYBR C 2 A_Hoof
		CYBR E 0 A_SpawnItemEx ("HDSmoke", random(-32,32),random(-32,32),random(46,96),0,0,random(1,4),0,160,64)
		CYBR CCC 1 A_Chase
		CYBR E 0 A_SpawnItemEx ("HDSmoke", random(-32,32),random(-32,32),random(46,96),0,0,random(1,4),0,160,64)
		CYBR DDDD 1 A_Chase
		Loop
	Missile:
		CYBR E 0 A_ChangeFlag ("nopain",1)
		CYBR E 4 A_PlaySound ("spider/walk")
		CYBR E 4 A_FaceTarget
		CYBR E 8 A_PlaySound ("spider/walk")
		CYBR E 8 A_FaceTarget
		CYBR E 0 A_JumpIfCloser (320, "MissilePDW")
		CYBR E 0 A_JumpIfCloser (1024, 2)
		CYBR E 0 A_Jump (192, "MissileSnipe")
		CYBR E 0 A_JumpIfHealthLower (960, 3)
		CYBR E 0 A_Jump (108, "MissileBarrage")
		CYBR E 0 A_Jump (216, "MissileSweep1","MissileSweep2","MissileSweep3")

		CYBR EEE 0 A_SpawnItemEx ("HDSmoke", 34, -24, 52, random(-1,1),random(-1,1), random(1,3), 0, 160, 164)
		CYBR E 0 A_Jump (48, "MissileSweep1","MissileSweep2","MissileSweep3")
		goto MissileBarrage

	MissileSnipe:
		CYBR E 12
		CYBR F 8 BRIGHT A_CustomMissile ("SatanRocquette", 43, -24, random(0,-1))
		CYBR E 6 A_FaceTarget
		CYBR F 8 BRIGHT A_CustomMissile ("SatanRocquette", 44, -24, 0)
		CYBR E 6 A_FaceTarget
		CYBR F 8 BRIGHT A_CustomMissile ("SatanRocquette", 43, -24, random(0,1))
		CYBR E 8 A_JumpIfHealthLower (1200, 1)
		Goto See
		CYBR E 8 A_SpawnItemEx ("HDSmoke", 34, -24, 52, random(-1,1),random(-1,1), random(1,3), 0, 160, 164)
		Goto See

	MissileSweep1:
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher8", 42, -24, random(-0,-3))
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher26", 42, -24, random(-1,1))
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher44", 42, -24, random(0,3))
		CYBR E 8
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", 42, -24, random(1,-6))
		CYBR E 10 //A_FaceTarget
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", 42, -24, random(-2,2))
		CYBR E 10 //A_FaceTarget
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", 42, -24, random(-1,6))
		CYBR E 8 A_JumpIfHealthLower (1200, 1)
		Goto See
		CYBR E 8 A_SpawnItemEx ("HDSmoke", 34, -24, 52, random(-1,1),random(-1,1), random(1,3), 0, 160, 164)
		Goto See

	MissileSweep2:
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher8", 42, -24, random(0,3))
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher26", 42, -24, random(-1,1))
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher44", 42, -24, random(0,3))
		CYBR E 8
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", 42, -24, random(-1,6))
		CYBR E 10 //A_FaceTarget
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", 42, -24, random(-2,2))
		CYBR E 10 //A_FaceTarget
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", 42, -24, random(1,-6))
		CYBR E 8 A_JumpIfHealthLower (1200, 1)
		Goto See
		CYBR E 8 A_SpawnItemEx ("HDSmoke", 34, -24, 52, random(-1,1),random(-1,1), random(1,3), 0, 160, 164)
		Goto See

	MissileSweep3:
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher8", 42, -24, random(-4,4))
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher26", 42, -24, random(-4,4))
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher44", 42, -24, random(-4,4))
		CYBR E 8
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", random(40,44), -24, random(-4,4))
		CYBR E 10 //A_FaceTarget
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", random(40,44), -24, random(-4,4))
		CYBR E 10 //A_FaceTarget
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", random(40,44), -24, random(-4,4))
		CYBR E 8 A_JumpIfHealthLower (1200, 1)
		Goto See
		CYBR E 8 A_SpawnItemEx ("HDSmoke", 34, -24, 52, random(-1,1),random(-1,1), random(1,3), 0, 160, 164)
		Goto See

	MissilePDW:
		TNT1 A 0 A_Jump (48, "MissileSweep3")
		CYBR E 8 A_CustomMissile ("SatanDelayedRocquette", random(40,44), -24, random(-8,8))
		CYBR E 4 A_FaceTarget
		CYBR E 8 A_CustomMissile ("SatanDelayedRocquette", random(40,44), -24, random(-8,8))
		CYBR E 4 A_FaceTarget
		CYBR E 8 A_CustomMissile ("SatanDelayedRocquette", random(40,44), -24, random(-8,8))
		CYBR E 4 A_FaceTarget
		CYBR E 8 A_JumpIfHealthLower (1200, 1)
		Goto See
		CYBR E 8 A_SpawnItemEx ("HDSmoke", 34, -24, 52, random(-1,1),random(-1,1), random(1,3), 0, 160, 164)
		Goto See

	MissileBarrage:
		CYBR E 0 A_JumpIfHealthLower (400, "MissileMachineGun")
		CYBR E 0 A_FaceTarget
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher8", 42, -24, random(-3,3))
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher26", 42, -24, random(-3,3))
		CYBR F 0 A_CustomMissile ("SatanRocquetteLauncher44", 42, -24, random(-6,6))
		CYBR E 8
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", 42, -24, random(-2,-5))
		CYBR E 10 //A_FaceTarget
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", 42, -24, random(0,-2))
		CYBR E 10 //A_FaceTarget
		CYBR F 8 BRIGHT //A_CustomMissile ("SatanRocquette", 42, -24, random(1,4))
		CYBR E 0 A_Jump (160,"MissileBarrage")
		CYBR E 10 A_ChangeFlag ("nopain",0)
		CYBR E 0 A_JumpIfHealthLower (1200, 3)
		Goto See
		CYBR E 10 A_SpawnItemEx ("HDSmoke", 34, -24, 52, random(-1,1),random(-1,1), random(1,3), 0, 160, 164)
		Goto See

	MissileMachineGun:
		CYBR E 0 A_ChangeFlag ("nopain",1)
		CYBR E 2 A_FaceTarget
		CYBR F 6 BRIGHT A_CustomMissile ("SatanRocquette", 42, -24, random(12,-12))
		CYBR E 0 A_ChangeFlag ("nopain",0)
		CYBR E 0 A_SentinelRefire
		Goto Missile+2

	Death:
		CYBR G 12 A_Pain
		CYBR D 0
		CYBR DD 6 A_ExtChase (0, 0)
		CYBR A 12
		CYBR B 0 A_PlaySoundEx ("spider/walk","soundslot5")
		CYBR BB 6 A_ExtChase (0, 0)
		CYBR C 12 A_PlaySoundEx ("cyber/hoof","soundslot6")
		CYBR D 0
		CYBR DD 6 A_ExtChase (0, 0)
		CYBR D 0 A_SpawnItemEx ("HDExplosionBoss", random(-12,12), random(-12,12), random(60,64), random(-1,1),random(-1,1), random(1,3))
		CYBR A 10 A_PlaySoundEx ("cyber/hoof","soundslot6")
		CYBR D 0 A_SpawnItemEx ("HDExplosionBoss", random(-12,12), random(-12,12), random(60,64), random(-1,1),random(-1,1), random(1,3))

		CYBR A 5 A_PlaySound ("cyber/hoof")
		CYBR B 0 A_PlaySound ("spider/walk")
		CYBR B 6 A_ExtChase (0, 0)
		CYBR D 0 A_SpawnItemEx ("HDExplosionBoss", random(-26,26), random(-26,26), random(60,64), random(-1,1),random(-1,1), random(1,3))

		CYBR B 6 A_ExtChase (0, 0)
		CYBR C 16 A_PlaySoundEx ("cyber/hoof","soundslot6")
		CYBR DD 6 A_ExtChase (0, 0)
		CYBR D 6 A_SpawnItemEx ("HDExplosionBoss", random(-26,26), random(-26,26), random(62,68), random(-1,1),random(-1,1), random(1,3))

		CYBR A 20
		CYBR B 0 A_PlaySoundEx ("spider/walk","soundslot5")
		CYBR BB 6 A_ExtChase (0, 0)
		CYBR D 0 A_SpawnItemEx ("HDExplosionBoss", random(-26,26), random(-26,26), random(70,88), random(-1,1),random(-1,1), random(1,3))
		CYBR C 24 A_PlaySoundEx ("cyber/hoof","soundslot6")
		CYBR E 14 A_PlaySoundEx ("spider/walk","soundslot5")
		CYBR EEEE 6 A_FaceTarget
		CYBR FF 0 A_SpawnItemEx ("HDSmoke", 34, -24, 52, random(-1,1),random(-1,1), random(1,3), 0, 160, 0)
		CYBR FFFFFFF 0 A_SpawnItemEx ("BigWallChunk", 34, -24, 52, random(4,14),random(-3,3), random(1,4), random(0,360), 160, 0)
		CYBR FFFFF 0 A_SpawnItemEx ("HugeWallChunk", 34, -24, 52, random(4,24),random(-3,3), random(1,4), random(0,360), 160, 0)
		CYBR F 8 BRIGHT A_SpawnItemEx ("HDExplosion", 34, -24, 52)
		CYBR E 56
		CYBR EEEEEEE 4 A_SpawnItemEx ("HDSmoke", 34, -24, 52, random(-1,1),random(-1,1), random(1,3), 0, 160, 96)
		CYBR EEEEEEE 2 A_SpawnItemEx ("HDSmoke", 34, -24, 52, random(-1,1),random(-1,1), random(1,3), 0, 160, 32)
		CYBR EEEEEEE 1 A_SpawnItemEx ("HDSmoke", 34, -24, 52, random(-1,1),random(-1,1), random(1,3), 0, 160, 0)
//	XDeath:
		CYBR E 4 A_FaceTarget
		CYBR H 6 A_Scream
		CYBR H 2 bright A_SpawnItemEx ("HDExplosion", random(-26,26), random(-26,26), random(56,64), random(-1,1),random(-1,1), random(1,3))
		CYBR H 3 bright A_SpawnItemEx ("HDExplosionBoss", random(-36,36), random(-36,36), random(40,46), random(-1,1),random(-1,1), random(1,3))
		CYBR H 1 bright A_SpawnItemEx ("HDExplosion", random(-26,26), random(-46,46), random(30,36), random(-1,1),random(-1,1), random(1,3))

		CYBR I 2 A_Explode (512, 16)
		CYBR I 0 Radius_Quake (6, 42, 3, 8, 0)
		CYBR I 2 bright A_SpawnItemEx ("HDExplosionBoss", random(-36,36), random(-26,26), random(60,78), random(-1,1),random(-1,1), random(1,3))
		CYBR I 2 bright A_SpawnItemEx ("HDExplosion", random(-36,36), random(-26,26), random(50,68), random(-1,1),random(-1,1), random(1,3))
		CYBR I 3 bright A_SpawnItemEx ("HDExplosion", random(-26,26), random(-26,26), random(75,82), random(-1,1),random(-1,1), random(1,3))

		CYBR J 3 bright A_SpawnItemEx ("HDExplosionBoss", random(-26,26), random(-46,46), random(45,52), random(-1,1),random(-1,1), random(1,3))
		CYBR J 3 bright A_SpawnItemEx ("HDExplosion", random(-36,36), random(-26,26), random(64,82), random(-1,1),random(-1,1), random(1,3))
		CYBR J 3 bright A_SpawnItemEx ("HDExplosionBoss", random(-36,36), random(-26,26), random(45,82), random(-1,1),random(-1,1), random(1,3))

		CYBR K 4 bright A_SpawnItemEx ("HDExplosion", random(-36,36), random(-46,46), random(48,62), random(-1,1),random(-1,1), random(1,3))
		CYBR K 4 A_SpawnItemEx ("HDExplosionBoss", random(-66,66), random(-66,66), random(15,42), random(-1,1),random(-1,1), random(1,3))

		CYBR L 4 A_SpawnItemEx ("HDExplosion", random(-36,36), random(-36,36), random(62,82), random(-1,1),random(-1,1), random(1,3))
		CYBR L 1 A_SpawnItemEx ("HDExplosionBoss", random(-16,16), random(-16,16), random(75,82), random(-1,1),random(-1,1), random(1,3))

		CYBR LLLL 3 A_SpawnItemEx ("HDSmoke", random(-36,36), random(-36,36), random(24,80), random(-1,1),random(-1,1), random(1,3),0,160)

		CYBR M 0 A_NoBlocking
		CYBR MMMM 2 A_SpawnItemEx ("HDSmoke", random(-20,20), random(-20,20), random(24,80), random(-1,1),random(-1,1), random(1,3),0,160)
		CYBR NNOO 4 A_SpawnItemEx ("HDSmoke", random(-26,26), random(-26,26), random(12,40), random(-1,1),random(-1,1), random(1,3),0,160)
		TNT1 A 0 A_GivetoTarget("HDKillCount",1)
		TNT1 A 0 ACS_ExecuteAlways(558,0,0,1,600)
		CYBR PPPPP 8 A_SpawnItemEx ("HDSmoke", random(-36,36), random(-36,36), random(2,10), random(-1,1),random(-1,1), random(1,3),0,160)
		CYBR P -1 A_BossDeath
		Stop
	XDeath:
		CYBR G 2 A_FaceTarget
		CYBR H 4 A_Scream

		CYBR I 4 A_Explode (16, 128)
		CYBR I 0 Radius_Quake (6, 42, 3, 8, 0)

		CYBR J 4
		CYBR JJJ 2 A_SpawnItemEx ("CyberGibs", random(1,36),random(-36,36),random(36,66), random(1,10),random(1,10), random(1,20),random(0,360),160)

		CYBR K 1
		CYBR KK 4 A_SpawnItemEx ("CyberGibs", random(1,36),random(-36,36),random(36,66), random(1,10),random(1,10), random(1,20),random(0,360),160)

		CYBR LL 2 A_SpawnItemEx ("CyberGibs", random(1,36),random(-36,36),random(36,66), random(1,10),random(1,10), random(1,20),random(0,360),160)

		CYBR LLLL 3 A_SpawnItemEx ("MegaBloodSplatter", random(-36,36), random(-36,36), random(40,80), random(-12,12),random(-12,12), random(-10,20),random(0,360),160)

		CYBR M 0 A_NoBlocking
		CYBR MMMM 2 A_SpawnItemEx ("HDSmoke", random(-20,20), random(-20,20), random(24,80), random(-1,1),random(-1,1), random(1,3),0,160)
		CYBR NNOO 4 A_SpawnItemEx ("HDSmoke", random(-26,26), random(-26,26), random(12,40), random(-1,1),random(-1,1), random(1,3),0,160)
		TNT1 A 0 A_GivetoTarget("HDKillCount",1)
		TNT1 A 0 ACS_ExecuteAlways(558,0,0,1,600)
		CYBR P -1 A_BossDeath
		Stop
	}
}
ACTOR CyberGibs
{
	+corpse
	states
	{
	spawn:

		POSS O 5 A_ChangeFlag("NODROPOFF", 0)

		TROO P 0 A_SpawnItemEx ("MegaBloodSplatter", 0,0,34, 0,0,0, 0,160)

		POSS O 5 A_PlaySound ("misc/gibbed")

		TROO Q 0 A_SpawnItemEx ("MegaBloodSplatter", 0,0,34, 0,0,0, 0,160)

		TROO Q 0 A_SpawnItemEx ("MegaBloodSplatter", 0,0,34, 0,0,0, 0,160)
	fall:
		POSS P 3 A_SpawnItemEx ("HDSmoke", random(-6,6), random(-6,6), random(1,4), random(-1,1),random(-1,1), random(1,3),0,160)
		POSS PPP 1 A_SpawnItemEx ("MegaBloodSplatter", 0,0,34, 0,0,0, 0,160)
		loop
	crash:

		POSS QQRRSSTT 2 A_SpawnItemEx ("HDSmoke", random(-6,6), random(-6,6), random(1,4), random(-1,1),random(-1,1), random(1,3),0,160)
		POSS U 0 A_SpawnItemEx("HDExplosion",0,0,2,velx,vely,velz+1,0,SXF_NOCHECKPOSITION|SXF_ABSOLUTEMOMENTUM,190)

		POSS U 6 A_FadeOut(0.2)

		wait

	}
}
ACTOR HDExplosionBoss : HDExplosion
{
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("world/explode")
		MISX A 0 bright A_SetTranslucent (1, 1)
		MISX A 3 bright A_Explode (140,  random(112,256))
		MISX AAAAAAAAAAAA 0 A_SpawnItemEx ("HugeWallChunk", 0, 0, 0, random(-12,12),random(-12,12),random(8,20),random(0,360),160)
		MISX AAA 0 A_SpawnItemEx ("HDSmoke", random(-6,6), random(-6,6), random(-1,6), 0,0,0, 0,160)
		MISX AAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx ("BigWallChunk", random(-6,6), random(-6,6), random(-6,6), random(-6,6),random(-6,6),random(4,18),random(0,360),160)
		MISX AAAAAAAAA 0 A_SpawnItemEx ("BloodChunk", 0, 0, 0, random(-6,6),random(-6,6),random(4,18),random(0,360),160)
	Death2:
		MISL B 6 bright
		MISL BBCCCDDDD 2 BRIGHT A_FadeOut (0.1)
		Stop
	}
}

ACTOR Spiderdemon : SpiderMastermind replaces SpiderMastermind
{
	+noblood
	+missileevenmore
	+nodropoff
	maxstepheight 72
	maxdropoffheight 72
	speed 12
	decal "BulletScratch"
	attacksound "spider/gun"
	painchance 80
	damagefactor "Thermal", 0.9
	damagefactor "SmallArms0", 0.6
	damagefactor "SmallArms1", 0.7
	damagefactor "SmallArms2", 0.8
	damagefactor "SmallArms3", 0.9
	obituary "%o was diced by the spider mastermind."
	maxtargetrange 1024
	radius 96
	states
	{
	See:
		TNT1 A 0 A_ChangeFlag ("missilemore", 1)
		TNT1 A 0 A_JumpIfCloser (256, 2)
		TNT1 A 0 A_ChangeFlag ("missilemore", 0)

		TNT1 A 0 A_PlaySound ("spider/walk")
		SPID A 4 A_Chase
		SPID B 0 A_Chase
		SPID B 4 A_Recoil (-3)
		SPID C 0 A_Chase
		SPID C 4 A_Recoil (-6)

		TNT1 A 0 A_PlaySound ("spider/walk")
		SPID D 4 A_Chase
		SPID E 0 A_Chase
		SPID E 4 A_Recoil (-3)
		SPID F 0 A_Chase
		SPID F 4 A_Recoil (-6)
		loop
	Missile:
		SPID A 6 A_FaceTarget
		SPID A 4 A_Stop
		SPID A 0 A_PlayWeaponSound ("weapons/vulcanup")
		SPID A 10 A_FaceTarget
		goto Shoot
	Shoot:
		SPID G 2 BRIGHT A_CustomBulletAttack (4, 4, 1, 9, "BulletPuffBig")
		TNT1 A 0 A_SpawnItem ("DistantRifle", 1, 1, 0, 0)
		SPID H 2 BRIGHT A_CustomBulletAttack (4, 4, 1, 9, "BulletPuffBig")
		TNT1 A 0 A_SpawnItem ("DistantRifle", 1, 1, 0, 0)
		SPID G 2 BRIGHT A_CustomBulletAttack (4, 4, 1, 9, "BulletPuffBig")
		TNT1 A 0 A_SpawnItem ("DistantRifle", 1, 1, 0, 0)
		SPID H 2 BRIGHT A_CustomBulletAttack (4, 4, 1, 9, "BulletPuffBig")
		TNT1 A 0 A_SpawnItem ("DistantRifle", 1, 1, 0, 0)
		SPID G 2 BRIGHT A_CustomBulletAttack (4, 4, 1, 9, "BulletPuffBig")
		TNT1 A 0 A_SpawnItem ("DistantRifle", 1, 1, 0, 0)
		SPID H 2 BRIGHT A_CustomBulletAttack (4, 4, 1, 9, "BulletPuffBig")
		TNT1 A 0 A_SpawnItem ("DistantRifle", 1, 1, 0, 0)
		SPID G 0 A_Jump (32, 2)
		SPID G 0 A_SpidRefire
		loop
		SPID H 0 A_SpidRefire
		goto See
	Pain:
		SPID I 4
		SPID I 4 A_Pain
		goto See
	Death:
		SPID J 1 A_ChangeFlag ("nodropoff", 0)
		SPID J 10 A_Scream

		SPID JJJJJJJ 2 A_SpawnItemEx ("HDSmoke", random(-36,36), random(-36,36), random(24,80), random(-1,1),random(-1,1), random(1,3),0,160)
		SPID K 0 bright A_SpawnItemEx ("HDExplosion", random(-34,34), random(-34,34), random(12,40), random(-1,1),random(-1,1), random(1,3))

		SPID KKKK 2 A_SpawnItemEx ("HDSmoke", random(-36,36), random(-36,36), random(24,80), random(-1,1),random(-1,1), random(1,3),0,160)
		SPID K 0 bright A_SpawnItemEx ("HDExplosion", random(-34,34), random(-34,34), random(12,40), random(-1,1),random(-1,1), random(1,3))
		SPID K 2 A_SpawnItemEx ("HDSmoke", random(-36,36), random(-36,36), random(24,80), random(-1,1),random(-1,1), random(1,3),0,160)


		SPID L 0 A_NoBlocking
		SPID LLLL 2 A_SpawnItemEx ("HDSmoke", random(-36,36), random(-36,36), random(24,80), random(-1,1),random(-1,1), random(1,3),0,160)
		SPID L 0 bright A_SpawnItemEx ("HDExplosionBoss", random(-24,24), random(-24,24), random(24,40), random(-1,1),random(-1,1), random(1,3))
		SPID L 2 A_SpawnItemEx ("HDExplosion", random(-36,36), random(-36,36), random(12,24), random(-1,1),random(-1,1), random(1,3))

		SPID M 3 bright A_SpawnItemEx ("HDExplosionBoss", random(-46,46), random(-46,46), random(24,40), random(-1,1),random(-1,1), random(1,3))
		SPID M 2 bright A_SpawnItemEx ("HDExplosion", random(-36,36), random(-36,36), random(12,24), random(-1,1),random(-1,1), random(1,3))
		SPID M 5 bright A_SpawnItemEx ("HDExplosionBoss", random(-46,46), random(-46,46), random(24,40), random(-1,1),random(-1,1), random(1,3))
		SPID M 5 bright A_SpawnItemEx ("HDExplosion", random(-46,46), random(-46,46), random(24,40), random(-1,1),random(-1,1), random(1,3))
		SPID M 2 A_Explode (512, 16)
		SPID M 0 bright Radius_Quake (5, 42, 4, 8, 0)

		SPID N 3 bright A_SpawnItemEx ("HDExplosion", random(-46,46), random(-46,46), random(24,40), random(-1,1),random(-1,1), random(1,3))
		SPID N 4 bright A_SpawnItemEx ("HDExplosionBoss", random(-46,46), random(-46,46), random(24,40), random(-1,1),random(-1,1), random(1,3))
		SPID N 3 bright A_SpawnItemEx ("HDExplosion", random(-46,46), random(-46,46), random(24,40), random(-1,1),random(-1,1), random(1,3))

		SPID O 3 bright A_SpawnItemEx ("HDExplosionBoss", random(-46,46), random(-46,46), random(20,36), random(-1,1),random(-1,1), random(1,3))
		SPID O 3 bright A_SpawnItemEx ("HDExplosion", random(-56,56), random(-56,56), random(20,36), random(-1,1),random(-1,1), random(1,3))
		SPID O 4 bright A_SpawnItemEx ("HDExplosionBoss", random(-56,56), random(-56,56), random(20,36), random(-1,1),random(-1,1), random(1,3))

		SPID PPQQR 4 bright A_SpawnItemEx ("HDSmoke", random(-56,56), random(-56,56), random(12,14), random(-1,1),random(-1,1), random(1,3),0,160)
		SPID R 0 A_SpawnItemEx ("SpiderRemains")
		TNT1 A 0 A_GivetoTarget("HDKillCount",1)
		TNT1 A 0 ACS_ExecuteAlways(558,0,0,1,500)
		SPID SSSSSSSSSSSSSS 5 A_SpawnItemEx ("HDSmoke", random(-66,66), random(-56,56), random(12,14), random(-1,1),random(-1,1), random(1,3),random(0,255),160)
		SPID S -1 A_BossDeath
		Stop
	}
}
actor SpiderRemains
{
	states
	{
	spawn:
		SPID R 0
	spawn2:
		SPID R 2 A_SpawnItemEx ("HDSmoke", random(-66,66), random(-56,56), random(12,14), random(-1,1),random(-1,1), random(1,3),0,160)
		SPID R 2 A_FadeOut (0.1)
		loop
	}
}