actor EclipseBossAnchor
{
//	+NOGRAVITY
	obituary "%o fell to the darkness of \c[Eclipse]Eclipse\c-."
	gravity 0.25
	renderstyle none
	states
	{
		Spawn:
		PLAY A -1
		stop
		Scaling:
		PLAY A 2 A_ScaleVelocity(0.9)
		loop
	}
}

actor EclipseBase
{
	scale 0.5
	+NOINTERACTION
	+FORCEYBILLBOARD
	height 1
	radius 1
	states
	{
		Spawn:
		TNT1 A -1
		stop
	}
}

actor EclipseHitbox
{
	radius 16
	height 64
	+SHOOTABLE
	+INVULNERABLE
	-SOLID
	+THRUSPECIES
	+NOBLOOD
	species "Enemy"
	damagefactor "Trample", 0.0
}

actor EclipseIntroFX : EclipseBase
{
renderstyle "Stencil"
stencilcolor "Black"
scale 0.75
+NOINTERACTION

states
{
	Spawn:
	ECL0 A 0 A_FadeOut(0.08)
	ECL0 A 1 A_SetScale(scalex - 0.06, scaley + 0.06)
	loop
}
}

actor EclipseBody : EclipseBase
{
	damagetype "Remove"
	states
	{
		IntroIdle:
		ECL0 A 3 A_SpawnItemEx("EclipseIntroFX", -2, 0, -4, 0, 0, 2)
		loop
		Rising:
		ECL0 A -1
		loop
		OnFloor:
		ECL1 S -1 
		loop
		Intro:
		ECL0 ABCDEFFGGHHHHHHHH 6
		ECL0 HIJK 6
		TNT1 A 0 A_Quake(3, 8, 0, 256, "")
		TNT1 A 0 A_PlaySoundEx("misc/hugequake2", "Voice", 0, 0)
		IntroLegsWait:
		ECL0 K 0 A_SpawnITemEx("EclipseDestroy64")
		ECL0 K -1 A_GiveInventory("CutterFlag", 1)
		stop
		
		IntroFast:
		ECL0 ABCDEFFGHHHHH 4
		goto IntroLegsWait
		
		Idle:
		ECL1 AAABBCCBB 8
		loop
		Upright:
		ECL1 D -1
		loop
		Leanback:
		ECL1 E -1
		loop
		EndPain:
		ECL1 F 5
		ECL1 G 12
		ECL1 M -1
		EndPain2:
		ECL1 F 5
		ECL1 G -1
		Shocked:
		ECL1 A 5
		ECL1 E 50
		goto Idle
		Pain:
		ECL1 G 8
		ECL1 F 4
		ECL1 A -1
		stop
		OhNo:
		ECL1 F -1
		stop
		Right:
		ECL1 H -1
		stop
		Left:
		ECL1 I -1
		stop
		AttackRight:
		ECL1 J -1
		stop
		AttackLeft:
		ECL1 K -1
		stop
		Dizzy:
		ECL1 LMN 6
		loop
		Uppercut:
		ELC1 R 1
		ECL1 R 0 A_SpawnItemEx("EclipseUppercutExplosion", 0, 0, 2)
		ECL1 RRRRRRRRRRRRRRRRRRR 0 A_SpawnItemEx("EclipseGib", 32, random(-32, 32), random(32, 64), 0, random(-5, 5), random(1, 5), 0, SXF_NOCHECKPOSITION)  
		UpperCutLoop:
		ECL1 R 3 
		ECL1 T 3
		loop
		Land:
		ECL1 S -1
		stop
		Block:
		Smug:
		ECL1 O -1
		Laugh:
		ECL1 PPPPPPQQQQPPPPQQQQPPPPQQQQPPPPQQQQQQQQQQQQ 2
		ECL1 P -1
		loop
		Drag:
		ECL1 R 1 //A_SpawnITemEx("EclipseDestroy64", 0, 0, 0)//A_Explode(1, 128, XF_NOTMISSILE, 0, 128)
		loop
		TheEnd:
		ECL1 R 230
		FadeEnd:
		ECL1 R 1 A_FadeOut(0.1)
		loop
	}
}

actor EclipseUppercutExplosion
{
scale 0.5
+NOINTERACTION
states
{
Spawn:
ECLP HIJKLM 6
stop
}
}

actor EclipseRightArm : EclipseBase
{
	states
	{
	
		Idle:
		ECL2 A -1
		stop
		Raise:
		ECL2 B -1
		stop
		RaiseFX:
		ECL2 B 1 A_SpawnItemEx("EclipseRightArmFX", -2)
		loop
		Swipe:
		ECL2 C -1
		stop
		Summon:
		ECL2 D -1
		stop
		Fist:
		ECL2 E -1
		stop
		Palm:
		ECL2 F -1
		stop
		Block:
		ECL2 G -1
		stop
	}
}

actor GammaPlayerFXSwipeRight : CustomInventory
{
	states
	{
		Pickup:
		TNT1 A 0 A_SpawnItemEx("EclipseSwipeRightFX", 18, frandom(-2, 2), 50 + frandom(-2, 2))
		stop
	}
}
actor EclipseSwipeRightFX : EclipseBase
{
	scale 0.15
	translation "192:192=4:4", "198:198=67:67"
	states
	{
	Spawn:
	ECL2 NOP 4
	stop
	}
}


actor GammaPlayerFXSwipeLeft : CustomInventory
{
	states
	{
		Pickup:
		TNT1 A 0 A_SpawnItemEx("EclipseSwipeLeftFX", 18, frandom(-2, 2), 50 + frandom(-2, 2))
		stop
	}
}
actor EclipseSwipeLeftFX : EclipseSwipeRightFX
{
	states
	{
	Spawn:
	ECL2 QRS 4
	stop
	}
}

actor EclipseLeftArm : EclipseBase
{
	states
	{
		Idle:
		ECL2 H -1
		stop
		Raise:
		ECL2 I -1
		stop
		RaiseFX:
		ECL2 I 1 A_SpawnItemEx("EclipseLeftArmFX", -2)
		loop
		Swipe:
		ECL2 J -1
		stop
		Summon:
		ECL2 K -1
		stop
		Fist:
		ECL2 L -1
		stop
		Palm:
		ECL2 M -1
		stop
	}
}

actor EclipseRightArmFX : EclipseBase
{
	renderstyle translucent
	+NOINTERACTION
	states
	{
	Spawn:
	ECL2 B 0
	ECL2 B 0 Thing_SetTranslation(0, 1100)
	Goto Fade
	Fade:
	ECL2 B 0 A_SetScale(scalex + 0.01, scaley + 0.01)
	ECL2 B 1 A_FadeOut(0.1)
	loop
	}
}

actor EclipseLeftArmFX : EclipseRightArmFX
{
	states
	{
	Spawn:
	ECL2 I 0
	ECL2 I 0 Thing_SetTranslation(0, 1100)
	Goto Fade
	Fade:
	ECL2 I 0 A_SetScale(scalex + 0.01, scaley + 0.01)
	ECL2 I 1 A_FadeOut(0.1)
	loop
	}
}

actor EclipseLegs : EclipseBase
{
	states
	{
		SpawnDust:
		TNT1 A 0 A_SpawnItemEx("EclipseTrample64")
		ECL3 A 0 A_SpawnItemEx("EclipseDustWarper",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
		Idle:
		ECL3 A -1
		stop
		Right:
		ECL3 B -1
		stop
		Left:
		ECL3 C -1
		stop
	}
}

actor EclipseEyeLaserStart
{
	//PROJECTILE
	speed 0
	+NOGRAVITY
	-SOLID
	+LOOKALLAROUND
	-SHOOTABLE
	+THRUSPECIES
	species "Enemy"
	radius 48
	
	height 32
	health 9900
	scale 0.8
	damagefactor "Trample", 0.0
	translation "192:192=227:227", "198:198=253:253" 
	renderstyle none
	states
	{
		Spawn:
		TNT1 A 0
		Look:
		PLAY A 1 A_LookEx(0, 0, 0, 0, 360, "Start")
		loop
		Start:
		TNT1 A 0 ACS_NamedExecuteAlways("SetTargetToGamma", 0)
		TNT1 A 0 ACS_NamedExecuteAlways("ShootablePainSound", 0)
		CRAS B 0 A_PlaySoundEx("misc/sunstarbeamcharge", "SoundSlot6", 0, 0) 
		TNT1 A 1 A_FaceTarget
		ECL4 EFG 2 A_FaceTarget
		TNT1 A 15
		See:
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
		TNT1 A 35 A_TakeInventory("CutterFlag", 9999)
		CRAS B 0 A_StopSoundEx("SoundSlot6") 
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_SetAngle(angle + 90)
		BeamLeft:
		TNT1 A 0 A_GiveInventory("CutterFlag", 1)
		TNT1 A 0 A_SpawnItemEx("EclipseEyeLaser", 0, 0, -8, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx("EclipseEyeLaserVisual", 0, 0, -8, 0, 0, 0, 0, SXF_CLIENTSIDE|SXF_NOCHECKPOSITION)
		TNT1 A 1 A_SetAngle(angle -4)
		TNT1 A 0 A_JumpIfInventory("CutterFlag", 45, "BeamChange")
		TNT1 A 0 A_GiveInventory("CutterFlag", 1)
		TNT1 A 0 A_SpawnItemEx("EclipseEyeLaser", 0 + 6, 0, -8, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx("EclipseEyeLaserVisual", 0 + 6, 0, -8, 0, 0, 0, 0, SXF_CLIENTSIDE|SXF_NOCHECKPOSITION)
		TNT1 A 1 A_SetAngle(angle -4)
		TNT1 A 0 A_JumpIfInventory("CutterFlag", 45, "BeamChange")
		loop
		BeamChange:
		TNT1 A 35 A_TakeInventory("CutterFlag", 9999)
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_SetAngle(angle - 90)
		BeamRight:
		TNT1 A 0 A_GiveInventory("CutterFlag", 1)
		TNT1 A 0 A_SpawnItemEx("EclipseEyeLaser", 0, 0, -8, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx("EclipseEyeLaserVisual", 0, 0, -8, 0, 0, 0, 0, SXF_CLIENTSIDE|SXF_NOCHECKPOSITION)
		TNT1 A 1 A_SetAngle(angle +4)
		TNT1 A 0 A_JumpIfInventory("CutterFlag", 45, "See")
		TNT1 A 0 A_GiveInventory("CutterFlag", 1)
		TNT1 A 0 A_SpawnItemEx("EclipseEyeLaser", 0 + 6, 0, -8, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx("EclipseEyeLaserVisual", 0 + 6, 0, -8, 0, 0, 0, 0, SXF_CLIENTSIDE|SXF_NOCHECKPOSITION)
		TNT1 A 1 A_SetAngle(angle +4)
		TNT1 A 0 A_JumpIfInventory("CutterFlag", 45, "See")
		loop
	}
}

actor EclipseShockwaveHitbox : EclipseEyeLaserStart
{
	+SHOOTABLE
	+NOPAIN
	states
	{
		Spawn:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("ShootablePainSound", 0)
		Goto See
		See:
		TNT1 A -1
		loop
	}
}

actor EclipseEyeLaserFX
{
	+MISSILE
	+NOINTERACTION
	//renderstyle none
	scale 0.8
	translation "192:192=227:227", "198:198=253:253"
	states
	{
		Spawn:
		TNT1 A 1
		ECL4 EFG 2 //A_FaceTarget
		TNT1 A 0 A_SetScale(0.04, 0.04)
		Scale:
		TNT1 A 0
		ECLP P 1 A_SetScale(scalex+0.02, scaley+0.02)
		ECLP P 1 A_SetScale(scalex+0.02, scaley+0.02)
		ECLP P 1 A_SetScale(scalex+0.02, scaley+0.02)
		//ECLP P 1 A_SetScale(scalex+0.04, scaley+0.04)
		ECLP P 1 A_SetScale(0.04, 0.04)
		loop
	}
}

actor EclipseEyeLaser
{
	+MISSILE
	+THRUACTORS
	damage (0)
	PROJECTILE
	translation "208:208=4:4", "210:248=227:227"
	-SOLID
	radius 4
	height 1
	+THRUSPECIES
	species "Enemy"
	scale 0.2
	var int user_xoffs;
	var int user_yoffs;
	states
	{
		Spawn:
		TNT1 A 0
		TNT1 A 0 A_JumpIfCloser(1000, "SpawnFX")
		goto FX
		SpawnFX:
		TNT1 A 0 A_SpawnItemEx("EclipseEyeLaser", 12, 0, -0.7, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx("EclipseEyeLaserDamage", 0, 0, floorz-z)
		FX:
		TNT1 A 1 //A_FadeOut(0.2)
		stop
		XDeath:
		TNT1 A 0
		stop
		Death:
		CRAS B 0
		stop
	}
}

actor EclipseEyeLaserDamage
{
	renderstyle none
	PROJECTILE
	damagetype "NoPain"
	damage (1)
	height 2
	states
	{
		Spawn:
		PLAY A 2
		stop
	}
}

actor EclipseEyeLaserVisual : EclipseEyeLaser
{
	+CLIENTSIDEONLY
	states
	{
		Spawn:
		TNT1 A 0
		TNT1 A 0 A_JumpIfCloser(1000, "SpawnFX")
		goto FX
		SpawnFX:
		TNT1 A 0 A_SpawnItemEx("EclipseEyeLaserVisual", 12, 0, -0.7, 0, 0, 0, 0, SXF_CLIENTSIDE|SXF_NOCHECKPOSITION)
		FX:
		ECL4 N 1 //A_FadeOut(0.2)
		stop
		XDeath:
		TNT1 A 0
		stop
		Death:
		CRAS B 0 A_PlaySoundEx("weapon/magmacharge2", "SoundSlot5", 0, 0) 
		CRAS B 0 A_SetUservar("user_xoffs", frandom(-10, 10))
		CRAS B 0 A_SetUservar("user_yoffs", frandom(-10, 10))
		CRAS B 0 A_SpawnItemEx("EclipseTrample32")
		CRAS B 0 A_SpawnItemEx("EclipseEyeLaserExplosionFX", user_xoffs, user_yoffs, 0, 0, 0, 1)
		CRAS B 0 A_SpawnItemEx("EclipseEyeLaserExplosionFX", user_xoffs, user_yoffs, 0, 0, 0, 2)
		CRAS B 0 A_SpawnItemEx("EclipseEyeLaserExplosionFX", user_xoffs, user_yoffs, 0, 0, 0, 3)
		CRAS B 0 A_SpawnItemEx("EclipseEyeLaserExplosionFX", user_xoffs, user_yoffs, 0, 0, 0, 4)
		CRAS B 0 A_SpawnItemEx("EclipseEyeLaserExplosionFX", user_xoffs, user_yoffs, 0, 0, 0, 5)
		CRAS B 0 A_SpawnItemEx("EclipseEyeLaserExplosionFX", user_xoffs, user_yoffs, 0, 0, 0, 6)
		CRAS B 0 A_SpawnItemEx("EclipseEyeLaserExplosionFX", user_xoffs, user_yoffs, 0, 0, 0, 7)
		stop
	}
}

actor EclipseEyeLaserExplosionFX : GammaLaserExplosionFX
{
	scale 0.2
	gravity 0.4
}

actor EclipseDustWarper
{
	+MISSILE
	+NOINTERACTION
	reactiontime 17
	states
	{
	Spawn:
	TNT1 A 0 A_CountDown
	TNT1 A 2 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_NOCHECKPOSITION)
	TNT1 A 0 A_SpawnITemEx("EclipseDustFX", 0, random(-35, 35), 0, 0, 0, frandom(0.1, 2.0))
	loop
	}
}

actor EclipseDustFX
{
	scale 0.5
	+NOINTERACTION
	
	states
	{
	Spawn:
	POOF AAAAAAAAA 1 A_FadeOut(0.08)
	Fade:
	POOF B 1 A_FadeOut(0.08)
	loop
	}
}


actor EclipseDarkBallSpawner
{
	PROJECTILE
	+NOCLIP
	+NOINTERACTION
	var int user_power;
	renderstyle none
	states
	{
		Spawn:
		PLAY A 1
		PLAY A 0 A_JumpIf(user_power == 2, "Phase5")
		PLAY A 0 A_JumpIf(user_power == 1, "Phase3")
		Phase0:
		PLAY A 15 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -6, 3.5, 0) 
		PLAY A 15 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -3, 6, 0) 
		PLAY A 15 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 3, 6, 0) 
		PLAY A 15 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 6, 3.5, 0) 
		stop
		Phase3:
		PLAY A 8 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -6, 3.5, 0) 
		PLAY A 8 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -3, 6, 0) 
		PLAY A 8 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 3, 6, 0) 
		PLAY A 8 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 6, 3.5, 0)
		
		PLAY A 8 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 6 * 1.6, 3.5 * 1.6, 0)
		PLAY A 8 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 3 * 1.6, 6 * 1.6, 0) 
		PLAY A 8 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -3 * 1.6, 6 * 1.6, 0) 
		PLAY A 8 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -6 * 1.6, 3.5 * 1.6, 0)
		stop
		Phase5:
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -6, 3.5, 0) 
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -3, 6, 0) 
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 3, 6, 0) 
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 6, 3.5, 0)
		
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 6 * 1.6, 3.5 * 1.6, 0)
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 3 * 1.6, 6 * 1.6, 0) 
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -3 * 1.6, 6 * 1.6, 0) 
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -6 * 1.6, 3.5 * 1.6, 0)
		
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -6 * 2.12, 3.5 * 2.12, 0) 
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, -3 * 2.12, 6 * 2.12, 0) 
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 3 * 2.12, 6 * 2.12, 0) 
		PLAY A 4 A_SpawnItemEx("EclipseDarkBallSpawn", -64, 0, 32, 0, 6 * 2.12, 3.5 * 2.12, 0)
		stop
		
		Death:
		PLAY A 0 
		stop
	}
}

actor EclipseDarkBallSpawn
{
	PROJECTILE
	speed 10
	scale 0.1
	//translation "0:255=0:0"
	+NOCLIP
	+FORCEXYBILLBOARD
	reactiontime 10
	states
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 Thing_ChangeTID(0, 902)
	PLAY A 0 A_PlaySoundEx("misc/eclipsedarkball", 0, 0, 1)
	Countdown:
	ECLP D 0 A_CountDown
	ECLP D 0 A_SpawnItemEx("EclipseDarkBallFX", -4, 0, 0, 0, 0, 0, 0, SXF_TRANSFERSCALE)
	ECLP D 1 A_ScaleVelocity(0.95)
	ECLP D 0 A_SetScale(scalex + 0.02, scaley + 0.02)
	ECLP E 1 //A_SpawnItemEx("EclipseDarkBallFX", -1, 0, 0, 0, 0, 0, 0, SXF_TRANSFERSCALE)//A_SetScale(scalex + 0.01, scaley + 0.01)
	ECLP D 0 A_SpawnItemEx("EclipseDarkBallFX", -4, 0, 0, 0, 0, 0, 0, SXF_TRANSFERSCALE)
	ECLP F 1 A_ScaleVelocity(0.95)
	ECLP D 0 A_SetScale(scalex + 0.02, scaley + 0.02)
	ECLP G 1 //A_SpawnItemEx("EclipseDarkBallFX", -1, 0, 0, 0, 0, 0, 0, SXF_TRANSFERSCALE)
	loop
	Death:
	ECLP E 0 A_SpawnItemEx("EclipseDarkBallHoming", 0, 0, 0, 1, 0, 0, 0, SXF_TRANSFERSCALE)
	stop
	}
}

actor EclipseDarkBallHoming : EclipseDarkBallSpawn
{
	+SHOOTABLE
	+THRUSPECIES
	species "Enemy"
	Damagefactor "Enemy", 0.0
	Damagefactor "NoPain", 0.0
	Damagefactor "Trample", 0.0
	damagetype "NoPain"
	+SEEKERMISSILE
	+FORCEXYBILLBOARD
	Health 1
	radius 32
	height 32
	damage (5)
	-NOCLIP
	-NOBLOCKMAP
	reactiontime 40
	states
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 Thing_ChangeTID(0, 902)
	TNT1 A 0 A_JumpIf(CallAcs("EclipseGetPhase",0)>=6, "QuickSeek")
	Seeking:
	ECLP D 0 A_JumpIfInventory("AstroCrushAmmo", 1, "Seeking2", AAPTR_TRACER)
	ECLP D 0 A_SeekerMissile(90, 90, SMF_LOOK|SMF_PRECISE|SMF_CURSPEED)
	ECLP DEFG 1 
	ECLP G 0 A_ScaleVelocity(1.015)
	loop
	Seeking2:
	ECLP G 0 A_ScaleVelocity(3.8)
	Seeking2Loop:
	ECLP D 0 A_CountDown
	ECLP D 0 A_SeekerMissile(40, 40, SMF_LOOK|SMF_CURSPEED)
	ECLP DEFG 1 
	loop
	QuickSeek:
	ECLP DD 1 A_SeekerMissile(40, 40, SMF_LOOK|SMF_CURSPEED, 256, 20)
	ECLP D 0 A_ScaleVelocity(25.0)
	QuickSeeking:
	ECLP DEFG 1 A_ScaleVelocity(1.01)
	loop
	Death:
	ECL4 O 0 A_Stop
	ECL4 O 0 A_SetScale(scalex + 0.1, scaley + 0.1)
	ECL4 O 0 A_Quake(2, 6, 0, 64, "")
	ECL4 OPQR 2
	stop
	}
}

actor EclipseDarkBallFX
{
	alpha 0.5
	translation "0:255=0:0"
	+NOINTERACTION
	+FORCEXYBILLBOARD
	states
	{
		Spawn:
		ECLP DDDEEFFGG 2 A_FadeOut(0.01)//A_SetScale(scalex * 0.95, scaley * 0.95)
		stop
	}
}

actor EclipseHandShooterRight
{
	+NOGRAVITY
	height 32
	radius 32
	renderstyle none
	+SHOOTABLE
	+THRUSPECIES
	health 500
	species "Enemy"
	damagefactor "NoPain", 0.0
	damagefactor "Trample", 0.0
	
	states
	{
		Spawn:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("ShootablePainSound", 0)
		goto Spawn2
		Spawn2:
		PLAY A 1 A_LookEx(0, 0, 0, 0, 360, "See")
		loop
		See:
		PLAY A 1 A_faceTarget
		PLAY AA 0 A_SpawnItemEx("EclipseHandProjectile", 0, 0, 0, 6, frandom(0, 3), frandom(-0.7, 0.5), 6) 
		loop
		Death:
		PLAY H 25
		stop
	}
}

actor EclipseHandShooterLeft : EclipseHandShooterRight
{
	states
	{
		Spawn:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("ShootablePainSound", 0)
		goto Spawn2
		Spawn2:
		PLAY AAA 1 A_LookEx(0, 0, 0, 0, 360, "See")
		loop
		See:
		PLAY A 1 A_faceTarget
		PLAY AA 0 A_SpawnItemEx("EclipseHandProjectile", 0, 0, 0, 6, frandom(-3, 0), frandom(-0.7, 0.5), -6) 
		loop
	}
}

actor EclipseHandProjectile
{
	scale 0.15
	speed 20
	PROJECTILE
	radius 3
	height 3
	damage (1)
	+THRUSPECIES
	+FORCEXYBILLBOARD
	species "Enemy"
	damagetype "NoPain"
	translation "192:192=250:250", "198:198=251:251"
	
	states
	{
		Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump(true, 0, 2, 4, 6, 8, 10)
		Elec:
		ECL4 SSTTUUVVUUTT 1 A_ScaleVelocity(1.01)
		loop
		Death:
		TNT1 A 0 A_SpawnItemEx("EclipseTrample32")
		stop
	}
}

actor EclipseShockwaveSpawner
{
	PROJECTILE
	+FLOORHUGGER
	speed 0
	renderstyle none
	+THRUACTORS
	translation "192:192=250:250", "198:198=251:251"
	scale 0.6
	
	states
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("ShockwaveSoundSpawner")
	PLAY A 0 A_SpawnItemEx("EclipseShockwave", 0 * 64, 0, 0)
	PLAY A 0 A_SpawnItemEx("EclipseShockwave", 1 * 64, 0, 0)
	PLAY A 0 A_SpawnItemEx("EclipseShockwave", 2 * 64, 0, 0)
	PLAY A 0 A_SpawnItemEx("EclipseShockwave", 3 * 64, 0, 0)
	PLAY A 0 A_SpawnItemEx("EclipseShockwave", 4 * 64, 0, 0)
	PLAY A 0 A_SpawnItemEx("EclipseShockwave", 5 * 64, 0, 0)
	PLAY A 0 A_SpawnItemEx("EclipseShockwave", -1 * 64, 0, 0)
	PLAY A 0 A_SpawnItemEx("EclipseShockwave", -2 * 64, 0, 0)
	PLAY A 0 A_SpawnItemEx("EclipseShockwave", -3 * 64, 0, 0)
	PLAY A 0 A_SpawnItemEx("EclipseShockwave", -4 * 64, 0, 0)
	PLAY A 0 A_SpawnItemEx("EclipseShockwave", -5 * 64, 0, 0)
	stop
	}
}

actor EclipseShockwave
{	
	translation "192:192=250:250", "198:198=251:251"
	PROJECTILE
	+FLOORHUGGER
	xscale 0.6
	yscale 0.01
	+THRUSPECIES
	species "Enemy"
	radius 32
	height 64
	+RIPPER
	+THRUACTORS
	damage (1)
	damagetype "NoPain"
	+FORCEYBILLBOARD
	//alpha 0.8
	//renderstyle add
	states
	{
		Spawn:
		TNT1 A 0
		TNT1 A 0 Thing_ChangeTID(0, 3001)
		
		ECL4 H 2 A_SetScale(0.1, 0.1)
		TNT1 A 3 A_SpawnItemEx("EclipseBuildingGib", 20, 0, 0, 0, 0, 12, random(0,360))
		ECL4 H 2 A_SetScale(0.125, 0.2)
		TNT1 A 3 A_SpawnItemEx("EclipseBuildingGib", 20, 0, 0, 0, 0, 12, random(0,360))
		ECL4 H 2 A_SetScale(0.15, 0.3)
		TNT1 A 3 A_SpawnItemEx("EclipseBuildingGib", 20, 0, 0, 0, 0, 12, random(0,360))
		ECL4 H 2 A_SetScale(0.175, 0.4)
		TNT1 A 3 A_SpawnItemEx("EclipseBuildingGib", 20, 0, 0, 0, 0, 12, random(0,360))
		ECL4 H 2 A_SetScale(0.2, 0.5)
		TNT1 A 3 A_SpawnItemEx("EclipseBuildingGib", 20, 0, 0, 0, 0, 12, random(0,360))
		ECL4 H 2 A_SetScale(0.225, 0.6)
		TNT1 A 3 A_SpawnItemEx("EclipseBuildingGib", 20, 0, 0, 0, 0, 12, random(0,360))
		ECL4 H 2 A_SetScale(0.250, 0.6)
		TNT1 A 3 A_SpawnItemEx("EclipseBuildingGib", 20, 0, 0, 0, 0, 12, random(0,360))
		ECL4 H 2 A_SetScale(0.250, 0.6)
		TNT1 A 3 A_SpawnItemEx("EclipseBuildingGib", 20, 0, 0, 0, 0, 12, random(0,360))
		ECL4 H 2 A_SetScale(0.275, 0.6)
		TNT1 A 3 A_SpawnItemEx("EclipseBuildingGib", 20, 0, 0, 0, 0, 12, random(0,360))
		ECL4 H 2 A_SetScale(0.275, 0.6)
		TNT1 A 10 A_SetScale(0.6, 0.6)
		TNT1 A 0 A_Quake(6, 6, 0, 256, "")
		
		ECL4 HI 2
		TNT1 A 0 A_SpawnItemEx("EclipseTrample32")
		ECL4 H 0 A_ChangeFlag("THRUACTORS", 0)
		ECL4 JKLM 5
		stop
	}
}

actor ShockwaveSoundSpawner
{
	+NOINTERACTION
	+MISSILE
	states
	{
	Spawn:
	TNT1 A 5
	TNT1 A 54 A_PlaySoundEx("misc/eclipseshockwave", "Voice", 0, 1)
	TNT1 A 49 A_PlaySoundEx("misc/hugequake", "Voice", 0, 1)
	stop
	}
}
actor EclipseGravityWell
{
	scale 0.5
	-SOLID
	+SHOOTABLE
	+NOGRAVITY
	+THRUSPECIES
	species "Enemy"
	damagefactor "NoPain", 0.0
	damagefactor "Enemy", 0.0
	damagefactor "Trample", 0.0
	damagetype "Enemy"
	+MISSILE
	height 48
	radius 16
	painchance 256
	+FORCEXYBILLBOARD
	health 700
	states
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_RearrangePointers(AAPTR_NULL, 0, AAPTR_TARGET)
	Look:
	TNT1 A 1 A_LookEx(0, 0, 0, 0, 360, "Start")
	loop
	Start:
	TNT1 A 10 //A_Warp(AAPTR_TRACER, user_xofs, 0, 16, user_angle, WARPF_NOCHECKPOSITION|WARPF_COPYINTERPOLATION)
	TNT1 AAAAAAAAAAAAAA 3 A_SpawnITemEx("EclipseGravityWellSpawning", 0, 0, 26)
	Warping:
	ECLP XX 0 A_SpawnItemEx("EclipseBuildingGib", random(16, 64), 0, -10, -5, 0, 5, random(0,360))
	ECLP XXXXYY 1 A_JumpIfCloser(100, "Shock")
	ECLP XX 0 A_SpawnItemEx("EclipseBuildingGib", random(16, 64), 0, -10, -5, 0, 5, random(0,360))
	ECLP YYZZZZ 1 A_JumpIfCloser(100, "Shock")
	ECLP X 0 A_SpawnItemEx("EclipseTrample32") 
	loop
	ShockRepeat:
	ECLP X 0 A_TakeInventory("CutterFlag", 1)
	Goto Shock+1
	Shock:
	ECLP X 0 ACS_NamedExecute("GravityWellThrust", 0)
	ECLI X 0 A_PlaySoundEx("weapon/sparkshock", "SoundSlot5", 0, 0)
	ECLP X 0 A_ChangeFlag("NOPAIN", 1)
	ECLP X 0 A_CustomRailgun(1, 0, none, none, RGF_SILENT, 1, 100.0, "EclipseDummyPuff", 0, 0, 0, 1, 0, 0)
	ECLP X 2 A_CustomRailgun(0, 0, none, "White", RGF_SILENT, 1, 100.0, "EclipseDummyPuff", 0, 0, 0, 1, 0, 0, "EclipseGravityWellTether2", -2)
	ECLP X 2 A_CustomRailgun(0, 0, none, "White", RGF_SILENT, 1, 100.0, "EclipseDummyPuff", 0, 0, 0, 1, 0, 0, "EclipseGravityWellTether", -2)
	ECLP Y 2 A_CustomRailgun(0, 0, none, "White", RGF_SILENT, 1, 100.0, "EclipseDummyPuff", 0, 0, 0, 1, 0, 0, "EclipseGravityWellTether2", -2)
	ECLI X 0 A_PlaySoundEx("weapon/sparkshock", "SoundSlot5", 0, 0)
	ECLP Y 2 A_CustomRailgun(0, 0, none, "White", RGF_SILENT, 1, 100.0, "EclipseDummyPuff", 0, 0, 0, 1, 0, 0, "EclipseGravityWellTether", -2)
	ECLP Z 2 A_CustomRailgun(0, 0, none, "White", RGF_SILENT, 1, 100.0, "EclipseDummyPuff", 0, 0, 0, 1, 0, 0, "EclipseGravityWellTether2", -2)
	ECLP Z 2 A_CustomRailgun(0, 0, none, "White", RGF_SILENT, 1, 100.0, "EclipseDummyPuff", 0, 0, 0, 1, 0, 0, "EclipseGravityWellTether", -2)
	ECLP Z 0 A_JumpIfInventory("CutterFlag", 1, "ShockRepeat")
	ECLP X 0 A_ChangeFlag("NOPAIN", 0)
	Goto Warping
	Pain:
	ECLI X 0 A_PlaySoundEx("misc/eclipsegravitywellpain", "SoundSlot5", 0, 1)
	ECLI X 0 A_FaceTarget
	ECLI X 0 ACS_NamedExecuteAlways("T_GravityPain", 0)
	Goto Warping
	Death:
	TNT1 A 0 A_JumpIfInTargetInventory("AstroCrushAmmo", 1, "Death.Anime")
	ECLI X 0 A_PlaySoundEx("misc/eclipsegravitywelldeath", "SoundSlot5", 0, 1)
	ECLP Z 1 A_RearrangePointers(AAPTR_TRACER, 0, AAPTR_TARGET)
	TNT1 A 0 A_SpawnITemEx("EclipseGravityWellExplode", 0, 0, 28)
	TNT1 A 0 A_SpawnITemEx("EclipseGravityWellBits", 0, 0, 28)
	stop
	Death.Anime:
	TNT1 A 0 A_SpawnITemEx("EclipseGravityWellExplode2", 0, 0, 28)
	stop
	}
}

actor EclipseDummyPuff : BulletPuff
{
	Damagetype "NoPain"
	states
	{
	Spawn:
	TNT1 A 0
	stop
	}
}

actor EclipseGravityWellExplode
{
	+NOINTERACTION
	+MISSILE
	scale 0.6
	+FORCEXYBILLBOARD
	states
	{
		Spawn:
		ECLP NOPQ 3
		ECLP RSTUVW 3
		stop
	}
}

actor EclipseGravityWellExplode2 : EclipseGravityWellExplode
{
	states
	{
		Spawn:
		ECLP NOPQ 2
		ECLP RSTUVW 2
		stop
	}
}

actor EclipseGravityWellBits
{
	+MISSILE
	+NOINTERACTION
	var int user_angle;
	+FORCEXYBILLBOARD
	states
	{
		Spawn:
		TNT1 A 12
		Bits:
		//TNT1 A 0 A_SpawnItemEx("EclipseGravityWellBitHurtBox", 0, 0, -32, 5, 0, 0, user_angle)
		//TNT1 A 0 A_SpawnItemEx("EclipseGravityWellBit", 0, 0, 0, 5, 0, 0, user_angle)
		//TNT1 A 0 A_SetUserVar("user_angle", user_angle + 4)
		//TNT1 A 0 A_JumpIf(user_angle > 359, "Death")
		//loop
		TNT1 A -1 ACS_NamedExecuteWithResult("TC_SpawnGravityWellBits")
		stop
		Death:
		TNT1 A 0
		stop
	}
}

actor EclipseGravityWellBitHurtBox
{
	+THRUSPECIES
	species "Enemy"
	PROJECTILE
	damage (1)
	height 2
	radius 2
	damagetype "NoPain"
	renderstyle none
	states
	{
		Spawn:
		SHAB P 148
		stop
	}	
}

actor EclipseGravityWellBit
{
	+THRUSPECIES
	species "Enemy"
	PROJECTILE
	+THRUACTORS
	height 2
	radius 2
	scale 0.15 
	translation "38:47=198:198"
	states
	{
		Spawn:
		SHAB P 140
		Fade:
		SHAB P 4 A_SetScale(0.05, 0.05)
		SHAB P 4 A_SetScale(0.01, 0.01)
		stop
	}
}

actor EclipseGravityWellTether
{
	+NOINTERACTION
	scale 0.08
	//translation
	stencilcolor "Cyan"
	renderstyle stencil
	states
	{
		Spawn:
		MMFX B 4 
		stop
		
	}
}

actor EclipseGravityWellTether2 : EclipseGravityWellTether
{
	stencilcolor "White"
}

actor EclipseGravityWellSpawning
{
	+NOINTERACTION
	alpha 0.4
	renderstyle translucent
	reactiontime 6
	translation "0:255=0:0"
	scale 0.1
	+FORCEXYBILLBOARD
	states
	{
		Spawn:
		ECLP "[" 0 A_Countdown
		ECLP "[" 0 A_FadeIn(0.1)
		ECLP "[" 1 A_SetScale(scalex + 0.07, scalex + 0.07)
		loop
	}
}

actor EclipseGameEnder
{
	+MISSILE
	+FOILINVUL
	+THRUSPECIES
	species "Enemy"
	damage (99999999)
	height 1
	radius 1
	obituary "%o fell to the darkness of \c[Eclipse]Eclipse\c-."
	states
	{
		Spawn:
		TNT1 A 0
		TNT1 A 10
		stop
	}
}

actor EclipseShadowFigure
{
	//translation "198:198=0:0"
	+MISSILE
	-SOLID
	+THRUACTORS
	+THRUSPECIES
	species "Enemy"
	+NOGRAVITY
	renderstyle add
	scale 1.5
	health 1
	height 48
	damagetype "NoPain"
	damagefactor "Trample", 0.0
	states
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_ChangeFlag("MISSILE", 0)
	TNT1 A 1 Thing_SetTranslation(0, 1105)
	ERO4 M 5
	Scalev:
	ERO4 MMMMM 1 A_ScaleVelocity(0.8)
	loop
	Activate:
	ERO4 N 8 
	ERO4 O 4
	ERO4 O 0 A_ChangeFlag("THRUACTORS", false)
	ERO4 O 0 A_ChangeFlag("SHOOTABLE", true)
	ERO4 O 0 A_SetTranslucent(0.9, 0)
	ERO4 P 2 A_PlaysoundEx("misc/archiveawake", "Voice", 0, 1)
	ERO4 O 10 A_RearrangePointers(0, AAPTR_TARGET)
	Look:
	ERO4 O 1 A_LookEx(0, 0, 0, 0, 360, "Seek")
	loop
	Seek:
	ERO4 Q 0 A_JumpIfCloser(64, "Melee")
	ERO4 Q 0 A_FaceTarget
	ERO4 Q 1 A_ChangeVelocity(25.0, 0, 0, CVF_REPLACE|CVF_RELATIVE)
	loop
	Death:
	ERO4 T 0 A_FadeOut(0.1)
	ERO4 T 1 A_SetScale(scalex - 0.1, scaley + 0.1) 
	loop
	Melee:
	ERO4 Q 0 A_ChangeFlag("SHOOTABLE", false)
	ERO4 Q 0 A_Stop
	TNT1 A 0 A_ChangeFlag("MISSILE", 1)
	ERO4 Q 1 A_RearrangePointers(AAPTR_MASTER)
	ERO4 R 4 A_Explode(1, 256, 0, 0, 256)
	ERO4 S 8
	Fade:
	ERO4 S 1 A_FadeOut(0.1)
	loop
	}
}

actor EclipseShadowFigure2 : EclipseShadowFigure
{
	states
	{
		Melee:
		ERO4 Q 0 A_ChangeFlag("SHOOTABLE", false)
		ERO4 Q 0 A_Stop
		TNT1 A 0 A_ChangeFlag("MISSILE", 1)
		ERO4 Q 1 A_RearrangePointers(AAPTR_MASTER)
		ERO4 R 4 
		ERO4 S 4
		ERO4 S 4 A_Explode(1, 65, 0, 0, 65)
		Goto Fade
	}
}

actor EclipseShadowFigureSpawnFX : EclipseShadowFigure
{
	alpha 0.8
	translation "0:255=106:106"
	
	states
	{
		Spawn:
		ERO4 M 1 A_FadeOut(0.1)
		loop
	}
}

actor EclipseDeath
{
	+NOINTERACTION
	xscale 1.0
	yscale 0.01
	radius 2
	
	states
	{
		Spawn:
		ECL4 A 0 A_JumpIf(scaley >= 1.0, "End")
		ECL4 A 1 A_SetScale(1.0, scaley + 0.025)
		loop
		End:
		ECL4 A 35
		ECL4 BBBBBBBBBBBCCCCCCCCCCCDDDDDDDDDDD 1  A_SetScale(1.0, scaley - 0.025)
		stop
	}
}