//////////////////
// YELLOW DEVIL //    	 (He's more orange than anything...)
//////////////////

actor DevilPart
{
obituary "%o was crushed by \cfYellow Devil\c-."
PROJECTILE
Scale 2.5
Height 10
Radius 40
+RIPPER
+DONTBLAST
Damage(3)
States
{
Spawn:
TNT1 A 1
YBIT ABC 3
TNT1 A 0 A_Recoil(-25)
YBIT DEFC 3 //A_Explode(10, 40, 0, 0, 5)
Goto Spawn+5
Death:
TNT1 A 0 A_Stop
YBIT CBA 3
stop
}
}

actor EyeSpawner
{
-SOLID
radius 2
height 2
+NOGRAVITY
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_SpawnItemEx("DevilEye",0,random(-18,18),random(-16,16))
stop
}
}

actor DevilEye
{
obituary "%o was crushed by \cfYellow Devil\c-."
-SHOOTABLE
Health 3000
scale 2.5
Height 32
painchance 256
mass 99999999
Radius 32
+NOGRAVITY
States
{
Spawn:
YEYE CB 3 Thing_ChangeTID(0,10)
YEYE A 0 A_ChangeFlag("SHOOTABLE",1)
YEYE A 1 A_Look
Goto Spawn+3
See:
YEYE A 1 A_FaceTarget
loop
Pain:
TNT1 A 0 A_SpawnItem("PainFX",0,-13)
TNT1 A 1 ACS_Execute(5,0,9)
Goto See
Missile:
YEYE A 1 A_CustomMissile("DevilProjectile",0,0,random(-3,3))
Goto See
Death:
YEYE A 0 A_Stop
YEYE A 0 A_ChangeFlag("NOGRAVITY",1)
YEYE ABC 3
stop
}
}

actor DevilProjectile
{
obituary "%o was crushed by \cfYellow Devil\c-."
PROJECTILE
Radius 8
damagetype "QuickBoomerang"
Height 5
Damage (10)
Speed 15
scale 2.5
States
{
Spawn:
YBIT G 1
loop
}
}

actor DevilDamage 10559
{
//$Category MM8BDM-Bosses
//$Sprite AMMOA0
obituary "%o was crushed by \cfYellow Devil\c-."
+SHOOTABLE
Health 250
States
{
Spawn:
TNT1 A 1
loop
Death:
TNT1 A 1 ACS_Execute(17,0)
stop
}
}

actor YellowDevilGloopFX
{
reactiontime 8
states
{
Spawn:
TNT1 A 1
TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("YellowDevilFX", random(-80,80), 0, random(0,150), random(2,8), 0, random(0,3), random(0,360))
TNT1 A 0 A_CountDown
loop
}
}

actor YellowDevilFX
{
scale 2.5
PROJECTILE
damage 0
+RIPPER
-NOGRAVITY
states
{
Spawn:
YBIT DEFC 2
loop
}
}

actor YellowDevilBoss
{
Scale 2.5
-SOLID
-SHOOTABLE
+SLIDESONWALLS
Height 10
Radius 10
Speed 0
damagetype "Misc"
obituary "%o was crushed by \cfYellow Devil\c-."
States
{
	Spawn:
	YDV1 D 1 A_LookEx(0,0,0,0,360,"See")
	loop
	See:
	YDV1 A 0 A_FaceTarget
	YSV1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("YellowDevilDebris", 48, random(-512,125), random(16, 300), random(2,8), random(2,8), 0) 
	YDV1 AAAAAAAAAABCDD 4
	Seek:
	YDV1 D 1 A_LookEx(0,0,0,0,360,"ChaseStart")
	loop	
	SeekChase:
	YDV1 E 1 A_LookEx(0,0,0,0,360,"Chasing")
	loop	
	ChaseStart:
	YDV1 A 0 A_FaceTarget
	Chasing:
	YDV1 E 0 A_JumpIfInventory("CutterFlag", 1, "SlowChasing")
	YDV1 EEEEEEEEEEEE 1 A_ChangeVelocity(7.0,0.0,0.0,CVF_RELATIVE|CVF_REPLACE)
	YDV1 FFFFFFFFFFFF 1 A_ChangeVelocity(7.0,0.0,0.0,CVF_RELATIVE|CVF_REPLACE)
	YDV1 F 0 A_Explode(8, 200, XF_NOTMISSILE, 0 , 8)
	YDV1 F 0 A_PlaySoundEx("misc/bigstomp", "Voice", 0, 1)
	YDV1 F 0 A_Quake(2, 3, 0, 1000)
	YDV1 G 2 A_Stop
	YDV1 E 0 A_JumpIfInventory("CutterFlag", 1, "SlowChasing")
	YDV1 GGGGGGGGGGGG 1 A_ChangeVelocity(7.0,0.0,0.0,CVF_RELATIVE|CVF_REPLACE)
	YDV1 HHHHHHHHHHHH 1 A_ChangeVelocity(7.0,0.0,0.0,CVF_RELATIVE|CVF_REPLACE)
	YDV1 F 0 A_Explode(8, 200, XF_NOTMISSILE, 0 , 8)
	YDV1 F 0 A_PlaySoundEx("misc/bigstomp", "Voice", 0, 1)
	YDV1 F 0 A_Quake(2, 3, 0, 1000)
	YDV1 F 0 A_Chase
	YDV1 E 2 A_Stop
	goto SeekChase
	SlowChasing:
	YDV1 EEEEEEEEEEEEEEEEEEEEEEEE 1 A_ChangeVelocity(4.5,0.0,0.0,CVF_RELATIVE|CVF_REPLACE)
	YDV1 FFFFFFFFFFFFFFFFFFFFFFFF 1 A_ChangeVelocity(4.5,0.0,0.0,CVF_RELATIVE|CVF_REPLACE)
	YDV1 F 0 A_Explode(8, 200, XF_NOTMISSILE, 0 , 8)
	YDV1 F 0 A_PlaySoundEx("misc/bigstomp", "Voice", 0, 1)
	YDV1 F 0 A_Quake(2, 3, 0, 1000)
	YDV1 G 4 A_Stop
	YDV1 GGGGGGGGGGGGGGGGGGGGGGGG 1 A_ChangeVelocity(4.5,0.0,0.0,CVF_RELATIVE|CVF_REPLACE)
	YDV1 HHHHHHHHHHHHHHHHHHHHHHHH 1 A_ChangeVelocity(4.5,0.0,0.0,CVF_RELATIVE|CVF_REPLACE)
	YDV1 F 0 A_Explode(8, 200, XF_NOTMISSILE, 0 , 8)
	YDV1 F 0 A_PlaySoundEx("misc/bigstomp", "Voice", 0, 1)
	YDV1 F 0 A_Quake(2, 3, 0, 1000)
	YDV1 F 0 A_Chase
	YDV1 E 4 A_Stop
	YDV1 E 0 A_JumpIfInventory("CutterFlag", 1, "SlowChasing")
	Goto SeekChase
	Death:
	YDV1 E 0 A_FaceTarget
	YDV1 E 0 A_SpawnItemEx("FakeDeathFX", 0, 0, 128)
	YDV1 E 0 A_PlaySoundEx("misc/devildeath", "SoundSlot5", 0, 1)
	stop
}
}

actor YellowDevilDebris
{
PROJECTILE
+RIPPER
damage (0)
+DOOMBOUNCE
bouncecount 2
bouncefactor 0.3
wallbouncefactor 0.1
scale 2.5
-NOGRAVITY
States
{
	Spawn:
	YDV1 I 1
	TNT1 A 1
	loop
}
}

actor YellowDevilHitbox : CustomInventory
{
states
{
Pickup:
TNT1 A 1 A_SpawnItemEx("DevilEye2", 32, 0, 128, momx)
stop
}
}

actor DevilEye2
{
+SHOOTABLE
+NOBLOOD
Radius 32
Height 32
+NOTARGETSWITCH
+NOGRAVITY
+MISSILE
+DONTRIP
damagefactor "Misc", 0.0
renderstyle none
health 500
painchance 256
states
{
Spawn:
PLAY A 2
stop
Pain:
TNT1 A 0 A_SpawnItemEx("PainFX",13,0)
TNT1 A 1 ACS_Execute(5,0,38)
stop
Pain.ThunderBeam:
TNT1 A 0 A_SpawnItemEx("PainFX",13,0)
TNT1 A 1 ACS_Execute(5,0,39)
stop
Pain.TimeSlow:
TNT1 A 0 A_TakeFromTarget("CutterFlag",9999)
TNT1 A 0 A_SpawnItemEx("PainFX",13,0)
TNT1 A 1 ACS_Execute(5,0,38)
TNT1 A 0 A_ChangeFlag("NOINTERACTION",1)
TimeLoop:
TNT1 A 0 A_GiveToTarget("YellowDevilTimeFX",1)
TNT1 A 0 A_JumpIfInTargetInventory("CutterFlag", 35*8, "TimeEnd")
TNT1 A 1 A_GiveToTarget("CutterFlag",1)
TNT1 A 0 A_JumpIfInTargetInventory("CutterFlag",1,"TimeLoop")
TimeEnd:
TNT1 A 1 A_TakeFromTarget("CutterFlag",9999)
stop
}
}

actor YellowDevilTimeFX : CustomInventory
{
states
{
Pickup:
TNT1 A 1 A_SpawnItemEx("TimeSlowGFX", random(0, 220), 0, Random(0,256), 0, 0, 0, random(0, 360))
stop
}
}

actor YellowDevilLaserShot : CustomInventory
{
states
{
Pickup:
YDV1 F 0 A_PlaySoundEx("misc/minilaser", "SoundSlot5", 0, 1)
TNT1 A 0 A_FaceTarget
TNT1 A 1 A_CustomMissile("DevilLaser", 165, 0, random(-2,2))//A_SpawnItemEx("DevilLaser", 12, 0, 0, 0, 0, 0, random(0, 360))
stop
}
}


actor DevilLaser
{
PROJECTILE
Radius 16
damagetype "Misc"
obituary "%o was crushed by \cfYellow Devil\c-."
+NOINTERACTION
Height 16
Damage (8)
Speed 45
scale 2.5
States
{
Spawn:
YBIT GGG 1 A_SpawnItemEx("DevilLaserFX")
YBIT G 0 A_ChangeFlag("NOINTERACTION",0)
loop
}
}

actor DevilLaserFX
{
scale 2.5
renderstyle add
alpha 1.0
+NOINTERACTION
+NOGRAVITY
States
{
Spawn:
YBIT G 1 A_FadeOut(0.05)
loop
}
}