ACTOR IconOfSin_DnD : DnD_BaseRangedBoss replaces IconOfSin {
	Health 50000
	Radius 300
	Height 2000
	Mass 9000
	Speed 0
	PainChance 20
	DamageFactor "Normal", 0.5
	+DONTRIP
	+ISMONSTER
	+BOSS 
	+FLOORCLIP
	+NORADIUSDMG
	+DONTMORPH
	+BOSSDEATH
	+MISSILEMORE
	+NOBLOOD
	+NOTARGET
	+MISSILEEVENMORE
	+FORCEXYBILLBOARD
	+NODAMAGETHRUST
	//SeeSound "cyber/sight"
	//PainSound "cyber/pain"
	DeathSound "cyber/death"
	//ActiveSound "cyber/active"
	Obituary "%o was wiped out by an eldritch abomination"
	Tag "Icon of Sin"
	Scale 9.0
	States {
		SetInfo:
			TNT1 A 0
		Goto SpawnSetup
	
		SpawnSetup:
			ICOS A 0 ACS_NamedExecuteWithResult("DnD Init Monster Data", 250000)
			ICOS A 0 ACS_NamedExecuteWithResult(
				"DnD Custom Monster Scale",
				DND_CUSTOM_UNIQUEBOSS | (MONSTERCLASS_CYBERDEMON << 9) | (DND_MTYPE_DEMON_POW << 14),
				DND_MAGIC_IMMUNE,
				DND_FIRECREATURE,
				DND_SCORCHED
			)
			ICOS A 0 A_ChangeFlag("INVULNERABLE", 1)
			ICOS A 0 A_Jump(256, "Idle")
			ICOS A 35
		Wait
	
		Idle:
	    
			ICOS ABCCB 5 A_Look
		Loop
		SeeState:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("HasSpotedThePlayerAlready", 1, "See2")
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			
			TNT1 A 0
			ICOS ABCCBA 5 
			
			TNT1 A 0 A_PLaySoundEx("brain/sight", 4, 0, 2)
			TNT1 A 0 ACS_Execute(56)
			ICOH ABCBABCBABCBABCBAABCBABCBABCBABCBA 6
			ICOS A 0 A_ChangeFlag("INVULNERABLE", 0)
			ICOS AB 5
			TNT1 A 0 A_PLaySoundEx("ICOBREAT", 4, 0, 2)
			ICOS CCB 5
			//rawr
			//TNT1 A 0 A_PLaySoundEx("CLOVERFI", 4, 0, 2)
			//TNT1 A 0 Radius_Quake (22, 170, 0, 64, 0)
			//ICOA ABC 5
					
			//ICOA DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD 5 A_Explode(2, 5000)
			//ICOA DDDDD 5
			//ICOA CBA 5
			TNT1 A 0 A_GiveInventory("HasSpotedThePlayerAlready", 1)
		
		Goto Summon
		See2:
			TNT1 A 0
		Goto Ready
		Ready:
			TNT1 A 0
			TNT1 A 0 A_PLaySoundEx("ICOBREAT", 4, 0, 2)
			ICOS ABCCCCB 3 A_Chase
			ICOS ABCCCCB 3 A_Chase
			TNT1 A 0 A_PLaySoundEx("ICOBREAT", 4, 0, 2)
			ICOS ABCCCCB 3 A_Chase
			ICOS ABCCCCB 3 A_Chase
			TNT1 A 0 A_PLaySoundEx("ICOBREAT", 4, 0, 2)
			ICOS ABCCCCB 3 A_Chase
			ICOS ABCCCCB 3 A_Chase
			TNT1 A 0 A_PLaySoundEx("ICOBREAT", 4, 0, 2)
			ICOS ABCCCCB 3 A_Chase
			ICOS ABCCCCB 3 A_Chase
			TNT1 A 0 A_PLaySoundEx("ICOBREAT", 4, 0, 2)
			ICOS ABCCCCB 3 A_Chase
			ICOS ABCCCCB 3 A_Chase
		Goto Summon
		MissileState:
			ICOS A 1
			TNT1 A 0 A_Jump(42, "Summon")
			TNT1 A 0 A_Jump(256, "Flames", "Flames", "Thunder", "Fireballs", "Fireballs", "FireBalls")
	    Goto Ready
		Flames:
			TNT1 A 0
			//TNT1 A 0 A_JumpIfHealthLower(11000, "Meteors")
			ICOA ABCDD 5
			TNT1 A 0 A_PLaySoundEx("ICOFIRE", 1, 0, 2)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			ICOA EFEFEFEFEFEFEF 3 BRIGHT A_CustomMissile("CyberlordMissile2", 1586, 0, random(-16, 16), 0)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			ICOA DDCBA 5
		Goto Ready
		
		Summon:
			ICOT ABCC 5
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			ICOJ AB 5 BRIGHT
			TNT1 A 0 A_CustomMissile("BossSummoner325", 1875, 0, random(-8, 8), 0)
			ICOJ AB 5 BRIGHT
			TNT1 A 0 A_CustomMissile("BossSummoner325", 1875, 0, random(-8, 8), 0)
			ICOJ AB 5 BRIGHT
			TNT1 A 0 A_CustomMissile("BossSummoner325", 1875, 0, random(-8, 8), 0)
			ICOJ AB 5 BRIGHT
			TNT1 A 0 A_CustomMissile("BossSummoner325", 1875, 0, random(-8, 8), 0)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			ICOT CCBA 5
		Goto Ready	
		Thunder:
			ICOT ABCC 5
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			ICOT DE 1 BRIGHT
			ICOT C 1
			ICOT DE 1 BRIGHT
			ICOT C 1
			ICOT DE 1 BRIGHT
			ICOT C 1
			ICOT DE 1 BRIGHT
			ICOT C 1
			ICOT DE 1 BRIGHT
			ICOT C 1
			ICOT DE 1 BRIGHT
			ICOT C 1
			ICOT DE 1 BRIGHT
			ICOT C 1
			ICOT DE 1 BRIGHT
			ICOT C 1
			ICOT DE 1 BRIGHT
			TNT1 A 0 A_StopSound(4)
			TNT1 A 0 A_PLaySoundEx("ICOTHUND", 4, 0, 2)
			ICOT C 1
			ICOT DE 1 BRIGHT
			ICOT C 1
			TNT1 A 0 A_CustomMissile("SeekingTHunder_DnD", 0, 350)
			TNT1 A 0 A_CustomMissile("SeekingTHunder_DnD", 0, -350)
			ICOT DE 1 BRIGHT
			ICOT C 1
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			ICOT CCBA 5
		Goto Ready	
		
		FireBalls:	
	
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_JumpIfHealthLower(11000, "SuperFIreballs")
			ICOA ABCD 3
			ICOA EF 2 BRIGHT
			TNT1 A 0 A_CustomMissile("IOSFireBall", 1586, 0, 0, 0)
			ICOA DCBA 3
			ICOA A 7
			ICOA ABCD 3
			TNT1 A 0 A_CustomMissile("IOSFireBall", 1586, 0, 0, 0)
			ICOA EF 2 BRIGHT
			ICOA DCBA 3
			ICOA A 7
			ICOA ABCD 3
			TNT1 A 0 A_CustomMissile("IOSFireBall", 1586, 0, 0, 0)
			ICOA EF 2 BRIGHT 
			ICOA DCBA 3
			ICOA A 7
			ICOA ABCD 3
			ICOA EF 2 BRIGHT
			TNT1 A 0 A_CustomMissile("IOSFireBall", 1586, 0, 0, 0)
			ICOA DCBA 3
			ICOA A 7
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
		Goto Ready	
	
		Meteors:
			ICOT AAA 5
			
			ICOW AB 5
			ICOW CDEF 2 BRIGHT
			ICOW GGGGGHHHHIIIII 1 BRIGHT A_SpawnItem("MeteorCaster")
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			ICOW J 3
			ICOW KLM 5
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
		Goto Ready
		PainState:
			ICOA C 10 A_BrainPain
		Goto Ready
		Roar:
			TNT1 A 0
			TNT1 A 0 A_StopSound(4)
			TNT1 A 0 A_PLaySoundEx("ICOBREAT", 4, 0, 2)
			ICOS ABCCB 5
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_StopSound(4)
			TNT1 A 0 A_PLaySoundEx("CLOVERFI", 4, 0, 2)
			TNT1 A 0 Radius_Quake (22, 170, 0, 64, 0)
			ICOA ABC 5
					
			ICOA DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD 5 A_Explode(2, 5000)
			ICOA DDDDD 5
			ICOA CBA 5
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
		Goto Ready
		XDeathState:
		DeathState:
		Death.Emerald:
		Death.MagicSealing:
		Death.Ice:
		Death.P_Ice:
			ICOD Z 1
			TNT1 A 0 A_StopSound(4)
			TNT1 A 0 A_StopSound(3)
			TNT1 A 0 A_StopSound(1)
			TNT1 A 0 A_PLaySoundEx("brain/death", 4, 0, 2)
			TNT1 A 0 Radius_Quake (22, 140, 0, 64, 0)
			ICOD ZZZZZ 25 A_CustomMissile ("HollywoodExplosion2", 300, 0, random (0, 360), 2, random (30, 120))
			ICOD Z 25
			TNT1 A 0 A_StopSound(4)
			TNT1 A 0 A_PLaySoundEx("NUKEEXPL", 4, 0, 2)
			TNT1 A 0 A_SpawnItem("SuperNuclearExplosion", 0, 800)
			TNT1 A 15 ACS_NamedExecuteAlways("DnD Generic Boss Loot", 0, DND_BOSS_ENDGAME, 69, 15)
		Stop
		
		SuperFireballs:
			ICOA ABCDD 5
			TNT1 A 0 A_PLaySoundEx("ICOFIRE", 1, 0, 2)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			ICOA EFEFEF 3 BRIGHT A_CustomMissile("IOSFireBall", 1586, 0, random(-16, 16), 0)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			ICOA DDCBA 5
		Goto Ready		
	}
}

ACTOR SeekingTHunder_DnD : Actor replaces SeekingTHunder
{
	Stamina 256
	Projectile
	Speed 16
	FastSpeed 20
	+FLOORHUGGER
	+THRUACTORS
	+NOCLIP
	+SEEKERMISSILE
	+SCREENSEEKER
	Renderstyle Add
	Alpha 0.99
	YScale 6.0
	XScale 2.0
	Obituary "%o was wiped out by an eldritch abomination"
	var int user_count;
	const int finish_time = 7 * 8;
	States
	{
		Spawn:
			TNT1 A 0 A_SetUserVar("user_count", 0)
		SpawnLoop:
			ZOT1 A 1 BRIGHT A_SeekerMissile(18, 18, SMF_LOOK)
			TNT1 A 0 A_SetAngle(angle + frandom(-9, 9))
			ZOT1 B 1 A_ChangeVelocity(velx + 2 * cos(angle), vely + 2 * sin(angle), velz, CVF_REPLACE)
			ZOT1 CDE 1 BRIGHT
			THUN A 0 A_Explode(15, 100)
			FIR3 AAAAAAA 0 BRIGHT A_CustomMissile ("LightningParticleSFX", 0, 0, random (0, 360), 2, random (60, 130))
			TNT1 A 0 A_SetUserVar("user_count", user_count + 1)
			TNT1 A 0 A_JumpIf(user_count == finish_time, "Death")
		Loop
		Death:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_ScaleVelocity(0)
			ZOT1 ABCDEABCDEABCDEABCDE 1 BRIGHT A_FadeOut(0.1)
		Stop
	}
}


ACTOR IOSFireball_DnD : IOSFireball replaces IOSFireball
{
	Stamina 32
}