Actor Demolisher : DnD_BaseRangedBoss {
	Obituary "%o felt the power of the Spider-Demolisher."
	Health 0x7FFFFFFF
	Radius 96 
	Height 100 
	Mass 2048
	Speed 16 
	PainChance 20 
	Species "Spider2"
	+ISMONSTER
	+NoTarget
	+FloorClip
	+Boss
	+MissileEvenMore
	+DONTHURTSPECIES
	+NORADIUSDMG
	SeeSound "monster/demsit" 
	AttackSound "weapons/minigunfire" 
	PainSound "demon/pain2" 
	DeathSound "monster/demdth" 
	ActiveSound "spider/active" 
	Tag "Demolisher"
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_DEMOLISHER)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE1)
		Goto SpawnSetup

		IdleState:
			DEMO AB 10 A_GiveInventory("DnD_SightChecker", 1) 
		Loop 
		SeeState: 
			DEMO A 3 Fast A_Metal 
			DEMO ABB 3 Fast A_Chase 
			DEMO C 3 Fast A_Metal 
			DEMO CDD 3 Fast A_Chase 
			DEMO E 3 Fast A_Metal 
			DEMO EFF 3 Fast A_Chase 
		Goto See 
		MissileState:
			DEMO A 0 A_Jump (128,20)
			DEMO A 16 Fast A_FaceTarget
			DEMO T 1 Bright A_Playsound ("weapons/bfgf")
			DEMO T 4 Fast Bright A_FaceTarget
			DEMO T 4 Fast Bright A_FaceTarget
			DEMO T 5 Fast Bright A_FaceTarget
			DEMO T 5 Fast Bright A_FaceTarget
			DEMO T 5 Fast Bright A_FaceTarget
			DEMO T 5 Fast Bright A_FaceTarget
			DEMO U 8 Fast Bright A_CustomMissile ("BFGBallDemolisher",32,0,0)
			DEMO T 0 A_Jump (128,10)
			DEMO T 1 Bright A_Playsound ("weapons/bfgf")
			DEMO T 4 Fast Bright A_FaceTarget
			DEMO T 4 Fast Bright A_FaceTarget
			DEMO T 5 Fast Bright A_FaceTarget
			DEMO T 5 Fast Bright A_FaceTarget
			DEMO T 5 Fast Bright A_FaceTarget
			DEMO T 5 Fast Bright A_FaceTarget 
			DEMO U 8 Fast Bright A_CustomMissile ("BFGBallDemolisher",32,0,0)
			DEMO T 0 A_Jump (192,1)
		Goto See
			DEMO A 20 Fast A_FaceTarget
			TNT1 A 0 A_SpawnItemEx ("bulletcasing", -8, 28, 34, -4, 0, frandom(3.0, 5.0), random(-80, -90))
			TNT1 A 0 A_SpawnItemEx ("bulletcasing", -8, 28, 34, 4, 0, frandom(3.0, 5.0), random(-80, -90))
			TNT1 A 0 A_PlaySound("weapons/minigunfire", CHAN_WEAPON)
			TNT1 AA 0 A_CustomMissile("BigSpiderBullet", 32, -12, frandom(-16.0, 16.0))
			DEMO G 4 Fast Bright
			TNT1 A 0 ACS_NamedExecuteAlways("DnD On Monster Attack", 0)
			TNT1 A 0 A_SpawnItemEx ("bulletcasing", -8, 28, 34, -4, 0, frandom(3.0, 5.0), random(-80, -90))
			TNT1 A 0 A_SpawnItemEx ("bulletcasing", -8, 28, 34, 4, 0, frandom(3.0, 5.0), random(-80, -90))
			TNT1 A 0 A_PlaySound("weapons/minigunfire", CHAN_WEAPON)
			TNT1 AA 0 A_CustomMissile("BigSpiderBullet", 32, 0, frandom(-16.0, 16.0))
			DEMO H 4 Fast Bright
			DEMO H 1 Bright A_SpidRefire 
		Goto MissileState + 21 
		PainState: 
			TNT1 A 0 A_SpawnDebris("MetalScrap")
			DEMO I 3 Fast 
			DEMO I 3 Fast A_Pain 
		Goto See 
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState: 
			DEMO J 20 Bright A_Scream
			DEMO K 2 Bright A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			DEMO KKKK 2 Bright A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			DEMO LLLLL 2 Bright A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			DEMO MMMMM 2 Bright A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			DEMO NNNNN 2 Bright A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			DEMO OOOOO 2 Bright A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			DEMO PPPPP 2 Bright A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			DEMO QQQQQ 2 Bright A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			DEMO RRRRR 2 Bright A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			DEMO S 5 
			DEMO S -1 A_KillMaster 
		Stop 
	} 
}

Actor BigSpiderBullet : ZombieBullet {
	DamageType "Physical"
	Stamina 3
}

Actor BFGBallDemolisher : BFGBall2 {
	Decal "BFGLightning"
	Radius 13
	Height 8
	Speed 25
	Alpha 0.75
	Projectile
	Damage (100 * random(1, 8))
	DamageType "EnergyGreen"
	Stamina 16
	DeathSound "weapons/bfgx"
	+RANDOMIZE
	+DONTREFLECT
	+FOILINVUL
	+DONTBLAST
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			BFS1 AAAABBBB 1 Bright A_SpawnItemEx("GreenParticleSlowVanish",Random(-12,12),Random(-12,12),Random(-12,12),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
		Loop
		Death:
			TNT1 A 0 A_SpawnItemEx ("BFGFlare", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE | SXF_NOCHECKPOSITION, 0)
			BFE1 AB 8 Bright
			BFE1 C 8 Bright A_BFGSpray("BFGExtraDemolisher")
			BFE1 DEF 8 Bright
		Stop
	}
}

Actor BFGExtraDemolisher : BFGExtra {
	DamageType "EnergyGreen"
	Stamina 16
}

ACTOR Arachnophyte : DnD_BaseRangedBoss {
    //$Category monsters
    Health 0x7FFFFFFF
    Radius 96
    Height 100
    Speed 6
	XScale 1.4
	YScale 1.25
    PainChance 8
    Mass 5000
	MinMissileChance 8
	+ISMONSTER
	+MISSILEMORE
	+MISSILEEVENMORE
	+QUICKTORETALIATE
	+BOSS
	+NORADIUSDMG
    SEESOUND "arachnophyte/sight"
    PAINSOUND "arachnophyte/pain"
    DEATHSOUND "arachnophyte/death"
    ATTACKSOUND "spider/attack"
    OBITUARY "%o was perforated by an Arachnophyte."
	Tag "Arachnophyte"
    Decal Bulletchip
    states {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_ARACHNOPHYTE)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE1)
		Goto SpawnSetup

		IdleState:
			APYT A 0 A_PlaySound("arachnophyte/engine")
			APYT ABABAB 4 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			APYT A 0 A_PlaySound("arachnophyte/engine")
			APYT AABBAABBAABB 2 Fast A_Chase
		Goto See
		MissileState:
			APYT A 0 A_PlaySound("arachnophyte/engine")
			APYT BAB 4 Fast A_FaceTarget
			APYT A 0 A_PlaySound("arachnophyte/engine")
			TNT1 A 0 A_SpawnItemEx ("exshotguncasing", -8, 28, 34, -4, 0, frandom(3.0, 5.0), random(-80, -90))
			TNT1 A 0 A_PlaySound("spider/attack", CHAN_WEAPON)
			APYT C 4 Fast A_CustomMissile("PhyteBullet", 56, -12, frandom(-10.4, 10.4))
			TNT1 A 0 ACS_NamedExecuteAlways("DnD On Monster Attack", 0)
			TNT1 A 0 A_SpawnItemEx ("exshotguncasing", -8, 28, 34, -4, 0, frandom(3.0, 5.0), random(-80, -90))
			TNT1 A 0 A_PlaySound("spider/attack", CHAN_WEAPON)
			APYT D 4 Fast A_CustomMissile("PhyteBullet", 56, -12, frandom(-10.4, 10.4))
			APYT D 1 A_SpidRefire
		Goto MissileState + 6
		PainState:
			TNT1 A 0 A_SpawnDebris("MetalScrap")
			APYT A 3 A_Pain
		Goto See
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState:
			APYT A 0 A_PlaySound("spider/death")
			APYT A 4 A_Scream
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Medium_Delayed", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			APYT BBEEEEFFFF 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128) 
			APYT GGG 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_Fall
			APYT HHHIIIJJJ 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A -1 A_KillMaster
		Stop
    }
}

Actor PhyteBullet : ZombieBullet {
	Damage (random(2, 3) * 4)
	DamageType "Physical"
	Stamina 3
	States {
		Death:
		XDeath:
			TNT1 A 0 A_SetScale(0.55, 0.55)
			TNT1 AA 0 A_SpawnItem("ExpShellSoundEmitter")
			TNT1 AA 0 A_SpawnDebris("ExplosiveSpark", 1)
			TNT1 A 0 A_Jump(128, "Flip")
			DKSX A 2
			TNT1 A 0 A_SpawnItem("ArachnophyteExp1")
			DKSX BCDEFG 2
			DKSX HIJKL 1
		Stop
		Flip:
			DKSX M 2
			TNT1 A 0 A_SpawnItem("ArachnophyteExp1")
			DKSX NOPQRS 2
			DKSX TUVWX 1
		Stop
	}
}

Actor ArachnophyteExp1 : BaseExplosionDamage {
	DamageType "Explosive"
	Stamina 4
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(20, 96, 0)
		Stop
	}
}

actor PsionicQueen : DnD_BaseHybridBoss {
	+BOSS
	Health 0x7FFFFFFF
	Radius 96
	Height 100
	Mass 2048
	Speed 10
	PainChance 40
	SeeSound "queen/sight"
	ActiveSound "queen/active"
	PainSound "queen/pain"
	DeathSound "queen/death"
	MeleeSound "queen/melee"
	MeleeDamage 8
	MissileHeight 36
	+ISMONSTER
	+MISSILEMORE
	+MISSILEEVENMORE
	+QUICKTORETALIATE
	+NORADIUSDMG
	Obituary "%o suffered psychic trauma from a psionic queen's brainwaves."
	HitObituary "%o had %p skull chewed by a psionic queen."
	Scale 1.2
	Tag "Psionic Queen"
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_PSIONICQUEEN)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_UNCOMMON)
		Goto SpawnSetup

		IdleState:
			ARNQ A 1 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			ARNQ A 2 Fast A_Chase
		Goto See
		MeleeState:
		MissileState:
			TNT1 A 0 A_Jump(96, "BFG")
			TNT1 A 0 A_JumpIfCloser(512, "CloseRange")
		Goto LongRange
		CloseRange:
			TNT1 A 0 A_Jump(176, "RapidFire")
		Goto SpreadFire
		LongRange:
			TNT1 A 0 A_Jump(176, "SpreadFire")
		Goto RapidFire
		BFG:
			TNT1 A 0 A_PlaySound("queen/fire")
			ARNQ BCD 8 Fast A_FaceTarget
			ARNQ E 10 Fast Bright A_CustomMissile("QueenBFG",50,-10,0)
		Goto See
		RapidFire:
			ARNQ BCD 8 Fast A_FaceTarget
			ARNQ E 5 Fast BRIGHT A_CustomMissile ("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ D 0 BRIGHT A_FaceTarget
			ARNQ E 5 Fast BRIGHT A_CustomMissile ("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ D 0 BRIGHT A_FaceTarget
			ARNQ E 5 Fast BRIGHT A_CustomMissile ("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ D 0 BRIGHT A_FaceTarget
			ARNQ E 5 Fast BRIGHT A_CustomMissile ("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ P 0 BRIGHT A_FaceTarget
			ARNQ E 5 Fast BRIGHT A_CustomMissile ("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ D 0 BRIGHT A_FaceTarget
			ARNQ E 5 Fast BRIGHT A_CustomMissile ("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ D 0 BRIGHT A_FaceTarget
			ARNQ E 5 Fast BRIGHT A_CustomMissile ("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ D 0 BRIGHT A_FaceTarget
			ARNQ E 5 Fast BRIGHT A_CustomMissile ("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ D 0 BRIGHT A_FaceTarget
			ARNQ E 5 Fast BRIGHT A_CustomMissile ("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ D 0 BRIGHT A_FaceTarget
			ARNQ E 5 Fast BRIGHT A_CustomMissile ("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ D 0 BRIGHT A_FaceTarget
			ARNQ E 5 Fast BRIGHT A_CustomMissile ("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ D 5 Fast A_FaceTarget
		//ARNQ D 5
		Goto See
		SpreadFire:
			ARNQ BCD 8 Fast A_FaceTarget
			TNT1 A 0 A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-7,7), CMF_AIMOFFSET, random(-3,3))
			TNT1 A 0 A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-7,7), CMF_AIMOFFSET, random(-3,3))
			TNT1 A 0 A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-7,7), CMF_AIMOFFSET, random(-3,3))
			TNT1 A 0 A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-7,7), CMF_AIMOFFSET, random(-3,3))
			TNT1 A 0 A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-7,7), CMF_AIMOFFSET, random(-3,3))
			ARNQ E 5 Fast Bright A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ BCD 8 Fast A_FaceTarget
			TNT1 A 0 A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-7,7), CMF_AIMOFFSET, random(-3,3))
			TNT1 A 0 A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-7,7), CMF_AIMOFFSET, random(-3,3))
			TNT1 A 0 A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-7,7), CMF_AIMOFFSET, random(-3,3))
			TNT1 A 0 A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-7,7), CMF_AIMOFFSET, random(-3,3))
			TNT1 A 0 A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-7,7), CMF_AIMOFFSET, random(-3,3))
			ARNQ E 5 Fast Bright A_CustomMissile("QueenPlasmaBlast", 40, 0, random(-4,4))
			ARNQ D 5 Fast A_FaceTarget
		Goto See
		PainState:
			TNT1 A 0 A_Jump(50, "PainSpam")
			ARNQ F 4 Fast
			ARNQ F 4 Fast A_Pain
		Goto See
		PainSpam:
			ARNQ F 4 Fast Bright
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,5,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,25,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,45,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,65,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,85,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,105,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,125,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,145,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,165,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,185,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,205,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,225,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,245,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,265,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,285,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,305,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,325,32,0)
			ARNQ F 0 Bright A_custommissile("QueenPainPlasmaBlast",75,0,345,32,0)
			ARNQ F 4 Fast A_Pain
		Goto See
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState:
			ARNQ G 9 A_Scream
			ARNQ G 3 A_Fall
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			TNT1 A 0 A_NoBlocking
			ARNQ HI 9 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			ARNQ JK 9 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			ARNQ L 9 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			ARNQ M -1 A_KillMaster
		Stop
	}
}

actor QueenPlasmaBlast {
	Radius 13
	Height 8
	Speed 28
	Damage (6 * random(1, 8))
	DamageType "EnergyGreen"
	Stamina 16
	Projectile
	scale 0.75
	+BLOODLESSIMPACT
	+NOEXTREMEDEATH
	+DONTBLAST
	+PIERCEARMOR
	RenderStyle Add
	Alpha 0.75
	SeeSound "electricplasma/shoot"
	DeathSound "electricplasma/hit"
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			TNT1 AA 0 A_CustomMissile("QueenPlasmaBlastTrail", 0, 0, 0)
			EBLT GH 2 bright A_BishopMissileWeave
		loop
		Death:
			EBLT IJK 3 bright
		stop
	}
}

actor QueenPlasmaBlastTrail {
	Radius 13
	Height 8
	Speed 0//35
	Damage 0
	Projectile
	+RANDOMIZE
	RenderStyle Add
	Alpha 0.75
	+CLIENTSIDEONLY
	States {
		Spawn:
			EBLT ABC 3 bright A_BishopMissileWeave
		goto death
		Death:
			EBLT DEF 4 bright A_FadeOut(0.25)
		loop
	}
}

actor QueenPainPlasmaBlast : QueenPlasmaBlast {
  Speed 15
}

Actor PsionicQueenExp1 : BaseExplosionDamage {
	DamageType "MagicalVoid"
	Stamina 8
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(160, 192, 0)
		Stop
	}
}

ACTOR QueenBFG {
	Radius 12
	Height 12
	Speed 20
	Damage (15 * random(1, 8))
	DamageType "MagicalVoid"
	Stamina 8
	PROJECTILE
	+SEEKERMISSILE
	+DONTBLAST
	+PIERCEARMOR
	Renderstyle Add
	SEESOUND "queen/fire"
    DEATHSOUND "queen/hit"
    Decal "Scorch"
	states {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			XBTS A 2 BRIGHT A_SeekerMissile(1,4)
			TNT1 AA 0 A_SpawnItemEx("PurpleParticleSlowVanish",Random(-12,12),Random(-12,12),Random(-12,12),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
			TNT1 A 0 A_SpawnItemEx("ZWAVE",0,0,0,0,0,0,0,128)
			XBTS B 2 BRIGHT A_SeekerMissile(1,4)
			TNT1 AA 0 A_SpawnItemEx("PurpleParticleSlowVanish",Random(-12,12),Random(-12,12),Random(-12,12),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
			TNT1 A 0 A_SpawnItemEx("ZWAVE",0,0,0,0,0,0,0,128)
			XBTS C 2 BRIGHT A_SeekerMissile(1,4)
			TNT1 AA 0 A_SpawnItemEx("PurpleParticleSlowVanish",Random(-12,12),Random(-12,12),Random(-12,12),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
			TNT1 A 0 A_SpawnItemEx("ZWAVE",0,0,0,0,0,0,0,128)
			XBTS D 2 BRIGHT A_SeekerMissile(1,4)
			TNT1 AA 0 A_SpawnItemEx("PurpleParticleSlowVanish",Random(-12,12),Random(-12,12),Random(-12,12),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
			TNT1 A 0 A_SpawnItemEx("ZWAVE",0,0,0,0,0,0,0,128)
			XBTS E 2 BRIGHT A_SeekerMissile(1,4)
			TNT1 AA 0 A_SpawnItemEx("PurpleParticleSlowVanish",Random(-12,12),Random(-12,12),Random(-12,12),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
			TNT1 A 0 A_SpawnItemEx("ZWAVE",0,0,0,0,0,0,0,128)
			XBTS F 2 BRIGHT A_SeekerMissile(1,4)
			TNT1 AA 0 A_SpawnItemEx("PurpleParticleSlowVanish",Random(-12,12),Random(-12,12),Random(-12,12),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
			TNT1 A 0 A_SpawnItemEx("ZWAVE",0,0,0,0,0,0,0,128)
			XBTS G 2 BRIGHT A_SeekerMissile(1,4)
			TNT1 AA 0 A_SpawnItemEx("PurpleParticleSlowVanish",Random(-12,12),Random(-12,12),Random(-12,12),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
			TNT1 A 0 A_SpawnItemEx("ZWAVE",0,0,0,0,0,0,0,128)
			XBTS H 2 BRIGHT A_SeekerMissile(1,4)
			TNT1 AA 0 A_SpawnItemEx("PurpleParticleSlowVanish",Random(-12,12),Random(-12,12),Random(-12,12),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
			TNT1 A 0 A_SpawnItemEx("ZWAVE",0,0,0,0,0,0,0,128)
			XBTS I 2 BRIGHT A_SeekerMissile(1,4)
			TNT1 AA 0 A_SpawnItemEx("PurpleParticleSlowVanish",Random(-12,12),Random(-12,12),Random(-12,12),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
			TNT1 A 0 A_SpawnItemEx("ZWAVE",0,0,0,0,0,0,0,128)
			XBTS J 2 BRIGHT A_SeekerMissile(1,4)
			TNT1 AA 0 A_SpawnItemEx("PurpleParticleSlowVanish",Random(-12,12),Random(-12,12),Random(-12,12),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
			TNT1 A 0 A_SpawnItemEx("ZWAVE",0,0,0,0,0,0,0,128)
		Loop
		Death:
			XBTS K 0 Radius_Quake(15,15,0,40,0)
			XBTS K 2 BRIGHT A_SpawnItem("PsionicQueenExp1")
			XBTS LMNOPQRSTUVW 2 BRIGHT
		Stop
	}
}

ACTOR ZWAVE {  
	Radius 10
	Height 10
	Speed 0
	seesound "queen/fire"
	+Noclip
	PROJECTILE
	RENDERSTYLE Add
	+CLIENTSIDEONLY
	states {
		Spawn:
			TNT1 A 4
			BLST ABCDEFGHIJKLMNOP 3 BRIGHT A_FadeOut(0.0625)
		Stop
	}
}

ACTOR AngelOfDeath : DnD_BaseRangedBoss {
	Obituary "%o was raptured by an Angel of Death."
	Health 0x7FFFFFFF
	Radius 56
	Height 96 
	Mass 2048
	Speed 8
	Painchance 48
	DamageFactor "Painless_Sun", 1.3
	Scale 1.35
	SeeSound "angel/sight"
	Painsound "angel/pain"
	Deathsound "angel/death"
	Activesound "angel/active"
	Tag "Angel of Death"
	BloodColor "80 16 80"
	+ISMONSTER
	+BOSS
	+DONTRIP
	+MISSILEMORE
	+NORADIUSDMG
	+NOFEAR
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_ANGELOFDEATH)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE2)
		Goto SpawnSetup

		IdleState:
			LMDA AB 10 A_GiveInventory("DnD_SightChecker", 1)
		loop
		SeeState:
			LMDA AABBCCDD 3 Fast A_Chase
		Goto See
		MissileState:
			LMDA A 0 A_Jump (128,"Chaingun")
			LMDA I 8 Fast A_FaceTarget
			LMDA J 3 Fast bright A_CustomMissile ("PipeBomb", 78, 0)
			LMDA H 8 Fast 
			LMDA I 4 Fast A_FaceTarget
			LMDA J 3 Fast bright A_CustomMissile ("PipeBomb", 78, 0)
			LMDA H 8 Fast
			LMDA H 0 A_Jump (127,1)
			Goto See
			LMDA I 6 Fast A_FaceTarget
			LMDA J 3 Fast bright A_CustomMissile ("PipeBomb", 78, 0)
			LMDA H 8 Fast
		Goto See
		Chaingun:
			LMDA E 10 Fast A_FaceTarget
			TNT1 A 0 A_PlaySound("angeltracer/fire", CHAN_WEAPON)
			LMDA F 3 Fast bright A_CustomMissile ("BulletPierce", 78, 28, 0, 0)
			TNT1 A 0 A_PlaySound("angeltracer/fire", CHAN_WEAPON)
			LMDA G 3 Fast bright A_CustomMissile ("BulletPierce", 78, -28, 0, 0)
			TNT1 A 0 ACS_NamedExecuteAlways("DnD On Monster Attack", 0)
			TNT1 A 0 A_PlaySound("angeltracer/fire", CHAN_WEAPON)
			LMDA F 3 Fast bright A_CustomMissile ("BulletPierce", 78, 28, 0, 0)
			TNT1 A 0 A_PlaySound("angeltracer/fire", CHAN_WEAPON)
			LMDA G 3 Fast bright A_CustomMissile ("BulletPierce", 78, -28, 0, 0)
			LMDA G 0 A_CPosRefire
		goto Chaingun + 1
		PainState:
			LMDA H 2 Fast
			LMDA H 2 Fast A_Pain
			LMDA H 0 A_Jump(128, "Missile")
		Goto See
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState:
			LMDA H 4 A_Scream
			TNT1 A 0 A_NoBlocking
			LMDA KLMNOPQ 6
			TNT1 A 0 A_PlaySound("angel/collapse")
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			LMDA RRRRRRSSSSSS 1 A_SpawnItemEx ("WanderingSpirit", 0, 0, 32, 8, 0, 0, random(0, 360), 128, 0)
			LMDA STU 6
			LMDA V -1 A_KillMaster
		Stop
	}
}

Actor AngelOfDeathExp1 : BaseExplosionDamage {
	DamageType "Explosive"
	Stamina 4
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(64, 84, 0)
		Stop
	}
}

ACTOR PipeBomb {
	Radius 8
	Height 10
	Speed 32
	Damage (6 * random(1, 8))
	DamageType "Physical"
	Stamina 1
	Scale 1.25
	Seesound "pipebomb/fire"
	Deathsound "pipebomb/explode"
	Projectile
	+THRUGHOST
	+DONTBLAST
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			LMPI A 3 bright
			LMPI B 3 bright A_PlaySound("pipe/whoosh")
			LMPI C 3 bright
			LMPI D 3 bright A_PlaySound("pipe/whoosh")
			LMPI E 3 bright
		loop
		Death:
			TNT1 A 0 A_SpawnItem("AngelOfDeathExp1")
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0,  0)
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0, 30)
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0, 60)
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0, 90)
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0,120)
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0,150)
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0,180)
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0,210)
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0,240)
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0,270)
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0,300)
			FBXP A 0 A_SpawnItemEx("BulletPierce",0,0,0,35,0,0,330)
			FBXP ABC 5 bright
		stop
	}
}

ACTOR BulletPierce {
	radius 4
	height 8
	speed 44
	damage (3 * random(1, 8))
	DamageType "Physical"
	Stamina 1
	Scale 1.15
	seesound "angeltracer/explode"
	deathsound "angeltracer/explode"
	PROJECTILE
	+THRUGHOST
	+RIPPER
	+DONTBLAST
	Decal "BulletChip"
	BounceType "Hexen"
	BounceCount 3
	BounceFactor 1.0
	states {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			LMPB A 1 bright
		Loop
		Death:
			TNT1 A 1 bright
		Stop
	}
}

ACTOR Goldlich : DnD_BaseRangedBoss {
	Scale 1.35
	Mass 2048
	Painchance 8
	Health 0x7FFFFFFF
	Radius 56
	Height 96   
	SeeSound "goldlich/sight"
	PainSound "goldlich/pain"
	DeathSound "goldlich/death"
	ActiveSound "goldlich/active"
	Obituary "%o was annihilated by the goldlich's power."
	Speed 8
	DamageFactor "Painless_Sun", 1.3
	Species "Spider2"
	MinMissileChance 32
	Tag "Gold Lich"
	+ISMONSTER
	+BOSS
	+DONTRIP
	+NOBLOOD
	+THRUSPECIES
	+DONTHURTSPECIES
	+NOTARGET
	+MISSILEMORE
	+MISSILEEVENMORE
	+QUICKTORETALIATE
	+NOFEAR
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_GOLDLICH)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_EPIC)
		Goto SpawnSetup
	
		IdleState:
			GLIC A 1 A_GiveInventory("DnD_SightChecker", 1)
			GLIC A 3 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
		Loop
		SeeState:
			GLIC A 1 A_Chase
			GLIC A 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
		Goto See
		MeleeState:
		MissileState:
			GLIC A 1 A_FaceTarget
			GLIC A 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)

			GLIC B 0 A_FaceTarget
			GLIC B 0 A_Jump(64, "Missile1")
			GLIC B 0 A_Jump(88, "Missile2")
			GLIC B 0 A_Jump(128, "Missile3", "Missile4", "Missile5")
			GLIC B 0 A_Jump(255, "Missile4")
		Goto See
		Missile1:
			TNT1 A 0 A_JumpIfInventory("GoldLich_WraithCD", 1, "Missile3")
			GLIC B 0 A_PlaySound("goldlich/attack3")
			GLIC B 1 A_SpawnItemEx("ReiverGhostGoldLich", 56, 0, 0, 0, 0, 0, 0, SXF_SETMASTER)
			GLIC B 2
			GLIC B 1 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_SpawnItemEx("ReiverGhostGoldLich", 56, 0, 0, 0, 0, 0, 0, SXF_SETMASTER)
			GLIC B 1
			GLIC B 1 A_SpawnItemEx("ReiverGhostGoldLich", 56, 0, 0, 0, 0, 0, 0, SXF_SETMASTER)
			GLIC B 1 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 2
			GLIC B 1 A_SpawnItemEx("ReiverGhostGoldLich", 56, 0, 0, 0, 0, 0, 0, SXF_SETMASTER)
			GLIC B 1 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 
			GLIC B 1
			GLIC B 1 A_SpawnItemEx("ReiverGhostGoldLich", 56, 0, 0, 0, 0, 0, 0, SXF_SETMASTER)
			GLIC B 1 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 2
			TNT1 A 0 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_SpawnItemEx("ReiverGhostGoldLich", 56, 0, 0, 0, 0, 0, 0, SXF_SETMASTER)
		Goto See
		Missile2:
			TNT1 A 0 A_JumpIfInventory("GoldLich_SplitCD", 1, "Missile4")
			GLIC BBBBBBBB 1 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			TNT1 A 0 A_SpawnItemEx("TeleportFog")
			TNT1 AAAAAAAA 0 A_Wander
			TNT1 AAAAAAAA 0 A_Wander
			TNT1 A 0 A_SpawnItemEx("TeleportFog")
			TNT1 A 0 A_SpawnItemEx("FakeGoldlich", 0,0,0, 0,0,0, 0, SXF_TRANSFERTRANSLATION)
			TNT1 AAAAAAAA 0 A_Wander
			TNT1 AAAAAAAA 0 A_Wander
			TNT1 AAAAAAAA 0 A_Wander
			TNT1 AAAAAAAA 0 A_Wander
			TNT1 A 4 Fast
			TNT1 A 0 A_SpawnItemEx("TeleportFog")
		Goto See
		Missile3:
			GLIC B 0 A_PlaySound("goldlich/attack2")
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0,  0)
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0, 30)
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0, 60)
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0, 90)
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0,120)
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0,150)
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0,180)
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0,210)
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0,240)
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0,270)
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0,300)
			GLIC B 0 A_CustomMissile("GoldLichBounce",32,0,330)
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 3 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
		Goto See
		Missile4:
			GLIC B 0 A_PlaySound("goldlich/attack1")
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 0 A_CustomMissile("GoldLichFire")
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 0 A_CustomMissile("GoldLichFire")
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 0 A_CustomMissile("GoldLichFire")
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 0 A_CustomMissile("GoldLichFire")
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 0 A_CustomMissile("GoldLichFire")
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 0 A_CustomMissile("GoldLichFire")	
		Goto See
		Missile5:
			GLIC B 0 A_PlaySound("goldlich/attack2")
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0,  0)
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0, 30)
			TNT1 A 0 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0, 60)
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0, 90)
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0,120)
			TNT1 A 0 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0,150)
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0,180)
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0,210)
			TNT1 A 0 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0,240)
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0,270)
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0,300)
			TNT1 A 0 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_CustomMissile("GoldLichBounce2",56,0,330)
			GLIC B 3 Fast A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 3 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 3 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget
			GLIC B 3 A_SpawnItemEx("GoldLichGlitter", random(-32,32), random(-32,32), random(8,104),0,0,0, 0,0, 0)
			GLIC B 1 A_FaceTarget  
		Goto See
		PainState:
			GLIC A 4 Fast A_Pain
		Goto See
		XDeathState:
		DeathState:
			GLIC CC 4 A_SpawnItemEx("GoldLichGlitter", random(-36,36), random(-36,36), random(8,104),0,0,0, 0,0, 0)
			GLIC D 1 A_Scream
			GLIC D 3 A_SpawnItemEx("GoldLichGlitter", random(-36,36), random(-36,36), random(8,104),0,0,0, 0,0, 0)
			GLIC D 4 A_SpawnItemEx("GoldLichGlitter", random(-36,36), random(-36,36), random(8,104),0,0,0, 0,0, 0)

			GLIC EE 4 A_SpawnItemEx("GoldLichGlitter", random(-40,40), random(-40,40), random(0,112),0,0,0, 0,0, 0)
			GLIC FF 4 A_SpawnItemEx("GoldLichGlitter", random(-44,44), random(-44,44), random(0,96),0,0,0, 0,0, 0)

			GLIC G 0 A_NoBlocking
			GLIC G 4 A_SpawnItemEx("GoldLichGlitter", random(-52,52), random(-52,52), random(0,80),0,0,0, 0,0, 0)
			GLIC G 4 A_SpawnItemEx("GoldLichGlitter", random(-52,52), random(-52,52), random(0,80),0,0,0, 0,0, 0)

			GLIC HH 4 A_SpawnItemEx("GoldLichGlitter", random(-56,65), random(-56,56), random(0,64),0,0,0, 0,0, 0)

			GLIC IIIIIIIIIIIIIIIIIIII 4 A_SpawnItemEx("GoldLichGlitter", random(-64,64), random(-64,64), random(0,48),0,0,0, 0,0, 0)
			GLIC I -1 A_KillMaster
		Stop
	}
}

Actor GoldLich_SplitCD : PowerProtection {
	damagefactor "normal", 1.0
	powerup.duration -8
}

Actor GoldLich_WraithCD : PowerProtection {
	damagefactor "normal", 1.0
	powerup.duration -8
}

ACTOR GoldLichMiniExplodes {
	+DONTSPLASH
	+NOGRAVITY
	+CLIENTSIDEONLY
	States {
		Spawn:
			FXA1 DEF 3 BRIGHT
		Stop
	}
}

Actor GoldLichExp1 : BaseExplosionDamage {
	DamageType "MagicalDark"
	Stamina 8
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(64, 160,0)
		Stop
	}
}

ACTOR GoldLichBounce {
	Radius 14
	Height 12
	Speed 22
	Damage (5 * random(2,4))
	DamageType "MagicalDark"
	Stamina 8
	Projectile
	+NOGRAVITY
	+WINDTHRUST  
	-ACTIVATEIMPACT
	-ACTIVATEPCROSS
	-NOBLOCKMAP
	+SEEKERMISSILE
	+BOUNCEONACTORS
	+CANBOUNCEWATER  
	+DOOMBOUNCE
	+DONTBLAST
	+THRUSPECIES
	Species "Spider2"
	BounceCount 4
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			FXA1 ABCA 4 BRIGHT
		SpawnLoop:
			FXA1 BCA 4 Bright A_SeekerMissile(4, 4, SMF_CURSPEED)
		Loop
		Death:
			FXA1 A 0 A_PlaySound("goldlich/attack2Blast")
			FXA1 A 0 BRIGHT A_Stop
			FXA1 A 0 BRIGHT A_SpawnItem("GoldLichExp1")
			FXA1 GGGGGHHHHHIIIII 1 BRIGHT A_SpawnItemEx("GoldLichMiniExplodes", random(-32,32), random(-32,32), random(-32,32),0,0,0, 0,0, 0)
		Stop
	}
}

ACTOR GoldLichBounce2 : GoldLichBounce {
	Speed 24
	Projectile
	-SEEKERMISSILE
	BounceCount 8
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			FXA1 A 4 BRIGHT
			TNT1 A 0 A_Stop
			FXA1 B 4 Bright
			FXA1 C 4 Bright
			TNT1 A 0 A_ChangeFlag("NoGravity", 0)
		SpawnLoop:
			FXA1 AABBCC 2 Bright ThrustThing(angle*256/360, 8, 0, 0)
		Loop
		Death:
			FXA1 A 0 A_PlaySound("goldlich/attack2Blast")
			FXA1 A 0 BRIGHT A_Stop
			FXA1 A 0 BRIGHT A_SpawnItem("GoldLichExp1")
			FXA1 GGGGGHHHHHIIIII 1 BRIGHT A_SpawnItemEx("GoldLichMiniExplodes", random(-32,32), random(-32,32), random(-32,32),0,0,0, 0,0, 0)
		Stop
	}
}

ACTOR GoldLichFire {
	Radius 14
	Height 12
	Speed 16
	Damage (5 * random(1, 8))
	DamageType "MagicalFire"
	Stamina 40
	Projectile
	Alpha 0.85
	DeathSound "weapons/phoenixhit"
	+NOGRAVITY
	+WINDTHRUST  
	-ACTIVATEIMPACT
	-ACTIVATEPCROSS
	-NOBLOCKMAP
	+SEEKERMISSILE
	+DONTBLAST
	+THRUSPECIES
	Species "Spider2"
	RenderStyle Add
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		Weave:
			TNT1 A 0 A_PlaySound("goldlich/attack1")
			FX06 AAAABBBBCCCC 1 BRIGHT A_CstaffMissileSlither
			TNT1 A 0 A_Jump(128, "Track")
		Loop
		Track:
			TNT1 A 0 A_PlaySound("goldlich/attack1")
			FX06 AAAABBBBCCCC 1 BRIGHT A_SeekerMissile(360, 1)
			TNT1 A 0 A_Jump(128, "Weave")
		Loop
		Death:
			FX06 DEFG 5 BRIGHT
		Stop
	}
}

ACTOR GoldLichGlitter {
	+NOGRAVITY
	+CLIENTSIDEONLY
	States {
		Spawn:
			GGLT ABCDE 4 BRIGHT
		Stop
	}
}

ACTOR FakeGoldlich : Goldlich {
	Scale 1.35
	Mass 2000
	Speed 8
	Painchance 8
	Health 0x7FFFFFFF
	Species "Spider2"
	Tag "Fake Gold Lich"
	-BOSSDEATH
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_GOLDLICHFAKE)
			TNT1 A 0 A_SetArg(1, DND_SUMMONED)
		Goto SpawnSetup
	
		IdleState:
			GLIC A 10 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			GLIC A 1 A_Chase
			GLIC A 3 A_SpawnItemEx("GoldLichGlitter", random(-24,24), random(-24,24), random(-8,72),0,0,0, 0,0, 0)
		Loop
		MissileState:
			GLIC A 5 A_FaceTarget
			GLIC B 20 A_FaceTarget
		Goto See
		XDeathState:
		DeathState:
			GLIC C 7
			GLIC D 7 A_Scream
			GLIC EF 7
			GLIC G 7 A_NoBlocking
			GLIC H 7
			GLIC IIIIIIIIII 7 A_FadeOut(0.1)
		Stop
	}
}

ACTOR ReiverGhostGoldLich : ReiverGhost_NoExp {
	Scale 0.8
	Species "Spider2"
	+THRUSPECIES
	+DONTHURTSPECIES
}

ACTOR IronlichBoss : DnD_BaseRangedBoss {
	Scale 1.35
	Mass 2048
	Painchance 8
	Health 0x7FFFFFFF
	Radius 56
	Height 96   
	SeeSound "monster/cubsit"
	PainSound "Lich/pain"
	DeathSound "monster/cubdth"
	ActiveSound "Lich/act"
	Obituary "%o was mesmerized by the gaze of an Iron Lich."
	Speed 8
	Species "Spider2"
	Tag "Iron Lich"
	+ISMONSTER
	+BOSS
	+DONTRIP
	+NOBLOOD
	+THRUSPECIES
	+DONTHURTSPECIES
	+NOTARGET
	+MISSILEMORE
	+MISSILEEVENMORE
	+QUICKTORETALIATE
	+NOFEAR
	var int user_count;
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_IRONLICH)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_VERYRARE)
		Goto SpawnSetup

		IdleState:
			ILIC A 5 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			ILIC A 3 Fast A_Chase
		Goto See
		MissileState:
			TNT1 A 0 A_Jump(128, "Curse")
			TNT1 A 0 A_SetUserVar("user_count", 0)
			TNT1 A 0 A_Jump(192, "FireAttack", "IceAttack", "EarthAttack", "DarknessAttack", "EnergyAttack")
		GreenAttack:
			ILIC D 0 A_JumpIf(user_count == 3, "See")
			ILIC D 8 Fast Bright A_FaceTarget
			TNT1 A 0 A_CustomMissile("IronLichGreenAttack", 64, -24)
			TNT1 A 0 A_CustomMissile("IronLichGreenAttack", 64, 24)
			ILIC D 0 A_SetUserVar("user_count", user_count + 1)
		Loop
		FireAttack:
			ILIC C 8 Fast Bright A_FaceTarget
			TNT1 A 0 A_CustomMissile("IronLichFireAttack", 64, -24)
			TNT1 A 0 A_CustomMissile("IronLichFireAttack", 64, 24)
			ILIC C 8 Fast Bright A_FaceTarget
			TNT1 A 0 A_CustomMissile("IronLichFireAttack", 64, -24)
			ILIC C 0 A_CustomMissile("IronLichFireAttack", 64, 24)
		Goto See
		IceAttack:
			ILIC E 0 A_JumpIf(user_count == 3, "See")
			ILIC E 8 Fast Bright A_FaceTarget
			TNT1 A 0 A_PlaySound("Lich/Ice")
			TNT1 A 0 A_CustomMissile("IronLichIceAttack", 64, -24)
			TNT1 A 0 A_CustomMissile("IronLichIceAttack", 64, 24)
			ILIC E 0 A_SetUserVar("user_count", user_count + 1)
		Loop
		EarthAttack:
			TNT1 A 0 A_JumpIFCloser(384, "ContinueEarth")
		Goto RollNoEarth
		ContinueEarth:
			ILIC H 0 A_JumpIf(user_count == 3, "See")
			ILIC HH 8 Fast Bright A_FaceTarget
			TNT1 A 0 A_CustomMissile("IronLichGroundSpike", 0, 0, 0)
			TNT1 A 0 A_CustomMissile("IronLichGroundSpike", 0, 0, 8)
			TNT1 A 0 A_CustomMissile("IronLichGroundSpike", 0, 0, -8)
			ILIC H 0 A_SetUserVar("user_count", user_count + 1)
		Loop
		RollNoEarth:
			ILIC A 0 A_Jump(256, "FireAttack", "IceAttack", "GreenAttack", "DarknessAttack", "EnergyAttack")
		Goto See
		DarknessAttack:
			ILIC B 6 Fast Bright A_FaceTarget
		DarknessLoop:
			ILIC B 0 A_JumpIf(user_count == 6, "See")
			ILIC B 6 Fast Bright A_CustomMissile("IronLichDarkness", 64, 0, 0)
			TNT1 A 0 A_FaceTarget
			ILIC B 0 A_SetUserVar("user_count", user_count + 1)
		Loop
		EnergyAttack:
			ILIC F 12 Fast Bright A_FaceTarget
			TNT1 A 0 A_CustomMissile("IronLichEnergyAttack", 64, 0)
			ILIC F 12 Fast Bright A_FaceTarget
			ILIC F 0 A_CustomMissile("IronLichEnergyAttack", 64, 0)	
		Goto See
		Curse:
			ILIC A 0 A_Jump(256, "FireCurse", "IceCurse", "GreenCurse", "EarthCurse", "DarknessCurse", "EnergyCurse")
		Goto See
		FireCurse:
			ILIC J 8 Fast Bright A_FaceTarget
			TNT1 A 0 A_VileTarget("IronLichFireTracer")
			ILIC J 8 Fast Bright A_FaceTarget
		Goto See
		IceCurse:
			ILIC M 8 Fast Bright A_FaceTarget
			ILIC M 0 A_GiveToTarget("DnD_Curse_LichSlow", 1)
		Goto See
		GreenCurse:
			ILIC K 8 Fast Bright A_FaceTarget
			ILIC K 0 A_GiveToTarget("DnD_Curse_LichPoison", 1)
		Goto See
		EarthCurse:
			ILIC L 8 Fast Bright A_FaceTarget
			TNT1 A 0 A_PlaySound("Lich/Heal")
			TNT1 A 0 A_SpawnItem("LichHealFX")
			TNT1 A 0 ACS_NamedExecuteAlways("DnD Monster Health Regen Script", 0, DND_MHR_DURATION | (1 << 16), ACS_NamedExecuteWithResult("DnD Monster Heal Potency", 250), 5)
		Goto See
		DarknessCurse:
			// telegraphing
			TNT1 A 0 ACS_NamedExecuteAlways("DnD Create Blind FX", 0, DND_BLIND_PETRIFY, 1024)
			ILIC I 24 Fast Bright A_FaceTarget
			ILIC I 8 Fast Bright ACS_NamedExecuteWithResult("DnD Monster Blind Cast", 140 | (DND_BLIND_PETRIFY << 16), 32 | (16 << 8) | (16 << 16), 100, 1024)
		Goto See
		EnergyCurse:
			ILIC N 8 Fast Bright A_FaceTarget
			TNT1 A 0 A_PlaySound("Lich/EnergyCurse")
			ILIC N 0 A_SpawnItemEx("LichTurret", 0, 0, 112, 0, 0, 0, 0, SXF_SETMASTER | SXF_NOCHECKPOSITION)
		Goto See
		PainState:
			ILIC O 4 Fast ACS_NamedExecuteWithResult("DnD Monster Blind Cancel CS")
			ILIC O 4 Fast A_Pain
		Goto See
		XDeathState:
		DeathState:
			TNT1 A 0 A_Scream
			ILIC PPPP 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)  
			TNT1 A 0 A_NoBlocking
			ILIC QQQ 2 Bright A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128) 
			ILIC RRSSTT 2 Bright A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128) 
			ILIC U 4
			ILIC W -1 A_KillMaster
		Stop
	}
}

Actor IronLichGreenAttack : SentGmissile {
	Speed 36
	Damage (8 * random(1, 8))
	DamageType "MagicalGreen"
	Stamina 8
}

Actor VolcanoTBlast2Lich : VolcanoTBlast2 {
	DamageType "MagicalFire"
	Stamina 40
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		Goto Super::Spawn
	}
}

Actor IronLichFireAttack : beastball2 {
	Speed 28
	Damage (12 * random(1, 8))
	DamageType "MagicalFire"
	Stamina 40
	Scale 1.25
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		Goto Super::Spawn
	    Death:
			TNT1 A 0 A_SpawnItem("VolcanoExp")
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 0)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 15)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 30)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 45)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 60)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 75)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 90)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 105)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 120)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 135)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 150)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 165)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 180)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 195)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 210)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 225)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 240)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 255)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 270)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 285)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 300)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 315)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 330)
			TNT1 A 0 A_CustomMissile("VolcanoTBlast2Lich", 14, 0, 345)
			XPL1 A 4 BRIGHT 
			XPL1 BCDEF 4 bright
		stop
	}
}

Actor IronLichIceAttack {
	PROJECTILE
	Damage (8 * random(1, 8))
	DamageType "Ice"
	Stamina 64
	Speed 32
	Alpha 0.8
	Scale 1.25
	Renderstyle Add
	SeeSound "Lich/Ice"
	+DONTBLAST
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			FX39 ABC 3 Bright
		Loop
		XDeath:
			TNT1 A 0 A_PlaySound("Lich/IceHit")
		Goto SkipSound
		Death:
			TNT1 A 0 A_Playsound("Lich/IceHitW")
		SkipSound:
			FX39 D 5 Bright
			TNT1 A 0 A_CustomMissile("IronLichIceShard", 0, 0, 0, CMF_TRACKOWNER)
			TNT1 A 0 A_CustomMissile("IronLichIceShard", 0, 0, 45, CMF_TRACKOWNER)
			TNT1 A 0 A_CustomMissile("IronLichIceShard", 0, 0, 90, CMF_TRACKOWNER)
			TNT1 A 0 A_CustomMissile("IronLichIceShard", 0, 0, 135, CMF_TRACKOWNER)
			TNT1 A 0 A_CustomMissile("IronLichIceShard", 0, 0, 180, CMF_TRACKOWNER)
			TNT1 A 0 A_CustomMissile("IronLichIceShard", 0, 0, 225, CMF_TRACKOWNER)
			TNT1 A 0 A_CustomMissile("IronLichIceShard", 0, 0, 270, CMF_TRACKOWNER)
			TNT1 A 0 A_CustomMissile("IronLichIceShard", 0, 0, 315, CMF_TRACKOWNER)
			FX39 EEEEFFFFGGGG 1 Bright A_FadeOut(0.025)
		Stop
	}
}

ACTOR IronLichIceShard {
	Radius 12
	Height 6
	Speed 10
	Damage (3 * random(1, 8))
	DamageType "Ice"
	Stamina 64
	Scale 1.25
	Projectile
	Gravity 0.3
	-NOGRAVITY
	-ACTIVATEIMPACT
	-ACTIVATEPCROSS
	+DONTBLAST
	Alpha 0.8
	RenderStyle Add
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			FX39 HIJ 3 Bright
		Loop
		XDeath:
			TNT1 A 0 A_PlaySound("Lich/IceHit")
		Goto SkipSound
		Death:
			TNT1 A 0 A_Playsound("Lich/IceHitW")
		SkipSound:
			FX39 DEFG 3 Bright
		Stop
	}
}

ACTOR IronLichGroundSpike {
	PROJECTILE
	Speed 24
	Radius 8
	Height 8
	Damage (0)
	+RIPPER
	+BLOODLESSIMPACT
	+FLOORHUGGER
	+THRUGHOST
	+DONTBLAST
	States {
		Spawn:	
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			TNT1 D 2 A_CustomMissile("GroundSpikeExt",0,0,0,4)
			TNT1 A 3
			TNT1 D 2 A_CustomMissile("GroundSpikeExt",0,0,0,4)
			TNT1 A 3
			TNT1 D 2 A_CustomMissile("GroundSpikeExt",0,0,0,4)
			TNT1 A 3
			TNT1 D 2 A_CustomMissile("GroundSpikeExt",0,0,0,4)
			TNT1 A 3
			TNT1 D 2 A_CustomMissile("GroundSpikeExt",0,0,0,4)
			TNT1 A 3
			TNT1 D 2 A_CustomMissile("GroundSpikeExt",0,0,0,4)
			TNT1 A 3
			TNT1 D 2 A_CustomMissile("GroundSpikeExt",0,0,0,4)
			TNT1 A 3
			TNT1 D 2 A_CustomMissile("GroundSpikeExt",0,0,0,4)
			TNT1 A 3
		Stop
		Death:
			TNT1 A 1
		Stop
	}
}
		
ACTOR GroundSpikeExt {
	PROJECTILE
	Speed 0
	Scale 0.75
	Radius 8
	Height 12
	Damage (random(6, 14))
	DamageType "Physical"
	Stamina 1
	+FLOORHUGGER
	+RIPPER
	+THRUGHOST
	+DONTREFLECT
	+DONTBLAST
	SeeSound "ThrustSpikeRaise"
	DeathSound "ThrustSpikeLower"
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			RSPK DCBA 3
			RSPK A 5
			RSPK BCD 3
		Stop
	}
}

Actor IronLichDarkness {
	Speed 40
	Damage (20)
	DamageType "MagicalVisionDimmer"
	Stamina 8
	SeeSound "monster/curse1"
	Deathsound "Lich/VisionDim"
	Height 8
	Radius 6
	Renderstyle Add
	Alpha 0.85
	PROJECTILE
	+PIERCEARMOR
	+SEEKERMISSILE
	+DONTBLAST
	States {
		Spawn:
			TNT1 A 0 A_Jump(128, "Less")
			TNT1 AAAAAAAAAAAAAAA 0 A_BishopMissileWeave
		Less:
			TNT1 AAAAAAA 0 A_BishopMissileWeave
		SpawnLoop:
			LBA2 A 1 Bright A_SpawnItem("IronLichDarknessTrail")
			TNT1 A 0 A_SeekerMissile(4, 8)
		Loop
		Death:
			LBA2 GHIJ 3 Bright
		Stop
	}
}

Actor IronLichDarknessTrail {
	+CLIENTSIDEONLY
	+NOGRAVITY
	+NOCLIP
	Renderstyle Add
	Alpha 0.75
	
	States {
		Spawn:
			TNT1 A 2
			LBA2 BCDEF 1 Bright
		Stop
	}
}

Actor IronLichEnergyAttack {
	PROJECTILE
	Damage (6 * random(1, 8))
	DamageType "EnergyYellow"
	Stamina 16
	Height 12
	Radius 6
	+DOOMBOUNCE
	+RIPPER
	+PIERCEARMOR
	+BLOODLESSIMPACT
	+DONTBLAST
	Renderstyle Add
	Alpha 0.9
	var int user_count;
	Speed 32
	Scale 1.25
	States {
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_SetUserVar("user_count", 0)
		SpawnLoop:
			TNT1 A 0 A_JumpIf(user_count == 16, "Death")
			STAR AB 3 Bright A_CustomMissile("IronLichSmallEnergy", 0, 0, random(0, 360), CMF_AIMDIRECTION, frandom(-3.0, 3.0))
			TNT1 A 0 ThrustThing(angle * 256/360 + 4 * random(-32, 32), 3 * random(1, 3), 0, 0)
			TNT1 A 0 A_SetUserVar("user_Count", user_count + 1)
		Loop
		Death:
			STAR CDEF 3 Bright
		Stop
	}
}

Actor IronLichSmallEnergy {
	PROJECTILE
	height 6
	Radius 3
	Scale 0.75
	Renderstyle Add
	Alpha 0.75
	Damage (2 * random(1, 8))
	DamageType "EnergyYellow"
	Stamina 16
	Speed 8
	+DONTBLAST
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			STAR GH 3 Bright A_FadeOut(0.05)
		Loop
		Death:
			STAR GH 1 Bright A_FadeOut(0.1)
		Stop
	}
}

Actor IronLichFireTracer {
	Projectile
	+NOCLIP
	Damage 0
	var int user_count;
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 0 A_PlaySound("Lich/FireCurse")
			TNT1 A 0 A_SetUserVar("user_count", 0)
		SpawnLoop:
			TNT1 A 0 A_JumpIf(user_count == 12, "Die")
			TNT1 A 5 A_Fire
			TNT1 AAA 0 A_CustomMissile("IronLichFireSky", 192, random(-48, 48))
			TNT1 A 0 A_SetUserVar("user_count", user_count + 1)
		Loop
		Die:
			TNT1 A 1
		Stop
	}
}

Actor IronLichFireSky : VolcanoTBlast2 {
	+CEILINGHUGGER
	Gravity 1.25
	States {
		Spawn:
			TNT1 A 1
			TNT1 A 0 A_ChangeFlag("CEILINGHUGGER", 0)
			TNT1 A 0 A_ChangeFlag("NOGRAVITY", 0)
		Goto Super::Spawn
	}
}

actor LichHealFX
{
	translation "112:127=112:127"
	+NoBlockMap +NoGravity +NoSector +NoInteraction +NoClip -Solid +CLIENTSIDEONLY
        states
        {
        Spawn:
        	TNT1 A 0
        	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx ("BaseSparkle", 12 * random(-8, 8), 12 * random(-8, 8), random(0, 32), 0, 0, 3, 0, 129) 
        	Stop
        }     
        
}

Actor IronLichSmallEnergy2 {
	PROJECTILE
	height 6
	Radius 3
	Scale 0.75
	Renderstyle Add
	Alpha 0.75
	Damage (4 * random(1, 8))
	DamageType "EnergyYellow"
	Stamina 16
	Speed 32
	Species "Spider2"
	+THRUSPECIES
	+DONTBLAST
	+PIERCEARMOR
	States {
		Spawn:
			STAR GH 3 Bright
		Loop
		Death:
			STAR GH 1 Bright A_FadeOut(0.1)
		Stop
	}
}

Actor LichTurret {
	+ISMONSTER
	-COUNTKILL
	+NOCLIP
	+NOGRAVITY
	+NOTARGET
	+DONTREFLECT
	Speed 0
	Radius 2
	Height 2
	var int user_count;
	Obituary "%o was mesmerized by the gaze of an Iron Lich."
	States {
		Spawn:
			STAR G 2 Bright A_GiveInventory("DnD_SightChecker", 1)
		Loop
		See:
			TNT1 A 0 A_JumpIf(10 == user_count, "Death")
			TNT1 A 0 A_CustomMissile("IronLichSmallEnergy2", -12)
			TNT1 A 0 A_CustomMissile("IronLichSmallEnergy2", -12, 0, frandom(-6.4, 6.4))
			STAR GHGHGHGHGHGHGHGHGH 2 Bright
			TNT1 A 0 A_SetUserVar("user_count", user_count + 1)
		Loop
		Death:
			STAR GH 1 Bright A_FadeOut(0.1)
		Loop
	}
}

Actor SpiderOverlord : DnD_BaseRangedBoss {
	Species "Spider2"
	PainSound "SpiderMastermind/Pain"
	AttackSound ""
	Health 0x7FFFFFFF
	PainChance 8
	Scale 1.15
	Tag "Spider Overlord"
	Obituary "%o couldn't see a Spider Overlord coming."
	+ISMONSTER
	+DONTRIP
	+DONTHURTSPECIES
	+MISSILEMORE
	+MISSILEEVENMORE
	+BOSS
	+NORADIUSDMG
	+DONTMORPH
	Radius 128
	Height 100
	Mass 2048
	Speed 12
	MinMissileChance 160
	SeeSound "spider/sight"
	PainSound "SpiderMastermind/Pain"
	DeathSound "spider/death"
	ActiveSound "spider/active"
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_SPIDEROVERLORD)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_RARE2)
		Goto SpawnSetup

		IdleState:
			NMAS AB 10 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			TNT1 A 0 A_TakeInventory("DnD_Boolean", 1)
			NMAS A 3 Fast A_Metal
			NMAS ABB 3 Fast A_Chase
			NMAS C 3 Fast A_Metal
			NMAS CDD 3 Fast A_Chase
			NMAS E 3 Fast A_Metal
			NMAS EFF 3 Fast A_Chase
		Goto See
		MissileState:
			TNT1 A 0 A_PlaySound("weapons/minigunup", 7)
			NMAS T 8 Fast A_FaceTarget
			NMAS U 7 Fast A_FaceTarget
			NMAS T 6 Fast A_FaceTarget
			NMAS U 5 Fast A_FaceTarget
			NMAS T 4 Fast A_FaceTarget
			NMAS U 3 Fast A_FaceTarget
		MissileLoop:
			TNT1 A 0 A_StopSound(7)
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_PlaySound("SpiderMasterMind/MinigunSpin", 7)
			TNT1 A 0 A_PlaySound("SpiderMasterMind/MinigunFire", CHAN_WEAPON, 1, 1, 0.4)
			TNT1 A 0 A_GiveInventory("DnD_Boolean", 1)
			TNT1 A 0 A_SpawnItemEx ("bulletcasing", -8, 28, 34, -4, 0, frandom(3.0, 5.0), random(-80, -90))
			TNT1 A 0 A_CustomMissile("BigSpiderBullet", 32, -12, frandom(-10, 10))
			NMAS G 3 Fast Bright A_CustomMissile("BigSpiderBullet", 64, -12, frandom(-22.5, 22.5))
			TNT1 A 0 ACS_NamedExecuteAlways("DnD On Monster Attack", 0)
			TNT1 A 0 A_SpawnItemEx ("bulletcasing", -8, 28, 34, -4, 0, frandom(3.0, 5.0), random(-80, -90))
			TNT1 A 0 A_CustomMissile("SpiderOverlordMissile", 78, 16, 0, CMF_AIMOFFSET)
			TNT1 A 0 A_CustomMissile("SpiderOverlordMissile", 78, 0, 0, CMF_AIMOFFSET)
			TNT1 A 0 A_CustomMissile("BigSpiderBullet", 32, -12, frandom(-10, 10))
			NMAS H 3 Fast Bright A_CustomMissile("BigSpiderBullet", 32, -12, frandom(-22.5, 22.5))
			NMAS H 1 Bright A_MonsterRefire(24, "MissileFinish")
		Loop
		MissileFinish:
			TNT1 A 0 A_TakeInventory("DnD_Boolean", 1)
			TNT1 A 0 A_PlaySound("SpiderMasterMind/MinigunEnd", CHAN_WEAPON, 1, 0, 0.4)
			TNT1 A 0 A_PlaySound("SpiderMasterMind/MinigunSpinEnd", 7)
			NMAS U 3 Fast A_FaceTarget
			NMAS T 4 Fast A_FaceTarget
			NMAS U 5 Fast A_FaceTarget
			NMAS T 6 Fast A_FaceTarget
			NMAS U 7 Fast A_FaceTarget
			NMAS T 8 Fast A_FaceTarget
		Goto See
		PainState:
			TNT1 A 0 A_GiveInventory("SpiderFireChecker", 1)
			TNT1 A 0 A_SpawnDebris("MetalScrap")
			TNT1 A 0 A_ChangeFlag("GHOST", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Give", DND_GHOST, -1, -1, -1)
			NMAS I 6 Fast A_SetTranslucent(0.5, 0)
			NMAS I 6 Fast A_Pain
			TNT1 A 0 A_ChangeFlag("GHOST", 0)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Monster Trait Take", DND_GHOST, -1, -1, -1)
			NMAS I 0 A_SetTranslucent(1.0, 0)
		Goto See
		XDeathState:
			TNT1 A 0 A_SpawnItemEx("GenericGibber_High", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
		DeathState:
			TNT1 A 0 A_SetTranslucent(1.0, 0)
			NMAS J 2 A_Scream
			TNT1 A 0 A_StopSound(7)
			TNT1 A 0 A_StopSound(CHAN_WEAPON)
			TNT1 A 0 A_GiveInventory("SpiderFireChecker", 1)
			NMAS J 18
			NMAS K 2 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			NMAS KKKK 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			NMAS LLLLL 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			NMAS MMMMM 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			NMAS NNNNN 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			NMAS OOOOO 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			NMAS PPPPP 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			NMAS QQQQQ 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			TNT1 A 0 A_SpawnItemEx("GenericGibber_Low", 0, 0, 0, 0, 0, 0, 0, SXF_USEBLOODCOLOR)
			NMAS RRRRR 2 A_SpawnItemEx("ExplosionFX", 0, 0, random(0, 32),random(-9,9),random(-9,9),random(5,9), 48, 128)
			NMAS S 5
			NMAS S -1 A_KillMaster
		Stop
	}	
}

ACTOR SpiderOverlordMissile : SentGmissile {
	Speed 20
	DamageType "MagicalGreen"
	Stamina 8
	Damage (4 * random(1, 8))
	Scale 0.5
	+SEEKERMISSILE
	+PIERCEARMOR
	States {
		Spawn:
			CFX6 AAA 1 Bright A_SpawnItem("Barbtrail",0,0)
			TNT1 A 0 A_SeekerMissile(22.5, 22.5, SMF_PRECISE)
		loop
	}
}

actor DarkLich : DnD_BaseRangedBoss {
	obituary "%o couldn't withstand the magic of a Dark Lich."
	Health 0x7FFFFFFF
	painchance 0
	speed 7
	radius 52
	height 100
	mass 2048
	damage 0
	SeeSound "monster/cubsit"
	PainSound "Lich/pain"
	DeathSound "monster/cubdth"
	ActiveSound "Lich/act"
	Species "Spider2"
	+ISMONSTER
	+NOBLOOD
	+DONTRIP
	+MISSILEMORE
	+MISSILEEVENMORE
	+QUICKTORETALIATE
	+DONTHARMSPECIES
	+NOICEDEATH
	+NOINFIGHTING
	+NOBLOOD
	+DONTMORPH
	+BOSS
	+NODAMAGETHRUST
	+NOTARGET
	+NOPAIN
	RenderStyle Translucent
	Tag "Dark Lich"
	Alpha 0.85
	States {
		SetInfo:
			TNT1 A 0 A_SetArg(4, DND_DARKLICH)
			TNT1 A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", DND_MWEIGHT_VERYRARE)
		Goto SpawnSetup

		IdleState:
			DLCH A 3 A_GiveInventory("DnD_SightChecker", 1)
		Loop
		SeeState:
			DLCH A 3 Fast A_Chase
			DLCH A 0 A_SpawnItem("DarkLichMoveFX", 0, 0)
		Goto See
		MissileState:
			TNT1 A 0 A_Jump (256, "Fire1", "Fire2", "Fire3", "Fire4")
		Fire1:
			DLCH A 8 Fast A_FaceTarget
			DLCH B 8 Fast A_CustomMissile("DarkLichWarp")
		goto See
		Fire2:
			DLCH A 8 Fast A_FaceTarget
			TNT1 A 0 A_CustomMissile("DarkSpiritAttack")
			DLCH B 10 Fast A_FaceTarget
			TNT1 A 0 A_CustomMissile("DarkSpiritAttack")
			DLCH B 10 Fast A_FaceTarget
			TNT1 A 0 A_CustomMissile("DarkSpiritAttack")
			DLCH B 10 Fast A_FaceTarget
			TNT1 A 0 A_CustomMissile("DarkSpiritAttack")
			DLCH B 10 Fast A_FaceTarget
		goto See
		Fire3:
			DLCH A 8 Fast A_FaceTarget
			TNT1 A 0 A_PlaySound("DarkLich/zap", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("PurpleParticleSpawner", random(-24, 24), random(-24, 24), 24)
			DLCH A 8 Fast A_FaceTarget
			TNT1 A 0 A_PlaySound("DarkLich/zap", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("PurpleParticleSpawner", random(-24, 24), random(-24, 24), 24)
			DLCH A 8 Fast A_FaceTarget
			TNT1 A 0 A_PlaySound("DarkLich/zap", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("PurpleParticleSpawner", random(-24, 24), random(-24, 24), 24)
			DLCH A 8 Fast A_FaceTarget
			DLCH B 9 Fast A_CustomMissile("DarkLichVortex")
		Goto See
		Fire4:
			DLCH A 7 Fast A_FaceTarget
			TNT1 A 0 A_CustomMissile("DarkLichHomingBall", 24, 0, -6)
			DLCH B 9 Fast A_CustomMissile("DarkLichHomingBall", 24, 0, 6)
		Goto See
		XDeathState:
		DeathState: 	
			TNT1 A 0 A_NoBlocking
			DLCH B 25 
			TNT1 A 0 A_Scream
			DLCH B 3
			TNT1 A 0 A_FadeOut(0.075)
			TNT1 AAAAA 0 A_SpawnItemEx("DarkLichDeathExplosion", random(-96, 96), random(-96, 96), random(8, 96), 0, 0, 0, 0, SXF_NOCHECKPOSITION)
			DLCH B 3
			TNT1 A 0 A_FadeOut(0.075)
			TNT1 AAAAA 0 A_SpawnItemEx("DarkLichDeathExplosion", random(-96, 96), random(-96, 96), random(8, 96), 0, 0, 0, 0, SXF_NOCHECKPOSITION)
			DLCH B 3
			TNT1 A 0 A_FadeOut(0.075)
			TNT1 AAAAA 0 A_SpawnItemEx("DarkLichDeathExplosion", random(-96, 96), random(-96, 96), random(8, 96), 0, 0, 0, 0, SXF_NOCHECKPOSITION)
			DLCH B 3
			TNT1 A 0 A_FadeOut(0.075)
			TNT1 AAAAA 0 A_SpawnItemEx("DarkLichDeathExplosion", random(-96, 96), random(-96, 96), random(8, 96), 0, 0, 0, 0, SXF_NOCHECKPOSITION)
			DLCH B 3
			TNT1 A 0 A_FadeOut(0.075)
			TNT1 AAAAA 0 A_SpawnItemEx("DarkLichDeathExplosion", random(-96, 96), random(-96, 96), random(8, 96), 0, 0, 0, 0, SXF_NOCHECKPOSITION)
			DLCH B 3
			TNT1 A 0 A_FadeOut(0.075)
			TNT1 AAAAA 0 A_SpawnItemEx("DarkLichDeathExplosion", random(-96, 96), random(-96, 96), random(8, 96), 0, 0, 0, 0, SXF_NOCHECKPOSITION)
			DLCH B 3
			TNT1 A 0 A_FadeOut(0.075)
			TNT1 AAAAA 0 A_SpawnItemEx("DarkLichDeathExplosion", random(-96, 96), random(-96, 96), random(8, 96), 0, 0, 0, 0, SXF_NOCHECKPOSITION)
			DLCH B 3
			TNT1 A 0 A_FadeOut(0.075)
			TNT1 AAAAA 0 A_SpawnItemEx("DarkLichDeathExplosion", random(-96, 96), random(-96, 96), random(8, 96), 0, 0, 0, 0, SXF_NOCHECKPOSITION)
			TNT1 A -1 A_KillMaster
		stop
	}
}

Actor DarkLichDeathExplosion {
	+CLIENTSIDEONLY
	+NOINTERACTION
	+DONTSPLASH
	Renderstyle Add
	Alpha 0.85
	States {
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_PlaySound("MageStaffExplode")
			BSBS EFGHIJKLM 3 Bright
		Stop
	}
}

ACTOR DarkLichMoveFX {
	+CLIENTSIDEONLY
	+NOINTERACTION
	+DONTSPLASH
	ALPHA 0.5
	States {
		Spawn:
			TNT1 A 3
			DLCH A 3 A_FadeOut(0.10)
		goto spawn+1
	}
}

Actor DarkSpiritAttack {
	PROJECTILE
	Height 8
	Radius 6
	Damage (1)
	DamageType "MagicalDark"
	Stamina 520
	Speed 18
	RENDERSTYLE ADD
	ALPHA 0.66
	ReactionTime 7
	Species "Spider2"
	Scale 1.1
	+THRUSPECIES
	-NOBLOCKMAP
	+GHOST
	+SHOOTABLE
	+RIPPER
	+SEEKERMISSILE
	+BLOODLESSIMPACT
	+SCREENSEEKER
	+NOBLOOD
	+HEXENBOUNCE
	+PIERCEARMOR
	+FORCEPAIN
	+CANBOUNCEWATER
	+DONTSPLASH
	+NODAMAGETHRUST
	SeeSound "SpiritActive"
	DeathSound "SpiritDie"
	Tag "Dark Spirit"
	States {
		Spawn:
			SPIR A 5 A_SeekerMissile(10, 30, SMF_LOOK)
			SPIR A 5 A_SeekerMissile(10, 30, SMF_LOOK)
			TNT1 AA 0 A_SeekerMissile(90, 90)
			SPIR B 5 A_SeekerMissile(10, 30, SMF_LOOK)
			SPIR B 5 A_SeekerMissile(10, 30, SMF_LOOK)
			TNT1 AA 0 A_SeekerMissile(90, 90)
			TNT1 A 0 A_PlaySound("SpiritActive")
			TNT1 A 0 A_CountDown
		Loop
		Death: 
			SPIR E 4 A_Stop
			SPIR F 5 A_Scream 
			SPIR GHIJ 4  
		Stop 
	}
}

Actor DarkLichWarpDamager : BaseExplosionDamage {
	DamageType "PhysicalTornado"
	Stamina 1
	+NODAMAGETHRUST
	+PIERCEARMOR
	+FORCEPAIN
	States {
		Spawn:
			TNT1 A 1 NoDelay A_Explode(4, 64, 0, 0, 24)
		Stop
	}
}

Actor DarkLichWarp {
	PROJECTILE
	Radius 16
	Height 56
	Damage (1)
	DamageType "PhysicalTornado"
	Stamina 1
	ReactionTime 7
	BounceFactor 0.8
	WallBounceFactor 0.8
	Speed 22
	Renderstyle Add
	Alpha 0.75
	MaxStepHeight 48
	Species "Spider2"
	+PIERCEARMOR
	-NOGRAVITY
	+FORCEPAIN
	+THRUACTORS
	+BLOODLESSIMPACT
	+HEXENBOUNCE
	+FLOORHUGGER
	+SEEKERMISSILE
	+SCREENSEEKER
	+STEPMISSILE
	+CANBOUNCEWATER
	+DONTSPLASH
	+NODAMAGETHRUST
	States {
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_PlaySound("ironlich/attack3", CHAN_BODY, 1.0, 1)
			TNT1 A 0 A_ScaleVelocity(0.1)
			FX07 DEFG 3
			TNT1 A 0 A_ChangeFlag("FLOORHUGGER", 0)
			TNT1 A 0 A_ScaleVelocity(10.0)
		SpawnLoop:
			TNT1 A 0 A_SpawnItem("DarkLichWarpDamager")
			TNT1 A 0 A_FadeOut(0.15)
			FX07 A 2 A_SeekerMissile(10, 30, SMF_LOOK)
			TNT1 A 0 A_SpawnItem("DarkLichWarpDamager")
			TNT1 A 0 A_FadeOut(0.15)
			FX07 A 3 A_SeekerMissile(10, 30, SMF_LOOK)
			TNT1 A 0 A_SpawnItem("DarkLichWarpDamager")
			TNT1 A 0 A_FadeOut(0.15)
			FX07 B 2 A_SeekerMissile(10, 30, SMF_LOOK)
			TNT1 A 0 A_SpawnItem("DarkLichWarpDamager")
			TNT1 A 0 A_FadeIn(0.15)
			FX07 B 3 A_SeekerMissile(10, 30, SMF_LOOK)
			TNT1 A 0 A_SpawnItem("DarkLichWarpDamager")
			TNT1 A 0 A_FadeIn(0.15)
			FX07 C 2 A_SeekerMissile(10, 30, SMF_LOOK)
			TNT1 A 0 A_SpawnItem("DarkLichWarpDamager")
			TNT1 A 0 A_FadeIn(0.15)
			FX07 C 3 A_SeekerMissile(10, 30, SMF_LOOK)
			TNT1 A 0 A_CountDown
		Loop
		Death:
			TNT1 A 0 A_Stop
			FX07 GFE 3
			TNT1 A 0 A_StopSound(CHAN_BODY)
			FX07 D 3
		Stop
	}
}

Actor DarkLichVortexExp1 : BaseExplosionDamage {
	DamageType "MagicalVoid"
	Stamina 520
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(24, 160, 0)
		Stop
	}
}

Actor DarkLichVortexExp2 : BaseExplosionDamage {
	DamageType "MagicalVoid"
	Stamina 520
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(36, 192, 0)
		Stop
	}
}

Actor DarkLichVortexExp3 : BaseExplosionDamage {
	DamageType "MagicalVoid"
	Stamina 520
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(48, 224,0)
		Stop
	}
}

Actor DarkLichVortexExp4 : BaseExplosionDamage {
	DamageType "MagicalVoid"
	Stamina 520
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(60, 288,0)
		Stop
	}
}

Actor DarkLichVortexExp5 : BaseExplosionDamage {
	DamageType "MagicalVoid"
	Stamina 520
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(72, 360,0)
		Stop
	}
}

Actor DarkLichVortex {
	PROJECTILE
	Height 10
	Radius 6
	Speed 20
	Damage (80)
	DamageType "MagicalVoid"
	Stamina 520
	SeeSound "redballbsee"
	DeathSound "DarkLich/VortexHit"
	Species "Spider2"
	+BLOODLESSIMPACT
	+NODAMAGETHRUST
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			GNF1 ABCABC 2 BRIGHT
			TNT1 A 0 A_PlaySound("DarkLich/Charge")
		Loop
		Death:
			GNF1 D 2 BRIGHT
			GNF1 E 2 BRIGHT A_PlaySound("DarkLich/VortexBuild")
			GNF1 F 2 BRIGHT A_SpawnItem("DarkLichVortexExp1")
			GNF1 G 2 BRIGHT 
			GNF1 H 2 BRIGHT A_SpawnItem("DarkLichVortexExp2")
			GNF1 I 2 BRIGHT 
			GNF1 J 2 BRIGHT A_SpawnItem("DarkLichVortexExp3")
			GNF1 K 2 BRIGHT 
			GNF1 L 2 BRIGHT A_SpawnItem("DarkLichVortexExp4")
			GNF1 M 2 BRIGHT 
			GNF1 N 2 BRIGHT A_SpawnItem("DarkLichVortexExp5")
			GNF1 O 2 BRIGHT 
			GNF1 P 2 BRIGHT A_SpawnItem("DarkLichVortexExp4")
			GNF1 Q 2 BRIGHT 
			GNF1 R 2 BRIGHT A_SpawnItem("DarkLichVortexExp3")
			GNF1 S 2 BRIGHT A_FadeOut(0.2) 
			GNF1 T 2 BRIGHT A_SpawnItem("DarkLichVortexExp2")
			GNF1 U 2 BRIGHT A_FadeOut(0.2) 
			GNF1 V 2 BRIGHT A_SpawnItem("DarkLichVortexExp1")
			GNF1 W 2 BRIGHT A_FadeOut(0.2) 
			GNF1 X 2 BRIGHT A_SpawnItem("DarkLichVortexExp1")
			GNF1 Y 2 BRIGHT A_FadeOut(0.2)
			GNF1 Z 2 BRIGHT A_SpawnItem("DarkLichVortexExp1")
			GNF1 "[" 2 BRIGHT  A_FadeOut(0.2)
		Stop
	}
}

actor ArchWSpark {
	+NOINTERACTION
	+CLIENTSIDEONLY
	RenderStyle Add
	States {
		Spawn:
			FX11 G 1 Bright Light(DISCIPLEBALL_X2) A_FadeOut (0.1)
		loop
	}
}

Actor DarkLichHomingBallExp : BaseExplosionDamage {
	DamageType "MagicalVoid"
	Stamina 520
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
			TNT1 A 1 A_Explode(36, 96,0)
		Stop
	}
}

ACTOR DarkLichHomingBall {
	PROJECTILE
	Speed 16
	Height 16
	Radius 10
	SeeSound "MageStaffFire"
	DeathSound "MageStaffExplode"
	DamageType "MagicalVoid"
	Stamina 520
	Damage (random(15, 30))
	Species "Spider2"
	+NODAMAGETHRUST
	+SEEKERMISSILE
	+SCREENSEEKER
	States {
		Spawn:
			TNT1 A 0 NoDelay ACS_NamedExecuteAlways("DnD Pierce Check")
		SpawnLoop:
			BSBS A 0 Bright Light(DISCIPLEBALL)
			BSBS A 0 Bright Light(DISCIPLEBALL) A_PlaySoundEx ("DarkLich/ballfly", "SoundSlot6", 1) 
			BSBS A 2 Bright Light(DISCIPLEBALL) 
			BSBS A 0 Bright Light(DISCIPLEBALL) A_SpawnItemEx ("ArchWSpark", random (-6, 6), random (-6, 6), random (-6, 6), 0, 0, 0, 0, 160)
			BSBS B 2 Bright Light(DISCIPLEBALL)
			BSBS B 0 Bright Light(DISCIPLEBALL) A_SpawnItemEx ("ArchWSpark", random (-6, 6), random (-6, 6), random (-6, 6), 0, 0, 0, 0, 160)
			BSBS C 2 Bright Light(DISCIPLEBALL)
			BSBS C 0 Bright Light(DISCIPLEBALL) A_SpawnItemEx ("ArchWSpark", random (-6, 6), random (-6, 6), random (-6, 6), 0, 0, 0, 0, 160)
			BSBS D 2 Bright Light(DISCIPLEBALL) A_SeekerMissile(2, 10)
			BSBS D 0 Bright Light(DISCIPLEBALL) A_SpawnItemEx ("ArchWSpark", random (-6, 6), random (-6, 6), random (-6, 6), 0, 0, 0, 0, 160)
			BSBS A 0 Bright Light(DISCIPLEBALL) A_SeekerMissile(2, 10)
			BSBS A 0 Bright Light(DISCIPLEBALL) A_PlaySoundEx ("DarkLich/ballfly", "SoundSlot6", 1) 
			BSBS A 2 Bright Light(DISCIPLEBALL) A_SeekerMissile(2, 10)
			BSBS A 0 Bright Light(DISCIPLEBALL) A_SpawnItemEx ("ArchWSpark", random (-6, 6), random (-6, 6), random (-6, 6), 0, 0, 0, 0, 160)
			BSBS B 2 Bright Light(DISCIPLEBALL) A_SeekerMissile(2, 10)
			BSBS B 0 Bright Light(DISCIPLEBALL) A_SpawnItemEx ("ArchWSpark", random (-6, 6), random (-6, 6), random (-6, 6), 0, 0, 0, 0, 160)
			BSBS C 2 Bright Light(DISCIPLEBALL) A_SeekerMissile(2, 10)
		Loop
		Death:
			BSBS E 0 Bright Light(DISCIPLEBALL) A_StopSoundEx ("SoundSlot6")
			BSBS E 0 Bright Light(DISCIPLEBALL) A_SetTranslucent (1, 1) 
			BSBS E 3 Bright Light(DISCIPLEBALL) A_SpawnItem("DarkLichHomingBallExp")
			BSBS FGHIJKLM 3 Bright
		Stop
	}
}

Actor DarkLichWarpDamageCooldown : PowerDamage {
	powerup.duration 4
	damagefactor "normal", 1.0
}

Actor DarkLichGhostDamageCooldown : PowerDamage {
	powerup.duration 7
	damagefactor "normal", 1.0
}