ACTOR BossBrainReplacer Replaces BossBrain
{
  Health 250
  Mass 10000000
  PainChance 255
  Height 80
  +SOLID
  +SHOOTABLE
  +NOICEDEATH
  +OLDRADIUSDMG
  MONSTER
  PainSound "brain/pain"
  DeathSound "brain/death"
  damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0    damagefactor "Avoid", 0.0
  damagefactor "Shrapnel", 0.0	damagefactor "KillMe", 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
  States
  {
 
	
  Spawn:
	TNT1 A 0
	
	TNT1 A 0 A_JumpIf(x == 2880, "ReplaceDoom2Check")
	TNT1 A 0 A_JumpIf(x == -64, "ReplaceDoom2Reloaded")//D2Reloaded
	TNT1 A 0 A_JumpIf(x == 3072, "EvidenceTNTMap30")
	TNT1 A 0 A_JumpIf(x == -3648, "EvidencePlutoniaMap30")
	TNT1 A 0 A_JumpIf(x == -128, "EvidenceAVMap30")
	TNT1 A 0 A_JumpIf(x == 7940, "EvidenceEPICMap30")
	TNT1 A 0 A_JumpIf(x == -2496, "EvidenceWOSMap30")
	TNT1 A 0 A_JumpIf(x == 448, "EvidencePL2Map30")
	TNT1 A 0 A_JumpIf(x == 4608, "EvidencePLCRMap30")
	MARN A 0 ACS_ExecuteAlways(177, 0, 0, 0, 0)//Check if you are playing on an Wolfenstein level
	TNT1 A 0 Thing_ChangeTID(0,748)
	BBRN A 1

  Spawn2:	
    BBRN A 3
	TNT1 A 0 A_JumpIfInventory("AltEasyMarineVerification", 1, "IsPlayingAlt")
	BBRN A 100
    Loop
	
	EvidenceTNTMap30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(y == -1472, "ConfirmTNTMAP30")
			Stop		
			
	ConfirmTNTMAP30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(z == 224, "IsTNTMap30")
			Stop	

			
		IsTNTMAP30:
			TNT1 A 0
			TNT1 A 0 A_SetAngle(90)
			TNT1 A 0 ACS_ExecuteALways(290)
			TNT1 A 0 A_SpawnItemEx ("GateKeeper",608,0,-9999,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			GOTO sPAWN2
			
			
		EvidencePlutoniaMap30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(y == 6080, "ConfirmPlutoniaMAP30")
			Stop		
			
	    ConfirmPlutoniaMAP30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(z == 14, "IsPlutoniaMap30")
			Stop	

			
		IsPlutoniaMap30:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("GateKeeper",320,0,-9999,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			GOTO sPAWN2	
			
			
		EvidenceAVMap30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(y == 6026, "ConfirmAVMAP30")
			TNT1 A 0 A_JumpIf(y == 6048, "ConfirmAVMAP30")
			Stop		
			
	    ConfirmAVMAP30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(z == 14, "IsAVMap30")
			Stop	

			
		IsAVMap30:
			TNT1 A 0
			TNT1 A 0 A_SetANgle(0)
			Goto ReplaceDoom2
			
			
			
		EvidenceEPICMap30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(y == -1224, "ConfirmEPICMAP30")
			Stop		
			
	    ConfirmEPICMAP30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(z == 208, "IsEPICMap30")
			Stop	

			
		IsEPICMap30:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("GateKeeper",224,64,-9999,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			GOTO sPAWN2	
			
			
		//////////////
		
		
		EvidencePL2Map30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(y == 280, "ConfirmPL2MAP30")
			Stop		
			
	    ConfirmPL2MAP30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(z == 128, "IsPL2Map30")
			Stop	

			
		IsPL2Map30:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("GateKeeper",328,0,-9999,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			GOTO sPAWN2	
			
			
		EvidencePLCRMap30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(y == 416, "ConfirmPLCRMAP30")
			Stop		
			
	    ConfirmPLCRMAP30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(z == 64, "IsPLCRMap30")
			Stop	

			
		IsPLCRMap30:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("DeletusVeryLarge",304,0,100,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0
			Stop
			
   ReplaceDoom2:
		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_ExecuteALways(230)
		TNT1 A 0 A_SpawnItemEx ("GateKeeperMeatBase",0,600,-50,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 0 A_SpawnItemEx ("GateKeeperMeat1",0,580,-70,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 0 A_SpawnItemEx ("GateKeeperMeat2",15,540,-100,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 0 A_SpawnItemEx ("GateKeeperMeat3",-15,500,-120,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 0 A_SpawnItemEx ("GateKeeperMeat1",-25,460,-100,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 0 A_SpawnItemEx ("GateKeeperMeat2",-15,420,-80,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 0 A_SpawnItemEx ("GateKeeperMeat3",0,400,-60,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 0 A_SpawnItemEx ("GateKeeperMeat2",20,360,-20,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 0 A_SpawnItemEx ("GateKeeperMeat1",5,320,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 0 A_SpawnItemEx ("GateKeeperMeat3",0,280,10,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 0 A_SpawnItemEx ("IconOfSin",0,600,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		BBRN A 1
		BBRN A -1
		Loop
		
  		
  
  ReplaceDoom2Reloaded:
		TNT1 A 0
		TNT1 A 0 A_SetAngle(0)
		Goto ReplaceDoom2
		
		
  ReplaceDoom2Check:
		TNT1 A 0
		TNT1 A 0 A_JumpIf(y == 1648, "ReplaceDoom2")
		BBRN A 1
		BBRN A -1
		Loop
		
		
	EvidenceWOSMap30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(y == 2536, "ConfirmWOSMAP30")
			Stop		
			
	    ConfirmWOSMAP30:
			TNT1 A 1
			TNT1 A 0 A_JumpIf(z == -128, "IsWOSMap30")
			Stop	

			
		IsWOSMap30:
			TNT1 A 0
			TNT1 A 0 ThrustThingZ(0, 99999, 0, 1)
			TNT1 A 5
			TNT1 A 0 A_SetANgle(0)
			Goto ReplaceDoom2	
		
  BrainExplode:
    MISL BBBBBBBC 1 Bright
    MISL D 1 A_BrainExplode
    Stop	
	
  Pain:
    BBRN B 36 A_BrainPain
    Goto Spawn2
  Death:
			TNT1 AAAAAAAAAAAAAA 0 A_CustomMissile ("BloodMistExtraBig", 50, 0, random (0, 360), 2, random (20, 90))
		TNT1 AAAAAAAAAAAA 0 A_CustomMissile ("SuperGoreMist", 54, 0, random (0, 360), 2, random (30, 90))
		TNT1 AAAAAAAA 0 A_CustomMissile ("SuperGoreSpawner2", 64, 0, random (0, 360), 2, random (20, 40))
		 TNT1 AA 0 A_CustomMissile ("XDeath1", 52, 0, random (0, 360), 2, random (10, 90))
		 TNT1 A 0 A_CustomMissile ("XDeath2", 52, 0, random (0, 360), 2, random (10, 90))
		 TNT1 A 0 A_CustomMissile ("XDeath3", 52, 0, random (0, 360), 2, random (10, 90))
		 TNT1 A 0 A_CustomMissile ("XDeath4", 52, 0, random (0, 360), 2, random (10, 90))
		 TNT1 AA 0 A_CustomMissile ("XDeathSkinPiece2", 65, 0, random (0, 360), 2, random (10, 90))
		 TNT1 AA 0 A_CustomMissile ("XDeathSkinPiece1", 65, 0, random (0, 360), 2, random (10, 90))
		 TNT1 A 0 A_CustomMissile ("XDeathOrgan1", 24, 0, random (0, 360), 2, random (10, 90))
		 TNT1 A 0 A_CustomMissile ("XDeathOrgan2", 24, 0, random (0, 360), 2, random (10, 90))
		 TNT1 A 0 A_SpawnItem ("BigBloodSpot")
    TNT1 A 100 A_BrainScream
    TNT1 AA 10
    TNT1 A -1 A_BrainDie
    Stop
	
	Death.Crush:
    BBRN A 1 A_BrainScream
    BBRN AA 1
    BBRN A -1 A_BrainDie
    Stop
	
	
	IsPlayingAlt:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
		TNT1 A 0 A_ChangeFlag("NOTARGET", 1)
		TNT1 A 0 A_ChangeFlag("NOBLOCKMAP", 1)
		TNT1 A 0 A_SpawnItemEx("AltMap01Airplane", 0, 0, 28, 0, 0, 0, 0, SXF_TRANSFERPOINTERS | SXF_TRANSFERAMBUSHFLAG)
		Stop
  }
}





ACTOR AltMap01Airplane
{
  Health 250
  Mass 10000000
  PainChance 255
  +SOLID
  +SHOOTABLE
  +NOICEDEATH
  +OLDRADIUSDMG
  PainSound "brain/pain"
  DeathSound "brain/death"
  damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0    damagefactor "Avoid", 0.0
  damagefactor "Shrapnel", 0.0	damagefactor "KillMe", 0.0  damagefactor "TeleportRemover", 0.0
  States
  {
  BrainExplode:
    MISL BC 10 Bright
    MISL D 10 A_BrainExplode
    Stop
  Spawn:
	TNT1 A 1
	TNT1 A 0 A_SetAngle(90)
	TNT1 A 0 A_SpawnItemEx("AltMap01CloudSpawner", 1100, 0, 0)
  Spawn2:	
	TNT1 A 0 A_PlaySoundEx("AMBAIRP", 1, 1)
	TNT1 A 10
    Loop
  Pain:
    BBRN B 36 A_BrainPain
    Goto Spawn
  Death:
    BBRN A 100 A_BrainScream
    BBRN AA 10
    BBRN A -1 A_BrainDie
    Stop
	
	IsPlayingAlt:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
		TNT1 A 0 A_ChangeFlag("NOTARGET", 1)
		TNT1 A 0 A_ChangeFlag("NOBLOCKMAP", 1)
		TNT1 A 0 A_SpawnItemEx("AltMap01Airplane", 0, 0, 28, 0, 0, 0, 0, SXF_TRANSFERPOINTERS | SXF_TRANSFERAMBUSHFLAG)
		Stop
  }
}