//KABRO		
// - Sprites from the "Satyr" from Realm667's bestiary
///////////////////////////////////////////////////////////////////////////////
actor Kabro replaces DoomImp {
	
  	obituary "%o got murdered by a Kabro"
	Health 35
    Radius 18
    Height 50
    Scale 0.80
    Speed 10
    PainChance 100
    Mass 100
    MONSTER 
    +FLOORCLIP
    SeeSound "kabro/sight"
    PainSound "kabro/pain"
    DeathSound "kabro/death"
    ActiveSound "kabro/active"
	DamageFactor "frag_boom", 1.5
	GibHealth 50
	MeleeThreshold 148
	
    States{
		Spawn:
			KABR AB 5 A_Look
			Loop
		See:
			KABR AABBCCDD 1 A_Chase
			Loop
		Melee:
			KABR EF 3 A_FaceTarget
			KABR G 6 A_CustomMeleeAttack (20, "enemy/meleehit","enemy/meleeswing" , "StrongMelee")
			KABR PQ 3 A_FaceTarget
			KABR R 6 A_CustomMeleeAttack (20, "enemy/meleehit","enemy/meleeswing" , "StrongMelee")
			KABR R 2
			Goto See
		Missile:
			KABR E 6 A_FaceTarget
			KABR EFG 2 A_FaceTarget  
			KABR G 3 A_CustomMissile ("Kabro_Fireball", 35, 0, 0, 0, 0)
			KABR PQR 2 A_FaceTarget
			KABR R 3 A_CustomMissile ("Kabro_Fireball", 35, 0, 0, 0, 0)  
			KABR R 6 
			Goto See
		Pain:
			KABR H 4
			KABR H 4 A_Pain
			Goto See
		Death:
			TNT1 A 0 A_Jump(255, "dth1", "dth2")
		dth1:
			KAD1 A 5 A_Scream
			KAD1 B 5 A_Fall
			KAD1 CDEF 5
			KAD1 G -1
			stop
		dth2:
			KAD2 A 5 A_Scream
			KAD2 B 5 A_Fall
			KAD2 CD 5
			KAD2 E -1
			stop
		XDeath:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("KabroXDeath", 0, 0, 0, 0 ,0 ,0 , 0, SXF_TRANSFERTRANSLATION)
			stop

		Raise:
			KABR ONMLKJI 8
			Goto See
		}
}
		
			
actor kabroxdeath {
	states{
		spawn:
			TNT1 A 0
			TNT1 A 0 A_PlaySound("gore/explode")
			TNT1 AA 0 A_SpawnItemEx ("gore_bloodmist", random(-2,2), random(-2,2), 8, frandom(-0.4,0.4) ,frandom(-0.4,0.4) ,0 , random(1,360), SXF_TRANSFERTRANSLATION)
			
			TNT1 AAAAA 0 A_CustomMissile("gore_fleshbit", 25, 0, random(0,180),2,random(20,120))
			TNT1 AAAAA 0 A_CustomMissile("gore_fleshbit", 25, 0, random(181,360),2,random(20,120))
			
			TNT1 AAA 0 A_CustomMissile("gib_spawner", 25, 0, random(0,180),2,random(20,120))
			TNT1 AAA 0 A_CustomMissile("gib_spawner", 25, 0, random(181,360),2,random(20,120))
			
			TNT1 A 0 A_SpawnItem ("Kabro_ArmsGibSpawn")
			TNT1 A 0 A_SpawnItem ("Kabro_ArmsGibSpawn")
			TNT1 A 0 A_CustomMissile("KabroLeg_Gib", 25, 0, random(0,180),2,random(50,160))
			TNT1 A 0 A_CustomMissile("KabroLeg_Gib", 25, 0, random(181,360),2,random(50,160))
			TNT1 A 0 A_CustomMissile("KabroHead_Gib", 25, 0, random(0,360),2,random(50,160))
			
			TNT1 A 4
			TNT1 AAAAA 0 A_CustomMissile("gore_fleshbit", 25, 0, random(0,180),2,random(20,120))
			TNT1 AAAAA 0 A_CustomMissile("gore_fleshbit", 25, 0, random(181,360),2,random(20,120))
			stop
	
	}
}	
			
			
actor Kabro_FireBall {
	radius 3
	height 3
	speed 24
	renderstyle add
	scale 0.2
	damage (random(20,24))
	PROJECTILE
	SeeSound "fireball/fire"
	DeathSound "fireball/explode"
	states{
		spawn:
			PRJ1 AB 1 bright A_SpawnItemEx("Kabro_BallTrail",0,0,0, 0,frandom(-0.3,0.3),frandom(-0.3,0.3))
			loop
		death:
			NULL A 1 A_SpawnItem("Kabro_FBBoom")
			stop
	}
}

actor Kabro_BallTrail {
	scale 0.2
	alpha 1.0
	renderstyle add
	+NOINTERACTION
	+FORCEXYBILLBOARD
	+NOTELEPORT
	states{
		spawn:
			PFOR ABCDE 1 bright
			PFOR FGHIJKL 1 bright A_FadeOut(0.1)
			stop
	}
}

actor Kabro_FBBoom {
	scale 0.5
	renderstyle add
	+NOGRAVITY
	+FORCEXYBILLBOARD
	+NOINTERACTION
	states{
		spawn:
			TNT1 A 0
			FX58 C 1 bright A_SpawnItemEx("Kabro_FBBoomFire",0,0,0, 0,frandom(-0.5,0.5),frandom(-0.5,0.5))
			FX58 DEFGHIJKLMNOPQ 1 bright
			stop
	}
}

actor Kabro_FBBoomFire {
	scale 0.6
	alpha 1.0
	renderstyle add
	+NOINTERACTION
	+FORCEXYBILLBOARD
	+NOTELEPORT
	states{
		spawn:
			TNT1 A 0
			TNT1 A 0 A_Jump(255,"sp1","sp2","sp3")
		sp1:	
			PFOR A 1 bright A_FadeOut(0.08)
			loop
		sp2:
			PFOR B 1 bright A_FadeOut(0.08)
			loop
		sp3:
			PFIR C 1 bright A_FadeOut(0.08)
			loop
	}
}


actor Kabro_ArmsGibSpawn{
	states{
		spawn:
			NULL A 0
			NULL A 0 A_Jump(224,"arm1", "arm2")
			stop
		arm1:
			TNT1 A 0 A_CustomMissile("KabroArm1_Gib", 25, 0, random(0,360),2,random(50,160))
			stop
		arm2:
			TNT1 A 0 A_CustomMissile("KabroArm2_Gib", 25, 0, random(0,360),2,random(50,160))
			stop
	}
}

actor KabroArm1_Gib{
	health 1
	radius 10
	height 10
	mass 1
	speed 8
	gravity 0.5
	bouncetype "doom"
	bouncefactor 0.3
	BounceSound "blood/splat"
	DeathSound "blood/splat"
	PROJECTILE
	-NOGRAVITY
	+CORPSE
	+NOTELEPORT
	states{
		spawn:
			KBGA ABCDEFGH 2 A_SpawnItemEx ("blood_spray", 0, 0, 0,  random(-2,2) ,  random(-2,2) ,  random(-2,2) , random(0,360), SXF_TRANSFERTRANSLATION)
			//A_SpawnItemEx ("gore_bloodmist_small", 0, 0, 0, frandom(-0.2,0.2) , 0 , frandom(-0.2,0.2) , random(1,360), SXF_TRANSFERTRANSLATION)
			loop
		death:
			KBGA I -1
			stop
	}
}

actor KabroArm2_Gib : KabroArm1_Gib{
	states{
		spawn:
			KBGB ABCDEFGH 2 A_SpawnItemEx ("blood_spray", 0, 0, 0,  random(-2,2) ,  random(-2,2) ,  random(-2,2) , random(0,360), SXF_TRANSFERTRANSLATION)
			//A_SpawnItemEx ("gore_bloodmist_small", 0, 0, 0, frandom(-0.2,0.2) , 0 , frandom(-0.2,0.2) , random(1,360), SXF_TRANSFERTRANSLATION)
			loop
		death:
			KBGB I -1
			stop
			//KBGB I 80 A_FadeOut(0.1) 
			//loop
	}
}

actor KabroLeg_Gib : KabroArm1_Gib{
	states{
		spawn:
			TNT1 A 0 
			TNT1 A 0 A_Jump(224, "l1")
			stop
		l1:
			KBGC ABCDEFGH 2 A_SpawnItemEx ("blood_spray", 0, 0, 0,  random(-2,2) ,  random(-2,2) ,  random(-2,2) , random(0,360), SXF_TRANSFERTRANSLATION)
			//A_SpawnItemEx ("gore_bloodmist_small", 0, 0, 0, frandom(-0.2,0.2) , 0 , frandom(-0.2,0.2) , random(1,360), SXF_TRANSFERTRANSLATION)
			loop
		death:
			KBGC I -1
			stop			
			//KBGC I 80 A_FadeOut(0.1) 
			//loop
	}
}

actor KabroHead_Gib : KabroArm1_Gib{
	states{
		spawn:
			TNT1 A 0
			TNT1 A 0 A_Jump(224, "h1")
			stop
		h1:
			KBGD ABCDEFGH 2 A_SpawnItemEx ("blood_spray", 0, 0, 0,  random(-2,2) ,  random(-2,2) ,  random(-2,2) , random(0,360), SXF_TRANSFERTRANSLATION)
			//A_SpawnItemEx ("gore_bloodmist_small", 0, 0, 0, frandom(-0.2,0.2) , 0 , frandom(-0.2,0.2) , random(1,360), SXF_TRANSFERTRANSLATION)
			loop
		death:
			KBGD I -1
			stop
			//KBGD I 80 A_FadeOut(0.1) 
			//loop
	}
}