Actor Goldenboner
{
	Health 250
    Radius 25
    Height 10
	projectilepassheight 50
    Speed 20
    PainChance 30
 	Painchance "BarrelGrab", 0
	mass 1000
    scale 0.35
	Monster
    +FLOORCLIP
	+avoidmelee
	+DONTRIP
	+lookallaround
	+NORADIUSDMG
	+DONTCORPSE
	+bright
	-countkill
	MinMissileChance 800
	bloodtype goldbonespray
	SeeSound "goldskeleton/sight"
    PainSound "goldskeleton/pain"
    DeathSound "skeleton/gib"
    ActiveSound "goldskeleton/chatter"
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 1 A_DropItem ("GoldBonerCompanion",1,256)
	Waiting:
		GBNR AB 2 A_Look
		loop
	see:
		GBNR ABCDEF 2 A_Chase
		TNT1 A 0 A_GiveInventory ("fleetimer", 1)
		TNT1 A 0 A_JumpIfInventory ("fleetimer", 20, "flee")
		TNT1 A 0 A_Jump (60, "runaway")
		loop
	runaway:
		TNT1 A 0 A_GiveInventory ("fleetimer", 1)
		TNT1 A 0 A_JumpIfInventory ("fleetimer", 20, "flee")
		TNT1 A 0 A_ChangeFlag ("frightened", 1)
		TNT1 A 0 ThrustThingZ (0,50,0,0)
		TNT1 A 0 ThrustThing(angle*256/360+192,random(16,24),0,0)
		GBNR ABCDEF 2 A_Chase
		GBNR AAABBBCCCDDDEEEFFF 2 A_FastChase
		GBNR AAABBBCCCDDDEEEFFF 2 A_FastChase
		GBNR AAABBBCCCDDDEEEFFF 2 A_FastChase
		TNT1 A 0 A_ChangeFlag ("frightened", 0)		
		goto see
	pain:
		TNT1 A 0 A_SpawnItemEx ("goldenbonerminorloot", 0, 0, 0, random (-10, 10), random (-10, 10), random (5, 12))
		TNT1 AA 0 A_SpawnItemEx ("goldenbonerminorloot", 0, 0, 0, random (-10, 10), random (-10, 10), random (3, 10))
		TNT1 A 0 A_TakeInventory ("PowerTerrorStatus",999)
 		TNT1 A 0 A_TakeInventory ("PowerKickedStatus",999)
		TNT1 A 0 A_TakeInventory ("fleetimer", 3)
		TNT1 A 0 A_PlaySound ("skeleton/allpain",0,1,0,0.5)
		GBNR J 8 A_Pain
		GBNR AAABBBCCCDDDEEEFFF 2 A_FastChase
		GBNR AAABBBCCCDDDEEEFFF 2 A_FastChase
		goto see
	Pain.Dazer:
	Pain.Superkick:
		GBNR J 2
		TNT1 A 0 A_GiveInventory ("KickDazer",1)
		GBNR J 8 A_Pain
		goto Dazed
    Dazed:
		GBNR J 2
		GBNR J 1 A_SetAngle (angle+15)
		GBNR J 1 A_JumpIfInventory ("PowerKickedStatus",1,"Dazed")
		Goto See
	missile:
		TNT1 A 0 A_GiveInventory ("fleetimer", 2)
		TNT1 A 0 A_PlaySound ("goldskeleton/taunt",0)
		GBDN ABABABAB 4 A_FastChase
		TNT1 A 0 A_JumpIfInventory ("fleetimer", 20, "flee")
		goto see
	flee:
		TNT1 A 0 A_Stop
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_ChangeFlag ("nodamage", 1)
		TNT1 A 0 A_ChangeFlag ("nointeraction", 1)
		TNT1 A 0  A_PlaySound ("goldskeleton/spin",0)
		GSPN ABCDFGH 2
		GSPN A 2
		TNT1 A 0 A_PlaySound ("goldskeleton/spin",0)
		GSPN ABCDEFGH 1 
		GSPN AB 1 
		TNT1 A 0 A_PlaySound ("goldskeleton/spin",0)		
		GSPN CD 1
		GSPN EF 1 
		GSPN GH 1
		TNT1 A 0 A_PlaySound ("goldskeleton/spin",0)		
		GSPN CD 1
		GSPN EF 1 
		GSPN GH 1
		TNT1 A 0 A_SpawnItem ("winkout")
		TNT1 A 0 A_PlaySound ("goldskeleton/ding",0)
		stop
	death:
		GBNR KL 2 A_Fall
		TNT1 A 0 A_Scream
		TNT1 A 0 A_SpawnItemEx ("goldenbonerloot", 0, 0, 0, random (-10, 10), random (10, 10), random (4, 8))
		TNT1 AA 0 A_SpawnItemEx ("goldenbonerloot", 0, 0, 0, random (-10, 10), random (10, 10), random (2, 4))
		TNT1 AA 0 A_SpawnItemEx ("goldenbonerloot", 0, 0, 0, random (-10, 10), random (10, 10), random (3, 6))
		TNT1 AAAAA 0 A_SpawnItem ("goldbonespray")
		ISKL AAAA 0 A_SpawnItemEx("goldhipbone",0,0,0,random(-10,10),random(-10,10),10)
		ISKL A 0 A_SpawnItemEx("goldribcage",0,0,0,random(-10,10),random(-10,10),12)
		TNT1 A 0 A_SpawnItemEx ("SpinningGoldenBarrel",0,0,0,frandom(-8,-8),frandom(-7,7),frandom(12,15),0, SXF_NOCHECKPOSITION)
		TNT1 A 1
		stop
	Death.superkick:	
		GBNR J 1 A_Scream 
		GBNR J 1 A_ScaleVelocity (0.1)
 		GBNR J 1 A_Stop
		GBNR J 1 A_NoBlocking
		TNT1 A 0 A_ChangeFlag ("NOCLIP",1)
		TNT1 A 0 A_ChangeFlag ("NOGRAVITY",1)
		GBNR J 1 a_facetarget
		TNT1 A 0 ThrustThingZ (0,80,0,1)
		TNT1 A 0 ThrustThing(angle*256/360+128, 110, 1, 0)
		TNT1 A 0 A_SpawnItemEx ("kickdeathsound")
		TNT1 A 0 A_SpawnItemEx ("goldenbonerloot", 0, 0, 0, random (-10, 10), random (10, 10), random (4, 8))
		TNT1 AA 0 A_SpawnItemEx ("goldenbonerloot", 0, 0, 0, random (-10, 10), random (10, 10), random (2, 4))
		TNT1 AA 0 A_SpawnItemEx ("goldenbonerloot", 0, 0, 0, random (-10, 10), random (10, 10), random (3, 6))
		TNT1 A 0 A_SpawnItemEx ("SpinningGoldenBarrel",0,0,0,frandom(-8,-8),frandom(-7,7),frandom(12,15),0, SXF_NOCHECKPOSITION)
		GBNR J 1
		GBNR J 2
	kickfly:
		GBDN CDEF 1 A_SpawnItemEx ("KustamParticle",random(-8,8),random(-8,8),random(-10,10),random(-120,120)/15.0,random(-130,130)/12.0,random(-110,110)/17.0,0)
		TNT1 A 0 A_FadeOut (0.02)
		loop
	}
}

actor goldenbonerminorloot : randomspawner
{
	dropitem "smallspiritgemdrop", 256, 1
	dropitem "smalldarkgemdrop", 256, 1
}

actor goldenbonerloot : randomspawner
{
	dropitem "arcanecrystaldrop", 256, 2
	dropitem "bigdarkgemdrop", 256, 1
}

actor fleetimer : inventory
{
	inventory.maxamount 20
	inventory.amount 1
}