//Ballhog
//Credits and thanks. Glaber (Creation for SRB2), Techokami(spriterip), Tom Payne (original front sprites), Hivebrain (Sprite and shading help)
freeslot(
	"MT_BALLHOG",
	"S_PGBL_STND",
	"S_PGBL_ACTIVE1",
	"S_PGBL_ACTIVE2",
	"S_PGBL_ACTIVE3",
	"S_PGBL_ACTIVE4",
	"S_PGBL_ACTIVE5",
	"S_PGBL_BALL",
	"SPR_PIG_",
	"MT_BUNNYBALL",
	"S_BUNNYBALL1",
	"S_BUNNYBALL2",
	"S_BUNNYBALLSTART",
	"S_BUNNYBALLREPET",
	"S_BUNNYBALLDED",
	"S_BUNNYBALLPUSH",
	"SPR_BALL"
)

//Ballhog ball
mobjinfo[MT_BUNNYBALL] = {
	doomednum = -1,
	spawnstate = S_BUNNYBALLSTART,
	spawnhealth = 1,
	seestate = S_BUNNYBALL1,
	seesound = sfx_pogo,
	reactiontime = 8,
	meleestate = S_BUNNYBALL1,
	deathstate = S_XPLD1,
	deathsound = sfx_cybdth,
	xdeathstate = S_BUNNYBALL2,
	speed = 10*FRACUNIT,
	radius = 10*FRACUNIT,
	height = 20*FRACUNIT,
	mass = 100,
	damage = 20*FRACUNIT,
	flags = MF_SPECIAL|MF_PAIN|MF_BOUNCE|MF_NOBLOCKMAP
}

states[S_BUNNYBALLSTART] =	{SPR_BALL,	A,	1,	A_BunnyHop,	4,	0,	S_BUNNYBALLPUSH}
states[S_BUNNYBALLPUSH] =	{SPR_BALL,	A,	2,	A_BunnyHop,	4,	2,	S_BUNNYBALL1}
states[S_BUNNYBALL1] =	{SPR_BALL,	B,	2,	A_FishJump,	6*FRACUNIT,	4,	S_BUNNYBALL2}
states[S_BUNNYBALL2] =	{SPR_BALL,	A,	2,	A_FishJump,	6*FRACUNIT,	4,	S_BUNNYBALLREPET}
states[S_BUNNYBALLREPET] =	{SPR_BALL,	B,	0,	A_Repeat,	62,	S_BUNNYBALL1,	S_BUNNYBALLDED}
states[S_BUNNYBALLDED] =	{SPR_BALL,	A,	2,	A_RemoteDamage,	0,	1,	S_XPLD1}


mobjinfo[MT_BALLHOG] = {
//$Name "Ballhog"
//$Sprite PIG_A1
//$Category Genesis Enemies
	doomednum = 4032,
	spawnstate = S_PGBL_ACTIVE1,
	spawnhealth = 1,
	seestate = S_PGBL_ACTIVE1,
	reactiontime = 32,
	painchance = 200,
	deathstate = S_XPLD_FLICKY,
	deathsound = sfx_pop,
	speed = 7,
	radius = 15*FRACUNIT,
	height = 37*FRACUNIT,
	mass = 100,
	flags = MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY
}

states[S_PGBL_STND] =	{SPR_PIG_,	A,	1,	A_Look,	0,	0,	S_PGBL_ACTIVE1}
states[S_PGBL_ACTIVE1] =	{SPR_PIG_,	A,	6,	nil,	0,	0,	S_PGBL_ACTIVE2}
states[S_PGBL_ACTIVE2] =	{SPR_PIG_,	C,	6,	nil,	0,	0,	S_PGBL_ACTIVE3}
states[S_PGBL_ACTIVE3] =	{SPR_PIG_,	D,	16,	A_BunnyHop,	4,	0,	S_PGBL_ACTIVE4}
states[S_PGBL_ACTIVE4] =	{SPR_PIG_,	C,	6,	nil,	0,	0,	S_PGBL_ACTIVE5}
states[S_PGBL_ACTIVE5] =	{SPR_PIG_,	A,	3,	A_Repeat,	3,	S_PGBL_ACTIVE1,	S_PGBL_BALL}
states[S_PGBL_BALL] =	{SPR_PIG_,	B,	6,	A_TrapShot,	(16<<16)+MT_BUNNYBALL,	(16<<16)+315,	S_PGBL_ACTIVE1}

//Puyo
if not(kirbyabilitytable)
    rawset(_G, "kirbyabilitytable", {})
end
kirbyabilitytable[MT_BALLHOG] = 9    // Makes MT_BALLHOG give Ball
