//===========================================================================
//
// Spider boss
//
//===========================================================================
ACTOR TheSpiderMastermind Replaces SpiderMastermind
{
    damagefactor "BFG", 0.2	damagefactor "Desintegrate", 0.4
    damagefactor "HKFT", 0.05
	damagefactor "Avoid", 1.0
	damagefactor "GibRemoving", 0.0	damagefactor "Trample", 0.0
	damagefactor "TeleportRemover", 0.0
	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	Obituary "%o was destroyed by a Mastermind."
	Painchance "Stomp", 255
	Painchance "Explosive", 255
	+NOICEDEATH
	Game Doom
	SpawnID 7
	Health 4000
	Radius 60
	Height 100
    damagefactor "Crush", 30.0
    Scale 1.1
	Mass 6000
	Speed 20
	PainChance 30
	PainChance "Cut", 5
	Painchance "Fatality", 90
	Monster
	//MinMissileChance 200
	DeathHeight 0
	BurnHeight 0
	+BOSS
	+FLOORCLIP
    +DONTRIP
	+DONTMORPH
	+BOSSDEATH
    +NORADIUSDMG
	+MISSILEMORE
	+SOLID
	+MISSILEEVENMORE
	+SHOOTABLE
	Bloodtype "MastermindBlood"
	DropItem "DemonStrengthRune" 25
	SeeSound "spider/sight"
	AttackSound "spider/attack"
	PainSound "SPIPAIN1"
	DeathSound "spider/death"
	ActiveSound "spider/active"
	obituary "$OB_SPIDER"
    damagefactor "Blood", 0.0
	MaxStepHeight 24
	MaxDropOffHeight 32
	Tag "Spiderdemon Mastermind"
	States
	{
	Pain.Killme:
	Pain.Taunt:
		TNT1 A 0
		TNT1 A 0 HealThing(1)
		Goto Missile
	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:
		SPID A 0
		TNT1 A 0 A_GiveInventory("TargetIsAMastermind")
		TNT1 A 0 A_JumpIf(x == 1600, "ReplaceForBOSS")
		TNT1 A 0 A_JumpIf(x == -2720, "ReplaceForMotherdemon1")
		TNT1 A 0 A_JumpIf(x == 0, "ReplaceForMotherdemon2")
		TNT1 A 0 ACS_NamedExecuteAlways("BDCHeckClassicMonsters", 0, 0, 0, 0)//Check if Vanilla Mode is activated
		Goto Stand
	
	ReplaceForBOSS:
		TNT1 A 0
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
		TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
		TNT1 A 0 ACS_NamedExecuteAlways("MapEnhancementE3M8")
		TNT1 A 0 A_SpawnItemEx("RocketBox", 64, 64)
		TNT1 A 0 A_SpawnItemEx("RocketBox", -64, 64)
		TNT1 A 0 A_SpawnItemEx("RocketBox", -64, -64)
		TNT1 A 0 A_SpawnItemEx("RocketBox", 64, -64)
		TNT1 A 0 A_SpawnItemEx ("SuperMastermind",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 10
		Stop
		
	ReplaceForMotherDemon1:
		TNT1 A 0
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_JumpIf(y != 32, "Stand")
		TNT1 A 0 A_JumpIf(z != -80, "Stand")
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
		TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
		TNT1 A 0 A_SpawnItemEx ("MotherDemon",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 10
		Stop	
		
		
	ReplaceForMotherDemon2:
		TNT1 A 0
		TNT1 A 0 A_JumpIf(y != 0, "Stand")
		TNT1 A 0 A_JumpIf(z != 48, "Stand")
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
		TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
		TNT1 A 0 A_SpawnItemEx ("MotherDemon",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 10
		Stop		
	
	Stand:	
		SPID A 10 A_Look
		Loop
		
	See:
		
		SPID A 2 A_Metal
		SPID A 2 A_Chase
		SPID B 2 A_Chase
		SPID B 2 A_Chase
		SPID C 2 A_Chase
		SPID C 2 A_Chase
		SPID D 2 A_Chase
		SPID D 2 A_Metal
		SPID E 2 A_Chase
		SPID E 2 A_Chase
		SPID F 2 A_Chase
		Loop

	Missile:
	    TNT1 A 0 A_TakeInventory ("BrutalCounter2", 500)
		TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
		TNT1 A 0 A_ChangeFlag("NODROPOFF", 0)
		SPID A 4 A_FaceTarget 
		SPID A 4 A_FaceTarget 
		SPID A 4 A_FaceTarget 
        SPID G 4 A_FaceTarget
		
		
		SPID G 3 A_FaceTarget
		SPID H 2 BRIGHT A_CustomMissile("MastermindTracer", 42, 0, random(-3, 3), 1, random(-2, 2))
		TNT1 A 0 A_SpawnItem ("MasterMindCaseSpawn", 0, 60,0)
		
		TNT1 A 0 A_GiveInventory ("BrutalCounter2", 1)
		TNT1 A 0 A_JumpIfInventory ("BrutalCounter2", 30, "StopFiring")
		SPID G 0 A_SpidRefire
		Goto Missile+7
	
	StopFiring:
		SPID A 6 A_FaceTarget 
		Goto See
	
	Avoid:
		 TNT1 A 0
		 TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
		 TNT1 A 0 A_ChangeFlag("NODROPOFF", 1)
         NULL A 0 A_FaceTarget
         SPID ABCD 1 A_FastChase
         NULL A 0 A_FaceTarget
         SPID ABCD 1 A_FastChase
		 NULL A 0 A_FaceTarget
		 TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
		 TNT1 A 0 A_ChangeFlag("NODROPOFF", 0)
		 Goto Missile+6
		
	Pain:
		SPID I 4 A_Pain
        Goto See

	Pain.Stomp:
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_Recoil(10)
		SPID I 2 A_Pain
		Goto See
		
	Pain.Explosive:
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_Recoil(10)
		SPID I 2 A_Pain
		Goto Avoid
		
	Death:
		SPID J 1
		SPID J 20 A_Scream
		tnt1 a 0 A_FaceTarget
		SPID K 10 A_NoBlocking
		TNT1 A 0 A_CustomMissile ("RidiculousExplosionSpawner", 30, 0, random (0, 360), 2, 90)
		SPID LM 5
		EXPL A 0 Radius_Quake (8, 100, 0, 22, 0)
        TNT1 A 0 //A_Explode(150, 300)
		TNT1 AAAAAAAAAA 0 A_CustomMissile ("PEPart2SuperFast", 32, 0, random (0, 360), 2, random (0, 160))
		TNT1 AAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 40, 0, random (0, 360), 2, random (40, 90))
		TNT1 AAAAAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 100, 0, random (0, 360), 2, random (40, 90))
        TNT1 AAA 0 A_CustomMissile ("MastermindLeg", 40, 0, random (0, 360), 2, random (40, 90))
		TNT1 A 0 A_SpawnItem ("GiantBloodSpot")
		
		TNT1 A 0 A_ChangeFlag("NOTARGET", 1)
		SPID NOPQR 5
        SPID S 300
		SPID S 1 A_BossDeath
		SPID S -1
		Stop
		
		
		
	Death.Stomp:
	Death.Telefrag:
	Death.Massacre:
		SPID J 0 A_Stop
		TNT1 A 0 A_NoBlocking
		SPID J 5 A_Scream
		tnt1 a 0 A_FaceTarget
		SPID K 3 
		SPID LM 3
		TNT1 AAA 0 A_CustomMissile ("XDeath2", 42, 0, random (0, 360), 2, random (0, 160))
		TNT1 AAA 0 A_CustomMissile ("XDeath3", 42, 0, random (0, 360), 2, random (0, 160))
		TNT1 AAAA 0 A_CustomMissile ("BloodMistXXBig", 50, 0, random (0, 360), 2, random (40, 90))
		TNT1 AAAAAAAAAA 0 A_CustomMissile ("BloodMistBig", 50, 0, random (0, 360), 2, random (40, 90))
		TNT1 A 0 A_SpawnItem ("GiantBloodSpot")
		TNT1 A 0 A_SpawnItem ("StompedMastermind")
		TNT1 A 200
		SPID S 0 A_BossDeath
		Stop	
		
	
	
		
    Crush:
		TNT1 A 0
		TNT1 AAAA 0 A_SpawnItemEx ("BodyRemovalThing",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 1 A_XScream
		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		
		
		
	Death.Fatality:
	    TNT1 A 0
		TNT1 A 0 A_GiveToTarget("SoulAmmo", 10)
		TNT1 A 0 A_FaceTarget
		TNT1 AAAAA 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0, 0, 20, random (-1, 1), random (-1, 1), 8)
		TNT1 AAAAA 0 A_SpawnItemEx("ArmorShardFatalityBonus", 0, 0, 20, random (-1, 1), random (-1, 1), 8)
		TNT1 A 0 A_Pain
        TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_JumpIfIntargetInventory("IsPlayer", 1, 1)
		Goto Death
		TNT1 A 0 A_GiveToTarget("GoFatality", 1)
		TNT1 A 0 A_GiveToTarget("MastermindFatality", 1)
		TNT1 A 500
		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 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
    }
}




ACTOR StompedMastermind
{
    Radius 56
    Height 32
    Scale 1.0
	+SHOOTABLE
	+NOBLOOD
	DamageFactor "Trample", 0.0
	DamageFactor "Stomp", 0.0
	Health 300
	Mass 999999
    States
    {
     Spawn:
        FTS2 F 10
		TNT1 A 0 A_ChangeFlag("SOLID", 1)
		FTS2 F -1
        Stop
    
	Death:
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_Explode(300, 400)
		TNT1 A 0 A_CustomMissile ("RidiculousExplosionSpawner", 30, 0, random (0, 360), 2, 90)
		EXPL A 0 Radius_Quake (8, 100, 0, 22, 0)
		TNT1 AAAAAAAAAA 0 A_CustomMissile ("PEPart2SuperFast", 32, 0, random (0, 360), 2, random (0, 160))
		TNT1 AAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 40, 0, random (0, 360), 2, random (40, 90))
		TNT1 AAAAAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 100, 0, random (0, 360), 2, random (40, 90))
        TNT1 AAA 0 A_CustomMissile ("MastermindLeg", 40, 0, random (0, 360), 2, random (40, 90))
		SPID S 1
		SPID S -1
		Stop
    }
}








ACTOR Titan
{
    damagefactor "BFG", 0.2	damagefactor "Desintegrate", 0.4
    damagefactor "HKFT", 0.05
	damagefactor "Avoid", 1.0
	damagefactor "GibRemoving", 0.0	damagefactor "Trample", 0.0
	damagefactor "TeleportRemover", 0.0
	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	Obituary "%o was destroyed by a Mastermind."
	Painchance "Stomp", 255
	Painchance "Explosive", 255
	+NOICEDEATH
	Game Doom
	SpawnID 7
	Health 100000
	Radius 160
	Height 640
    damagefactor "Crush", 30.0
    Scale 5.0
	Mass 996000
	Speed 80
	MaxStepHeight 400
	MaxDropOffHeight 400
	PainChance 30
	Painchance "Fatality", 90
	Monster
	//MinMissileChance 200
	DeathHeight 0
	BurnHeight 0
	+BOSS
	+FLOORCLIP
    +DONTRIP
	+DONTMORPH
	+BOSSDEATH
    +NORADIUSDMG
    +NOBLOOD
	+MISSILEMORE
	+SOLID
	+MISSILEEVENMORE
	+SHOOTABLE
	DropItem "DemonStrengthRune" 25
	SeeSound "spider/sight"
	AttackSound "spider/attack"
	PainSound "SPIPAIN1"
	DeathSound "spider/death"
	ActiveSound "spider/active"
	obituary "$OB_SPIDER"
    damagefactor "Blood", 0.0
	States
	{
	
    Spawn:
		KPRM A 10 A_Look
		Loop
		
	See:
		KPRM A 20 A_Explode(9999, 600)
		KPRM BBBBB 2 A_Chase("", "")
		KPRM C 20 A_Explode(9999, 600)
		KPRM DDDDD 2 A_Chase("", "")
		Loop
	}
}