actor BaronOfHellClass : Playerpawn
{
  health 1000
  gibhealth 99999 //added - actor can not be gibbed
  radius 24
  height 64
  mass 1000
  speed 0.50 //0.4
  painchance 50
  Player.DisplayName "BaronOfHell"
  Player.MaxHealth 1000
  Player.ViewHeight 54
  Player.SoundClass BaronOfHellClass 
  Player.JumpZ 6//5
  Player.MorphWeapon "BaronHand"
  Player.WeaponSlot 1, BaronHand
  BloodColor "darkgreen"
  
  DamageFactor "Suicide", 0 // puppetmaster can not suicide a monster
  DamageFactor "MarineDamage", 0.6
  DamageFactor "MarineRLDamage", 0.6
  DamageFactor "BFGSplash", 0.6
  DamageFactor "MarineRail", 0.6
  
  DamageFactor "CybRLDamage", 0.25
  DamageFactor "ImpBallDamage", 0
  DamageFactor "CacoDamage", 0
  DamageFactor "SkelDamage", 0
  DamageFactor "FatsoDamage", 0
  DamageFactor "KnightDamage", 0
  DamageFactor "ArachDamage", 0
  DamageFactor "viledamage", 0
  DamageFactor "Control", 0
  DamageFactor "ZombiesDamage", 0
  DamageFactor "Slime", 0
  
  -PICKUP
  +NOSKIN
  +NOPAIN
  -FRIENDLY
  +NOTARGET
  +LONGMELEERANGE //added
  +NOTRIGGER //added - avoid issues in level design
  
  states
  {
  Spawn:
	BOSS AB 10
    loop
  See:
    BOSS A 1 A_Jump (240,2) //0
	BOSS A 0 A_PlaySoundEx ("baron/active","body")
	BOSS AABBCCDD 3
    loop
  Missile:
    BOSS E 8 
	BOSS F 8 bright 
    BOSS G 9 bright
    goto See   
  Death:
    BOSS I 8 A_GiveToTarget ("MarineExp",7)
    BOSS J 8 A_PlaySoundEx ("baron/death","body")
    BOSS K 8 Thing_changeTid(144,0)
    BOSS L 8 A_NoBlocking
    BOSS MN 8 
	BOSS O 1 A_SpawnItemEx ("MDeathGhost",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0) //0
	BOSS O -1
	stop	
  }
}

// Weapon

ACTOR BaronHand : Weapon
{
  obituary "%o was bruised by %k."
  hitobituary "%o was ripped open by %k."
  weapon.kickback 100
  attacksound "baron/melee"
  weapon.ammouse 0
  +WEAPON.NOALERT
  +ammo_optional
  +Alt_Ammo_Optional
  +WEAPON.CHEATNOTWEAPON
  //+INVENTORY.UNDROPPABLE //added
  +WEAPON.NOAUTOAIM

  states
  {
  Spawn:
    TNT1 A 0 Thing_Remove (0)
    Stop
  Select:
    BHND A 1 A_Raise
	goto ready
  Ready:
    BHND FAEA 2 A_WeaponReady
    //TNT1 A 0 A_JumpIfInventory ("Mskull",0,6)
    //BHND FAEA 2 A_WeaponReady
    //TNT1 A 0 A_JumpIfInventory ("Mskull",3,1)
    BHND F 0 HealThing(5)	
    Loop
  DeSelect:
    BHND A 1 A_Lower
    Loop
  Fire:
    BHND A 0 A_JumpIfCloser (130,"Melee") //80
	BHND A 0 A_JumpIfInventory ("PM_AltFireX",1,"AltFireX")
	BHND A 0 A_JumpIfInventory ("PM_AltFireY",1,"AltFireY")
    BHND A 6 
	//TNT1 A 0 SetPlayerProperty (0, 1, 0)
	BHND B 6 
	BHND C 7 
	BHND D 7 A_FireCustomMissile ("KnightBallAd",0,0,0,15,0)
	//TNT1 A 0 SetPlayerProperty (0, 0, 0)
    Goto Ready
	
  AltFireX:
	BHND A 6 
	BHND B 6 
	BHND C 7 
	BHND D 1 A_FireCustomMissile ("KnightBallAdFast",0,0,0,15,0)
	BHND D 0 A_FireCustomMissile ("KnightBallAdFast",-7,0,0,15,0)
	BHND D 0 A_FireCustomMissile ("KnightBallAdFast",7,0,0,15,0)
	BHND A 12 
    Goto Ready
  AltFireY:
    BHND A 6 
	BHND B 6 
	BHND C 7 
	BHND D 1 A_FireCustomMissile ("KnightBallAd",0,0,0,15,0)
	BHND D 5 A_FireCustomMissile ("KnightBallAd",-7,0,0,15,0)
	BHND D 5 A_FireCustomMissile ("KnightBallAd",7,0,0,15,0)
	BHND D 5 A_FireCustomMissile ("KnightBallAd",-14,0,0,15,0)
	BHND D 5 A_FireCustomMissile ("KnightBallAd",14,0,0,15,0)
	BHND D 5 A_FireCustomMissile ("KnightBallAd",-7,0,0,15,0)
	BHND D 5 A_FireCustomMissile ("KnightBallAd",7,0,0,15,0)
	BHND D 0 DamageThing (100)
	BHND A 5 
    Goto Ready
	
  Melee:
	BHND B 4 
    BHND C 4 
	BHND D 4 A_CustomPunch (25,0,0,"FBulletPuff",90)
	BHND C 4
    Goto Ready
  Altfire:
    BHND A 5 ACS_ExecuteAlways (419,0,12)
  	goto Ready
  }
}


actor KnightBallAd
{
  radius 8
  height 16
  renderstyle add
  alpha 1
  speed 23
  damage 10
  seesound "baron/attack"
  deathsound "baron/shotx"
  DamageType "KnightDamage"
  PROJECTILE
  +RANDOMIZE
  states
  {
  Spawn:
    BAL7 A 2 bright A_SpawnItem("BBallTrace",0)
	BAL7 B 2 bright A_SpawnItem("BBallTrace",0)
    loop
  Death:
    BAL7 C 5 A_Explode (6,64,0,0)
    BAL7 DE 5 bright
    stop
  }
}

actor KnightBallAdFast
{
  radius 8
  height 16
  renderstyle add
  alpha 1
  speed 32
  damage 10
  seesound "baron/attack"
  deathsound "baron/shotx"
  DamageType "KnightDamage"
  PROJECTILE
  +RANDOMIZE
  states
  {
  Spawn:
    BAL7 A 2 bright A_SpawnItem("BBallTrace",0)
	BAL7 B 2 bright A_SpawnItem("BBallTrace",0)
    loop
  Death:
    BAL7 C 5 A_Explode (6,64,0,0)
    BAL7 DE 5 bright
    stop
  }
}




actor BBallTrace
{
  renderstyle Translucent
  alpha 0.5
  scale 0.7
  +NOBLOCKMAP
  +NOGRAVITY
  states
  {
  Spawn:
    BAL7 ABAB 3 A_FadeOut(0.0)
    stop
  }
}  

// Belphegor

actor BelphegorClass : Playerpawn
{
  Health 1500
  gibhealth 99999 //added - actor can not be gibbed
  radius 24
  height 64
  mass 1000
  speed 0.50 // 0.4
  painchance 50
  Player.DisplayName "Belphegor"
  Player.MaxHealth 1000
  Player.ViewHeight 54
  Player.SoundClass BaronOfHellClass 
  Player.JumpZ 6 //5
  Player.MorphWeapon "BelphegorHand"
  Player.WeaponSlot 1, BelphegorHand
  BloodColor "darkgreen"
  
  DamageFactor "Suicide", 0 // puppetmaster can not suicide a monster
  DamageFactor "MarineDamage", 0.6
  DamageFactor "MarineRLDamage", 0.6
  DamageFactor "BFGSplash", 0.6
  DamageFactor "MarineRail", 0.6
  
  DamageFactor "CybRLDamage", 0.25
  DamageFactor "ImpBallDamage", 0
  DamageFactor "CacoDamage", 0
  DamageFactor "SkelDamage", 0
  DamageFactor "FatsoDamage", 0
  DamageFactor "KnightDamage", 0
  DamageFactor "ArachDamage", 0
  DamageFactor "viledamage", 0
  DamageFactor "Control", 0
  DamageFactor "ZombiesDamage", 0
  DamageFactor "Slime", 0
  
  -PICKUP
  +NOSKIN
  +NOPAIN
  -FRIENDLY
  +NOTARGET
  +LONGMELEERANGE //added
  +NOTRIGGER //added - avoid issues in level design
  
  states
  {
  Spawn:
	BOS3 AB 10 
    loop
  See:
    BOS3 A 1 A_Jump (240,2) //0
	BOS3 A 0 A_PlaySoundEx ("baron/active","body")
	BOS3 AABBCCDD 3
    loop
  Missile:
    BOS3 EF 5 
	BOS3 G 5 bright
	BOS3 EF 5 
	BOS3 G 5 bright
	BOS3 EF 5 
	BOS3 G 5 bright
    goto See   
  Death:
    BOS3 I 8 A_GiveToTarget ("MarineExp",7)
    BOS3 J 8 A_PlaySoundEx ("baron/death","body")
    BOS3 K 8 Thing_changeTid(144,0)
    BOS3 L 8 A_NoBlocking
    BOS3 MN 8 
	BOS3 O 1 A_SpawnItemEx ("MDeathGhost",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0) //0
	BOS3 O -1
	stop
  }
}

// Weapon

ACTOR BelphegorHand : Weapon
{
  obituary "$OB_BELPHEGOR"
  hitobituary "$OB_BELPHEGOR_MELEE"
  weapon.kickback 100
  attacksound "baron/melee"
  weapon.ammouse 0
  +WEAPON.NOALERT
  +ammo_optional
  +Alt_Ammo_Optional
  +WEAPON.CHEATNOTWEAPON
  //+INVENTORY.UNDROPPABLE //added
  +WEAPON.NOAUTOAIM
  
  states
  {
  Spawn:
    TNT1 A 0 Thing_Remove (0)
    Stop
  Select:
    BHND A 1 A_Raise
	goto ready
  Ready:
    BHND FAEA 2 A_WeaponReady
    //TNT1 A 0 A_JumpIfInventory ("Mskull",0,6)
    //BHND FAEA 2 A_WeaponReady
    //TNT1 A 0 A_JumpIfInventory ("Mskull",3,1)
    BHND F 0 HealThing(5)
    Loop
  DeSelect:
    BHND A 1 A_Lower
    Loop
  Fire:
    BHND A 0 A_JumpIfCloser (130,"Melee") //80
	BHND A 0 A_JumpIfInventory ("PM_AltFireX",1,"AltFireX")
	BHND A 0 A_JumpIfInventory ("PM_AltFireY",1,"AltFireY")
	BHND ABC 3 
    //TNT1 A 0 SetPlayerProperty (0, 1, 0)
	BHND D 5 A_FireCustomMissile ("PBelphegorBall",0,0,0,15,0)
	BHND ABC 3 
	BHND D 5 A_FireCustomMissile ("PBelphegorBall",0,0,0,15,0)
	BHND ABC 3 
	BHND D 5 A_FireCustomMissile ("PBelphegorBall",0,0,0,15,0)
	//TNT1 A 3 SetPlayerProperty (0, 0, 0)
    Goto Ready
	
  AltFireX:
    BHND ABC 3 
	BHND D 1 A_FireCustomMissile ("PBelphegorBallFast",0,0,0,15,0)
	BHND D 0 A_FireCustomMissile ("PBelphegorBallFast",-4,0,0,15,0)
	BHND D 0 A_FireCustomMissile ("PBelphegorBallFast",4,0,0,15,0)
	BHND A 20
    Goto Ready
  AltFireY:
	BHND ABC 3 
	BHND D 3 A_FireCustomMissile("PBelphegorBall",random(-20,20),0,0,0)
	BHND D 3 A_FireCustomMissile("PBelphegorBall",random(-20,20),0,0,0)
	BHND D 3 A_FireCustomMissile("PBelphegorBall",random(-20,20),0,0,0)
	BHND D 3 A_FireCustomMissile("PBelphegorBall",random(-20,20),0,0,0)
	BHND D 3 A_FireCustomMissile("PBelphegorBall",random(-20,20),0,0,0)
	BHND D 3 A_FireCustomMissile("PBelphegorBall",random(-20,20),0,0,0)
	BHND D 3 A_FireCustomMissile("PBelphegorBall",random(-20,20),0,0,0)
	BHND D 3 A_FireCustomMissile("PBelphegorBall",random(-20,20),0,0,0)
	BHND D 3 A_FireCustomMissile("PBelphegorBall",random(-20,20),0,0,0)
	BHND D 3 A_FireCustomMissile("PBelphegorBall",random(-20,20),0,0,0)
		BHND D 0 DamageThing (100)
    Goto Ready	
	
  Melee:
	BHND B 4 
    BHND C 4 
	BHND D 4 A_CustomPunch (25,0,0,"FBulletPuff",90)
	BHND C 4
    Goto Ready
  Altfire:
    BHND A 5 ACS_ExecuteAlways (419,0,27)
  	goto Ready
  }
}

actor PBelphegorBall
{
  radius 8
  height 16
  renderstyle add
  alpha 1
  speed 23
  damage 10
  seesound "baron/attack"
  deathsound "baron/shotx"
  DamageType "KnightDamage"
  PROJECTILE
  +RANDOMIZE
  states
  {
  Spawn:
    BAL7 A 2 bright A_SpawnItem("BBallTrace",0)
	BAL7 B 2 bright A_SpawnItem("BBallTrace",0)
    loop
  Death:
    BAL7 C 5 A_Explode (6,64,0,0)
    BAL7 DE 5 bright
    stop
  }
}

actor PBelphegorBallFast
{
  radius 8
  height 16
  renderstyle add
  alpha 1
  speed 23
  damage 10
  seesound "baron/attack"
  deathsound "baron/shotx"
  DamageType "KnightDamage"
  PROJECTILE
  +RANDOMIZE
  states
  {
  Spawn:
    BAL7 A 2 bright A_SpawnItem("BBallTrace",0)
	BAL7 B 2 bright A_SpawnItem("BBallTrace",0)
    loop
  Death:
    BAL7 C 5 A_Explode (6,64,0,0)
    BAL7 DE 5 bright
    stop
  }
}