//Sorry in advance for bad code - I'm an idiot, and still relatively new to this.
freeslot("S_BAIG_SHOT",
"S_BAIG_SHOT_JUMP",
"S_BAIG_SHOT_SPRING",
"S_BAIG_JUMPSHOT",
"S_BAIGLAZER",
"S_BAIGJUMPLAZER",
"S_BAIGCHARGELAZER",
"S_BAIGLAZEREND",
"S_BAIGGROUNDSPARK",
"S_BOST",
"SPR_HUDE",
"SPR_HUDC",
"SPR_HUDR",
"SPR_HUDS",
"SPR_LAZF",
"SPR_LAZJ",
"SPR_GSPK",
"SPR_CHRG",
"SPR_BOST",
"SPR2_BANG",
"SPR2_FKIK",	//pssssst: If you want to have your character dancing with Milne, make an 8-frame animation with sprites named "FKIK"
"SPR2_SHIT",	//This one's for that "fallen down" frame when you fail an XMomentum trick
"SPR2_ATRK",
"SPR2_BTRK",
"SPR2_CTRK",
"MT_BOST",
"MT_BAIGLAZER",
"MT_BAIGJUMPLAZER",
"MT_BAIGCHARGELAZER")

//Shooting states, _JUMP is specifically for when she's spinning,
//and _SPRING is for spring and falling animations, you'll see why further down

states[S_BAIG_SHOT] = {
	sprite = SPR_PLAY,
	tics = 10,
	nextstate = S_PLAY_STND,
	frame = FF_ANIMATE|SPR2_FIRE,
	var1 = 5,
	var2 = 2
}

states[S_BAIG_SHOT_JUMP] = {
	sprite = SPR_PLAY,
	tics = 10,
	nextstate = S_PLAY_ROLL,
	frame = FF_ANIMATE|SPR2_FIRE,
	var1 = 5,
	var2 = 2
}

states[S_BAIG_SHOT_SPRING] = {
	sprite = SPR_PLAY,
	tics = 10,
	nextstate = S_PLAY_FALL,
	frame = FF_ANIMATE|SPR2_FIRE,
	var1 = 5,
	var2 = 2
}

//Jumpshooting State
states[S_BAIG_JUMPSHOT] = {
	sprite = SPR_PLAY,
	tics = 10,
	nextstate = S_PLAY_JUMP,
	frame = SPR2_BANG
}

//Lazer Object States
states[S_BAIGLAZER] = {
	sprite = SPR_LAZF,
	tics = -1,
	nextstate = S_BAIGLAZEREND,
	frame = FF_FULLBRIGHT|FF_ANIMATE|A,
	var1 = 6,
	var2 = 2
}

states[S_BAIGJUMPLAZER] = {
	sprite = SPR_LAZJ,
	tics = -1,
	nextstate = S_BAIGLAZEREND,
	frame = FF_FULLBRIGHT|FF_ANIMATE|A,
	var1 = 6,
	var2 = 2
}

states[S_BAIGCHARGELAZER] = {
	sprite = SPR_CHRG,
	tics = 175,
	nextstate = S_NULL,
	frame = FF_FULLBRIGHT|FF_ANIMATE|A,
	var1 = 6,
	var2 = 2
}

states[S_BAIGLAZEREND] = {
	sprite = SPR_GSPK,
	tics = 2,
	nextstate = S_NULL,
	frame = FF_FULLBRIGHT|FF_ANIMATE|A,
	var1 = 1,
	var2 = 2
}

states[S_BAIGGROUNDSPARK] = {
	sprite = SPR_GSPK,
	tics = 2,
	nextstate = S_NULL,
	frame = FF_FULLBRIGHT|FF_ANIMATE|A,
	var1 = 1,
	var2 = 2
}

//Lazer Object Codes
mobjinfo[MT_BAIGLAZER].spawnstate = S_BAIGLAZER
mobjinfo[MT_BAIGLAZER].deathstate = S_NULL
mobjinfo[MT_BAIGLAZER].deathsound = sfx_turhit
mobjinfo[MT_BAIGLAZER].speed = 75*FRACUNIT
mobjinfo[MT_BAIGLAZER].radius = 20*FRACUNIT
mobjinfo[MT_BAIGLAZER].height = 20*FRACUNIT
mobjinfo[MT_BAIGLAZER].damage = 1
mobjinfo[MT_BAIGLAZER].flags = MF_NOGRAVITY | MF_MISSILE | MF_NOCLIPHEIGHT

mobjinfo[MT_BAIGCHARGELAZER].spawnstate = S_BAIGCHARGELAZER
mobjinfo[MT_BAIGCHARGELAZER].deathstate = S_NULL
mobjinfo[MT_BAIGCHARGELAZER].speed = 75*FRACUNIT
mobjinfo[MT_BAIGCHARGELAZER].radius = 40*FRACUNIT
mobjinfo[MT_BAIGCHARGELAZER].height = 40*FRACUNIT
mobjinfo[MT_BAIGCHARGELAZER].damage = 2
mobjinfo[MT_BAIGCHARGELAZER].health = 10
mobjinfo[MT_BAIGCHARGELAZER].flags = MF_NOGRAVITY | MF_MISSILE | MF_NOCLIPHEIGHT

mobjinfo[MT_BAIGJUMPLAZER].spawnstate = S_BAIGJUMPLAZER
mobjinfo[MT_BAIGJUMPLAZER].deathstate = S_BAIGGROUNDSPARK
mobjinfo[MT_BAIGJUMPLAZER].radius = 20*FRACUNIT
mobjinfo[MT_BAIGJUMPLAZER].height = 20*FRACUNIT
mobjinfo[MT_BAIGJUMPLAZER].damage = 1
mobjinfo[MT_BAIGJUMPLAZER].flags = MF_NOGRAVITY





//Code for T116Chars Boostmode - Might make more special later! Feel free to copy and edit for custom dashmode shenanigans.

//Object state and info for the blue dash particles - replace with whatever sprites you'd like, but don't forget to freeslot them above!
//While doing so, replace every instance of "BOST" in your code and sprite names with a different name, or sprite conflicts will occur -
//namely, Backwards Aigis will use whatever graphic you added in instead of her dashlines, or your character will use the dashlines instead of your graphic.

states[S_BOST] = {
	sprite = SPR_BOST,
	tics = 4,
	nextstate = S_NULL,
	frame = FF_FULLBRIGHT|FF_ANIMATE|A,
	var1 = 3,
	var2 = 2
}

mobjinfo[MT_BOST].spawnstate = S_BOST
mobjinfo[MT_BOST].deathstate = S_NULL
mobjinfo[MT_BOST].radius = 20*FRACUNIT
mobjinfo[MT_BOST].height = 5*FRACUNIT
mobjinfo[MT_BOST].flags = MF_NOGRAVITY | MF_NOCLIP


//The code itself
local function boostmode()
    for player in players.iterate
        if player.mo.skin == "backwards_aigis" then
		
		S_StopSoundByID(player.mo, 703)
		S_StopSoundByID(player.mo, 727) //Sounds 703 and 727 are the "power up" and "power down" sounds that occur
		//when entering or exiting vanilla dashmode.
		//This stops it from playing, as setting player.dashmode to 3*TICRATE 
		//under certain conditions while testing used to cause the latter to play on every frame -
		//namely, not setting dashmode to true in S_SKIN. I thought it wouldn't be necessary, and
		//I had hoped to keep this version of boost mode as seperate as possible from the vanilla one
		//to prevent any random conflicts.
		//That said, since vanilla dashmode is very hardcoded for some reason, the sounds might still pop up
		//from time to time. If you see this and know of an alternate fix, please let me know.
		//The reason why you have to set player.dashmode to 3*TICRATE is explained below.
		
		player.bostspawn = $ or 0 //counter for spawning the blue dash particles
		if player.bostspawn > 2 then
			player.bostspawn = 0
		end
		
		
		player.boostmode = $ or 0 //starts a counter for boost mode
			if player.speed > player.runspeed //if moving fast enough or spindashing, the counter increases. Remove "player.panim == PA_ABILITY2" if your character can't spindash, unless you want things like melee attacks to speed you up.      Actually... Hmm.
			or player.panim == PA_ABILITY2 then
				player.boostmode = $ + 1
			elseif player.panim == PA_SPRING //if launching off a spring/similar objects or rolling, the counter stays put. This lets you preserve speed!
			or player.panim == PA_FALL
			or player.panim == PA_ROLL
			or player.mo.state == S_BAIG_SHOT //also preserves boostmode counter if in shooting states
			or player.mo.state == S_BAIG_JUMPSHOT //you can check for states instead of animations if you'd like
			or player.mo.state == S_BAIG_SHOT_JUMP
			or player.mo.state == S_BAIG_SHOT_SPRING then
				player.boostmode = $
			else //if not doing any of those things, the counter decreases.
				player.boostmode = $ - 1
			end
			
			if player.boostmode < 0 then //prevents the counter from going under 0.
				player.boostmode = 0
			end
			
            if player.boostmode >= 70 then// once the counter reaches 70 (about two in-game seconds), boost mode activates!
			    local ghost = P_SpawnGhostMobj(player.mo) //spawns afterimages
                ghost.fuse = 3 //amount of afterimages
				player.bostspawn = $ + 1
				if player.bostspawn == 1 then
					local bostlocal = P_SpawnMobjFromMobj(player.mo, P_RandomRange(-64, 64)*FRACUNIT, P_RandomRange(-64, 64)*FRACUNIT, P_RandomRange(5, 56)*FRACUNIT, MT_BOST) //spawns blue dash particles randomly around the player
					if bostlocal and bostlocal.valid then
						bostlocal.angle = player.mo.angle
					end
				end
				player.normalspeed = 48*FRACUNIT //increases player's top speed
				
				if player.speed > player.runspeed
				and player.panim ~= PA_PAIN
				and not (player.pflags & PF_FULLSTASIS)then
					player.dashmode = 3*TICRATE //This allows the custom boost mode to function with momentum mods - those usually only recognize vanilla dashmode, and this is a way around that.
				end
		    elseif player.boostmode >= 50 then
			    local ghost = P_SpawnGhostMobj(player.mo)
				ghost.fuse = 2
				player.normalspeed = 36*FRACUNIT
				player.bostspawn = $
				player.dashmode = 0*TICRATE
			else
				local ghost = nil
				player.normalspeed = 36*FRACUNIT
				player.bostspawn = $
				player.dashmode = 0*TICRATE
            end
			
			if player.boostmode > 106 then //prevents the counter from increasing infinitely, but with about an extra second of leeway while not moving to keep the speed up.
				player.boostmode = 105
			end
			
			//This bit controls the sound that plays when entering boost mode.
			//It prevents it from playing when exiting boost mode.
			//Thanks to amperbee on Discord - I had coded my own way around this,
			//but it was dumb and confusing.
			local boostmode = player.boostmode
			local boostmodeprev = player.boostmodeprev or 0
			
			if player.boostmode == 70
			and boostmode > boostmodeprev then
				S_StartSound(player.mo, 469)
			end
			
			player.boostmodeprev = boostmode
			
		//Gonna archive the way I did it here, if you want to see that for some reason
			
		//  //A check to make sure the sound below only plays when entering boost mode, and not exiting it.
		//  if player.boostmode == 69 then
		//  	player.boostmodesoundcheck = true
		//  end
			
		//  //plays a sound upon entering boost mode. This isn't part of the code above because that would cause the sound to play on every frame
		//  if player.boostmode == 70 
		//  and player.boostmodesoundcheck == true then
		//  	S_StartSound(player.mo, 469)
		//  end
		//  //when the variable is false, the sound doesn't trigger.
		//  if player.boostmode == 71 then
		//  	player.boostmodesoundcheck = false
		//  end
			
        end
    end
end

addHook("ThinkFrame", boostmode)



//Lazer Code Section



//Code for her neutral special
local function shoot()
    for player in players.iterate
	    player.baigisshootcounter = $ or 0 //starts a counter to prevent shooting on every frame - maybe I'll give her a "machine gun mode" someday.
        if player.mo.skin == "backwards_aigis" then
            if (player.cmd.buttons & BT_CUSTOM1) and player.baigisshootcounter > 10 then //when the counter reaches 10, she can shoot
			    if (player.pflags & PF_JUMPED) //makes sure she doesn't spin without damaging, or vise versa
				or (player.pflags & PF_SPINNING)
				or (player.pflags & PF_STARTDASH) then
					player.mo.state = S_BAIG_SHOT_JUMP //the states from earlier
				elseif player.panim == PA_SPRING
				or player.panim == PA_FALL then
					player.mo.state = S_BAIG_SHOT_SPRING
				else
					player.mo.state = S_BAIG_SHOT
				end
				S_StartSoundAtVolume(player.mo, 141, 100)
				P_SpawnPlayerMissile(player.mo, MT_BAIGLAZER)
				player.baigisshootcounter = 0 //resets the counter
			end
			player.baigisshootcounter = $ + 1 //actually makes the counter increment upwards
        end
    end
end

//Function for command that switches homing lazers on or off
local function HomingLazerSwitch(player, arg)
	if player.mo and player.mo.valid then
		if player.mo.skin == "backwards_aigis" then //Checks if you're playing as her
			if arg then //Arg is short for argument, aka what a player types in the console after the command
				arg = arg:lower() //lower() switches the argument to all lowercase - it's easier to manage
				if arg == "off"
				or arg == "no"
				or arg == "disable"
				or arg == "disabled"
				or arg == "0"
				or arg == "false" then
					player.hominglazers = 0 //Turns them off
					CONS_Printf(player, "Lazers will not lock onto enemies and monitors.") //Prints this message, only for the player who activate the command
				elseif arg == "on"
				or arg == "yes"
				or arg == "enable"
				or arg == "enabled"
				or arg == "1"
				or arg == "true" then
					player.hominglazers = 1 //Turns them on
					CONS_Printf(player, "Lazers will now lock onto enemies and monitors.")
				else
					CONS_Printf(player, "Invalid Input. Options are on and off.")
				end
			else
				CONS_Printf(player, "Toggles homing lazers. Will not affect charge shots. Current option is: " + player.hominglazers) //Printed when no argument is present
			end
		else
			CONS_Printf(player, "You're not playing as Backwards Aigis. Swap skins first!") //Printed for obvious reasons
		end
	else
		CONS_Printf(player, "This can only be done in a level.") //Same as above
	end
end

//Registers the command under the name specified
COM_AddCommand("hominglazers", function(player, arg)
	HomingLazerSwitch(player, arg)
end)

//Code for homing lazers - I'm an idiot for not doing this earlier...
addHook("MobjThinker", function(mo, player)
	if mo.target.player.hominglazers == 1 then
		mo.tracer = P_LookForEnemies(mo.target.player, false, true)
		A_HomingChase(mo, 75*FRACUNIT, 1)
	else
		return
	end
end, MT_BAIGLAZER)


addHook("ThinkFrame", shoot)

//Code for her charge shot
local function chargeshot()
	for player in players.iterate
		player.baigischargeshotcounter = $ or 0
		if player.mo.skin == "backwards_aigis" then
			if player.powers[pw_super] ~= 0 then //super-only rapid charge shot code - nearly identical to the regular shot code
				if (player.cmd.buttons & BT_CUSTOM2) and player.baigischargeshotcounter > 10 then
					if (player.pflags & PF_JUMPED)
					or (player.pflags & PF_SPINNING)
					or (player.pflags & PF_STARTDASH) then
						player.mo.state = S_BAIG_SHOT_JUMP
					elseif player.panim == PA_SPRING
					or player.panim == PA_FALL then
						player.mo.state = S_BAIG_SHOT_SPRING
					else
						player.mo.state = S_BAIG_SHOT
					end
					S_StartSoundAtVolume(player.mo, 93, 150)
					P_SpawnPlayerMissile(player.mo, MT_BAIGCHARGELAZER)
					player.baigischargeshotcounter = 0
				end
				player.baigischargeshotcounter = $ + 1
			else                                            //Actual charge shot code
				if (player.cmd.buttons & BT_CUSTOM2) then //counter that goes up when custom 2 is held, and goes down when it isn't
					player.baigischargeshotcounter = $ + 1
				else
					player.baigischargeshotcounter = $ - 1
				end
				
				if player.baigischargeshotcounter < 0 then //prevents the counter from decreasing infinitely
					player.baigischargeshotcounter = 0
				end
				
				if player.baigischargeshotcounter > 30 then //variable for when the charge is ready, easier to code with
					player.chargeshotready = true
				else
					player.chargeshotready = false
				end
				
				if player.chargeshotready
				and not (player.cmd.buttons & BT_CUSTOM2) then //makes her shoot on release of custom2 instead of rapid firing
					if (player.pflags & PF_JUMPED) //again, makes sure she doesn't spin without damaging, or vise versa
					or (player.pflags & PF_SPINNING)
					or (player.pflags & PF_STARTDASH) then
						player.mo.state = S_BAIG_SHOT_JUMP
					elseif player.panim == PA_SPRING
					or player.panim == PA_FALL then
						player.mo.state = S_BAIG_SHOT_SPRING
					else
						player.mo.state = S_BAIG_SHOT
					end
					S_StartSoundAtVolume(player.mo, 93, 150)
					P_SpawnPlayerMissile(player.mo, MT_BAIGCHARGELAZER)
					player.baigischargeshotcounter = 0 //resets the timer completely upon shooting
				end
			end
		end
	end
end

addHook("ThinkFrame", chargeshot)



//function that checks if a wall is bustable, then crumbles it, by Tatsuru (i'm an idiot)
local function CheckAndCrumble(mo, sec)
  for fof in sec.ffloors()
    if not (fof.flags & FF_EXISTS) then continue end
    if not (fof.flags & FF_BUSTUP) then continue end
    
    if mo.z + mo.height < fof.bottomheight then continue end 
    if mo.z > fof.topheight then continue end

    EV_CrumbleChain(fof)
  end
end

//Calls the crumble function for the chargeshot
addHook("MobjThinker", function(mo)
  CheckAndCrumble(mo, mo.subsector.sector)
end, MT_BAIGCHARGELAZER)

//Collision code to let everything activate properly
addHook("MobjLineCollide", function(mo, line)
  for _, sec in ipairs({line.frontsector, line.backsector})
    CheckAndCrumble(mo, sec)
  end
end, MT_BAIGCHARGELAZER)


//Code that lets chargeshots break spikes
addHook("MobjMoveCollide", function(mo, spike)
	if (mo.z < spike.z - 40*FRACUNIT) or (mo.z >= spike.z + 40*FRACUNIT) then
		return
	end

	if spike.type ~= MT_SPIKE then
		return
	end
	
	P_KillMobj(spike)
end, MT_BAIGCHARGELAZER)

//Code that lets chargeshots deal two damage - except for certain instances where you aren't dead center on your shots for some reason
//Stupid bees and their stupid bee spawners
addHook("MobjMoveCollide", function(mo, mohit)
	if (mo.z < mohit.z - 40*FRACUNIT) or (mo.z >= mohit.z + 40*FRACUNIT) then
		return
	end

	if mohit.flags & MF_ENEMY
	or mohit.flags & MF_SHOOTABLE
	or mohit.flags & MF_BOSS then
		P_DamageMobj(mohit, mo, mo.target, 2)
	end
end, MT_BAIGCHARGELAZER)

//Code for Jumpshooting
local function jumpshot()
	for player in players.iterate
		if player.mo.skin == "backwards_aigis" then
			if not (player.cmd.buttons & BT_JUMP) then //variables are being set to make sure this all works properly
				player.jumpshotready = true
				player.jumpshooting = false
			elseif not (player.pflags & PF_JUMPED) then //if she hasn't jumped, the jumpshot won't go off - prevents it from breaking things on springs, like ChrispyChars Tricks
				player.jumpshotready = true
				player.jumpshooting = false
			elseif player.jumpshotready then //actually causes the shot
				player.jumpshooting = true
				player.jumpshotready = false
			else
				player.jumpshooting = false
			end
			
			if player.jumpshooting then //the shot itself
				player.mo.state = S_BAIG_JUMPSHOT
				if (player.mo.eflags & MFE_VERTICALFLIP) then
					S_StartSoundAtVolume(player.mo, 141, 100)
					local mylocal = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z + 20*FRACUNIT, MT_BAIGJUMPLAZER)
					mylocal.target = player.mo
				else
					S_StartSoundAtVolume(player.mo, 141, 100)
					local mylocal = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_BAIGJUMPLAZER)
					mylocal.target = player.mo
				end
			end
		end
	end
end

addHook("ThinkFrame", jumpshot)

//Codes for lazer afterimages
addHook("MobjThinker", function(mo)
	local ghost = P_SpawnGhostMobj(mo)
    ghost.fuse = 10
end, MT_BAIGLAZER)

addHook("MobjThinker", function(mo)
	local ghost = P_SpawnGhostMobj(mo)
    ghost.fuse = 10
end, MT_BAIGCHARGELAZER)


//Code for vertical lazers, thank you so much Marcos
addHook("MobjThinker", function(mo)
	
	if (mo.eflags & MFE_VERTICALFLIP) then //checks if she's upside down, and pushes the lazer upwards or downwards respectively
		mo.z = $ + 50*FRACUNIT
	else
		mo.z = $ - 50*FRACUNIT
	end
	
	if (mo.target.eflags & MFE_VERTICALFLIP) and not (mo.eflags & MFE_VERTICALFLIP) then //sets the verticalflip flag based on Backwards Aigis' current state, so the code above triggers properly
		mo.eflags = $ | MFE_VERTICALFLIP
	elseif not (mo.target.eflags & MFE_VERTICALFLIP) and (mo.eflags & MFE_VERTICALFLIP) then
		mo.eflags = $ & ~MFE_VERTICALFLIP
	end
	
	if (mo.state ~= S_BAIGGROUNDSPARK) and P_IsObjectOnGround(mo) then //calls the groundspark state. Causes lag in netgames, so it's been disabled for now (the state only lasts for 2 tics)
		mo.state = S_BAIGGROUNDSPARK
	end
end, MT_BAIGJUMPLAZER)

//JumpLazer collision code, again thank you Marcos
addHook("MobjMoveCollide", function(mo, mohit)
	if (mo.z < mohit.z) or (mo.z >= mohit.z + 10*FRACUNIT) then //I know what this does now - it's a height check.
		return
	end
	
	if mohit.flags & MF_ENEMY //if the lazer or groundspark hits something, it damages it and disappears
	or mohit.flags & MF_MONITOR
	or mohit.flags & MF_SHOOTABLE
	or mohit.flags & MF_BOSS then
		P_DamageMobj(mohit, mo, mo.target, 1)
		P_RemoveMobj(mo)
	else
		return
	end
end, MT_BAIGJUMPLAZER)



//Other misc. code, such as HUD, super, and addon support




//Code for superabilities - superfloat and infinite jump
local function superabilities()
    for player in players.iterate
        if player.mo.skin == "backwards_aigis" then
            if player.powers[pw_super] ~= 0 then
				if (player.pflags & PF_JUMPED) then //resets the flag that prevents you from using a jump ability more than once - also gives her infinite thokks when floating. Unintentional, but it's funny so it stays.
					player.pflags = $ & ~PF_THOKKED
				end
				
				if (player.pflags & PF_JUMPED) then //super float code - switches her charability to thok when spin is held. Why is this tied to thok and thok only?
					if (player.cmd.buttons & BT_USE) then
						player.charability = CA_THOK
					else
						player.charability = CA_DOUBLEJUMP
					end
				end
			else
				player.charability = CA_DOUBLEJUMP //makes sure her double jump is restored, even if spin was held while detransforming. Playing as her with a thok was interesting, though.
			end
		end
	end
end

addHook("ThinkFrame", superabilities)

//Code for her charge HUD - Temporary, will probably spice up later
hud.add(function(v, player)
	for player in players.iterate
		if player.mo.skin == "backwards_aigis" then
			local hudempty = v.cachePatch('HUDEA0')
			local hudcharge = v.cachePatch('HUDCA0')
			local hudready = v.cachePatch('HUDRA0')
			local hudsupercharge = v.cachePatch('HUDSA0')
			
			v.drawString(210, 5, "CHARGE:")
			if player.powers[pw_super] ~= 0 then
				v.draw(270, 0, hudsupercharge)
			else
				if player.baigischargeshotcounter > 0
				and player.baigischargeshotcounter < 31 then
					v.draw(270, 0, hudcharge)
				elseif player.baigischargeshotcounter > 30 then
					v.draw(270, 0, hudready)
				else
					v.draw(270, 0, hudempty)
				end
			end
		end
	end
end)

//ChrispyChars Tricks - refer to its .pk3 for easy instructions to make these yourself, but feel free to use these as an example too.
if not CC_TrickSkins
	rawset(_G, "CC_TrickSkins", {})
end

CC_TrickSkins["backwards_aigis"] = {
	{
		sprite2 = SPR2_SPNG,
		rotation = 1,
		tics = 0
	},
	{
		sprite2 = SPR2_FIRE,
		rotation = -1,
		tics = 0
	},
	{
		sprite2 = SPR2_ATRK,
		rotation = 0,
		tics = 0
	},
	{
		sprite2 = SPR2_BTRK,
		rotation = -1,
		tics = 0
	},
	{
		sprite2 = SPR2_CTRK,
		rotation = 0,
		tics = 0
	}
}

//Kirby ability
if not(kirbyabilitytable)
    rawset(_G, "kirbyabilitytable", {})
end

kirbyabilitytable["backwards_aigis"] = 16
kirbyabilitytable[MT_BAIGLAZER] = 16
kirbyabilitytable[MT_BAIGCHARGELAZER] = 16
kirbyabilitytable[MT_BAIGJUMPLAZER] = 16

//If you see this, I hope you're having a nice day! :D