ACTOR BossBrainReplacer Replaces BossBrain
{
  Health 250
  Mass 10000000
  PainChance 255
  +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
  {
  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 ("EldritchAbomination",0,600,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 10 
		Stop	
  
  ReplaceDoom2Reloaded:
		TNT1 A 0
		TNT1 A 0 A_SetAngle(0)
		Goto ReplaceDoom2
		
  BrainExplode:
    MISL BBBBBBBC 1 Bright
    MISL D 1 A_BrainExplode
    Stop
	
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(x == 2880, "ReplaceDoom2")
	TNT1 A 0 A_JumpIf(x == -64, "ReplaceDoom2Reloaded")//D2Reloaded
	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
  Pain:
    BBRN B 36 A_BrainPain
    Goto Spawn2
  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
  }
}





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
  }
}