//===========================================================================
//
// Spider boss
//
//===========================================================================
ACTOR TheSpiderMastermind Replaces SpiderMastermind
{
    damagefactor "BFG", 0.2
    damagefactor "HKFT", 0.05
    //damagefactor "Head", 1.5
	damagefactor "Explosive", 1.5
	damagefactor "Avoid", 0.0
	damagefactor "Decaptate", 5.0
	damagefactor "Stomp", 0.0
	damagefactor "GibRemoving", 0.0
	damagefactor "Trample", 0.0
	damagefactor "TeleportRemover", 0.0
	DamageFactor "CauseObjectsToSplash", 0.0
	Obituary "%o was destroyed by a Mastermind."
	+NOICEDEATH
	Game Doom
	SpawnID 7
	Health 4000
	Radius 90
    damagefactor "Crush", 30.0
    Scale 1.5
	Height 72
	Mass 500000
	Speed 20
	PainChance 30
	PainChance "Explosive", 80
	Monster
	//MinMissileChance 200
	+BOSS
	+FLOORCLIP
    +DONTRIP
	+DONTMORPH
	+BOSSDEATH
    +NORADIUSDMG
    +NOBLOOD
	+MISSILEMORE
	+SOLID
	+MISSILEEVENMORE
	+SHOOTABLE
	DropItem "DemonStrengthRune" 25
	SeeSound "spider/sight"
	AttackSound "spider/attack"
	PainSound "spider/pain"
	DeathSound "spider/death"
	ActiveSound "spider/active"
	obituary "$OB_SPIDER"
    damagefactor "Blood", 0.0
	MaxStepHeight 24
	MaxDropOffHeight 32
	States
	{
	Death.KillMe:
    Death.Taunt:
	    TNT1 A 0 A_ChangeFlag("SOLID", 0)
        TNT1 A 0 A_SpawnItem("TheSpiderMastermind")
        Stop
	ReplaceVanilla:
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
		TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
		TNT1 A 0 A_SpawnItemEx ("VanillaSpiderMastermind",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		Stop
    Spawn:
		TNT1 A 0
		TNT1 A 0 A_GiveInventory("TargetIsAMastermind")
		TNT1 A 0 ACS_ExecuteAlways(796, 0, 0, 0, 0)//Check if Vanilla Mode is activated
		
	Stand:	
		SPID A 10 A_Look
		Loop
		
	See:
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID A 2 A_Metal
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID A 2 A_Chase
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID B 2 A_Chase
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID B 2 A_Chase


		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID C 2 A_Chase
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID C 2 A_Chase
		
		TNT1 A 0 A_SpawnItemEx("MasterMindStep", 90, 90)
		TNT1 A 0 A_SpawnItemEx("MasterMindStep", -90, 90)
		
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID D 2 A_Chase
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID D 2 A_Metal

		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID E 2 A_Chase
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID E 2 A_Chase
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID F 2 A_Chase
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		
		TNT1 A 0 A_SpawnItemEx("MasterMindStep", 90, -90)
		TNT1 A 0 A_SpawnItemEx("MasterMindStep", -90, -90)
		Loop

	Missile:
	    TNT1 A 0 A_TakeInventory ("BrutalCounter2", 500)
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
		SPID A 4 A_FaceTarget 
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
		SPID A 4 A_FaceTarget 
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
		SPID A 4 A_FaceTarget 
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
        SPID H 4 A_FaceTarget
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
		TNT1 AAAAAAAAAAAAAAAAA 0
		
		
		
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
		SPID G 2 A_FaceTarget
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
		SPID H 2 BRIGHT A_CustomMissile("MastermindTracer", 72, 0, random(-7, 7), 1, random(-4, 2))
		TNT1 A 0 A_SpawnItem ("MasterMindCaseSpawn", 0, 60,0)
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
		TNT1 A 0 A_GiveInventory ("BrutalCounter2", 1)
		TNT1 A 0 A_JumpIfInventory ("BrutalCounter2", 30, "StopFiring")
		SPID G 0 A_SpidRefire
		Goto Missile+20
	
	StopFiring:
	TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
	SPID A 6 A_FaceTarget 
	Goto See
	
		Avoid:
         NULL A 0 A_FaceTarget
         SPID A 6 A_FastChase
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
         NULL A 0 A_FaceTarget
         SPID B 6 A_FastChase
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
		 NULL A 0 A_FaceTarget
         SPID C 6 A_FastChase
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
         NULL A 0 A_FaceTarget
         SPID D 6 A_FastChase 
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 81,0)
		 Goto Missile
		
	Pain:
		TNT1 A 0 A_SpawnItem("MasterMindHitBox", 0, 72,0)
		SPID I 4 A_Pain
        Goto See






	Death:
		SPID J 20 A_Scream
		tnt1 a 0 A_FaceTarget
		EXPL A 0 Radius_Quake (8, 100, 0, 22, 0)
        TNT1 AAAAAA 0 A_CustomMissile ("ExplosionSpawner", 50, 0, random (0, 360), 2, random (0, 360))
        TNT1 AAAA 0 A_CustomMissile ("SuperGoreSPawner", 110, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 90, 0, random (0, 360), 2, random (70, 90))
		SPID K 10 A_NoBlocking
        TNT1 AAAAAA 0 A_CustomMissile ("ExplosionSpawner", 10, 0, random (0, 360), 2, random (0, 360))
        TNT1 AAAA 0 A_CustomMissile ("UltraGoreSPawner", 80, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 90, 0, random (0, 360), 2, random (70, 90))
		SPID L 5
        TNT1 AAAA 0 A_CustomMissile ("MuchMeatDeath", 0, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("RidiculousExplosionSpawner", 30, 0, random (0, 360), 2, 90)
		TNT1 AAAAAAAAAAAA 0 A_CustomMissile ("PEPart2SuperFast", 32, 0, random (0, 360), 2, random (0, 160))
        TNT1 AAAA 0 A_CustomMissile ("UltraGoreSPawner", 30, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAA 0 A_CustomMissile ("UltraGoreSpawner", 30, 0, random (0, 360), 2, random (0, 180))
		TNT1 AAAAAAAAAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 30, 0, random (0, 360), 2, random (70, 90))
		 TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 100, 0, random (0, 360), 2, random (20, 90))
        //SPID MNOPQR 5
		TNT1 AAA 0 A_CustomMissile ("MastermindLeg", 30, 0, random (0, 360), 2, random (40, 90))
		TNT1 A 0 A_CustomMissile ("MastermindLeg", 30, 0, 0, 2, 65)
		//TNT1 AAAAAAAAAAAA 0 A_CustomMissile ("PEPart2SuperFast", 32, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("GiantBloodSpot")
        SPID S 300
		SPID S 1 A_BossDeath
		SPID S -1
		Stop
		
	Death.Telefrag:
		SPID J 20 A_Scream
		tnt1 a 0 A_FaceTarget
		EXPL A 0 Radius_Quake (8, 100, 0, 22, 0)
        TNT1 AAAAAA 0 A_CustomMissile ("ExplosionSpawner", 50, 0, random (0, 360), 2, random (0, 360))
        TNT1 AAAA 0 A_CustomMissile ("SuperGoreSPawner", 110, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 90, 0, random (0, 360), 2, random (70, 90))
		SPID K 10 A_NoBlocking
        TNT1 AAAAAA 0 A_CustomMissile ("ExplosionSpawner", 10, 0, random (0, 360), 2, random (0, 360))
        TNT1 AAAA 0 A_CustomMissile ("UltraGoreSPawner", 80, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 90, 0, random (0, 360), 2, random (70, 90))
		SPID L 5
        TNT1 AAAA 0 A_CustomMissile ("MuchMeatDeath", 0, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("RidiculousExplosionSpawner", 30, 0, random (0, 360), 2, 90)
		TNT1 AAAAAAAAAAAA 0 A_CustomMissile ("PEPart2SuperFast", 32, 0, random (0, 360), 2, random (0, 160))
        TNT1 AAAA 0 A_CustomMissile ("UltraGoreSPawner", 30, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAA 0 A_CustomMissile ("UltraGoreSpawner", 30, 0, random (0, 360), 2, random (0, 180))
		TNT1 AAAAAAAAAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 30, 0, random (0, 360), 2, random (70, 90))
		 TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 100, 0, random (0, 360), 2, random (20, 90))
        //SPID MNOPQR 5
		TNT1 AAA 0 A_CustomMissile ("MastermindLeg", 30, 0, random (0, 360), 2, random (40, 90))
		TNT1 A 0 A_CustomMissile ("MastermindLeg", 30, 0, 0, 2, 65)
		//TNT1 AAAAAAAAAAAA 0 A_CustomMissile ("PEPart2SuperFast", 32, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("GiantBloodSpot")
        TNT1 A 300
		TNT1 A 1 A_BossDeath
		TNT1 A -1
		Stop
		
    Crush:
        TNT1 A 0 A_PlaySound("misc/xdeath4")
        CRS3 A 5
        CRS3 A -1
        Stop
		
		
Death.Cut:
Death.Saw:
Death.decaptate:
		TNT1 AAAAAAAAAAAAAAAAA 0 A_CustomMissile ("XDeath1", 120, 0, random (0, 360), 2, random (50, 130))
		TNT1 A 0 A_CustomMissile ("XSpiderMastermindCuttedBrain", 120, 0, random (0, 360), 2, random (50, 130))
		SPIY AAAAAAAAAAA 8 A_SpawnItem("MuchBlood", 0, 120)
		
		EXPL A 0 Radius_Quake (8, 100, 0, 22, 0)
        TNT1 AAAAAA 0 A_CustomMissile ("ExplosionSpawner", 50, 0, random (0, 360), 2, random (0, 360))
        TNT1 AAAA 0 A_CustomMissile ("SuperGoreSPawner", 110, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 90, 0, random (0, 360), 2, random (70, 90))
		SPID K 10 A_NoBlocking
        TNT1 AAAAAA 0 A_CustomMissile ("ExplosionSpawner", 10, 0, random (0, 360), 2, random (0, 360))
        TNT1 AAAA 0 A_CustomMissile ("UltraGoreSPawner", 80, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 90, 0, random (0, 360), 2, random (70, 90))
		SPID L 5
        TNT1 AAAA 0 A_CustomMissile ("MuchMeatDeath", 0, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("RidiculousExplosionSpawner", 30, 0, random (0, 360), 2, 90)
		TNT1 AAAAAAAAAAAA 0 A_CustomMissile ("PEPart2SuperFast", 32, 0, random (0, 360), 2, random (0, 160))
        TNT1 AAAA 0 A_CustomMissile ("UltraGoreSPawner", 30, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAA 0 A_CustomMissile ("UltraGoreSpawner", 30, 0, random (0, 360), 2, random (0, 180))
		TNT1 AAAAAAAAAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 30, 0, random (0, 360), 2, random (70, 90))
		 TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 100, 0, random (0, 360), 2, random (20, 90))
        //SPID MNOPQR 5
		TNT1 AAA 0 A_CustomMissile ("MastermindLeg", 30, 0, random (0, 360), 2, random (40, 90))
		TNT1 A 0 A_CustomMissile ("MastermindLeg", 30, 0, 0, 2, 65)
		//TNT1 AAAAAAAAAAAA 0 A_CustomMissile ("PEPart2SuperFast", 32, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("GiantBloodSpot")
        TNT1 A 300
		TNT1 A 0 A_BossDeath
		Stop		
	}
}


ACTOR XSpiderMastermindCuttedBrain
{
    Radius 8
    Height 8
    Speed 10
    Scale 1.2
	Mass 1
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +MOVEWITHSECTOR
    +CLIENTSIDEONLY
    +RIPPER
    +BLOODLESSIMPACT 
	-DONTSPLASH
	+THRUGHOST
damagetype Blood
    SeeSound "misc/xdeath4"
    DeathSound "misc/xdeath1"
	Decal BrutalBloodSplat
	Mass 1
    States
    {
    Spawn:
	    TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
        SPIP ABCDEFGH 3 A_CustomMissile ("Brutal_FlyingBloodTrail", 0, 0, random (0, 360), 2, random (0, 360))
        Loop
    Death:
        TNT1 A 0 A_SpawnItem("Brutal_BloodSpot",0,0,0,1)
        SPIP I 1
		SPIP I -1
        Stop
     Splash:
        TNT1 A 0
        Stop
    }
}


ACTOR CyberStomp
{
	Radius 12
	Height 8
	+MISSILE
	Speed 15
    Damage 50
	renderstyle translucent
	alpha 0.75
	DamageType Stomp
    MeleeDamage 0
    Gravity 2.0
    Decal "Cracks"
    -NOGRAVITY
    +EXTREMEDEATH
    Health 5
	States
	{
	Spawn:
        TNT1 A 10
		Stop
	Death:

NULL A 0 A_CustomMissile("FootStep6", 0, 0, 150)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -150)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -30)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 30)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -60)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 60)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -90)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 90)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -120)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 120)
        TNT1 A 0 A_SpawnItemEx("FootStep5", 0, 0, 40, 0, 0)
          TNT1 A 0 A_PlaySound("CLAP")
		TNT1 AAAAAAAAAAAA 0 A_custommissile("HugeWallChunk",0,0,random(0,360),2,random(-40,40))
        TNT1 AAAAAAAAAAAA 0 A_custommissile("BigWallChunk",0,0,random(0,360),2,random(-40,40))
		EXPL AAA 0 A_CustomMissile ("BigSmokes", 0, 0, random (0, 360), 2, random (0, 360))
		EXPL AAA 0 A_CustomMissile ("ExplosionSmoke", 0, 0, random (0, 360), 2, random (0, 360))
		
		EXPL A 0 A_Explode
		MNSM ABCDEFGHIJKLMNOPQ 1 bright
		Stop
	}
}



ACTOR CyberStompBig
{
	Radius 12
	Height 8
	+MISSILE
	Speed 15
    Damage 50
	renderstyle translucent
	alpha 0.75
	DamageType Stomp
    MeleeDamage 0
    Gravity 2.0
    Decal "Cracks"
    -NOGRAVITY
    +EXTREMEDEATH
    Health 5
	States
	{
	Spawn:
        TNT1 A 10
		Stop
	Death:

NULL A 0 A_CustomMissile("FootStep6", 0, 0, 150)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -150)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -30)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 30)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -60)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 60)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -90)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 90)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -120)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 120)
        TNT1 A 0 A_SpawnItemEx("FootStep5", 0, 0, 40, 0, 0)
          TNT1 A 0 A_PlaySound("CLAP")
		TNT1 AAAAAAAAAAAA 0 A_custommissile("HugeWallChunk",0,0,random(0,360),2,random(-40,40))
        TNT1 AAAAAAAAAAAA 0 A_custommissile("BigWallChunk",0,0,random(0,360),2,random(-40,40))
		EXPL AAA 0 A_CustomMissile ("BigSmokes", 0, 0, random (0, 360), 2, random (0, 360))
		EXPL AAA 0 A_CustomMissile ("ExplosionSmoke", 0, 0, random (0, 360), 2, random (0, 360))
		
		EXPL A 0 A_Explode(300, 300, 0)
		MNSM ABCDEFGHIJKLMNOPQ 1 bright
		Stop
	}
}






ACTOR MastermindStep
{
	Radius 32
	Height 32
	Speed 0
    Damage 50
	renderstyle translucent
	alpha 0.75
	DamageType Stomp
    MeleeDamage 0
    Gravity 2.0
	Scale 0.4
    Decal "Cracks"
    -NOGRAVITY
    +EXTREMEDEATH
	//MONSTER
	//-COUNTKILL
	//+SHOOTABLE
	//+NOBLOOD
	//Health 50000
	Obituary "%o has stepped by a Mastermind."
    Health 5
	States
	{
	Spawn:
     
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 150)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -150)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -30)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 30)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -60)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 60)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -90)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 90)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, -120)
NULL A 0 A_CustomMissile("FootStep6", 0, 0, 120)
        TNT1 A 0 A_SpawnItemEx("FootStep5", 0, 0, 40, 0, 0)
		EXPL AAA 0 A_CustomMissile ("ExplosionSMoke", 0, 0, random (0, 360), 2, random (0, 360))
		
		EXPL A 0 A_Explode(300, 50, 0)
		TNT1 A 4
		MNSM ABCDEFGHIJKLMNOPQ 0
		Stop
	}
}
















ACTOR MastermindLeg
{
    Radius 8
    Height 8
    Speed 24
    Scale 1.3
	Gravity 0.8
	Mass 1
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +MOVEWITHSECTOR
	+THRUACTORS
	+FLOORCLIP
	-NOGRAVITY
	+FORCERADIUSDMG
	+SKYEXPLODE
    damagetype Stomp
    SeeSound "misc/xdeath4"
    DeathSound "misc/xdeath1"
	Decal BrutalBloodSplat
	Mass 1
    States
    {
    Spawn:
	    TNT1 A 0 A_JumpIf(waterlevel > 1, "Underwater")
        SPP4 ABCDEFGH 5
        Loop
    Death:
	    TNT1 A 0 ThrustThingZ(0,50,0,1)
		TNT1 A 0 A_Explode(300, 100)
		EXPL AAAAAAA 0 A_CustomMissile ("ExplosionSMoke", 0, 0, random (0, 360), 2, random (0, 360))
		Goto KeepRotating
	KeepRotating:	
        SPP4 AB 2
		SPP4 CDEFGH 2 A_CheckFloor("Rest")
		Loop
	Rest:	
	    SPP4 A 1
		TNT1 A 0 A_Explode(50, 100)
		EXPL AAAAAAA 0 A_CustomMissile ("ExplosionSMoke", 0, 0, random (0, 360), 2, random (0, 360))
		SPP4 A -1
        Stop
		
     Underwater:
	 Splash:
	    SPP4 A 4
        Loop
    }
}