ACTOR BabyCaco : DnD_BaseHybridMonster {
	Health 0x7FFFFFFF
	Radius 16
	Height 56
	Mass 200
	Speed 9
	PainChance 176
	SeeSound "BabyCaco/Sight"
	PainSound "BabyCaco/Pain"
	DeathSound "BabyCaco/Death"
	ActiveSound "BabyCaco/Active"
	BloodColor "Blue"
	Obituary "%o underestimated a Baby Cacodemon."
	HitObituary "%o was nibbled to death by a Baby Cacodemon."
	Tag "Baby Cacodemon"
	Species "Cacodemon"
	+ISMONSTER
	+NOGRAVITY
	+FLOAT 
	-FLOORCLIP
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_BABYCACO)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_UNCOMMON)
		Goto SpawnSetup

		IdleState:
			CACB A 10 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			CACB A 3 Fast A_Chase
		Goto See
		MeleeState:
		MissileState:
			CACB AB 5 Fast A_FaceTarget
			CACB C 5 Fast Bright A_CustomComboAttack("BabyCacoBall", 17, random(1,8) * 3, "BabyCaco/Melee")
		Goto See
		PainState:
			CACB D 3 Fast
			CACB D 3 Fast A_Pain
			CACB E 6 Fast
		Goto See
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState:
			CACB F 8
			CACB G 8 A_Scream
			CACB H 8
			CACB I 8
			CACB J 8 A_NoBlocking
			CACB K 8
			CACB L -1 A_SetFloorClip
		Stop
		RaiseState:
			CACB L 8 A_UnSetFloorClip
			CACB KJIHGF 8
		Goto See
	}
}

ACTOR BabyCacoBall {
	Radius 3
	Height 4
	Speed 11
	FastSpeed 10
	Damage (2 * random(1, 8))
	DamageType "Energy"
	Stamina 16
	Projectile 
	+DONTBLAST
	+RANDOMIZE
	RenderStyle Add
	Alpha 1
	SeeSound "caco/attack"
	DeathSound "caco/shotx"
	Decal "HImpScorch"
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			BCAB AB 4 BRIGHT
		Loop
		Death:
			BCAB CDE 6 BRIGHT
		Stop
	}
}

Actor Fleshspawn : DnD_BaseRangedMonster {
	Obituary "%o was burned by a FleshSpawn." 
	HitObituary "%o was devoured by a FleshSpawn."
	Health 0x7FFFFFFF
	GibHealth -5
	Radius 16
	Height 56
	mass 80
	speed 10
	damage (2 * random(1, 8))
	DamageType "Melee"
	Stamina 1
	painchance 224
	missiletype "Fleshspawnball"
	bloodcolor "blue"
	attacksound "flesh/melee"
	seesound "flesh/sight"
	painsound "flesh/pain"
	deathsound "flesh/death"
	activesound "flesh/active"
	Tag "Fleshspawn"
	+ISMONSTER
	+FLOAT
	+NOGRAVITY
	+DONTHURTSPECIES
	+NOINFIGHTING
	+NOTARGET
	-FLOORCLIP
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_FLESHSPAWN)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_VERYRARE)
		Goto SpawnSetup

		IdleState:
			FLSP AB 8 A_GiveInventory("DnD_SightChecker", 1)
		loop
		SeeState:
			FLSP AABB 2 Fast A_Chase
		Goto See
		MissileState:
			FLSP C 0 A_Jump(128,"Charge")
			FLSP C 8 Fast A_FaceTarget
			FLSP G 4 Fast A_FaceTarget
			FLSP H 4 Fast Bright A_CustomMissile("Fleshspawnball", 12, 0, 0)
		goto See
		Charge:
			FLSP C 0 A_Jump(96, 6)
			FLSP C 8 Fast A_FaceTarget
			FLSP D 4 Fast A_FaceTarget    
			FLSP E 4 Fast A_SkullAttack
			FLSP FE 4 Fast
		Goto Charge+4
			FLSP C 8 Fast A_FaceTarget
			FLSP D 4 Fast A_FaceTarget    
			FLSP E 4 Fast A_SkullAttack
			FLSP FEFE 4 Fast
			FLSP C 6 Fast A_FaceTarget
			FLSP D 4 Fast A_FaceTarget    
			FLSP E 4 Fast A_SkullAttack
			FLSP FE 4 Fast
		Goto Charge+4
		PainState:
			FLSP I 3 Fast 
			FLSP I 3 Fast A_Pain
		Goto See
		DeathState:
			FLSP I 5
			FLSP J 5 A_Scream
			FLSP K 5
			FLSP L 5 A_NoBlocking
			FLSP MN 5 A_SetFloorClip
			FLSP O -1 
		Stop
		XDeathState: 
			FLSP P 3 
			FLSP Q 0 A_FaceTarget
			FLSP Q 0 A_SpawnItemEx("FleshSpawnGibs", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			FLSP Q 0 A_CustomMissile("Fleshspawngib1", 14, 0, random(-180,180), 2, random(10,40))
			FLSP Q 0 A_CustomMissile("Fleshspawngib2", 6, 2, random(-180,180), 2, random(0,25))
			FLSP Q 0 A_CustomMissile("Fleshspawngib2B", 10, -2, random(-180,180), 2, random(0,25))
			FLSP Q 0 A_CustomMissile("Fleshspawngib3", 8, 0, random(-180,180), 2, random(0,35))
			FLSP Q 0 A_CustomMissile("Fleshspawngib4", 12, 5, random(-180,180), 2, random(-5,40))
			FLSP Q 0 A_CustomMissile("Fleshspawngib4B", 5, -5, random(-180,180), 2, random(0,30))
			FLSP Q 0 A_CustomMissile("Fleshspawngib5", 6, 3, random(-180,180), 2, random(10,60))
			FLSP Q 0 A_CustomMissile("Fleshspawngib5", 8, 0, random(-180,180), 2, random(-10,55))
			FLSP Q 0 A_CustomMissile("Fleshspawngib6", 12, 0, 0, 2, 0)
			FLSP Q 3 A_XScream
			FLSP R 3 A_NoBlocking  
			FLSP STU 3
		Stop
		RaiseState:
			FLSP O 5 A_UnSetFloorClip
			FLSP NMLKJI 5
		Goto See
	}
}

Actor FleshSpawnGibs {
	+NoClip
	States {
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_CustomMissile("Fleshspawngib1", 14, 0, random(-180,180), 2, random(10,40))
			TNT1 A 0 A_CustomMissile("Fleshspawngib2", 6, 2, random(-180,180), 2, random(0,25))
			TNT1 A 0 A_CustomMissile("Fleshspawngib2B", 10, -2, random(-180,180), 2, random(0,25))
			TNT1 A 0 A_CustomMissile("Fleshspawngib3", 8, 0, random(-180,180), 2, random(0,35))
			TNT1 A 0 A_CustomMissile("Fleshspawngib4", 12, 5, random(-180,180), 2, random(-5,40))
			TNT1 A 0 A_CustomMissile("Fleshspawngib4B", 5, -5, random(-180,180), 2, random(0,30))
			TNT1 A 0 A_CustomMissile("Fleshspawngib5", 6, 3, random(-180,180), 2, random(10,60))
			TNT1 A 0 A_CustomMissile("Fleshspawngib5", 8, 0, random(-180,180), 2, random(-10,55))
			TNT1 A 0 A_CustomMissile("Fleshspawngib6", 12, 0, 0, 2, 0)
		Stop
	}
}

Actor Fleshspawnball {
	Damage (2 * random(1, 8))
	Damagetype "Energy"
	Stamina 16
	Speed 10
	Radius 3
	Height 5
	SeeSound "caco/attack"
	DeathSound "caco/shotx"
	RenderStyle Add
	Alpha 0.9
	Projectile
	states {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			FLBL ABCBABCBABCBABCBIJKLM 4 Bright
		Stop
		Death:
			FLBL DEFGH 4 Bright
		Stop
	}
}

Actor Fleshspawngib1 {
	Speed 8
	Mass 100
	Radius 1
	Height 1
	Projectile
	+CLIENTSIDEONLY
	-NOGRAVITY
	+DROPOFF
	States {
		Spawn:
			FGB1 ABCD 4 
		loop
		Death:
			FGB1 E -1
		stop
	}
}

Actor Fleshspawngib2 : Fleshspawngib1 {
	Speed 8
	Mass 100
	Radius 1
	Height 1
	Projectile
	-NoGravity
	+DropOff
	+ClientSideOnly
	States {
		Spawn:
			FGB2 ABCD 4 
		loop
		Death:
			FGB2 I -1
		stop
	}
}

Actor Fleshspawngib2B : Fleshspawngib1 {
	States {
		Spawn:
			FGB2 EFGH 4 
		loop
		Death:
			FGB2 J -1
		stop      
	}
}

Actor Fleshspawngib3 : Fleshspawngib1 {
	States {
		Spawn:
			FGB3 ABCD 4 
		loop
		Death:
			FGB3 E -1
		stop      
	}
}

Actor Fleshspawngib4 : Fleshspawngib1 {
	States {
		Spawn:
			FGB4 ABCD 4 
		loop
		Death:
			FGB4 I -1
		stop      
	}
}

Actor Fleshspawngib4B : Fleshspawngib1 {
	States {
		Spawn:
			FGB4 EFGH 4 
		loop
		Death:
			FGB4 J -1
		stop      
	}
}

Actor Fleshspawngib5 : Fleshspawngib1 {
	States {
		Spawn:
			FGB5 ABCD 4 
		loop
		Death:
			FGB5 E -1
		stop      
	}
}

Actor Fleshspawngib6 : Fleshspawngib1 {
	Speed 0
	States {
		Spawn:
			FGB6 A 4 
		loop
		Death:
			FGB6 BC 4
			FGB6 D -1
		stop      
	}
}

ACTOR ESoul : DnD_BaseRangedMonster { 
	obituary "%o was raped by a black soul."
	Health 0x7FFFFFFF
	Radius 16
	Height 56
	mass 400
	speed 5
	damage (5 * random(1,8))
	DamageType "Melee"
	Stamina 1
	painchance 128
	renderstyle Add
	Alpha 0.4
	attacksound "skull/melee"
	PainSound "nightmare/pain"
	DeathSound "nightmare/death"
	ActiveSound "nightmare/active"
	Tag "Black Soul"
	+ISMONSTER
	+FLOAT
	+NOGRAVITY
	+NOICEDEATH
	+MISSILEMORE
	+DONTFALL
	+STEALTH
	+NOBLOOD
	-FLOORCLIP
	states {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_ETHEREALSOUL)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE2)
		Goto SpawnSetup

		IdleState:
			ETHS ABCD 10 bright A_GiveInventory("DnD_SightChecker", 1)
		loop
		SeeState:
			ETHS AABBCCDD 3 Fast bright A_Chase 
		Goto See
		MissileState:
			ETHS C 0 bright A_Jump(128,9)
			ETHS C 6 Fast bright A_FaceTarget
			ETHS E 4 Fast bright A_SkullAttack
			ETHS E 0 bright A_FaceTarget
			ETHS F 4 Fast bright A_SkullAttack
			ETHS F 0 bright A_FaceTarget
			ETHS E 4 Fast bright A_SkullAttack
			ETHS E 0 bright A_FaceTarget
			ETHS F 4 Fast bright A_SkullAttack
		goto See
			ETHS P 3 Fast bright A_FaceTarget
			ETHS Q 4 Fast bright A_FaceTarget
			ETHS R 5 Fast bright A_CustomMissile("ShadowBall", 0, 0, 0)
			ETHS E 4 Fast bright
		goto See
		PainState:
			ETHS G 3 Fast bright
			ETHS G 3 Fast bright A_Pain
		goto See
		XDeathState:
		DeathState:
			ETHS F 3 bright
			TNT1 AAAAA 0 A_CustomMissile("LostSoulSmoke", 0, 0, random(0,360), 2, random(0,360))
			ETHS H 3 bright A_ScreamAndUnblock
			ETHS IJKLMNO 3 bright
		stop
	}
}

ACTOR ShadowBall {
	Radius 6
	Height 8
	Speed 12
	Damage (3 * random(1, 8))
	DamageType "Magical"
	Stamina 8
	Projectile
	+DONTBLAST
	+RANDOMIZE
	RenderStyle "ADD"
	Alpha 0.75
	SeeSound "imp/attack"
	DeathSound "imp/shotx"
	Decal DoomImpScorch
	States {
		Spawn: 
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			SBAL ABC 4 BRIGHT A_SpawnItemEx("ShadowTrail", 0, 0, 0, 0, 0, 0, 0, 128)
			Loop
		Death:
			SBAL C 5 Bright
			SBAL DEFGH 4 BRIGHT
		Stop
	}
}

actor ShadowTrail {
    RENDERSTYLE ADD
    ALPHA 0.6
    +NOINTERACTION
	+CLIENTSIDEONLY
    States {
		Spawn:
			SHTR ABCDEF 4 Bright
		Stop
    }
}

Actor GuardianCube : DnD_BaseRangedMonster {
	Health 0x7FFFFFFF
	Radius 16
	Height 56
	Mass 150
	Speed 8
	PainChance 128
	Obituary "%o got fried by a Guardian Cube."
	+ISMONSTER
	+NoGravity
	+Float
	+DontFall
	-DONTRIP
	+DontHurtSpecies
	+NOBLOOD
	-FLOORCLIP
	SeeSound "monster/sensit"
	PainSound "monster/senpai"
	ActiveSound "monster/cubfly"
	deathsound "monster/sendth"
	Tag "Guardian Cube"
	States  { 
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_GUARDIANCUBE)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE2)
		Goto SpawnSetup

		IdleState:
			CUBE A 10 A_GiveInventory("DnD_SightChecker", 1) 
		Loop 
		SeeState: 
			CUBE ABC 5 Fast A_Chase
		Goto See 
		MissileState: 
			CUBE D 5 Fast Bright A_FaceTarget 
			CUBE E 0 Bright A_CustomMissile("CubeShot",10,4,0,1)
			CUBE E 4 Fast Bright A_CustomMissile("CubeShot",10,-4,0,1)
			CUBE D 4 Fast Bright A_FaceTarget 
			CUBE E 0 Bright A_CustomMissile("CubeShot",10,4,0,1)
			CUBE E 4 Fast Bright A_CustomMissile("CubeShot",10,-4,0,1)
			CUBE D 4 Fast Bright A_FaceTarget  
			CUBE E 0 Bright A_CustomMissile("CubeShot",10,4,0,1)
			CUBE E 4 Fast Bright A_CustomMissile("CubeShot",10,-4,0,1)
			CUBE D 4 Fast Bright A_FaceTarget
		Goto See 
		PainState: 
			CUBE D 3 Fast 
			CUBE D 3 Fast A_Pain 
		Goto See 
		XDeathState:
		DeathState:
			CUBE E 0 Bright A_NoBlocking
			TNT1 AAAAA 0 A_CustomMissile("LostSoulSmoke", 0, 0, random(0,360), 2, random(0,360))
			CUBE E 0 Bright A_SetFloorClip
			CUBE E 6 Bright A_Scream 
			CUBE FGH 6 Bright
		Stop
	}
}

Actor GuardianCube_NoCount : GuardianCube {
	-COUNTKILL
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_GUARDIANCUBE)
			TNT1 A 0 A_SetArg(1, DND_MAGIC_WEAKNESS | DND_BULLET_RESIST)
			TNT1 A 0 A_SetArg(2, DND_SUMMONED)
		Goto SpawnSetup
	}
}

Actor CubeShot {
	Radius 5
	Height 5
	Speed 15
	Damage (1 * random(1, 8))
	DamageType "MagicalFire"
	Stamina 40
	RenderStyle Add
	Alpha 0.85
	Projectile
	+ThruGhost
	Seesound "weapons/firsfi"
	DeathSound "weapons/maceex"
	Obituary "%o got fried by a Guardian Cube."
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			CBAL AB 3 Bright A_SpawnItemEx("CubePuff",0,0,0,0,0,0,0,128)
		Loop
		Death:
			CBAL CDEFG 3 Bright
		Stop
	}
}

Actor CubePuff {   
	RenderStyle Add
	Alpha 0.67
	+CLIENTSIDEONLY
	+NOINTERACTION
	States {
		Spawn:
			CBAL HIJ 3 Bright
		Stop 
	}
}

Actor ForgottenOne : DnD_BaseRangedMonster {
	Obituary "A Forgotten One rammed %o."
	Health 0x7FFFFFFF
	Radius 16
	Height 56
	Mass 50
	Speed 8
	PainChance 230
	Scale 0.9
	PainSound "Forgotten/Pain"
	DeathSound "Forgotten/Death"
	ActiveSound "Forgotten/Active"
	Damage (3 * random(1, 8))
	DamageType "Melee"
	Stamina 1
	Tag "Forgotten One"
	+ISMONSTER
	+Float
	+NoGravity
	+NoIceDeath
	+DontFall
	+FloatBob
	+NoBlood
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_FORGOTTENONE)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE2)
		Goto SpawnSetup

		IdleState:
			FRGO A 0 Bright
			FRGO A 0 Bright A_ChangeFlag("FloatBob", 1)
			FRGO AAAAAABBBBBB 1 Bright A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			FRGO A 0 A_ChangeFlag("FloatBob", 1)
			FRGO AABB 3 Fast Bright A_Chase
		Goto See
		MissileState:
			FRGO C 0 A_ChangeFlag("FloatBob", 0)
			FRGO CCDDC 2 Fast Bright A_FaceTarget
			FRGO D 0 Bright A_PlaySound("Forgotten/Attack")
			FRGO D 2 Fast Bright A_SkullAttack
			FRGO C 2 Fast Bright
			FRGO C 0 Bright A_JumpIfTargetInLOS(4, 75)
			FRGO C 0 A_Jump(24, "StopCharge")
			FRGO DC 2 Fast Bright
		Goto MissileState + 10
			FRGO C 0 Bright
		Goto MissileState + 7
		StopCharge:
			FRGO C 0 A_Stop
		Goto See
		PainState:
			FRGO E 0 A_ChangeFlag("FloatBob", 1)
			FRGO E 3 Fast Bright
			FRGO E 3 Fast Bright A_Pain
		Goto See
		XDeathState:
		DeathState:
			FRGO E 0 A_ChangeFlag("FloatBob", 0)
			FRGO E 0 A_Stop
			TNT1 AAAAA 0 A_CustomMissile("LostSoulSmoke", 0, 0, random(0,360), 2, random(0,360))
			FRGO EF 4 Bright
			FRGO G 6 Bright A_Scream
			FRGO H 6 Bright
			FRGO I 6 Bright A_NoBlocking
			FRGO J 6 Bright
		Stop
	}
}

//Watcher
ACTOR Watcher : DnD_BaseHybridMonster { 
	Health 0x7FFFFFFF
	Radius 16
	Height 40 
	Mass 150 
	Speed 10 
	PainChance 160
	MeleeRange 40
	SeeSound "monster/watsit" 
	PainSound "monster/watpai" 
	DeathSound "monster/watdth" 
	ActiveSound "monster/watact" 
	AttackSound "ChaosSerpent/melee"
	Tag "Watcher"
	+ISMONSTER
	+NOGRAVITY 
	+FLOAT
	-FLOORCLIP
	States  { 
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_WATCHER)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_UNCOMMON)
		Goto SpawnSetup
	
		IdleState:
			WATC A 10 A_GiveInventory("DnD_SightChecker", 1) 
		Loop 
		SeeState: 
			WATC A 3 Fast A_Chase
		Goto See 
		MissileState: 
			WATC E 5 Fast A_FaceTarget 
			WATC F 5 Fast A_FaceTarget 
			WATC G 5 Fast BRIGHT A_CustomMissile("WatcherShot",12,0,0) 
		Goto See
		MeleeState:
			WATC BCD 5 Fast A_FaceTarget 
			WATC A 5 Fast A_CustomMeleeAttack(4 * random(1, 8))
		Goto See
		PainState: 
			WATC H 3 Fast 
			WATC H 3 Fast A_Pain 
		Goto See 
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState: 
			WATC I 8 A_scream
			WATC JKLM 6 
			WATC N 6 A_noblocking
			WATC N 0 A_SetFloorClip
			WATC O -1 
		stop
		RaiseState:
			CACB O 8 A_UnSetFloorClip
			WATC NMLKJI 8 
		Goto See
	} 
}

ACTOR WatcherShot {
	Radius 4
	Height 8
	Speed 20
	Damage (3 * random(1, 8))
	DamageType "Magical"
	Stamina 8
	RENDERSTYLE ADD
	ALPHA 0.67
	PROJECTILE
	+THRUGHOST
	+FORCEXYBILLBOARD
	+PIERCEARMOR
	SeeSound "monster/watatk"
	DeathSound "monster/wathit"
	States {
		Spawn:
			FWAT AB 4 Bright
		loop
		Death:
			TNT1 A 0 A_SpawnItemEx("PurpleParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
			TNT1 AAA 0 A_CustomMissile("FireballSmoke", 0, 0, random(0,360), 2, random(0,360))
			FWAT CDE 4 Bright
		stop
	}
}