addHook("PlayerThink", do
	for player in players.iterate
		if player.mo.valid
		and(player.mo.skin == "legacytrop") then
			player.powers[pw_underwater] = 0
			player.powers[pw_spacetime] = 0
		end
	end
end)

addHook("PlayerThink", do
	for player in players.iterate
		if player.mo.valid
		and(player.mo.skin == "legacytrop") and player.mo.state == S_PLAY_RUN then
		player.powers[pw_strong] =  STR_ANIM|STR_PUNCH
		end
	end
end)

addHook("PlayerThink", do
	for player in players.iterate
		if player.mo.valid
		and(player.mo.skin == "legacytrop") and player.mo.state == S_PLAY_DASH then
		player.powers[pw_strong] =  STR_ANIM|STR_PUNCH|STR_SPIKE
		end
	end
end)

addHook("PlayerThink", do
	for player in players.iterate
		if player.mo.valid
		and(player.mo.skin == "legacytrop") and player.mo.state == S_PLAY_RUN and player.speed >= 40 * FRACUNIT then
		player.mo.state = S_PLAY_DASH
		end
	end
end)

addHook("PlayerThink", do
	for player in players.iterate
		if player.mo.valid
		and(player.mo.skin == "legacytrop") and player.mo.state == S_PLAY_DASH and player.speed <= 40 * FRACUNIT then
		player.mo.state = S_PLAY_RUN
		end
	end
end)

addHook("PlayerThink", do
	for player in players.iterate
		if player.mo.valid
		and(player.mo.skin == "legacytrop") and player.mo.state == S_PLAY_RUN and player.speed <= 28 * FRACUNIT then
		player.mo.state = S_PLAY_WALK
		end
	end
end)

addHook("PlayerThink", do
	for player in players.iterate
		if player.mo.valid
		and(player.mo.skin == "legacytrop") and player.mo.state == S_PLAY_WALK and player.speed >= 28 * FRACUNIT then
		player.mo.state = S_PLAY_RUN
		end
	end
end)

addHook("PlayerThink", do
	for player in players.iterate
		if player.mo.valid
		and(player.mo.skin == "legacytrop") and player.mo.state == S_PLAY_WALK and player.speed == 0 * FRACUNIT then
		player.mo.state = S_PLAY_STND
		end
	end
end)


addHook("MobjSpawn", function(mo) mo.tech = 0 end, MT_PLAYER)//tech checker.
addHook("MobjSpawn", function(mo) mo.techlock = 0 end, MT_PLAYER)//tech locker.
addHook("MobjSpawn", function(mo) mo.techtimer = 0 end, MT_PLAYER)//techtimer.
addHook("PlayerThink", do
	for player in players.iterate
		if (player.mo and player.mo.skin == "legacytrop")
		and not (player.pflags & PF_JUMPED)
		and not (player.pflags & PF_SPINNING)
				if (player.mo.state == S_PLAY_SPRING)
					player.mo.tech = 1
				end
				if player.mo.tech == 1
					player.mo.techlock = 1
				end
				if player.mo.techlock == 1
				and (player.mo.state == S_PLAY_FALL)
					player.mo.state = S_PLAY_ROLL
					player.mo.techtimer=18
				end
				if player.mo.techtimer != nil
				and player.mo.techtimer > 0
					player.mo.techtimer = $1 - 1
				end
				if (player.mo.state == S_PLAY_ROLL)
				and player.mo.techtimer == 0
				player.mo.state = S_PLAY_FALL
				player.mo.tech = 0
				player.mo.techlock = 0
				end
		end
	end
end)