actor Lavademon : DnD_BaseHybridMonster {
	obituary "%o was charred by a Lava Giant."
	Health 0x7FFFFFFF
	radius 24
	height 64
	mass 1000
	speed 12
	painchance 96
	seesound "lavdsit"
	painsound "lavdpain"
	deathsound "lavddie"
	activesound "lavdsit"
	meleerange 144
	Tag "Lava Demon"
	Species "HK"
	+ISMONSTER
	+NOBLOOD
	+DONTRIP
	+DONTHURTSPECIES
	+NORADIUSDMG
	states {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_LAVADEMON)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE1)
		Goto SpawnSetup
	
		IdleState:
			LAVD H 0 bright ACS_NamedExecuteAlways("DnD Wendigo Wisp Spawn", 0, 0, 25)
			LAVD H 10 bright A_GiveInventory("DnD_SightChecker", 1)
		loop
		SeeState:
			LAVD A 0 bright A_SpawnItemEx("firestep",0,-5,0)
			LAVD A 6 Fast bright A_Chase
			LAVD B 0 ACS_NamedExecuteAlways("DnD Wendigo Wisp Spawn", 0, 1, 50)
			LAVD B 6 Fast bright A_Chase
			LAVD C 0 bright A_SpawnItemEx("firestep",0,5,0)    
			LAVD C 6 Fast bright A_Chase
			LAVD D 0 Bright ACS_NamedExecuteAlways("DnD Wendigo Wisp Spawn", 0, 1, 50) 
			LAVD D 6 Fast bright A_Chase
		Loop
		MeleeState:
			LAVD EF 5 bright A_facetarget
		MeleeLoop:
			TNT1 A 0 A_TakeInventory("LavaGolemLooper", 1)
			TNT1 A 0 A_custommissile("PhoenixFX3",49, 18,0,1)    
			LAVD G 2 bright A_custommissile("PhoenixFX3",49, -18,0,1)
			TNT1 A 0 A_custommissile("PhoenixFX3",49, 18,0,1)    
			LAVD G 2 bright A_custommissile("PhoenixFX3",49, -18,0,1)    
			TNT1 A 0 A_custommissile("PhoenixFX3",49, 18,0,1)    
			LAVD G 2 bright A_custommissile("PhoenixFX3",49, -18,0,1)    
			TNT1 A 0 A_custommissile("PhoenixFX3",49, 18,0,1)    
			LAVD G 2 bright A_custommissile("PhoenixFX3",49, -18,0,1)  
			TNT1 A 0 A_GiveInventory("LavaGolemCheck", 1)
			TNT1 A 0 A_custommissile("PhoenixFX3",49, 18,0,1)
			LAVD G 2 bright A_custommissile("PhoenixFX3",49, -18,0,1)
			LAVD G 1 Bright A_JumpIfInventory("LavaGolemLooper", 1, "MeleeLoop")
			LAVD F 4 Bright A_FaceTarget
		Goto See
		MissileState:
			LAVD E 0 bright A_CustomMissile("firestep",0,-5,0)
			LAVD E 0 bright A_CustomMissile("firestep",0,5,0)    
			LAVD EF 5 Fast bright A_FaceTarget
			LAVD G 0 bright A_CustomMissile("beastball2", 45,-21,0,1)    
			LAVD G 10 Fast bright A_CustomMissile("beastball2", 45,16,0,1)
		goto See
		PainState:
			LAVD E 3 Fast bright
			LAVD E 0 Bright A_PlaySound("lavdpain")
			LAVD E 3 Fast bright A_Pain
		goto See
		XDeathState:
		DeathState:
			LAVD S 8 bright A_Scream
			TNT1 AAAAAAAAA 0 A_SpawnItemEx("LavaDemonSmoke", 0, 0, 24, 2, 0, 2, random(0, 360))
			LAVD TTTT 2 bright A_CustomMissile("Volcanoblast2", 16, 0, random(0, 360))
			LAVD UVW 8 bright    
			LAVD X 8 bright A_NoBlocking
			LAVD Y 60 bright
			LAVD Y -1 A_KillMaster
		stop
		RaiseState:
			LAVD XWVUTS 6
		Goto See
	}
}

Actor LavaGolemLooper : DnD_Boolean { }

Actor LavaGolemCheck : DnD_Activator {
	States {
		Pickup:
			TNT1 A 0 A_JumpIfTargetInLOS("Check", 90, JLOSF_DEADNOJUMP, 160)
		Stop
		Check:
			TNT1 A 0 A_JumpIfCloser(160, "Confirm")
		Stop
		Confirm:
			TNT1 A 0 A_GiveInventory("LavaGolemLooper", 1)
		Stop
	}
}

Actor PuffyC {
	Radius 6
	Height 8
	Speed 10
	+NOBLOCKMAP
	+NOGRAVITY
	+NOTELEPORT
	+DONTSPLASH
	RenderStyle Add
	+CLIENTSIDEONLY
	+NOINTERACTION
	States {
		Spawn:
			TNT1 A 0 NoDelay Thing_ChangeTID(0, SPECIAL_FX_TID)
			FRB1 DEFGH 4
		Stop
	}
}

Actor LavaDemonSmoke : msxgen_smoke {
	Scale 0.55
}

actor phoenixFX3 {
	seesound "weapons/phoenixpowshoot"
	damage (random(1, 8))
	DamageType "Fire"
	Stamina 32
	Speed 20
	Projectile
	Radius 6
	Height 8
	Speed 10
	+DONTBLAST
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			FX09 ABABA 2 Bright
			FX09 B 2 Bright A_ChangeVelocity(0, 0, 1.5)
			FX09 CDEF 2 Bright
		Stop
		Death:
			FX09 G 3 Bright
			FX09 H 3 Bright A_ChangeVelocity(0, 0, 1.8)
			FX09 I 4 Bright
			FX09 JK 5 Bright
		Stop
	}
}

Actor VolcanoBlast2 {
	Radius 8
	Height 8
	Speed 2
	Damage (2 * random(1, 8))
	Damagetype "Fire"
	Stamina 32
	Gravity 0.125
	PROJECTILE
	+NOBLOCKMAP
	+DROPOFF
	+NOTELEPORT
	+DONTBLAST
	-NOGRAVITY
	DeathSound "world/volcano/blast"

	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			VFBL AB 4 BRIGHT A_SpawnItemEx("PuffyC", random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625, 0, 0, 0, 0, SXF_ABSOLUTEPOSITION, 64)
		Loop
		Death:
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 16, 0, 0, CMF_TRACKOWNER | CMF_OFFSETPITCH, frandom(0, 2))
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 16, 0, 90, CMF_TRACKOWNER | CMF_OFFSETPITCH, frandom(0, 2))
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 16, 0, 180, CMF_TRACKOWNER | CMF_OFFSETPITCH, frandom(0, 2))
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 16, 0, 270, CMF_TRACKOWNER | CMF_OFFSETPITCH, frandom(0, 2))
			XPL1 A 4 BRIGHT A_Explode(25, 25, 0)
			XPL1 BCDEF 4 BRIGHT
		Stop
	}
}

Actor VolcanoTBlast2 {
	Radius 8
	Height 6
	Speed 3
	Damage (random(1, 8))
	Damagetype "Fire"
	Stamina 32
	Gravity 0.125
	PROJECTILE
	-NOGRAVITY
	+NOBLOCKMAP
	+DROPOFF
	+NOTELEPORT
	+DONTBLAST
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			VTFB AB 4 Bright
		Loop
		Death:
			SFFI CBABCDE 4 Bright
		Stop
	}
}

Actor VolcanoExp : BaseExplosionDamage {
	DamageType "Fire"
	Stamina 32
	Obituary "%o was charred by a lavademon."
	States
	{
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(25, 32, 0)
		Stop
	}
}

actor BeastBall2 : Volcanoblast2 {
	radius 9
	height 8
	speed 15
	damage (5 * random(1, 8))
	seesound "lavdatk"
	deathsound "weapons/phoenixhit"
	damagetype "Fire"
	Stamina 32
	Projectile
	states {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			VFBL A 0 bright A_CustomMissile ("wraithfx2",0,0)
			VFBL A 4 bright A_SpawnItemEx("PuffyC", random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625, 
											0,0,0,0,SXF_ABSOLUTEPOSITION, 64)
			VFBL B 4 bright A_SpawnItemEx("PuffyC", random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625, 
											0,0,0,0,SXF_ABSOLUTEPOSITION, 64)
		loop
		Death:
			TNT1 A 0 A_SpawnItemEx("OrangeParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AAAA 0 A_SpawnItemEx("ExplosionFX2", 0, 0, 0, frandom(-1, 1), frandom(-1, 1), frandom(-1, 1))
			TNT1 AAAAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 0, CMF_TRACKOWNER)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 90, CMF_TRACKOWNER)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 180, CMF_TRACKOWNER)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 270, CMF_TRACKOWNER)
			XPL1 A 4 BRIGHT A_SpawnItem("VolcanoExp")
			XPL1 BCDEF 4 bright
		stop
	}
}
 
actor firestep {
	radius 1
	height 1
	speed 0
	damage 0
	+CLIENTSIDEONLY
	states {
		Spawn:
			TNT1 AA 0 A_PlaySound("world/lavasizzle")
			LVAS A 3 bright
			LVAS B 3 bright A_CustomMissile("lavasmoke1",0,0)
			LVAS CDEF 3 bright
		stop
	}
}
     
actor lavasmoke1 {
	radius 1
	height 1
	speed 0
	damage 0
	renderstyle translucent
	alpha 0.5
	+CLIENTSIDEONLY
	states {
		Spawn:
			LVAS GHIJK 3 bright
		stop
	}
}   

// 25%
Actor DnD_WendigoWispSpawner : DnD_Activator {
	States {
		Pickup:
			TNT1 A 0 A_Jump(128, "Other")
			TNT1 A 0 A_SpawnItemEx("DnD_IceGuyWisp1", frandom(-24, 24), frandom(-24, 24), 60, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		Stop
		Other:
			TNT1 A 0 A_SpawnItemEx("DnD_IceGuyWisp2", frandom(-24, 24), frandom(-24, 24), 60, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		Stop
	}
}

// 50%
Actor DnD_WendigoWispChaseSpawner : DnD_Activator {
	States {
		Pickup:
			TNT1 A 0 A_Jump(128, "Other")
			TNT1 A 0 A_SpawnItemEx("DnD_IceGuyWisp1", frandom(-24, 24), frandom(-24, 24), 60, velx, vely, velz, 0, SXF_NOCHECKPOSITION)
		Stop
		Other:
			TNT1 A 0 A_SpawnItemEx("DnD_IceGuyWisp2", frandom(-24, 24), frandom(-24, 24), 60, velx, vely, velz, 0, SXF_NOCHECKPOSITION)
		Stop
	}
}

Actor DnD_IceGuyWisp1 {
	+CLIENTSIDEONLY
	+NOGRAVITY
	Height 4
	Radius 2
	RenderStyle Translucent
	Alpha 0.4
	States {
		Spawn:
			ICWS ABCDEFGHI 2
		Stop
	}
}

Actor DnD_IceGuyWisp2 : DnD_IceGuyWisp1 {
	States {
		Spawn:
			ICWS JKLMNOPQR 2
		Stop
	}
}

ACTOR LordofHeresy : DnD_BaseHybridMonster { 
    Health 0x7FFFFFFF
    Radius 24
    Height 64
    Speed 9 
    PainChance 50
    BloodColor "7D 9D 59"
    Mass 1000
	+ISMONSTER
    Species "HK"
    +DONTHURTSPECIES
    Obituary "%o was annihilated by the heresy lord." 
    SeeSound "LordOfHeresy/sight" 
    PainSound "demon/pain" 
    DeathSound "LordOfHeresy/death" 
    ActiveSound "LordOfHeresy/act"  
	Translation "16:43=52:77", "33:33=220:220", "34:37=[155,91,19]:[155,91,19]", "38:40=[135,67,7]:[135,67,7]", "41:43=[115,43,0]:[115,43,0]", "44:48=237:239", "190:191=238:238"
	Tag "Lord of Heresy"
    States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_LORDOFHERESY)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_UNCOMMON)
		Goto SpawnSetup
		
		IdleState:
			LOHS AB 10 A_GiveInventory("DnD_SightChecker", 1) 
		Loop 
		SeeState: 
			LOHS AABBCCDD 4 Fast A_Chase 
		Goto See
		MissileState: 
			LOHS E 0 A_Jump(85, "Combo1") 
			LOHS E 0 A_Jump(128, "Combo2")
		MeleeState:
			LOHS E 8 Fast A_FaceTarget 
			LOHS F 8 Fast A_FaceTarget 
			LOHS G 8 Fast A_CustomComboAttack("BaronBall", 32, 10 * random(1, 8), "baron/melee") 
		Goto See
		Combo1:
			LOHS E 8 Fast A_FaceTarget 
			LOHS F 8 Fast A_FaceTarget 
			LOHS G 0 A_Custommissile ("BaronBall", 32, 0, 8) 
			LOHS G 0 A_Custommissile ("BaronBall", 32, 0, 0) 
			LOHS G 8 Fast A_Custommissile ("BaronBall", 32, 0, -8) 
		Goto See 
		Combo2:
			LOHS E 8 Fast A_FaceTarget 
			LOHS F 8 Fast A_FaceTarget 
			LOHS G 0 A_Custommissile ("BaronBall", 32, 0, -20) 
			LOHS G 8 Fast A_Custommissile ("BaronBall", 32, 0, 0) 
			LOHS E 8 Fast A_FaceTarget 
			LOHS F 8 Fast A_FaceTarget 
			LOHS G 0 A_Custommissile ("BaronBall", 32, 0, 20) 
			LOHS G 8 Fast A_Custommissile ("BaronBall", 32, 0, 0) 
			LOHS E 8 Fast A_FaceTarget 
			LOHS F 8 Fast A_FaceTarget 
			LOHS G 0 A_Custommissile ("BaronBall", 32, 0, -12) 
			LOHS G 8 Fast A_Custommissile ("BaronBall", 32, 0, 12) 
		Goto See 
		PainState: 
			LOHS H 5 Fast 
			LOHS H 5 Fast A_Pain 
		Goto See
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState: 
			LOHS I 8
			LOHS J 8 A_Scream 
			LOHS K 4
			LOHS K 4 A_Fall
			LOHS LMN 8
			LOHS O -1 A_KillMaster
			Stop 
		RaiseState:
			LOHS ONMLKJI 5 
		Goto See
    } 
}

Actor Cybruiser : DnD_BaseHybridMonster { 
	Health 0x7FFFFFFF
	Radius 24 
	Height 64 
	Mass 1000 
	Speed 8 
	PainChance 20
	Obituary "%o was blown away by a Cybruiser."
	HitObituary "%o was smashed by a Cybruiser."
	+ISMONSTER
	+MissileMore
	+NOBLOOD
	+DONTRIP
	Species "HK"
	+DONTHURTSPECIES
	SeeSound "monster/brusit" 
	PainSound "baron/pain" 
	DeathSound "monster/brudth"
	MeleeSound "baron/melee"
	Tag "Cybruiser"
	States { 
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_CYBRUISER)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE1)
		Goto SpawnSetup

		IdleState:
			CRUS AB 10 A_GiveInventory("DnD_SightChecker", 1) 
		Loop 
		SeeState:
			CRUS A 1 A_Playsound("monster/bruwlk")
			CRUS A 2 Fast A_Chase
			CRUS A 3 Fast A_Chase
			CRUS BB 3 Fast A_Chase
			CRUS C 1 A_Playsound("monster/bruwlk")
			CRUS C 2 Fast A_Chase
			CRUS C 3 Fast A_Chase 
			CRUS DD 3 Fast A_Chase
		Goto See
		MissileState:
			TNT1 A 0 A_Jump(96, "Single")
			CRUS E 8 Fast A_FaceTarget 
			CRUS F 12 Fast Bright A_CustomMissile("BruiserMissile",38,15,0,0)
			CRUS E 12 Fast A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteAlways("DnD On Monster Attack", 0)
			CRUS F 12 Fast Bright A_CustomMissile("BruiserMissile",38,15,0,0)
			CRUS E 12 Fast A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteAlways("DnD On Monster Attack", 0)
			CRUS F 12 Fast Bright A_CustomMissile("BruiserMissile",38,15,0,0)
		Goto See
		Single:
			CRUS E 8 Fast A_FaceTarget 
			CRUS F 12 Fast Bright A_CustomMissile("BruiserMissile",38,15,0,0)
		Goto See
		MeleeState:
			CRUS GH 8 Fast A_FaceTarget
			CRUS I 8 Fast A_CustomMeleeAttack(10 * random(1, 8), "baron/melee")
		Goto See
		PainState: 
			CRUS J 2 Fast 
			CRUS J 2 Fast A_Pain 
		Goto See 
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState:
			CRUS K 6 Bright A_Scream
			CRUS LLLMMMNNN 2 Bright A_SpawnItemEx("ExplosionFXSmall", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			CRUS O 6 Bright A_NoBlocking
			CRUS QR 6 Bright
			CRUS S 6
			CRUS T -1 A_KillMaster
		Stop
		RaiseState:
			CRUS SRQONMLK 6
		Goto See
	}
}

Actor CybrusExp : BaseExplosionDamage {
	DamageType "Explosive"
	Stamina 4
	Obituary "%o was blown away by a Cybruiser."
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(64, 64, 0)
		Stop
	}
}

Actor BruiserMissile {
	Radius 8
	Height 12
	Speed 28
	Damage (10 * random(1, 8))
	DamageType "Explosive"
	Stamina 4
	Scale 1.0
	SpawnID 251
	Projectile
	RenderStyle Normal
	+ThruGhost
	+DONTBLAST
	SeeSound "monster/brufir"
	DeathSound "weapons/hellex"
	DontHurtShooter
	Decal Scorch
	States {
		Spawn: 
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			FBRS A 1 Bright
			FBRS A 1 Bright A_SpawnItemEx("BruiserTrail",0,0,0,0,0,0,0,128)
		Loop
		Death:
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlare", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE | SXF_NOCHECKPOSITION, 0)
			TNT1 AAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 180))
			TNT1 AAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 360))
			TNT1 AAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_SetTranslucent(0.67,1)
			BAL3 C 6 Bright
			BAL3 D 6 Bright A_SpawnItem("CybrusExp")
			BAL3 E 6 Bright
		Stop
	}
}

Actor BruiserTrail {
	RenderStyle Translucent
	Alpha 0.67
	+NOINTERACTION
	+CLIENTSIDEONLY
	States {
		Spawn:
			TNT1 A 3 Bright
			PUFF ABCD 4 BRIGHT
		Stop 
	}
}

Actor BruiserDemon : DnD_BaseHybridMonster {
	Health 0x7FFFFFFF
	Radius 24
	Height 64
	Mass 1500
	Speed 8
	PainChance 15
	+ISMONSTER
	+LookAllAround
	+MISSILEMORE
	+MissileEvenMore
	Species "HK"
	+DONTHURTSPECIES  
	SeeSound "superbaron/scream"
	PainSound "superbaron/pain"
	DeathSound "superbaron/death"
	ActiveSound "superbaron/act"
	MeleeSound "baron/melee"
	Obituary "%o was slaughtered by a Bruiserdemon."
	HitObituary "%o was cremated by a Bruiserdemon."
	Scale 1.15
	Tag "Bruiser Demon"
	BloodType "BruiserBloodEmber"
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_BRUISERDEMON)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE2)
		Goto SpawnSetup
	
		IdleState:
			BRUS AB 10 Bright A_GiveInventory("DnD_SightChecker", 1) 
		Loop
		SeeState:
			BRUS AAABBBCCCDDD 2 Fast Bright A_Chase
		Goto See
		MeleeState:
			BRUS E 6 Fast Bright A_FaceTarget
			BRUS F 6 Fast Bright A_FaceTarget
			BRUS G 6 Fast Bright A_CustomComboAttack("BruiserBall", 32, 20 * random(1, 8), "baron/melee")
		Goto See
		MissileState:
			BRUS E 0 Bright A_Jump(144, 8)
			BRUS EF 6 Fast Bright A_FaceTarget
			BRUS G 6 Fast Bright A_CustomMissile("BruiserBall")
			BRUS G 0 Bright A_Jump(96, 1)
		Goto See
			BRUS HI 6 Fast Bright A_FaceTarget
			BRUS J 6 Fast Bright A_CustomMissile("BruiserBall")
		Goto See
			BRUS E 0 Bright A_Jump(96, 20)
			BRUS E 6 Fast Bright A_FaceTarget
			BRUS F 4 Fast Bright A_FaceTarget
			BRUS F 2 Fast Bright A_Custommissile("BruiserBall2",56,0,-40,0)
			BRUS G 1 Bright A_Custommissile("BruiserBall2",56,0,-30,0)
			BRUS G 1 Bright A_Custommissile("BruiserBall2",56,0,-20,0)
			BRUS G 1 Bright A_Custommissile("BruiserBall2",56,0,-10,0)
			BRUS G 1 Bright A_Custommissile("BruiserBall2",56,0,0,0)
			BRUS G 1 Bright A_Custommissile("BruiserBall2",56,0,10,0)
			BRUS G 1 Bright A_Custommissile("BruiserBall2",56,0,20,0)
			BRUS G 0 Bright A_Jump(96, 1)
		Goto See
			BRUS H 6 Fast Bright A_FaceTarget
			BRUS I 4 Fast Bright A_FaceTarget
			BRUS I 2 Fast Bright A_Custommissile("BruiserBall2",56,0,40,0)
			BRUS J 1 Bright A_Custommissile("BruiserBall2",56,0,30,0)
			BRUS J 1 Bright A_Custommissile("BruiserBall2",56,0,20,0)
			BRUS J 1 Bright A_Custommissile("BruiserBall2",56,0,10,0)
			BRUS J 1 Bright A_Custommissile("BruiserBall2",56,0,0,0)
			BRUS J 1 Bright A_Custommissile("BruiserBall2",56,0,-10,0)
			BRUS J 1 Bright A_Custommissile("BruiserBall2",56,0,-20,0)
		Goto See
			TNT1 A 0 A_PlaySound("superbaron/clap")
			BRUS KL 6 Fast Bright A_FaceTarget
			BRUS M 2 Fast Bright A_Custommissile("BruiserFireSpawner",16,0,-15,0)
			BRUS M 2 Fast Bright A_Custommissile("BruiserFireSpawner",16,0,0,0)
			BRUS M 2 Fast Bright A_Custommissile("BruiserFireSpawner",16,0,15,0)
		Goto See
		PainState:
			BRUS N 5 Fast Bright A_Pain
		Goto See
		XDeathState:
			TNT1 AAAAAAAAAAA 0 A_SpawnItemEx("BruiserBloodEmber", frandom(-16.0, 16.0), frandom(-16.0, 16.0), frandom(16.0, 40.0), frandom(-6, 6), frandom(-6, 6), frandom(1, 5))
		DeathState:
			BRUD A 6 Bright A_Scream
			BRUD BCD 4 Bright 
			BRUD EFG 4 Bright
			BRUD H 4 Bright A_Fall
			BRUD IJKLMNOP 4 Bright
			BRUD QRSTUV 4
			BRUD W -1 A_KillMaster
		Stop	
		RaiseState:
			BRUD VUTSRQ 2
			BRUD PONMLKJIHGFEDCBA 2 Bright
		Goto See
	}
}

Actor BruiserBall {
	Radius 16
	Height 16
	Speed 18
	Damage (10 * random(1, 8))
	DamageType "Fire"
	Stamina 32
	Projectile
	+Randomize
	+DONTBLAST
	RenderStyle "ADD"
	Alpha 0.9
	SeeSound "imp/attack"
	DeathSound "imp/shotx"
	Decal Scorch
	States {
		Spawn: 
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			BRBA AABB 2 Bright A_SpawnItemEx("BruiserBallTrail", 0, 0, 0, 0, 0, 0, 0, 128)
		Loop
		Death:
			TNT1 A 0 A_SpawnItemEx("OrangeParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AAAA 0 A_SpawnItemEx("ExplosionFX2", 0, 0, 0, frandom(-1, 1), frandom(-1, 1), frandom(-1, 1))
			TNT1 AAAAAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			BRBA KLMNOPQRSTUVWX 3 Bright
		Stop
	}
}

Actor BruiserBall2 {
	Radius 8
	Height 8
	Speed 10
	Damage (6 * random(1, 8))
	DamageType "Fire"
	Stamina 32
	Projectile
	+Randomize
	+DONTBLAST
	RenderStyle Add
	Alpha 0.9
	SeeSound "imp/attack"
	DeathSound "imp/shotx"
	Decal BaronScorch
	States {
		Spawn: 
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			BRB2 AB 6 Bright 
		Loop
		Death:
			TNT1 A 0 A_SpawnItemEx("OrangeParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AA 0 A_SpawnItemEx("ExplosionFX2", 0, 0, 0, frandom(-1, 1), frandom(-1, 1), frandom(-1, 1))
			TNT1 AAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			BRB2 CDEFGHI 3 Bright
		Stop
	}
}

Actor BruiserFireSpawner {
	Radius 8
	Height 8
	Speed 12
	Damage 0
	+Ripper
	+FloorHugger
	+BloodlessImpact
	+DONTBLAST
	Projectile
	MissileType BruiserFire
	Missileheight 0
	States {
		Spawn: 
			TNT1 A 3 Bright A_MissileAttack
			TNT1 A 3
			TNT1 A 3
		Loop
		Death:  
			TNT1 A 6
		Stop
	}
}

Actor BruiserBallTrail {
	RenderStyle Add
	Alpha 0.70
	+CLIENTSIDEONLY
	+NOINTERACTION
	States {
		Spawn:
			BRBA CDEFGHIJ 4 Bright
		Stop       
	}
}

Actor BruiserExp : BaseExplosionDamage {
	DamageType "Fire"
	Stamina 32
	Obituary "%o was slaughtered by a Bruiserdemon."
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(48, 128, 0)
		Stop
	}
}

Actor BruiserFire {
	Radius 1
	Height 1
	Speed 0
	Damage (12 * random(1, 8))
	DamageType "Fire"
	Stamina 32
	Projectile
	RenderStyle Add
	Alpha 0.9
	+NoClip
	+FloorHugger
	+DONTBLAST
	SeeSound "weapons/rocklx"
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			TNT1 A 0 A_SpawnItemEx("OrangeParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AAA 0 A_SpawnItemEx("ExplosionFX2", 0, 0, 0, frandom(-1, 1), frandom(-1, 1), frandom(-1, 1))
			TNT1 AAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			XXBF AB 3 Bright
			XXBF C 3 Bright A_SpawnItem("BruiserExp")
			XXBF DEFGHIJKLMNOPQRST 3 Bright
		Stop       
	}
}

// From HardDoom v83
Actor BruiserBloodEmber {
	Radius 1
	Height 1
	Mass 0
	+ClientSideOnly
	+DontSplash
	+NoBlockMap
	+MoveWithSector
	+NoTeleport
	+NoClip
	+DontTranslate
	Gravity 0.8
	States {
		Spawn:
			BEMB ABCBABCDABCD 4 Bright A_JumpIf(waterlevel > 1, "Splash")
		Stop
		Splash:
			TNT1 A 0
		Stop
	}
}

ACTOR Bormereth : DnD_BaseHybridMonster {
    Health 0x7FFFFFFF
    Radius 24
    Height 64
    Speed 10
    PainChance 75
    Mass 2500
	+ISMONSTER
    +MISSILEEVENMORE
	+DONTHURTSPECIES
	Species "HK"
    SeeSound "Bormereth/See"
    PainSound "Bormereth/Pain"
    ActiveSound "Bormereth/Act"
    DeathSound "Bormereth/die"
	MeleeSound "weapons/vblhit"
    Obituary "%o was incinerated by the rage of Bormereth."
    HitObituary "%o was smashed by Bormereth."
	Tag "Bormereth"
    States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_BORMERETH)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE1)
		Goto SpawnSetup
	
		IdleState:
			BORM A 10 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			BORM AABBCCDD 4 Fast A_Chase
		Goto See
		MissileState:
			TNT1 A 0 A_Jump(60,"Missile2")
			TNT1 A 0 A_Jump(128,17)
			BORM E 6 Fast A_FaceTarget
			BORM F 6 Fast A_FaceTarget
			TNT1 A 0 A_PlaySoundEx("bormereth/missilesimple","SoundSlot5")
			BORM G 6 Fast Bright A_CustomMissile("WraithFX12",25,0,0)
			BORM E 6 Fast A_FaceTarget
			BORM F 6 Fast A_FaceTarget
			TNT1 A 0 A_PlaySoundEx("bormereth/missilesimple","SoundSlot5")
			BORM G 6 Fast Bright A_CustomMissile("WraithFX12",25,0,0)
			BORM E 6 Fast A_FaceTarget
			BORM F 6 Fast A_FaceTarget
			TNT1 A 0 A_PlaySoundEx("bormereth/missilesimple","SoundSlot5")
			BORM G 6 Fast Bright A_CustomMissile("WraithFX12",25,0,0)
			BORM E 6 Fast A_FaceTarget
			BORM F 6 Fast A_FaceTarget
			TNT1 A 0 A_PlaySoundEx("bormereth/missilesimple","SoundSlot5")
			BORM G 6 Fast Bright A_CustomMissile("WraithFX12",25,0,0)
		Goto see
			TNT1 A 0 A_Jump(128,9)
			BORM E 6 Fast A_FaceTarget
			BORM F 3 Fast A_FaceTarget
			TNT1 A 0 A_PlaySoundEx("bormereth/missilesimple","SoundSlot5")
			BORM F 3 Fast Bright A_CustomMissile("WraithFX12",31,10,0)
			TNT1 A 0 A_PlaySoundEx("bormereth/missilesimple","SoundSlot5")
			BORM G 3 Fast Bright A_CustomMissile("WraithFX12",28,5,0)
			TNT1 A 0 A_PlaySoundEx("bormereth/missilesimple","SoundSlot5")
			BORM G 3 Fast Bright A_CustomMissile("WraithFX12",25,0,0)
		Goto see
			BORM E 6 Fast A_FaceTarget
			BORM F 6 Fast A_FaceTarget
			TNT1 A 0 A_PlaySoundEx("bormereth/missilesimple","SoundSlot5")
			BORM G 0 A_CustomMissile("WraithFX12",25,0,20)
			BORM G 0 A_CustomMissile("WraithFX12",25,0,0)
			BORM G 0 A_CustomMissile("WraithFX12",25,0,-20)
			BORM G 6 Fast Bright 
		Goto see
		Missile2:
			BORM F 5 Fast A_FaceTarget
			TNT1 A 0 A_PlaySoundEx("bormereth/missile2prepare","SoundSlot5")
			TNT1 A 0 A_SpawnItemEx("PossEttFakeFireBall",5,25,64,0,0,0,0,128)
			BORM EEEEE 5 Fast A_FaceTarget
			BORM E 3 Fast A_FaceTarget
			TNT1 A 0 A_CustomMissile("PossEttFireBall",64,25,0)
			BORM F 5 Fast A_FaceTarget
			BORM G 5 Fast A_FaceTarget
		goto see
		MeleeState:
			TNT1 A 0 A_PlaySound("weapons/hamswg")
			BORM E 6 Fast A_FaceTarget
			BORM F 6 Fast A_FaceTarget
			BORM G 6 Fast A_CustomMeleeAttack(8 * random(1, 8), "weapons/vblhit")
			BORM E 0 A_CPosRefire
		Goto see
		PainState:
			BORM H 2 Fast
			TNT1 A 0 A_SpawnItem("BormerethPainExp")
			TNT1 A 0 A_CustomMissile("FirePillarShot",16,0,0,CMF_AIMDIRECTION, 0)
			TNT1 A 0 A_CustomMissile("FirePillarShot",16,0,90,CMF_AIMDIRECTION, 0)
			TNT1 A 0 A_CustomMissile("FirePillarShot",16,0,180,CMF_AIMDIRECTION, 0)
			TNT1 A 0 A_CustomMissile("FirePillarShot",16,0,270,CMF_AIMDIRECTION, 0)
			TNT1 A 0 A_CustomMissile("FirePillarShot",16,0,45,CMF_AIMDIRECTION, 0)
			TNT1 A 0 A_CustomMissile("FirePillarShot",16,0,135,CMF_AIMDIRECTION, 0)
			TNT1 A 0 A_CustomMissile("FirePillarShot",16,0,-45,CMF_AIMDIRECTION, 0)
			TNT1 A 0 A_CustomMissile("FirePillarShot",16,0,-135,CMF_AIMDIRECTION, 0)
			BORM H 2 Fast A_Pain
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Give", DND_ISBLOCKING, -1, -1, -1)
			BORM H 16 Fast
			BORM H 2 Fast ACS_NamedExecuteWithResult("DnD Monster Trait Take", DND_ISBLOCKING, -1, -1, -1)
		Goto See
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState:
			TNT1 A 0 A_PlaySound("misc/gibbed")
			BORB A 5 A_Scream
			BORB B 5 A_SpawnItemEx("DBigEttinMace", 0, 0, 32, 3, 0, 0, -90, 128)
			TNT1 AAAA 0 A_SpawnItemEx("PEFBExploFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128) 
			TNT1 A 0 A_NoBlocking
			BORB CCCCC 1 A_SpawnItemEx("PEFBExploFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128) 
			TNT1 A 0 A_Fall
			BORB DDDDD 1 A_SpawnItemEx("PEFBExploFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128) 
			BORB EEEEFFFFFGGGGG 1 A_SpawnItemEx("PEFBExploFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128) 
			BORB HIJK 5
			BORB L -1 A_KillMaster
			Stop
		RaiseState:
			BORM QPONMLKJI 5
		Goto See
    }
}


actor DBigEttinMace {
	+CLIENTSIDEONLY
    +DOOMBOUNCE
    Speed 3
    States {
		Spawn:
			BORB MNOPQR 5
			BORB S -1
        Stop
    }
}

Actor WraithFX12 {
	Speed 14
	Radius 10
	Height 6
	Mass 5
	Damage (6 * random(1, 8))
	DamageType "MagicalFire"
	Stamina 40
	Projectile
	+FLOORCLIP
	SeeSound "WraithMissileFire"
	DeathSound "bormereth/missilesimpledeath"
	Scale 0.85
	Decal DoomImpScorch
	+DONTBLAST
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			WRBL A 3 Bright
			WRBL B 3 Bright A_SpawnItemEx("WraithFX22", 0, 0, 0, frandom(-0.5, -1.5), frandom(-1.5, 1.5))
			WRBL C 3 Bright
		Loop
		Death:
			WRBL D 4 Bright
			WRBL E 4 Bright A_SpawnItemEx("WraithFX22", 0, 0, 0, frandom(-0.5, -1.5), frandom(-1.5, 1.5))
			WRBL F 4 Bright
			WRBL GH 3 Bright A_SpawnItemEx("WraithFX22", 0, 0, 0, frandom(-0.5, -1.5), frandom(-1.5, 1.5))
			WRBL I 3 Bright
		Stop
	}
}

Actor PossEttFakeFireBall {
	+NOINTERACTION
	+CLIENTSIDEONLY
	Scale 1.1
	States {
		Spawn:
			TNT1 AAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360))
			WRBL A 1 Bright A_SetTranslucent(0.1)
			WRBL A 1 Bright A_SetTranslucent(0.15)
			WRBL A 1 Bright A_SetTranslucent(0.2)
			TNT1 AAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360))
			WRBL B 1 Bright A_SetTranslucent(0.25)
			WRBL B 1 Bright A_SetTranslucent(0.3)
			WRBL B 1 Bright A_SetTranslucent(0.35)
			TNT1 AAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360))
			WRBL C 1 Bright A_SetTranslucent(0.4)
			WRBL C 1 Bright A_SetTranslucent(0.45)
			WRBL C 1 Bright A_SetTranslucent(0.5)
			TNT1 AAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360))
			WRBL A 1 Bright A_SetTranslucent(0.55)
			WRBL A 1 Bright A_SetTranslucent(0.6)
			WRBL A 1 Bright A_SetTranslucent(0.65)
			TNT1 AAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360))
			WRBL B 1 Bright A_SetTranslucent(0.7)
			WRBL B 1 Bright A_SetTranslucent(0.75)
			WRBL B 1 Bright A_SetTranslucent(0.8)
			TNT1 AAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360))
			WRBL C 1 Bright A_SetTranslucent(0.85)
			WRBL C 1 Bright A_SetTranslucent(0.9)
			WRBL C 1 Bright A_SetTranslucent(0.95)
			TNT1 AAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360))
			WRBL A 3 Bright 
			TNT1 AAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360))
			WRBL B 3 Bright 
			TNT1 AAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360))
			WRBL C 5 Bright 
		Stop
	}
}

Actor BormerethExp : BaseExplosionDamage {
	DamageType "MagicalFire"
	Stamina 40
	Obituary "%o was incinerated by the rage of Bormereth."
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(48, 80, 0)
		Stop
	}
}

Actor BormerethPainExp : BaseExplosionDamage {
	DamageType "MagicalFire"
	Stamina 40
	Obituary "%o was incinerated by the rage of Bormereth."
	States
	{
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(9, 72, 0)
			TNT1 A 1 A_Explode(9, 84, 0)
			TNT1 A 1 A_Explode(9, 96, 0)
			TNT1 A 1 A_Explode(9, 108, 0)
			TNT1 A 1 A_Explode(9, 120, 0)
			TNT1 A 1 A_Explode(9, 132, 0)
		Stop
	}
}

Actor PossEttFireBall {
	Projectile
	Damage (8 * random(1, 8))
	Scale 1.1
	Speed 20
	Radius 10
	Height 6
	+SEEKERMISSILE
	+DONTBLAST
	+FLOORCLIP
	SeeSound "bormereth/missile2fired"
	DeathSound "bormereth/missile2death"
	DamageType "MagicalFire"
	Stamina 40
	Decal DoomImpScorch
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			TNT1 AAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),128)
			WRBL A 1 Bright A_SeekerMissile(5,5)
			TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
			WRBL A 1 Bright A_SeekerMissile(5,5)
			TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
			WRBL A 1 Bright A_SeekerMissile(5,5)
			TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
			TNT1 AAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),128)
			WRBL B 1 Bright A_SeekerMissile(5,5)
			TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
			WRBL B 1 Bright A_SeekerMissile(5,5)
			TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
			WRBL B 1 Bright A_SeekerMissile(5,5)
			TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
			TNT1 AAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),128)
			WRBL C 1 Bright A_SeekerMissile(5,5)
			TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
			WRBL C 1 Bright A_SeekerMissile(5,5)
			TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
			WRBL C 1 Bright A_SeekerMissile(5,5)
			TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
		Loop
		Death:
			TNT1 A 0 A_SpawnItemEx("OrangeParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AAA 0 A_SpawnItemEx("ExplosionFX2", 0, 0, 0, frandom(-1, 1), frandom(-1, 1), frandom(-1, 1))
			TNT1 AAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			TNT1 A 0 A_CustomMissile("PEFBExplo",0,0,0)
			TNT1 A 0 A_SpawnItem("BormerethExp")
			TNT1 AAAAAAAAAAAAAAA 0 A_SpawnItemEx("WraithFX23",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),128)
			TNT1 AAAAAAAAAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),128)
			WRBL DEF 3 Bright
			WRBL GHI 3
		Stop
	}
}	

Actor WraithFX22 {
	Projectile
	Damage 0
	-NOGRAVITY
	+THRUACTORS
	+CLIENTSIDEONLY
	Speed 0
	Radius 2
	Height 4
	Scale 0.75
	States {
		Spawn:
			WRBL KLKL 2 Bright
			TNT1 A 0 A_Jump(128, 1)
		Loop
			WRBL MNOP 2 Bright
			WRBL P 1 Bright A_FadeOut
		Wait
		Death:
			TNT1 A 1
		Stop
	}
}

Actor WraithFX23 {
	Projectile
	Damage 0
	+CLIENTSIDEONLY
	+RIPPER
	+BLOODLESSIMPACT
	Speed 0
	Radius 1
	Height 1
	States {
		Spawn:
			WRBL KLKL 2 Bright
			TNT1 A 0 A_Jump(128,1)
		Loop
			WRBL MNOP 2 Bright
			WRBL P 1 Bright A_FadeOut
		Wait
		Death:
			TNT1 A 1
		Stop
	}
}

Actor PEFBExplo {
	Projectile
	Speed 0
	Damage 0
	+CLIENTSIDEONLY
	+NOCLIP
	RenderStyle Add
	Alpha 0.6
	States {
		Spawn:
			FX58 ABCDEFGHIJKLMNOPQ 1 Bright
		Stop
	}
}

Actor PEFBExploFX {
	+NOGRAVITY
	+CLIENTSIDEONLY
	Scale 0.7
	Height 2
	Radius 2
	Alpha 0.75
	Renderstyle Add
	States {
		Spawn:
			TNT1 A 0 A_SpawnItemEx("OrangeParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			FX58 ABCDEFGHIJKLMNOPQ 1 Bright A_FadeOut(0.035)
		Stop
	}
}

Actor PEFBTrail {
	Projectile
	Speed 0
	Damage 0
	+NOCLIP
	+CLIENTSIDEONLY
	RenderStyle Add
	Scale 0.4
	Alpha 0.45
	States {
		Spawn:
			FX50 ABCDEFG 1 
			FX50 HIJKLMNOPQR 1 
		Stop
	}
}


//-------------------------------------------------------

Actor FirePillarShot {
	+MISSILE
	+NOINTERACTION
	+THRUACTORS
	+DONTBLAST
	+CLIENTSIDEONLY
	Speed 2
	Radius 2
	Height 2
	Scale 0.65
	ReactionTime 24
	const int maxdur = 24;
	States {
		Spawn:
			DGFL A 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL B 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL C 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL D 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL E 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL F 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL G 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL H 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL I 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL J 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL K 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL L 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL M 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL N 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL O 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL P 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL Q 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL R 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL S 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL T 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL U 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL V 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
			TNT1 A 0 A_CountDown
			DGFL W 1 Bright A_Warp(AAPTR_TARGET, 32 + (maxdur - reactiontime) * 2, 32 + (maxdur - reactiontime) * 2, 0, (maxdur - reactiontime) / 2, WARPF_NOCHECKPOSITION | WARPF_INTERPOLATE | WARPF_USECALLERANGLE )
		Stop
	}
}

ACTOR BloodSeeker : DnD_BaseHybridMonster {
	OBITUARY "%o was killed by a blood seeker."
	Bloodcolor "ff 0f 83"
	Health 0x7FFFFFFF
	Radius 24
	Height 64
	Mass 750
	Speed 12
	MeleeRange 160
	GibHealth -75
	PainChance 144
	SEESOUND "Beast/See"
	PAINSOUND "Beast/pain"
	DEATHSOUND "Beast/die"
	ACTIVESOUND "Beast/Act"
	Species "HK"
	Tag "Blood Seeker"
	+ISMONSTER
	states {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_BLOODSEEKER)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE1)
			TNT1 A 0 ACS_NamedExecuteAlways("DnD Bloodseeker Size Change")
		Goto SpawnSetup
	
		IdleState:
			BDE2 AB 10 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			TNT1 A 0 A_JumpIf(!ACS_NamedExecuteWithResult("DnD Bloodseeker Transform"), "NormalSee")
		Goto Transform
		NormalSee:
			BDE2 ABCDEF 6 Fast A_Chase
		Goto See
		Transform:
			BDE2 AABBCCDDEEFF 2 Fast A_Chase("Spit","Missile2")
			BDE2 AABBCCDDEEFF 2 Fast A_Chase("Spit","Missile2")
			BDE2 AABBCCDDEEFF 2 Fast A_Chase("Spit","Missile2")
		Goto See
		MissileState:
			BDE2 H 6 Fast A_FaceTarget
			TNT1 A 0 A_playSound("Beast/Attack")
			BDE2 I 6 Fast A_CustomMissile("BeastFireBall", 56, 0, 0)
			BDE2 I 0 A_CustomMissile("BeastFireBall", 56, 0, 8)
			BDE2 I 0 A_CustomMissile("BeastFireBall", 56, 0, -8)
		Goto See
		Missile2:
			BDE2 H 6 Fast A_FaceTarget
			TNT1 A 0 A_playSound("Beast/Attack")
			BDE2 I 6 Fast A_CustomMissile("BeastFireBall", 56, 0, 0)
			TNT1 A 0 A_CustomMissile("BeastFireBall", 56, 0, 8)
			TNT1 A 0 A_CustomMissile("BeastFireBall", 56, 0, -8)  
			TNT1 A 0 A_JumpIfCloser(160, "Spit")
			BDE2 H 6 Fast A_FaceTarget
			TNT1 A 0 A_playSound("Beast/Attack")
			TNT1 A 0 A_CustomMissile("BeastFireBall", 56, 0, 8)
			BDE2 I 6 Fast A_CustomMissile("BeastFireBall", 56, 0, -8)
			TNT1 A 0 A_CustomMissile("BeastFireBall", 56, 0, 0)
			TNT1 A 0 A_JumpIfCloser(160, "Spit")
			BDE2 H 6 Fast A_FaceTarget
			TNT1 A 0 A_playSound("Beast/Attack")
			TNT1 A 0 A_CustomMissile("BeastFireBall", 52, -16)
			TNT1 A 0 A_CustomMissile("BeastFireBall", 44, 0)
			TNT1 A 0 A_CustomMissile("BeastFireBall", 68, 0)	
			BDE2 I 6 Fast A_CustomMissile("BeastFireBall", 52, 16)	
		Goto See
		Spit:
			BDE2 H 6 Fast A_FaceTarget
			TNT1 A 0 A_CustomMissile("BeastFlame", 56, 0, random(1, 5)*(2*random(0,1)-1))
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_CustomMissile("BeastFlame", 56, 0, random(1, 5)*(2*random(0,1)-1))
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_CustomMissile("BeastFlame", 56, 0, random(1, 5)*(2*random(0,1)-1))
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			TNT1 AAA 0 A_CustomMissile("BeastFlame", 56, 0, random(1, 5)*(2*random(0,1)-1))
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_CustomMissile("BeastFlame", 56, 0, random(1, 5)*(2*random(0,1)-1))
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_CustomMissile("BeastFlame", 56, 0, random(1, 5)*(2*random(0,1)-1))
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_CustomMissile("BeastFlame", 56, 0, random(1, 5)*(2*random(0,1)-1))
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			TNT1 AAA 0 A_CustomMissile("BeastFlame", 56, 0, random(1, 5)*(2*random(0,1)-1))
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			BDE2 H 3 Fast  
		Goto See
		MeleeState:
			BDE2 H 6 Fast A_FaceTarget
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			TNT1 A 0 A_FaceTarget
			BDE2 I 2 Fast A_CustomMissile("BeastFlame", 56)
			BDE2 H 3 Fast
		Goto See
		PainState:
			BDE2 G 4 Fast A_Pain
		Goto See
		DeathState:
			BDE2 R 8
			TNT1 A 0 A_NoBlocking
			BDE2 S 8 A_Scream
			BDE2 TUVWX 6
			BDE2 Y 6
			BDE2 Z -1 A_KillMaster
		Stop
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			BDE2 J 6
			TNT1 A 0 A_NoBlocking
			BDE2 K 6 A_Scream
			BDE2 LMNOP 6
			BDE2 Q -1 A_KillMaster
		Stop
		RaiseState:
			BDE2 YXWVUT 6
			BDE2 SR 8
		Goto See
	}
}

Actor BeastTransform : DnD_Boolean { }

Actor BeastFireBall {
	Radius 8
	Height 16
	Speed 24
	PROJECTILE
	Damage (5*random(4, 8))
	DamageType "Fire"
	Stamina 32
	DeathSound "weapons/phoenixhit"
	+DONTBLAST
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			FX14 ABC 4 Bright
		Loop
		Death:
			TNT1 A 0 A_SpawnItemEx("OrangeParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AAA 0 A_SpawnItemEx("ExplosionFX2", 0, 0, 0, frandom(-1, 1), frandom(-1, 1), frandom(-1, 1))
			TNT1 AAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			FX14 DE 6 Bright
			FX14 FGH 4 Bright
		Stop
	}
}

Actor BeastExp1 : BaseExplosionDamage {
	DamageType "Fire"
	Stamina 32
	Obituary "%o was turned to crisps by a Bloodseeker."
	States
	{
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(2, 48, 0)
		Stop
	}
}

Actor BeastExp2 : BeastExp1 {
	States
	{
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(4, 48, 0)
		Stop
	}
}

Actor BeastFlame {
	Radius 6
	Height 8
	Speed 28
	PROJECTILE
	Scale 0.75
	Damage (5*random(1,2))
	DamageType "Fire"
	Stamina 32
	DeathSound "weapons/phoenixhit"
	+DONTBLAST
	States {
		spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			TNT1 A 0 A_PlaySound ("weapons/burning")
			FX06 ABC 4 Bright A_SpawnItem("BeastExp1")
		Loop
		Death:
			TNT1 A 0 A_SpawnItemEx("OrangeParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AAA 0 A_SpawnItemEx("ExplosionFX2", 0, 0, 0, frandom(-1, 1), frandom(-1, 1), frandom(-1, 1))
			TNT1 AAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			FX06 DEFG 3 Bright A_SpawnItem("BeastExp2")
		Stop
	}
}

Actor Barbatos : DnD_BaseHybridMonster {
	Health 0x7FFFFFFF
	Species "HK"
	BloodColor "Red"
	Height 64
	Radius 24
	PainChance 32
	Mass 1024
	+ISMONSTER
	Scale 0.75
	Translation "0:255=%[0.00,0.00,0.00]:[0.76,0.67,0.50]", "0:47=0:47", "80:111=80:111", "160:191=160:191", "208:235=208:235"
	SeeSound "cyber/sight"
	PainSound "demon/pain2"
	DeathSound "cyber/death"
	ActiveSound "cyber/active"
	Obituary "%o was sent to the pits of hell by a Barbatos."
	Tag "Barbatos"
	Speed 12
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_BARBATOS)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_UNCOMMON)
		Goto SpawnSetup
		
		IdleState:
			CYBR AB 10 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			CYBR A 3 Fast A_Hoof
			CYBR ABBCC 3 Fast A_Chase
			CYBR D 3 Fast A_Metal
			CYBR D 3 Fast A_Chase
		Goto See
		MeleeState:
		MissileState:
			CYBR E 6 Fast A_FaceTarget
			CYBR F 12 Fast A_CustomMissile("CyberdemonRocketWeak",36,-24)
			CYBR E 12 Fast A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteAlways("DnD On Monster Attack", 0)
			CYBR F 12 Fast A_CustomMissile("CyberdemonRocketWeak",36,-24)
			CYBR E 12 Fast A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteAlways("DnD On Monster Attack", 0)
			CYBR F 12 Fast A_CustomMissile("CyberdemonRocketWeak",36,-24)
		Goto See
		PainState:
			CYBR G 10 Fast A_Pain
		Goto See
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState:
			CYBR H 10
			CYBR I 10 A_Scream
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Medium_Delayed", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			CYBR JKL 10
			CYBR M 10 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Medium_Delayed", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			CYBR NO 10
			CYBR P 30
			CYBR P -1 A_KillMaster
		Stop
		RaiseState:
			CYBR ONMLKJIH 4
		Goto See
	}
}

Actor CyberdemonRocketWeakExplosion : BaseExplosionDamage {
	DamageType "Explosive"
	Stamina 4
	Obituary "%o was sent to the pits of hell by a Barbatos."
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(48, 96, 0)
		Stop
	}
}

Actor CyberdemonRocketWeak : CyberdemonRocket {
	DamageType "Explosive"
	Stamina 4
	Damage (6 * random(5, 8))
	Obituary "%o was sent to the pits of hell by a Barbatos."
	Scale 0.85
	Speed 20
	States {
		Death:
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlare", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE | SXF_NOCHECKPOSITION, 0)
			TNT1 AAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 180))
			TNT1 AAAAA 0 A_CustomMissile("RocketSmoke", 0, 0, random(0, 360), 2, random(0, 360))
			TNT1 AAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random (0, 360), 2, random (0, 360))
			MISL B 8 Bright A_SpawnItem("CyberdemonRocketWeakExplosion")
			MISL C 6 Bright
			MISL D 4 Bright
		Stop
	}
}

Actor ShadowWizard : DnD_BaseHybridMonster {
	Obituary "%o was lobotomized by a Shadow Wizard."
	Health 0x7FFFFFFF
	Radius 21
	Height 64
	PainChance 32
	Species "HK"
	MissileType "SkullWizardProjectile"
	PainSound "H2ShadowWizard/Pain"
	DeathSound "H2ShadowWizard/Death"
	ActiveSound "H2ShadowWizard/Sight"
	MeleeSound "H2ShadowWizard/Melee"
	Tag "Shadow Wizard"
	Mass 256
	Speed 6
	MeleeRange 96
	+ISMONSTER
	+DontHurtSpecies
	+MissileMore
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_SHADOWWIZARD)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE1)
		Goto SpawnSetup

		IdleState:
			SHWZ A 1 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			SHWZ AAAAAABBBBBBB 4 Fast A_Chase
		Goto See
		MeleeState:
			SHWZ C 6 Fast Bright A_FaceTarget
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_CustomMeleeAttack(10, "", "")
			TNT1 A 0 A_CustomMissile("SkullWizardPush", 40)
			SHWZ D 6 Fast Bright A_FaceTarget
		Goto See
		MissileState:
			SHWZ C 0 A_Jump(128, "Teleport")
		Attack:
			SHWZ C 8 Fast A_FaceTarget
			SHWZ D 8 Fast Bright A_FaceTarget
			SHWZ D 8 Fast Bright A_CustomMissile("ShadowWizardProjectile", 40, 0, 0)
			SHWZ D 0 Bright A_Jump(80, 2)
			SHWZ D 0 Bright A_SpidReFire
		Goto MissileState + 1
			SHWZ D 0
		Goto See
		Teleport:
			SHWZ C 0 A_JumpIfCloser(512, 1)
		Goto See
			TNT1 A 0 A_ChangeFlag("NoTeleport", 1)
			TNT1 A 0 A_ChangeFlag("NoDropOff", 0)
			SHWZ C 8 A_PlaySoundEx("H2ShadowWizard/Teleport", "SoundSlot7", 0)
			SHWZ DEF 8 Fast Bright
			TNT1 A 0 A_Stop
			TNT1 A 0 A_StopSoundEx("SoundSlot7")
			TNT1 A 0 A_SpawnItemEx("SkullWizardTeleport", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 A 0 A_ChangeFlag(Invulnerable, 1)
			TNT1 A 0 A_UnSetShootable
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Wander
			TNT1 AAA 3 Fast A_Wander
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Wander
			TNT1 AAA 3 Fast A_Wander
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Wander
			TNT1 AAA 3 Fast A_Wander
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Wander
			TNT1 AAA 3 Fast A_Wander
			TNT1 A 0 A_ChangeFlag(Invulnerable, 0)
			TNT1 A 0 A_SetShootable
			TNT1 A 0 A_PlaySound("Wizard/Appear", 7)
			SKWZ A 0 A_SpawnItemEx("SkullWizardTeleport", 0, 0, 0, 0, 0, 0, 0, 128)
			SHWZ A 0 A_ChangeFlag("NoDropOff", 1)
			SHWZ A 0 A_ChangeFlag("NoTeleport", 0)
			SHWZ A 0 A_Jump(224, "Attack")
		Goto See
		PainState:
			SHWZ A 3 Fast
			SHWZ A 3 Fast A_Pain
			SHWZ A 0 A_Jump(128, "Teleport")
		Goto See
		XDeathState:
		DeathState:
			SHWZ G 5 A_Scream
			SHWZ HIJ 5 bright
			SHWZ K 5 bright
			SHWZ LM 5 bright
			SHWZ N 5
			SHWZ O 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("DissipationEffect")
			SHWZ O 5 bright
			SHWZ P -1 A_KillMaster
		Stop
		RaiseState:
			SHWZ ON 5
			SHWZ MLKJIH 5 Bright
			SHWZ G 5
		Goto See
	}
}

Actor ShadowWizardProjectile : SkullWizardProjectile {
	Damage (random(3, 6) * 6)
	SeeSound "H2ShadowWizard/Fire"
    DeathSound "H2ShadowWizard/Hit"
}

ACTOR Kjaroch : DnD_BaseHybridMonster {
	Health 0x7FFFFFFF
	PainChance 32
	SeeSound "Kjaroch/See"
	PainSound "Kjaroch/pain"
	DeathSound "Kjaroch/death"
	ActiveSound "Kjaroch/Act"
	Obituary "%o was burned by the infernal flames of a Kjaroch."
	HitObituary "%o was torn apart by a Kjaroch."
	Translation  "0:47=[202,102,121]:[0,0,0]", "0:12=0:12", "13:15=1:2", "48:72=102:111", "73:79=6:8", "79:79=8:8", "137:141=110:112", "141:143=5:5", "144:150=109:109", "151:164=6:110", "190:191=[4,2,2]:[0,0,0]"
	Speed 9
	Tag "Kjaroch"
	Radius 24
	Height 64
	Mass 1000
	+ISMONSTER
	+DONTHURTSPECIES
	+MISSILEMORE
	BloodColor "7D 9D 59"
	Species "HK"
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_KJAROCH)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE2)
		Goto SpawnSetup

		IdleState:
			LOHS AB 10 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			LOHS AABBCCDD 2 Fast A_Chase
		Goto See
		PainState:
			LOHS H 3 Fast
			LOHS H 3 Fast A_Pain
		Goto See
		MeleeState:
			TNT1 A 0 A_PlaySound("Kjaroch/Melee")
			LOHS E 4 Fast A_FaceTarget
			LOHS F 4 Fast A_FaceTarget
			TNT1 A 0 A_CustomMeleeAttack(30, "Kjaroch/Hit", "")
			LOHS G 4 Fast A_FaceTarget
			TNT1 A 0 A_PlaySound("Kjaroch/Melee")
			LOHS P 4 Fast A_FaceTarget
			LOHS Q 4 Fast A_FaceTarget
			TNT1 A 0 A_CustomMeleeAttack(30, "Kjaroch/Hit", "")
			LOHS R 4 Fast A_FaceTarget
		Goto See
		MissileState:
			TNT1 A 0 A_Jump(112, "Missile2", "Missile3")
			TNT1 A 0 A_PlaySound("Kjaroch/Melee")
			LOHS EF 6 Fast A_FaceTarget
			LOHS G 6 Fast A_BasicAttack (30, "Kjaroch/Hit", "KjarochBall1", 32)
			TNT1 A 0 A_PlaySound("Kjaroch/Melee")
			LOHS PQ 6 Fast A_FaceTarget
			LOHS R 6 Fast A_BasicAttack (30, "Kjaroch/Hit", "KjarochBall1", 32)
			TNT1 A 0 A_PlaySound("Kjaroch/Melee")
			LOHS EF 6 Fast A_FaceTarget
			LOHS G 6 Fast A_BasicAttack (30, "Kjaroch/Hit", "KjarochBall1", 32)
		Goto See
		Missile2:
			TNT1 A 0 A_PlaySound("Kjaroch/Melee")
			LOHS EF 6 Fast A_FaceTarget
			LOHS G 6 Fast A_BasicAttack (30, "Kjaroch/Hit", "KjarochBall2", 36)
			TNT1 A 0 A_PlaySound("Kjaroch/Melee")
			LOHS PQ 6 Fast A_FaceTarget
			LOHS R 6 Fast A_BasicAttack (30, "Kjaroch/Hit", "KjarochBall2", 36)
		Goto See
		Missile3:
			TNT1 A 0 A_Jump(128, "Other")
			TNT1 A 0 A_PlaySound("Kjaroch/Melee")
			LOHS EF 6 Fast A_FaceTarget
			LOHS G 6 Fast A_BasicAttack (30, "Kjaroch/Hit", "KjarochGroundFlames", 1)
		Goto See
		Other:
			TNT1 A 0 A_PlaySound("Kjaroch/Melee")
			LOHS PQ 6 Fast A_FaceTarget
			LOHS R 6 Fast A_BasicAttack (30, "Kjaroch/Hit", "KjarochGroundFlames", 1)
			LOHS R 0 A_CustomMissile("KjarochGroundFlames", 0, 0, -9, CMF_AIMDIRECTION)
			LOHS R 0 A_CustomMissile("KjarochGroundFlames", 0, 0, 9, CMF_AIMDIRECTION)
		Goto See
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState:
			LOHS I 8
			LOHS J 2 A_Scream
			LOHS JJJ 2 A_SpawnItemEx("ExplosionFXMagicGreen", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128) 
			LOHS KKKK 2 A_SpawnItemEx("ExplosionFXMagicGreen", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128) 
			TNT1 A 0 A_NoBlocking
			LOHS LLLL 2 A_SpawnItemEx("ExplosionFXMagicGreen", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128) 
			LOHS MN 8
			LOHS O -1 A_KillMaster
		Stop
		RaiseState:
			LOHS ONMLKJI 8
		Goto See
	}
}

Actor KjarochBall1Trail {
	Renderstyle Add
	Alpha 0.66
	+NOGRAVITY
	+NOINTERACTION
	+CLIENTSIDEONLY
	
	States {
		Spawn:
			TNT1 A 2
			BAL7 AB 1 Bright A_FadeOut(0.1)
		Loop
	}
}

Actor KjarochBall1 : BaronBall2 {
	Damage (5 * random(4, 6))
	DamageType "Poison"
	Stamina 128
	Decal "BaronScorch"
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			BAL7 AABB 2 Bright A_SpawnItem("KjarochBall1Trail")
		Loop
	}
}

Actor KjarochBall2 : KjarochBall1 {
	Damage (5 * random(2, 4))
	SeeSound "Kjaroch/Missile2"
	DeathSound "redballbdeth"
	Decal "BaronScorch"
	Scale 1.1
	Height 16
	Radius 10
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			D4FX AAABBB 1 Bright A_SpawnItem("KjarochBall2Trail")
		Loop
		Death:
			TNT1 A 0 A_SpawnItemEx("GreenParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AAA 0 A_SpawnItemEx("ExplosionFX4", 0, 0, 0, frandom(-1, 1), frandom(-1, 1), frandom(-1, 1))
			TNT1 AAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			TNT1 A 0 A_SpawnItem("KjarochBall2Explosion")
			D4FX CCCDDDEEE 1 Bright A_CustomMissile("KjarochBall2Pieces", 0, 0, random(0, 360), CMF_TRACKOWNER | CMF_AIMDIRECTION, random(-16, 16))
			D4FX FGH 3 Bright
		Stop
	}
}

Actor KjarochBall2Trail {
	RenderStyle Add
	Alpha 0.66
	+CLIENTSIDEONLY
	+NOGRAVITY
	+NOINTERACTION
	States {
		Spawn:
			D4TR DEFGH 1
		Stop
	}
}

Actor KjarochBall2Explosion : BaseExplosionDamage {
	DamageType "Poison"
	Stamina 128
	Obituary  "%o was burned by the infernal flames of a Kjaroch."
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(18, 96, 0)
		Stop
	}
}

Actor KjarochBall2Pieces {
	Damage (2)
	DamageType "Poison"
	Stamina 128
	PROJECTILE
	Speed 16
	Height 8
	Radius 5
	-NOGRAVITY
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			BPBL AB 2 Bright
		Loop
		Death:
			BPBL CDEFG 2 Bright
		Stop
	}
}

Actor KjarochGroundFlames {
	Radius 10
	Height 10
	Speed 20
	Damage (4 * random(3, 6))
	DamageType "Poison"
	Stamina 128
	Scale 1.3
	+FloorHugger
	+DONTBLAST
	RenderStyle Add
	Projectile
	DeathSound "comet/explosion"
	Decal "RevenantScorch"
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			FSFX NOPQRSTNOPQRST 3 A_SpawnItemEx("KjarochGroundFlamesTrail",0,0,0,0,0,0,0,128)
		Loop
		Death:
			TNT1 A 0 A_SpawnItemEx("GreenParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			TNT1 AAAA 0 A_SpawnItemEx("ExplosionFXMagicGreen", 0, 0, random(0, 16),random(-4,4),random(-4,4),random(1,4), 48, 128) 
			TNT1 A 0 A_SpawnItem("KjarochGroundFlamesExplosion")
			FSFX UVW 3
		Stop
	}
}

Actor KjarochGroundFlamesExplosion : BaseExplosionDamage {
	DamageType "Poison"
	Stamina 128
	Obituary  "%o was burned by the infernal flames of a Kjaroch."
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(36, 96, 0)
		Stop
	}
}

Actor KjarochGroundFlamesTrail {  
	Scale 0.8
	RenderStyle Add
	Alpha 0.6
	+NOINTERACTION
	+CLIENTSIDEONLY
	States {
		Spawn:
			TNT1 A 4
			FSFX NOPQRST 3
		Stop
	}
}

Actor MagmaSerpent : DnD_BaseHybridMonster {
	Health 0x7FFFFFFF
	Radius 24
	Height 64
	Speed 13
	PainChance 64
	Mass 640
	BloodColor "Orange"
	Species "HK"
	+ISMONSTER
	+MISSILEMORE
	+DONTHURTSPECIES
	+NORADIUSDMG
	SeeSound "ChaosSerpent/See"
	AttackSound "ChaosSerpent/Melee"
	PAINSOUND "Beast/pain"
	DeathSound "ChaosSerpent/Die"
	ActiveSound "ChaosSerpent/See"
	Obituary "%o was blasted by a Magma Serpent."
	HitObituary "%o was swallowed by a Magma Serpent."
	Tag "Magma Serpent"
	const int ChunkFlags = SXF_TRANSFERTRANSLATION|SXF_ABSOLUTEVELOCITY;
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_MAGMASERPENT)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE1)
		Goto SpawnSetup

		IdleState:
			RDMN AA 10 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			RDMN ABCD 4 Fast A_Chase
		Goto See
		PainState:
			RDMN E 4 Fast
			RDMN E 4 Fast A_Pain
		Goto See
		MissileState:
			RDMN E 5 Fast A_FaceTarget
			RDMN F 6 Fast A_FaceTarget
			RDMN E 0 A_JumpIfCloser(300, "Breath")
			RDMN G 5 Fast BRIGHT A_CustomMissile("Lavaball",64,0,0,0)
		goto see
		Breath:
			TNT1 A 0 A_Jump(128, "Spit")
			RDMN G 0 A_PlaySoundEx("weapons/burning", auto)
			RDMN G 0 A_FaceTarget
			RDMN GGG 2 Fast bright A_CustomMissile("BeastFlame", 65, 0, random(-10,10), CMF_CHECKTARGETDEAD)
			RDMN G 0 A_PlaySoundEx("weapons/burning", auto)
			RDMN G 0 A_FaceTarget
			RDMN GGG 2 Fast bright A_CustomMissile("BeastFlame", 65, 0, random(-10,10), CMF_CHECKTARGETDEAD)
			RDMN G 0 A_PlaySoundEx("weapons/burning", auto)
			RDMN G 0 A_FaceTarget
			RDMN GGG 2 Fast bright A_CustomMissile("BeastFlame", 65, 0, random(-10,10), CMF_CHECKTARGETDEAD)
			RDMN G 0 A_PlaySoundEx("weapons/burning", auto)
			RDMN G 0 A_FaceTarget
			RDMN GGG 2 Fast bright A_CustomMissile("BeastFlame", 65, 0, random(-10,10), CMF_CHECKTARGETDEAD)
			RDMN G 0 A_PlaySoundEx("weapons/burning", auto)
			RDMN G 0 A_FaceTarget
			RDMN GGG 2 Fast bright A_CustomMissile("BeastFlame", 65, 0, random(-10,10), CMF_CHECKTARGETDEAD)
		goto See
		Spit:
			TNT1 A 0 A_PlaySoundEx("weapons/burning", auto)
			TNT1 A 0 A_FaceTarget
			RDMN GGGG 2 Fast bright A_SpawnItemEx("VolcanoTBlast2", 0, 0, 68, 12, 0, -5, frandom(-4.8, 4.8))
			TNT1 AA 0 A_SpawnItemEx("VolcanoTBlast2", 0, 0, 68, 12, 0, -5, frandom(-4.8, 4.8))
			TNT1 A 0 A_PlaySoundEx("weapons/burning", auto)
			TNT1 A 0 A_FaceTarget
			RDMN GGGG 2 Fast bright A_SpawnItemEx("VolcanoTBlast2", 0, 0, 68, 16, 0, -5, frandom(-4.8, 4.8))
			TNT1 AA 0 A_SpawnItemEx("VolcanoTBlast2", 0, 0, 68, 12, 0, -5, frandom(-4.8, 4.8))
			TNT1 A 0 A_PlaySoundEx("weapons/burning", auto)
			TNT1 A 0 A_FaceTarget
			RDMN GGGG 2 Fast bright A_SpawnItemEx("VolcanoTBlast2", 0, 0, 68, 20, 0, -5, frandom(-4.8, 4.8))
			TNT1 AA 0 A_SpawnItemEx("VolcanoTBlast2", 0, 0, 68, 12, 0, -5, frandom(-4.8, 4.8))
			TNT1 A 0 A_PlaySoundEx("weapons/burning", auto)
			TNT1 A 0 A_FaceTarget
			RDMN GGGG 2 Fast bright A_SpawnItemEx("VolcanoTBlast2", 0, 0, 68, 24, 0, -5, frandom(-4.8, 4.8))
			TNT1 AA 0 A_SpawnItemEx("VolcanoTBlast2", 0, 0, 68, 12, 0, -5, frandom(-4.8, 4.8))
			TNT1 A 0 A_PlaySoundEx("weapons/burning", auto)
			TNT1 A 0 A_FaceTarget
			RDMN GGGG 2 Fast bright A_SpawnItemEx("VolcanoTBlast2", 0, 0, 68, 28, 0, -5, frandom(-4.8, 4.8))
			RDMN GG 0 A_SpawnItemEx("VolcanoTBlast2", 0, 0, 68, 12, 0, -5, frandom(-4.8, 4.8))
		Goto See
		MeleeState:
			RDMN E 5 Fast A_FaceTarget
			RDMN F 7 Fast A_FaceTarget
			RDMN G 5 Fast A_CustomMeleeAttack(random[DemonAttack1](4,16)*2)
		Goto See
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState:
			RDMN H 6
			RDMN I 0 A_SpawnItemEx("MagmaChunk1", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625),
						   1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 90)
			RDMN I 0 A_SpawnItemEx("MagmaChunk2", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625),
						   1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
			RDMN I 0 A_SpawnItemEx("MagmaChunk3", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625),
						   1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
			RDMN I 0 A_SpawnItemEx("MagmaChunk4", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625),
						   1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
			RDMN I 6 A_SpawnItemEx("MagmaChunk5", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625),
						   1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
			RDMN J 1
			RDMN J 6 A_Scream
			RDMN K 6 A_NoBlocking
			RDMN L 6  A_QueueCorpse
			RDMN MNO 6
			RDMN P -1 A_KillMaster
		Stop
		RaiseState:
			RDMN PONMLKJIH 5
		Goto See
	}
}



ACTOR MagmaChunk1 : DemonChunk {
	+CLIENTSIDEONLY
	+MOVEWITHSECTOR
	States {
		Spawn:
			RDMA A 4
			RDMA A 10
			RDMA A 20
		Wait
		Death:
			RDMA A -1
		Stop
	}
}

ACTOR MagmaChunk2 : DemonChunk {
	+CLIENTSIDEONLY
	+MOVEWITHSECTOR
	States {
		Spawn:
			RDMB A 4
			RDMB A 10
			RDMB A 20
		Wait
		Death:
			RDMB A -1
		Stop
	}
}

ACTOR MagmaChunk3 : DemonChunk {
	+CLIENTSIDEONLY
	+MOVEWITHSECTOR
	States {
		Spawn:
			RDMC A 4
			RDMC A 10
			RDMC A 20
		Wait
		Death:
			RDMC A -1
		Stop
	}
}

ACTOR MagmaChunk4 : DemonChunk {
	+CLIENTSIDEONLY
	+MOVEWITHSECTOR
	States {
		Spawn:
			RDMD A 4
			RDMD A 10
			RDMD A 20
		Wait
		Death:
			RDMD A -1
		Stop
	}
}

ACTOR MagmaChunk5 : DemonChunk {
	+CLIENTSIDEONLY
	+MOVEWITHSECTOR
	States {
		Spawn:
			RDME A 4
			RDME A 10
			RDME A 20
		Wait
		Death:
			RDME A -1
		Stop
	}
}

Actor DreadKnight : DnD_BaseHybridMonster {
	Translation "3:3=40:40", "80:111=%[0.00,0.00,0.00]:[1.43,0.31,0.31]"
	Health 0x7FFFFFFF
	Scale 1.1
	RadiusDamageFactor 1.0
	HitObituary "%o was dismembered by a dread knight."
	Obituary "%o cowered away in fear of a dread knight's power."
	SeeSound "DreadKnight/See"
	ActiveSound "DreadKnight/Act"
	PainSound "DreadKnight/pain"
	DeathSound "DreadKnight/Die"
	MeleeSound "dknight/melee"
	DamageType "Melee"
	Stamina 1
	Renderstyle Translucent
	+ISMONSTER
	+NOFEAR
	+NODAMAGETHRUST
	+PIERCEARMOR
	+DONTRIP
	+DONTHURTSPECIES
	+NOBLOOD
	Species "HK"
	Tag "Dread Knight"
	Radius 24
	Height 64
	PainChance 100
	Mass 0x7FFFFFFF
	MeleeRange 96
	MaxStepHeight 32
	Speed 9
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_DREADKNIGHT)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_VERYRARE)
		Goto SpawnSetup

		IdleState:
			KNGT E 5 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Take", DND_ISBLOCKING, -1, -1, -1)
			KNGT AABBCCDD 2 Fast A_Chase
		Goto See
		Rush:
			KNGT ABCD 2 Fast A_Chase("Melee", "Charge")
			KNGT A 0 A_JumpIfInventory("DreadShield", 1, "Rush")
		Goto See
		MeleeState:
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			KNGT E 3 Fast A_FaceTarget
			KNGT F 2 Fast A_FaceTarget
			KNGT F 0 A_PlaySound("dknight/swing")
			KNGT GH 2 Fast
			KNGT I 3 Fast A_CustomMeleeAttack(random(8, 28), "dknight/melee", "", "Dread")
			KNGT J 4 Fast A_CustomMeleeAttack(random(8, 28), "dknight/melee", "", "Dread")
			KNGT E 2 Fast
		Goto See
		MissileState:
			TNT1 A 0 A_JumpIfCloser(224, "Shield")
		Skulls:
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			KNGT E 4 Fast A_FaceTarget
			KNGT F 3 Fast A_FaceTarget
			KNGT GH 3 Fast A_FaceTarget
			TNT1 A 0 A_CustomMissile("DreadSkull", 32, -16)
			TNT1 A 0 A_CustomMissile("DreadSkull", 32, 16)
			KNGT I 4 Fast A_CustomMissile("DreadSkull", 48)
			TNT1 A 0 A_CustomMissile("KFireBall",32,0,-12)
			TNT1 A 0 A_CustomMissile("KFireBall",32,0,-8)
			TNT1 A 0 A_CustomMissile("KFireBall",32,0,-4)
			TNT1 A 0 A_CustomMissile("KFireBall",32,0,0)
			TNT1 A 0 A_CustomMissile("KFireBall",32,0,4)
			TNT1 A 0 A_CustomMissile("KFireBall",32,0,8)
			TNT1 A 0 A_CustomMissile("KFireBall",32,0,12)
			KNGT E 2 Fast
		Goto See
		Charge:
			TNT1 A 0 A_TakeInventory("KnightTimer", 0)
			TNT1 A 0 A_PlaySound("DreadKnight/See")
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 ACS_ExecuteAlways(971, 0, 14) // script sets velocity, ensures no dropoff
			TNT1 A 0 A_ChangeFlag("SKULLFLY", 1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Give", DND_ISBLOCKING, -1, -1, -1)
		ChargeLoop:
			TNT1 A 0 A_JumpIfInventory("KnightTimer", 0, "Rush")
			TNT1 A 0 ACS_ExecuteAlways(971, 0, 14)
			KNGT ABCD 2 Fast A_FaceTarget
			TNT1 A 0 A_GiveInventory("KnightTimer", 1)
		Loop
		Shield:
			TNT1 A 0 A_JumpIfInventory("DreadShield", 1, "Charge")
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			KNGT EFG 3 Fast
			TNT1 A 0 A_PlaySound("items/bookofthedead")
			TNT1 A 0 A_GiveInventory("DreadShield", 1)
			TNT1 A 0 A_ChangeFlag("GHOST", 1)
			TNT1 A 0 A_SetTranslucent(0.5)
			KNGT IE 3 Fast
		Goto Charge
		PainState:
			TNT1 A 0 A_ChangeFlag("GHOST", 0)
			TNT1 A 0 A_TakeInventory("DreadShield", 1)
			TNT1 A 0 A_SetTranslucent(1.0)
			KNGT E 3 Fast A_Pain
			KNGT E 3 Fast
		Goto See
		RaiseState:
			TNT1 A 0 A_SetTranslucent(1.0)
			TNT1 A 0 A_ChangeFlag("GHOST", 0)
			TNT1 A 0 A_TakeInventory("DreadShield", 1)
			KNGT QPONLMK 3
		Goto See
		XDeathState:
		DeathState:
			TNT1 A 0 A_SetTranslucent(1.0)
			TNT1 A 0 A_ChangeFlag("GHOST", 0)
			TNT1 A 0 A_TakeInventory("DreadShield", 1)
			KNGT K 6 A_Scream
			KNGT L 5
			KNGT M 5
			TNT1 A 0 A_NoBlocking
			KNGT NOPQ 5
			KNGT R -1 A_KillMaster
		Stop
	}
}

Actor DreadShield : DnD_Boolean { }

Actor KnightTimer : Inventory {
	inventory.maxamount 20
}

Actor DreadSkull {
	PROJECTILE
	Damage (12)
	DamageType "MagicalFire"
	Stamina 8
	+NODAMAGETHRUST
	+PIERCEARMOR
	+DONTBLAST
	Renderstyle Add
	Speed 18
	Scale 0.6
	SeeSound "H2SkullWizard/Fire"
    DeathSound "H2SkullWizard/Hit"
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			TNT1 A 0 A_BishopMissileWeave
			IFX1 A 1 A_CustomMissile("KBallTrail",0,0,-90,0)
			IFX1 A 1 A_BishopMissileWeave
			TNT1 A 0 A_BishopMissileWeave
			IFX1 B 1 A_CustomMissile("KBallTrail",0,0,90,0)
			IFX1 B 1 A_BishopMissileWeave
		Loop
		Death:
			IFX1 IJKL 4 Bright
		Stop
	}
}

Actor MagmaGolem : DnD_BaseHybridMonster { 
    Health 0x7FFFFFFF
    Speed 6
	Scale 1.35
    Height 64
    Radius 24
    Mass 4096
    PainChance 48
    ReactionTime 8
    SeeSound "EarthGolem/See"
    PainSound "EarthGolem/Pain"
    DeathSound "EarthGolem/Death"
    ActiveSound "EarthGolem/Act"
    Obituary "%o was melted by a Magma Golem." 
	Species "HK"
	Tag "Magma Golem"
	BloodColor "D7 15 15"
	MeleeRange 76
	MaxTargetRange 428
	+ISMONSTER
	+DONTHURTSPECIES
	+DONTRIP
    States { 
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_MAGMAGOLEM)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_VERYRARE)
		Goto SpawnSetup
	
		IdleState:
		   GOL2 AB 10 A_GiveInventory("DnD_SightChecker", 1)
	    Loop 
		SeeState: 
			GOL2 AABBCCDD 2 Fast A_Chase
	    Goto See 
		MeleeState: 
			TNT1 A 0 A_PlaySound("Golem/Swing")
			TNT1 A 0 A_Jump(128, "OtherMelee")
			GOL2 E 6 Fast A_FaceTarget
			GOL2 F 2 Fast A_FaceTarget
			TNT1 A 0 A_CustomMeleeAttack(8 * random(6, 10), "Golem/Hit")
			GOL2 FG 4 Fast 
		Goto See
		OtherMelee:
			GOL2 R 6 Fast A_FaceTarget
			GOL2 S 2 Fast A_FaceTarget
			TNT1 A 0 A_CustomMeleeAttack(8 * random(6, 10), "Golem/Hit")
			GOL2 ST 4 Fast 
		Goto See
		MissileState:
			GOl2 Q 4 Fast A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(80, "Melee")
			GOl2 Q 4 Fast A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(80, "Melee")
			GOl2 Q 4 Fast A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(80, "Melee")
			GOl2 Q 4 A_FaceTarget
			TNT1 A 0 A_Jump(144, "MagmaNade")
			TNT1 A 0 A_FaceTarget
			GOL2 U 3 Fast Bright
			TNT1 A 0 A_FaceTarget
			GOL2 U 7 Fast Bright A_CustomMissile("beastball2", 40)
			TNT1 A 0 A_FaceTarget
			GOL2 U 7 Fast Bright A_CustomMissile("beastball2", 40)
			TNT1 A 0 A_FaceTarget
			GOL2 U 7 Fast Bright A_CustomMissile("beastball2", 40)
		Goto See
		MagmaNade:
			GOL2 U 5 Fast Bright A_FaceTarget
			GOL2 U 2 Fast Bright A_CustomMissile("MagmaGolemNade", 40, 0, 0, CMF_OFFSETPITCH, 16)
		Goto See
		PainState: 
		   GOL2 H 4 Fast
		   GOL2 H 4 Fast A_Pain
		   Goto See
		XDeathState:
		DeathState: 
		   GOL2 I 5
		   GOL2 J 4 A_Scream
		   GOL2 KKKK 1 A_CustomMissile("VolcanoTBlast2", random(16, 32), 0, random(0, 360), CMF_TRACKOWNER | CMF_AIMDIRECTION, 5 * random(-1, 18))
		   TNT1 A 0 A_SpawnItemEx("GolemSoul", 0, 0, 10, 0, 0, 1)
		   TNT1 A 0 A_NoBlocking
		   GOL2 LLLLMMMM 1 A_CustomMissile("VolcanoTBlast2", random(16, 32), 0, random(0, 360), CMF_TRACKOWNER | CMF_AIMDIRECTION, 5 * random(-1, 18))
		   GOL2 NO 4 
		   GOL2 P -1 A_KillMaster
		Stop
		RaiseState: 
		   GOL2 ONMLKJI 3
		Goto See 
    } 
}

Actor MagmaGolemExp : BaseExplosionDamage {
	DamageType "Fire"
	Stamina 32
	States {
		Spawn:
			TNT1 A 1 NoDelay A_Explode(28, 96, 0)
		Stop
	}
}

Actor MagmaGolemExp_2 : MagmaGolemExp {
	States {
		Spawn:
			TNT1 A 1 NoDelay A_Explode(20, 64, 0)
		Stop
	}
}

Actor MagmaGolemExp_3 : MagmaGolemExp {
	States {
		Spawn:
			TNT1 A 1 NoDelay A_Explode(12, 48, 0)
		Stop
	}
}

Actor MagmaGolemNade {
	PROJECTILE
	Damage (25)
	DamageType "Fire"
	Stamina 32
	Speed 20
	Height 18
	Radius 9
	BounceType Hexen
	BounceCount 6
	SeeSound "imp/attack"
	DeathSound "imp/shotx"
	BounceSound "SorcererBallBounce"
	Gravity 1.5
	Scale 1.15
	+CANBOUNCEWATER
	+USEBOUNCESTATE
	-NOGRAVITY
	States {
		Spawn:
			VFBL AABB 2 Bright A_SpawnItemEx("PuffyC", random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625, 0, 0, 0, 0, SXF_ABSOLUTEPOSITION, 64)
		Loop
		Bounce.Wall:
		Bounce.Floor:
			 TNT1 AAA 0 A_CustomMissile("VolcanoTBlast2", 8, 0, random(0, 360), CMF_TRACKOWNER | CMF_AIMDIRECTION, 5 * random(-36, 36))
			 TNT1 AA 0 A_CustomMissile("MagmaGolemNade_2", 0, 0, 45 * random(0, 8), CMF_TRACKOWNER)
		Death:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_SpawnItemEx("OrangeParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AAAA 0 A_SpawnItemEx("ExplosionFX2", 0, 0, 0, frandom(-1, 1), frandom(-1, 1), frandom(-1, 1))
			TNT1 AAAAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			TNT1 AAA 0 A_CustomMissile("VolcanoTBlast2", 14, 0, random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			TNT1 AAA 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 90 + random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			TNT1 AAA 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 180 + random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			TNT1 AAA 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 270 + random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			XPL1 ABC 4 Bright A_SpawnItem("MagmaGolemExp")
			XPL1 DEF 4 bright
		Stop
	}
}

Actor MagmaGolemNade_2 : MagmaGolemNade {
	Damage (15)
	Scale 1.0
	Speed 20
	States {
		Bounce.Wall:
		Bounce.Floor:
			 TNT1 AA 0 A_CustomMissile("VolcanoTBlast2", 8, 0, random(0, 360), CMF_TRACKOWNER | CMF_AIMDIRECTION, 5 * random(-36, 36))
			 TNT1 AAAA 0 A_CustomMissile("MagmaGolemNade_3", 0, 0, 45 * random(0, 8), CMF_TRACKOWNER)
		Death:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_SpawnItemEx("OrangeParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AAA 0 A_SpawnItemEx("ExplosionFX2", 0, 0, 0, frandom(-1, 1), frandom(-1, 1), frandom(-1, 1))
			TNT1 AAAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			TNT1 AA 0 A_CustomMissile("VolcanoTBlast2", 14, 0, random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			TNT1 AA 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 90 + random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			TNT1 AA 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 180 + random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			TNT1 AA 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 270 + random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			XPL1 ABC 4 Bright A_SpawnItem("MagmaGolemExp_2")
			XPL1 DEF 4 bright
		Stop
	}
}

Actor MagmaGolemNade_3 : MagmaGolemNade {
	Damage (10)
	Speed 20
	Scale 0.75
	States {
		Bounce.Wall:
		Bounce.Floor:
		Bounce.Ceiling:
			 TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 8, 0, random(0, 360), CMF_TRACKOWNER | CMF_AIMDIRECTION, 5 * random(-36, 36))
		Goto Spawn
		Death:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_SpawnItemEx("OrangeParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AA 0 A_SpawnItemEx("ExplosionFX2", 0, 0, 0, frandom(-1, 1), frandom(-1, 1), frandom(-1, 1))
			TNT1 AAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 14, 0, random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 90 + random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 180 + random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2", 14, 0, 270 + random(-12, 12), CMF_TRACKOWNER, random(0, 16))
			XPL1 ABC 4 Bright A_SpawnItem("MagmaGolemExp_3")
			XPL1 DEF 4 bright
		Stop
	}
}

const float warmaster_ratio = 0.25;

ACTOR Warmaster : DnD_BaseHybridMonster { 
    Health 0x7FFFFFFF
    Radius 24 
    Height 64 
    Speed 12
    PainChance 32
    Mass 1000
    Species "HK"
    +DONTHURTSPECIES	
    Obituary "%o never stood a chance against a Warmaster." 
    SeeSound "Warmaster/See" 
    PainSound "Warmaster/pain" 
    DeathSound "Warmaster/Die" 
    ActiveSound "Warmaster/act"  
	Tag "Warmaster"
	+ISMONSTER
	Scale 1.1
	+NOINFIGHTING
	+NOTARGET
    States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_WARMASTER)
			TNT1 A 0 ACS_NamedExecuteAlways("DnD Warmaster Rage")
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_EPIC)
		Goto SpawnSetup

		IdleState:
			BOSX AB 10 A_GiveInventory("DnD_SightChecker", 1) 
		Loop 
		SeeState:
			TNT1 A 0 A_ChangeFlag("NOBLOOD", 0)
			TNT1 A 0 A_UnSetReflectiveInvulnerable
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Take", DND_ISBLOCKING, DND_REFLECTIVE, -1, -1)
			TNT1 A 0 A_GiveInventory("WarmasterActive", 1)
		SeeLoop:
			TNT1 A 0 A_JumpIfInventory("WarmasterRage", 1, "SeeRage")
			BOSX AA 4 Fast A_Chase 
			TNT1 A 0 A_JumpIfInventory("WarmasterRage", 1, "SeeRage_B")
			BOSX BB 4 Fast A_Chase 
			TNT1 A 0 A_JumpIfInventory("WarmasterRage", 1, "SeeRage_C")
			BOSX CC 4 Fast A_Chase 
			TNT1 A 0 A_JumpIfInventory("WarmasterRage", 1, "SeeRage_D")
			BOSX DD 4 Fast A_Chase 
		Goto See
		SeeRage:
			BOSX AA 3 Fast A_Chase
		SeeRage_B:
			BOSX BB 3 Fast A_Chase
		SeeRage_C:
			BOSX CC 3 Fast A_Chase
		SeeRage_D:
			BOSX DD 3 Fast A_Chase
		Goto See
		MissileState: 
			TNT1 A 0 A_Jump(96, "Roar")
		MissileGo:
			TNT1 A 0 A_JumpIfInventory("WarmasterRage", 1, "RageMissile")
			BOSX E 7 Fast A_FaceTarget 
			TNT1 A 0 A_PlaySound("Warmaster/Attack")
			BOSX F 6 Fast A_FaceTarget 
			BOSX G 6 Fast A_CustomComboAttack("WarmasterFireBall_Explode", 38, 10 * random(1, 8), "baron/melee") 
			BOSX G 0 A_Jump(128, "MissileGo")
		Goto See 
		MeleeState:
			TNT1 A 0 A_PlaySound("Warmaster/Attack")
			BOSX E 2 Fast A_FaceTarget
			TNT1 A 0 A_Recoil(-1.6)
			BOSX E 3 Fast A_FaceTarget
			TNT1 A 0 A_Recoil(-2.0)
			BOSX F 2 Fast A_FaceTarget
			TNT1 A 0 A_Recoil(-2.4)
			BOSX F 3 Fast A_FaceTarget
			TNT1 A 0 A_Recoil(-2.8)
			BOSX G 5 Fast A_CustomComboAttack("WarmasterFireBall", 32, 10 * random(5, 8), "baron/melee")
		Goto See
		RageMissile:
			BOSX E 6 Fast A_FaceTarget 
			TNT1 A 0 A_PlaySound("Warmaster/Attack")
			BOSX F 5 Fast A_FaceTarget 
			TNT1 A 0 A_Custommissile ("WarmasterFireBall", 38, 0, 8) 
			BOSX G 2 Fast A_Custommissile ("WarmasterFireBall", 38, 0, 0)
			BOSX G 4 Fast A_Custommissile ("WarmasterFireBall", 38, 0, -8) 
			BOSX E 6 Fast A_FaceTarget 
			TNT1 A 0 A_PlaySound("Warmaster/Attack")
			BOSX F 5 Fast A_FaceTarget 
			LOHS G 0 A_Custommissile ("WarmasterFireBall_Explode", 38, 0, -20) 
			BOSX G 4 Fast A_Custommissile ("WarmasterFireBall", 38, 0, 0) 
			BOSX E 5 Fast A_FaceTarget 
			TNT1 A 0 A_PlaySound("Warmaster/Attack")
			BOSX F 4 Fast A_FaceTarget 
			LOHS G 0 A_Custommissile ("WarmasterFireBall_Explode", 38, 0, 20) 
			BOSX G 3 Fast A_Custommissile ("WarmasterFireBall", 38, 0, 0) 
			BOSX E 4 Fast A_FaceTarget 
			TNT1 A 0 A_PlaySound("Warmaster/Attack")
			BOSX F 3 Fast A_FaceTarget 
			LOHS G 0 A_Custommissile ("WarmasterFireBall", 38, 0, -12) 
			BOSX G 3 Fast A_Custommissile ("WarmasterFireBall", 38, 0, 12) 
		Goto See 
		Roar:
			TNT1 A 0 A_JumpIfInventory("RoarCooldown", 1, "MissileGo")
			TNT1 A 0 A_JumpIfInventory("WarmasterRage", 1, "RoarGo")
		Goto MissileGo
		RoarGo:
			BOSX H 3 Fast A_PlaySound("Warmaster/Roar")
			TNT1 A 0 A_GiveInventory("RoarCooldown", 1)
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_SpawnItemEx("WarmasterRoarFX", 2, 0, 40, 0, 0, 2)
			TNT1 A 0 A_RadiusGive("WarmasterBuff", 288, RGF_MONSTERS, 1)
			BOSX H 8 Fast 
		Goto See
		PainState: 
			TNT1 A 0 A_JumpIfInventory("WarmasterRage", 1, "PainRage")
			BOSX H 5 Fast 
			BOSX H 5 Fast A_Pain 
		Goto See 
		PainRage:
			TNT1 A 0 A_ChangeFlag("NOBLOOD", 1)
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_SpawnItemEx("WarmasterDeflectFX", 20, 0, 48)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Give", DND_ISBLOCKING, DND_REFLECTIVE, -1, -1)
			BOSX H 5 Fast A_SetReflectiveInvulnerable
			TNT1 A 0 A_SpawnItemEx("WarmasterDeflectFX", 20, 0, 48)
			BOSX H 5 Fast A_Pain
			BOSX H 0 A_ChangeFlag("NOBLOOD", 0)
			BOSX H 0 A_UnSetReflectiveInvulnerable
			BOSX H 0 ACS_NamedExecuteWithResult("DnD Monster Trait Take", DND_ISBLOCKING, DND_REFLECTIVE, -1, -1)
		Goto See
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState: 
			BOSX I 6 A_TakeInventory("WarmasterActive", 1)
			TNT1 AA 0 A_Scream
			BOSX J 5 
			BOSX K 4
			BOSX K 3 A_Fall
			BOSX LMN 3
			BOSX O -1 A_KillMaster
		Stop 
		RaiseState:
			BOSX O 0 A_UnSetReflectiveInvulnerable
			BOSX O 0 ACS_NamedExecuteWithResult("DnD Monster Trait Take", DND_ISBLOCKING, DND_REFLECTIVE, -1, -1)
			BOSX ONMLKJI 4 
		Goto See 
    }
}

Actor WarmasterBuff : DnD_Activator {
	States {
		Pickup:
			TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("DnD Is Demon - Self"), "Give")
		Stop
		Give:
			TNT1 A 0 HealThing(ACS_ExecuteWithResult(961, 7) * warmaster_ratio)
			TNT1 A 0 ACS_NamedExecuteAlways("DnD Warmaster Protect FX Trigger")
		Stop
	}
}

Actor WarmasterFireBall : GladiatorFireBall {
	Speed 32
}

Actor WarmasterFireBall_Explode : GladiatorFireBall_Explode {
	Speed 28
}

Actor WarmasterActive : DnD_Boolean { }
Actor WarmasterRage : DnD_Boolean { }

Actor RoarCooldown : PowerProtection {
	powerup.duration -10
	damagefactor "normal", 1.0
}

Actor WarmasterProtect : PowerProtection {
	powerup.duration -5
	damagefactor "normal", 1.0
}

Actor WarmasterDeflectFX {
	Translation "0:255=%[0.00,0.00,0.00]:[0.83,0.83,0.83]"
	Scale 0.85
	+CLIENTSIDEONLY
	+NOINTERACTION
	RenderStyle add
	Alpha 0.8
	States  { 
		Spawn: 
			R075 ABCDEFFGHIJKLMNOP 1 BRIGHT A_FadeOut(0.03)
		Stop 
	} 
}

Actor WarmasterProtectFX {
	Translation "0:255=%[0.00,0.00,0.00]:[0.83,0.83,0.83]"
	Scale 0.3
    RenderStyle Add
    Alpha 0.85
    +FORCEXYBILLBOARD
	+NOGRAVITY
	+THRUACTORS
    +NOINTERACTION
	+CLIENTSIDEONLY
    States {
		Spawn:
			TNT1 A 0
			DES5 K 1 Bright Light("WarmasterGrayGlow") A_FadeTo (0, 0.03, 1)
		Wait
    }
}

actor WarmasterProtectFXSpawner {
	+NOINTERACTION
	+CLIENTSIDEONLY
    States {
		Spawn:
			TNT1 AA 0 NoDelay A_SpawnItemEx("WarmasterProtectFX", frandom(-42.0, 42.0),frandom(-42.0,42.0),frandom(24.0,60.0), 0,0,2, 0, SXF_NOCHECKPOSITION)
			TNT1 A 1
		Stop
    }
}

Actor WarmasterRoarFX {
	+CLIENTSIDEONLY
	+NOINTERACTION
	Renderstyle Add
	Alpha 0.9
	States {
		Spawn:
			BOSX PQ 5 Bright
			BOSX R 15 Bright
			BOSX ST 5 Bright
		Stop
	}
}

actor Judicator : DnD_BaseHybridMonster {
	obituary "%o was peppered by a Judicator's machine gun."
	HitObituary "%o had %p head bashed in by a Judicator."
	Health 0x7FFFFFFF
	radius 24
	height 64
	mass 2048
	speed 10
	painchance 64
	SeeSound "Robodude/See"
	PainSound "Robodude/pain"
	DeathSound "Robodude/die"
	ActiveSound "Robodude/act"
	meleerange 160
	Tag "Judicator"
	Species "HK"
	const float thrust_vel = 24.0;
	Scale 1.15
	+ISMONSTER
	+NOBLOOD
	+DONTRIP
	+DONTHURTSPECIES
	+NODROPOFF
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_JUDICATOR)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_VERYRARE)
		Goto SpawnSetup
	
		IdleState:
			JUIC A 5 A_GiveInventory("DnD_SightChecker", 1)
		loop
		SeeState:
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Take", DND_ISBLOCKING, -1, -1, -1)
		SeeStateLoop:
			JUIC ABCD 4 Fast A_Chase
			TNT1 A 0 A_Jump(32, "BlockMove")
			JUIC ABCD 4 Fast A_Chase
		Goto See
		BlockMove:
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Give", DND_ISBLOCKING, -1, -1, -1)
		BlockMoveLoop:
			JUIC O 4 Fast A_Chase("", "")
			JUIC P 4 Fast A_Chase
			JUIC Q 4 Fast A_Chase("", "")
			JUIC R 4 Fast A_Chase
			TNT1 A 0 A_Jump(192, "See")
			JUIC O 4 Fast A_Chase("", "")
			JUIC P 4 Fast A_Chase
			JUIC Q 4 Fast A_Chase("", "")
			JUIC R 4 Fast A_Chase
		Loop
		MeleeState:
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Give", DND_ISBLOCKING, -1, -1, -1)
			TNT1 A 0 A_Jump(64, "MissileState")
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC G 2 Fast
			JUIC G 1 Fast A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC G 2 Fast
			JUIC G 1 Fast A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC G 2 Fast
			JUIC G 1 Fast A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC G 2 Fast
			JUIC G 1 Fast A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC G 2 Bright Fast
			JUIC G 1 Bright Fast A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC G 2 Bright Fast
			JUIC G 1 Bright Fast A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			JUIC G 2
			JUIC G 1 A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC G 2
			JUIC G 1 A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC G 2 Bright Fast
			JUIC G 1 Bright Fast A_FaceTarget
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC G 2 Bright Fast
			JUIC G 1 Bright Fast A_FaceTarget
			TNT1 A 0 A_ChangeVelocity(thrust_vel * cos(angle), thrust_vel * sin(angle), velz, CVF_REPLACE)
			JUIC OOO 1 Fast
			TNT1 A 0 A_CustomMissile("JudicatorBash_Weak", 32, 0, 0, CMF_AIMDIRECTION, 0)
			JUIC PPP 1 Fast
			JUIC Q 1 Fast A_Quake(2, 17, 0, 512, "Judicator/Step")
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC Q 2 Fast A_FaceTarget(22.5)
			JUIC R 3 Fast
			JUIC R 1 Fast A_CustomMissile("JudicatorBash_Weak", 32, 0, 0, CMF_AIMDIRECTION, 0)
			TNT1 A 0 A_ChangeVelocity(thrust_vel * cos(angle), thrust_vel * sin(angle), velz, CVF_REPLACE)
			JUIC O 3 Fast A_FaceTarget(22.5)
			TNT1 A 0 A_CustomMissile("JudicatorBash_Weak", 32, 0, 0, CMF_AIMDIRECTION, 0)
			JUIC P 3 Fast
			JUIC Q 1 Fast A_Quake(2, 17, 0, 512, "Judicator/Step")
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC Q 2 Fast
			JUIC R 2 Fast A_FaceTarget(22.5)
			JUIC R 1 Fast A_CustomMissile("JudicatorBash_Weak", 32, 0, 0, CMF_AIMDIRECTION, 0)
			TNT1 A 0 A_ChangeVelocity(thrust_vel * cos(angle), thrust_vel * sin(angle), velz, CVF_REPLACE)
			JUIC O 3 Fast A_CustomMissile("JudicatorBash_Weak", 32, 0, 0, CMF_AIMDIRECTION, 0)
			JUIC P 3 Fast A_Quake(2, 17, 0, 512, "Judicator/Step")
			JUIC Q 1 Fast
			TNT1 A 0 A_JumpIfCloser(160, "ShieldBash")
			JUIC Q 2 Fast
			JUIC R 3 Fast A_CustomMissile("JudicatorBash_Weak", 32, 0, 0, CMF_AIMDIRECTION, 0)
			TNT1 A 0 A_ScaleVelocity(0.15)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			JUIC G 2 Fast A_FaceTarget
		Goto See
		ShieldBash:
			TNT1 A 0 A_JumpIfInventory("JudicatorBashCD", 1, "FireFast")
			TNT1 A 0 A_GiveInventory("JudicatorBashCD", 1)
			JUIC A 2 Fast A_FaceTarget
			TNT1 A 0 A_ChangeVelocity(thrust_vel * cos(angle), thrust_vel * sin(angle), velz, CVF_REPLACE)
			TNT1 A 0 A_PlaySound("Judicator/Swing", CHAN_VOICE)
			TNT1 A 0 A_CustomMissile("JudicatorBash", 32, 0, 0, CMF_AIMDIRECTION, 0)
			JUIC G 6 Fast A_FaceTarget
			TNT1 A 0 A_Jump(160, "FireFast")
			JUIC G 1 Fast
		Goto See
		MissileState:
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Give", DND_ISBLOCKING, -1, -1, -1)
			TNT1 A 0 A_Jump(96, "RepeatedAttack")
			JUIC E 6 Fast
		FireFast:
			TNT1 A 0 A_FaceTarget
			JUIC E 3 Fast A_PlaySound("Judicator/Attack", CHAN_WEAPON)
			JUIC F 2 Bright Fast A_CustomMissile("RangerBullet", 44, 9, frandom(-14.5, 14.5))
			TNT1 A 0 A_FaceTarget
			JUIC E 3 Fast A_PlaySound("Judicator/Attack", CHAN_WEAPON)
			JUIC F 2 Bright Fast A_CustomMissile("RangerBullet", 44, 9, frandom(-14.5, 14.5))
			TNT1 A 0 A_FaceTarget
			JUIC E 3 Fast A_PlaySound("Judicator/Attack", CHAN_WEAPON)
			JUIC F 2 Bright Fast A_CustomMissile("RangerBullet", 44, 9, frandom(-14.5, 14.5))
			JUIC E 4 Fast
			JUIC E 1 Fast A_Jump(48, "Firefast")
		goto See
		RepeatedAttack:
			JUIC EEEE 4 Fast A_FaceTarget
		RepeatedAttackLoop:
			TNT1 A 0 A_FaceTarget
			JUIC E 3 Fast A_PlaySound("Judicator/Attack", CHAN_WEAPON)
			JUIC F 2 Bright Fast A_CustomMissile("RangerBullet", 44, 9, frandom(-14.5, 14.5))
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteAlways("DnD On Monster Attack", 0)
			JUIC E 3 Fast A_PlaySound("Judicator/Attack", CHAN_WEAPON)
			JUIC F 2 Bright Fast A_CustomMissile("RangerBullet", 44, 9, frandom(-14.5, 14.5))
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteAlways("DnD On Monster Attack", 0)
			JUIC E 3 Fast A_PlaySound("Judicator/Attack", CHAN_WEAPON)
			JUIC F 2 Bright Fast A_CustomMissile("RangerBullet", 44, 9, frandom(-14.5, 14.5))
			JUIC E 1 Fast A_MonsterRefire(160, "See")
		Goto See
		PainState:
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Give", DND_ISBLOCKING, -1, -1, -1)
			JUIC G 4 Fast A_Pain
			JUIC G 4 Fast
			JUIC G 1 Fast A_Jump(32, "BlockMove")
		goto See
		XDeathState:
		DeathState:
			JUIC H 4 ACS_NamedExecuteWithResult("DnD Monster Trait Take", DND_ISBLOCKING, -1, -1, -1)
			JUIC I 4 A_Scream
			JUIC J 4
			JUIC K 3
			JUIC L 3 A_NoBlocking
			JUIC M 3
			JUIC N -1 A_KillMaster
		stop
		RaiseState:
			JUIC NMLKJ 2
			JUIC IH 3
		Goto See
	}
}

Actor JudicatorBashCD : PowerDamage {
	damagefactor "normal", 1.0
	powerup.duration 52
}

actor JudicatorBash {
	radius 5
	height 5
	speed 36
	DamageType "Melee"
	Stamina 1
	damage (20 * random(1, 2))
	deathsound "weapons/vblhit"
	PROJECTILE
	+HITTRACER
	+SEEKERMISSILE
	+DONTBLAST
	States {
		spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			TNT1 AA 1 A_SeekerMissile(90, 90, SMF_PRECISE)
		stop
		death:
			TNT1 A 0 A_Quake(4, 17, 0, 256)
			TNT1 A 1 ACS_NamedExecuteWithResult("DnD Projectile Push", 28)
			TNT1 A 1
		stop
	}
}

Actor JudicatorBash_Weak : JudicatorBash {
	damage (8 * random(1, 2))
}