//taileels Lost World Bounce Attack. made by NOT ME!!!!!, MotdSpork. Boing!
addHook("MobjThinker", function(taileels)
	if (taileels and taileels.skin == "taileels") //if you're taileels..
	and taileels.player.playerstate == PST_LIVE //you alive bruh?
		if taileels.player.bounceattack == nil //if the variable doesnt exist
			taileels.player.bounceattack = 0 //create variable
		end
		if taileels.player.bouncenumber == nil //if the variable doesnt exist
			taileels.player.bouncenumber = 0 //create variable
			taileels.player.justchangedbouncenumber = 0 //create variable
		end
		if P_IsObjectOnGround(taileels) //are you on the ground?
		and taileels.player.bounceattack == 0 //the player isnt bouncing
			taileels.player.bouncenumber = 0 //set it to zero!
		end
		if taileels.player.usedown == nil //if the variable doesnt exist
		or not (taileels.player.cmd.buttons & BT_USE) //not pressing the spin button?
			taileels.player.usedown = 0 //create variable
			taileels.player.justchangedbouncenumber = 0 //create variable
		end
		if P_IsObjectOnGround(taileels) //Is the player on the ground?
		and (taileels.player.cmd.buttons & BT_USE) //Is the player holding the spin button?
			taileels.player.usedown = 1 //Set it to one!
		end
		if taileels.player.pflags & PF_JUMPED //if the player has jumped
		and not (taileels.player.pflags & PF_THOKKED) //and the player hasnt used their mid-air ability
		and not (P_IsObjectOnGround(taileels)) //and you arent on the ground.
		and taileels.player.cmd.buttons & BT_USE //pressing custom2?
		and taileels.player.bounceattack == 0 //checking if the custom variable it set to 0
		and taileels.player.usedown == 0 //make sure you arent holding the spin button.
		and not (taileels.player.exiting) //not...exiting the level?
		and taileels.health //you're alive?
		and not (P_PlayerInPain(taileels.player)) //not hurt are you?
			taileels.player.bounceattack = 1 //set it to one!
			P_SetObjectMomZ(taileels, -35*FRACUNIT) //make the player "shoot" downward
			//P_SetObjectMomZ(taileels, FixedMul(-35*FRACUNIT, taileels.scale)) //make the player shoot downwards 
			taileels.player.pflags = $1|PF_THOKKED //force the player into a "thokked" state
		end
			
		if (taileels.eflags & MFE_JUSTHITFLOOR) //you're on the ground.
		and not (taileels.player.pflags & PF_SPINNING) //you arent spinning....somehow
		and not (taileels.player.pflags & PF_STARTDASH) //you arent doing a spindash
		and not (taileels.tracer and taileels.tracer.type == MT_TUBEWAYPOINT) //not in a...zoomtube?
		and taileels.player.bounceattack == 1 //our custom variable is one right...?
		and taileels.health //is the player alive..?
		and not (P_PlayerInPain(taileels.player)) //not hurt are you?
			if taileels.player.bouncenumber == 0 //if he hasnt bounced yet
			and taileels.player.justchangedbouncenumber == 0 //if he hasnt left the ground yet
				taileels.player.justchangedbouncenumber = 1 //now he has!
				taileels.player.bouncenumber = 1 //Set this to one!
				taileels.player.pflags = $1|PF_JUMPED //forcing the player into a jumping state.
				P_SetObjectMomZ(taileels, 12*FRACUNIT)
				if not (taileels.player.panim == PA_ROLL) //checking if the players animation is it's spinning anim.
					taileels.state = S_PLAY_ROLL //force the player into a spinning state.
				end
			end
			if taileels.player.bouncenumber == 1 //if it's currently on his first bounce
			and taileels.player.justchangedbouncenumber == 0 //if he hasnt left the ground yet
			and not (P_PlayerInPain(taileels.player)) //not hurt are you?
				taileels.player.justchangedbouncenumber = 1 //now he has!
				taileels.player.bouncenumber = 2 //set this to two!
				taileels.player.pflags = $1|PF_JUMPED //forcing the player into a jumping state.
				P_SetObjectMomZ(taileels, 13*FRACUNIT)
				if not (taileels.player.panim == PA_ROLL) //checking if the players animation is it's spinning anim.
					taileels.state = S_PLAY_ROLL //force the player into a spinning state.
				end
			end
			if taileels.player.bouncenumber == 2 //if it's currently on his second bounce
			and taileels.player.justchangedbouncenumber == 0 //if he hasnt left the ground yet
			and not (P_PlayerInPain(taileels.player)) //not hurt are you?
				taileels.player.justchangedbouncenumber = 1 //now he has!
				taileels.player.bouncenumber = 0 //set it back to zero
				taileels.state = S_PLAY_SPRING //change to spring frame, like is SLW!
				P_SetObjectMomZ(taileels, 15*FRACUNIT) //send the player upwards
				taileels.player.pflags = $1 & ~PF_JUMPED // No longer jumping. Don't land on an enemy!
			end
			taileels.player.bounceattack = 0 //set it back to zero.
			taileels.player.usedown = 1 //set it to one.
			taileels.player.pflags = $1 & ~PF_THOKKED //uncheck the thokked flag, allowing you to bounce again.
			S_StartSound(taileels, sfx_s3k77) //play a sound c:			
			
		end
		//some quick checks
		
		if taileels.player.bounceattack == 1 //checking our variable.
		and taileels.health //and you're alive
		and not (P_PlayerInPain(taileels.player)) //not hurt are you?
			P_SpawnThokMobj(taileels.player) //spawn the players thok object
			if not (taileels.player.panim == PA_ROLL) //checking if the players animation is it's spinning anim.
				taileels.state = S_PLAY_ROLL //force the player into a spinning state.
			end
			if (taileels.momz > (9000*P_MobjFlip(taileels))) // the player is going up...?  
				P_SetObjectMomZ(taileels, FixedMul(-35*FRACUNIT, taileels.scale)) //not anymore >.>
			end
		else 
			taileels.player.bounceattack = 0 //set it to 0
		end
		if taileels.player.bounceattack == 1 //checking if hes bouncing
			taileels.player.pflags = $1 & ~PF_SPINNING // you're no longer "spinning" if you were before
		end
		if not (taileels.player.pflags & PF_JUMPED) // if you are not actuallly jumping
			taileels.player.bounceattack = 0 //set this back to zero to be safe
		end
		
		if taileels.eflags & MFE_GOOWATER //is the player in THZ goop?
		or taileels.player.powers[pw_carry] //is the player being carried?
		//or taileels.player.pflags & PF_ROPEHANG //is the player on a ACZ ropehang?
			taileels.player.bounceattack = 0 //set to zero!
		end
		if not (taileels.player.pflags & PF_JUMPED) //if the player hasnt jumped
			taileels.player.bounceattack = 0 //set this to zero
		end
	end
end, MT_PLAYER)