--[*~Mint "The AmyDroid" Sweetnam~*]--
--(Some) Sprites by SSNeoMint.--
--Lua made by SSNeoMint and Jesus.B.--

freeslot("SKINCOLOR_SWEETNAM")
skincolors[SKINCOLOR_SWEETNAM] = {
	name = "Sweetnam",
    ramp = {0,0,128,128,129,129,130,130,130,132,133,134,135,136,137,138},
	invcolor = SKINCOLOR_YELLOW,
	invshade = 3,
	chatcolor = V_SKYMAP,
	accessible = true
}

freeslot "SKINCOLOR_LEGACYMINT"
skincolors[SKINCOLOR_LEGACYMINT] = {
	name = "LegacyMint",
    ramp = {0,1,1,128,128,128,129,129,129,130,130,131,132,134,134,135},
	invcolor = SKINCOLOR_YELLOW,
	invshade = 5,
	chatcolor = V_SKYMAP,
	accessible = true
}

freeslot "SKINCOLOR_NEOBLUE"
skincolors[SKINCOLOR_NEOBLUE] = {
	name = "NeoBlue",
    ramp = {144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159},
	invcolor = SKINCOLOR_RED,
	invshade = 5,
	chatcolor = V_BLUEMAP,
	accessible = true
}

freeslot "SKINCOLOR_SCARLET"
skincolors[SKINCOLOR_SCARLET] = {
	name = "Scarlet",
    ramp = {32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47},
	invcolor = SKINCOLOR_BLUE,
	invshade = 5,
	chatcolor = V_REDMAP,
	accessible = true
}

-- Wait animation

freeslot("S_PLAY_MINTWAIT0", "S_PLAY_MINTWAIT1", "S_PLAY_MINTWAIT2", "S_PLAY_MINTWAIT3", 
"S_PLAY_MINTWAIT4", "S_PLAY_MINTWAIT5", "S_PLAY_MINTWAIT6", "SPR2_RAIT", "SPR2_MAIT")

states[S_PLAY_MINTWAIT0] = {SPR_PLAY, SPR2_RAIT, 15, nil, 0, 1, S_PLAY_MINTWAIT1}
states[S_PLAY_MINTWAIT1] = {SPR_PLAY, SPR2_MAIT, 27, nil, 0, 0, S_PLAY_MINTWAIT2}
states[S_PLAY_MINTWAIT2] = {SPR_PLAY, SPR2_MAIT, 10, nil, 0, 0, S_PLAY_MINTWAIT3}
states[S_PLAY_MINTWAIT3] = {SPR_PLAY, SPR2_MAIT, 10, nil, 0, 0, S_PLAY_MINTWAIT4}
states[S_PLAY_MINTWAIT4] = {SPR_PLAY, SPR2_MAIT, 10, nil, 0, 0, S_PLAY_MINTWAIT5}
states[S_PLAY_MINTWAIT5] = {SPR_PLAY, SPR2_MAIT, 10, nil, 0, 0, S_PLAY_MINTWAIT6}
states[S_PLAY_MINTWAIT6] = {SPR_PLAY, SPR2_MAIT, 10, nil, 0, 0, S_PLAY_MINTWAIT5}


addHook("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.state == S_PLAY_MINTWAIT6 or player.speed > 1*FRACUNIT then return end
if player.mo.skin == "mint" and player.mo.state == S_PLAY_WAIT 

player.mo.state = S_PLAY_MINTWAIT0
end;end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.speed > 1*FRACUNIT then return end
if player.mo.skin == "mint" and not player.speed == 1*FRACUNIT
and player.mo.state == S_PLAY_MINTWAIT0 

player.mo.frame = A
end;end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.speed > 1*FRACUNIT then return end
if player.mo.skin == "mint" and not player.speed == 1*FRACUNIT
and player.mo.state == S_PLAY_MINTWAIT1 

player.mo.frame = A
end;end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.speed > 1*FRACUNIT then return end
if player.mo.skin == "mint" and not player.speed == 1*FRACUNIT
and player.mo.state == S_PLAY_MINTWAIT2 

player.mo.frame = B
end;end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.speed > 1*FRACUNIT then return end
if player.mo.skin == "mint" and not player.speed == 1*FRACUNIT
and player.mo.state == S_PLAY_MINTWAIT3 

player.mo.frame = C
end;end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.speed > 1*FRACUNIT then return end
if player.mo.skin == "mint" and not player.speed == 1*FRACUNIT
and player.mo.state == S_PLAY_MINTWAIT4 

player.mo.frame = D
end;end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.speed > 1*FRACUNIT then return end
if player.mo.skin == "mint" and not player.speed == 1*FRACUNIT
and player.mo.state == S_PLAY_MINTWAIT5 

player.mo.frame = E
end;end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.speed > 1*FRACUNIT then return end
if player.mo.skin == "mint" and not player.speed == 1*FRACUNIT
and player.mo.state == S_PLAY_MINTWAIT6 

player.mo.frame = F
end;end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.speed != 0*FRACUNIT
and (player.mo.state >= S_PLAY_MINTWAIT0 and player.mo.state <= S_PLAY_MINTWAIT6)
and P_IsObjectOnGround(player.mo)

player.mo.state = S_PLAY_STND
end
end)

-- Jump

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
    if player.mo.eflags & MFE_VERTICALFLIP then return end
    if maptol & TOL_MARIO then return end
	if player.mo and player.mo.valid and (player.mo.skin == "mint") and player.pflags & PF_JUMPED then
	if player.mo.state == S_PLAY_JUMP
	and player.mo.momz < 0
	player.mo.state = S_PLAY_FALL
	elseif player.mo.state == S_PLAY_FALL
	and player.mo.momz > 0
	player.mo.state = S_PLAY_JUMP
	end
	end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
    if maptol & TOL_MARIO or player.mo.eflags & MFE_VERTICALFLIP then return end
	if player.mo and player.mo.valid and (player.mo.skin == "mint") and player.pflags & PF_JUMPED then
	if player.mo.state == S_PLAY_JUMP
	and player.mo.momz < 0
	player.mo.state = S_PLAY_FALL
	end
	end
end)

-- Victory

freeslot("S_PLAY_VICTORY1", 
"S_PLAY_VICTORY2", 
"S_PLAY_VICTORY3", 
"S_PLAY_VICTORY4",
"S_PLAY_VICTORY5",
"S_PLAY_VICTORY6",
"S_PLAY_VICTORY7",
"S_PLAY_VICTORY8",
"S_PLAY_VICTORY9",
"S_PLAY_VICTORY10",
"S_PLAY_VICTORY11",
"S_PLAY_VICTORY12",
"S_PLAY_VICTORY13",
"S_PLAY_VICTORYB", "SPR2_VICT", "sfx_mjump", "sfx_wav", "SPR2_VICB")

freeslot("S_PLAY_RELA1",
"S_PLAY_RELA2", 
"S_PLAY_RELA3", 
"S_PLAY_RELA4",
"S_PLAY_RELA5", 
"S_PLAY_RELA6", 
"S_PLAY_RELA7", 
"S_PLAY_RELA8", 
"S_PLAY_RELA9",
"S_PLAY_RELA10", 
"S_PLAY_RELA11", 
"S_PLAY_RELA12", 
"S_PLAY_RELA13",
"S_PLAY_RELA14", 
"S_PLAY_RELA15",
"S_PLAY_LAMO", 
"SPR2_LAMO", 
"SPR2_RELA")

states[S_PLAY_VICTORY1] = {SPR_PLAY, SPR2_VICT, 4, nil, 0, 0, S_PLAY_VICTORY2}
states[S_PLAY_VICTORY2] = {SPR_PLAY, SPR2_VICT, 3, nil, 0, 0, S_PLAY_VICTORY3}
states[S_PLAY_VICTORY3] = {SPR_PLAY, SPR2_VICT, 7, nil, 0, 0, S_PLAY_VICTORY4}
states[S_PLAY_VICTORY4] = {SPR_PLAY, SPR2_VICT, 5, nil, 0, 0, S_PLAY_VICTORY5}
states[S_PLAY_VICTORY5] = {SPR_PLAY, SPR2_VICT, 5, nil, 0, 0, S_PLAY_VICTORY6}
states[S_PLAY_VICTORY6] = {SPR_PLAY, SPR2_VICT, -1, nil, 0, 0, S_PLAY_VICTORY6}
states[S_PLAY_VICTORY7] = {SPR_PLAY, SPR2_VICT, 2, nil, 0, 0, S_PLAY_RELA1}
states[S_PLAY_RELA1] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA2}
states[S_PLAY_RELA2] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA3}
states[S_PLAY_RELA3] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA4}
states[S_PLAY_RELA4] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA5}
states[S_PLAY_RELA5] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA6}
states[S_PLAY_RELA6] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA7}
states[S_PLAY_RELA7] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA8}
states[S_PLAY_RELA8] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA9}
states[S_PLAY_RELA9] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA10}
states[S_PLAY_RELA10] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA11}
states[S_PLAY_RELA11] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA12}
states[S_PLAY_RELA12] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA13}
states[S_PLAY_RELA13] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA14}
states[S_PLAY_RELA14] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_RELA15}
states[S_PLAY_RELA15] = {SPR_PLAY, SPR2_RELA, 3, nil, 0, 0, S_PLAY_LAMO}
states[S_PLAY_LAMO] = {SPR_PLAY, SPR2_LAMO, 2, nil, 0, 0, S_PLAY_LAMO}


addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if not player.exiting
or player.cmd.buttons & BT_TOSSFLAG then return end
if player.mo.skin == "mint" 
and (player.mo.state == S_PLAY_STND or player.mo.state == S_PLAY_EDGE or player.mo.state == S_PLAY_WAIT)
and player.exiting
and not player.speed
and not player.burststomp == true
and P_IsObjectOnGround(player.mo)

player.mintvictorypose = true
if player.mo.eflags & MFE_UNDERWATER
player.mo.state = S_PLAY_RELA3
else
player.mo.state = S_PLAY_VICTORY1
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and not player.exiting

player.mintvictorypose = false
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_VICTORY1
and player.exiting

player.mo.frame = A
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_VICTORY2
and player.exiting

player.mo.frame = B
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_VICTORY3
and player.exiting

player.mo.frame = C
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_VICTORY4
and player.exiting

player.mo.frame = D

local mintangle = (player.cmd.angleturn << 16) - ANGLE_90
if P_IsObjectOnGround(player.mo)
P_MoveOrigin(player.mo, player.mo.x, player.mo.y ,player.mo.z + 1*FRACUNIT)

if not S_SoundPlaying(player.mo, sfx_mjump)
S_StartSound(player.mo, sfx_mjump)
P_SetObjectMomZ(player.mo, 5*FRACUNIT)
P_Thrust(player.mo, mintangle, 4*FRACUNIT)
end
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_VICTORY5
and player.exiting

player.mo.frame = E
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mintvictorypose
and not P_IsObjectOnGround(player.mo)
and player.exiting

player.mintvictoryfall = true
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_VICTORY5
and player.exiting
and player.mo.momz <= -1*FRACUNIT
and not P_IsObjectOnGround(player.mo)

player.mo.state = S_PLAY_VICTORY6
and player.exiting
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_VICTORY6
and player.exiting

player.mo.frame = F
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mintvictoryfall
and player.exiting
and P_IsObjectOnGround(player.mo)

S_StartSound(player.mo, sfx_s3k4c)
player.mo.state = S_PLAY_RELA1
player.mintvictoryfall = false
P_InstaThrust(player.mo, player.mo.angle, 0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA1

player.mo.frame = A
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA2

player.mo.frame = B
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA3

player.mo.frame = C
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA4

player.mo.frame = D
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA5

player.mo.frame = E
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA6

player.mo.frame = F
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
if not S_SoundPlaying(player.mo, sfx_wav)
S_StartSound(player.mo, sfx_wav)
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA7

player.mo.frame = G
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA8

player.mo.frame = H
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA9

player.mo.frame = I
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA10

player.mo.frame = J
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA11

player.mo.frame = K
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA12

player.mo.frame = L
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA13

player.mo.frame = M
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA14

player.mo.frame = N
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_RELA15

player.mo.frame = O
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

-- Taunts

freeslot("S_PLAY_MINTTAUNT1", "S_PLAY_MINTTAUNT2", 
"S_PLAY_MINTTAUNT3", "S_PLAY_MINTTAUNT4", "S_PLAY_MINTTAUNT5", 
"S_PLAY_MINTTAUNT6", "S_PLAY_MINTTAUNT7", "S_PLAY_MINTTAUNT8", "S_PLAY_MINTTAUNT9", 
"S_PLAY_MINTTAUNT10", "S_PLAY_MINTTAUNT11", "S_PLAY_MINTTAUNT12", "SPR2_TANT", "SPR2_TANF", "SPR2_TANR")
states[S_PLAY_MINTTAUNT1] = {SPR_PLAY, SPR2_TANT, 2, nil, 0, 0, S_PLAY_MINTTAUNT2}
states[S_PLAY_MINTTAUNT2] = {SPR_PLAY, SPR2_TANT, 2, nil, 0, 0, S_PLAY_MINTTAUNT3}
states[S_PLAY_MINTTAUNT3] = {SPR_PLAY, SPR2_TANT, 2, nil, 0, 0, S_PLAY_MINTTAUNT4}
states[S_PLAY_MINTTAUNT4] = {SPR_PLAY, SPR2_TANT, 2, nil, 0, 0, S_PLAY_MINTTAUNT4}
states[S_PLAY_MINTTAUNT5] = {SPR_PLAY, SPR2_TANF, 2, nil, 0, 0, S_PLAY_MINTTAUNT6}
states[S_PLAY_MINTTAUNT6] = {SPR_PLAY, SPR2_TANF, 2, nil, 0, 0, S_PLAY_MINTTAUNT7}
states[S_PLAY_MINTTAUNT7] = {SPR_PLAY, SPR2_TANF, 2, nil, 0, 0, S_PLAY_MINTTAUNT8}
states[S_PLAY_MINTTAUNT8] = {SPR_PLAY, SPR2_TANF, 2, nil, 0, 0, S_PLAY_MINTTAUNT8}
states[S_PLAY_MINTTAUNT9] = {SPR_PLAY, SPR2_TANR, 2, nil, 0, 0, S_PLAY_MINTTAUNT10}
states[S_PLAY_MINTTAUNT10] = {SPR_PLAY, SPR2_TANR, 2, nil, 0, 0, S_PLAY_MINTTAUNT11}
states[S_PLAY_MINTTAUNT11] = {SPR_PLAY, SPR2_TANR, 2, nil, 0, 0, S_PLAY_MINTTAUNT12}
states[S_PLAY_MINTTAUNT12] = {SPR_PLAY, SPR2_TANR, 2, nil, 0, 0, S_PLAY_MINTTAUNT12}

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.hugging then return end
if player.mo.skin == "adventuresonic" then return end
if player.mo.skin == "mint"
and P_IsObjectOnGround(player.mo)
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
and player.mo.state == S_PLAY_STND 
or player.mo.state == S_PLAY_MINTWAIT0
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
and player.mo.skin == "mint"
or player.mo.state == S_PLAY_MINTWAIT1
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
and player.mo.skin == "mint"
or player.mo.state == S_PLAY_MINTWAIT2
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
and player.mo.skin == "mint"
or player.mo.state == S_PLAY_MINTWAIT3
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
and player.mo.skin == "mint"
or player.mo.state == S_PLAY_MINTWAIT4
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
and player.mo.skin == "mint"
or player.mo.state == S_PLAY_MINTWAIT5
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
and player.mo.skin == "mint"
or player.mo.state == S_PLAY_MINTWAIT6
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
and player.mo.skin == "mint"
or player.mo.state == S_PLAY_MINTTAUNT8
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
and player.mo.skin == "mint"
or player.mo.state == S_PLAY_MINTTAUNT12
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
and player.mo.skin == "mint"

player.mo.state = S_PLAY_MINTTAUNT1
S_StartSound(player.mo, sfx_s25a)
else return false end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" and not player.powers[pw_super]
and (player.mo.state == S_PLAY_MINTTAUNT1 or player.mo.state == S_PLAY_MINTTAUNT2
or player.mo.state == S_PLAY_MINTTAUNT3 or player.mo.state == S_PLAY_MINTTAUNT4)
and player.speed > 0*FRACUNIT 

player.mo.state = S_PLAY_STND
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT1

player.mo.frame = A
if player.mo.frame == A and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
player.powers[pw_nocontrol] = 1
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT2

player.mo.frame = B
if player.mo.frame == B and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
player.powers[pw_nocontrol] = 1
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT3

player.mo.frame = C
if player.mo.frame == C and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
player.powers[pw_nocontrol] = 1
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT4

player.mo.frame = D
if player.mo.frame == D and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM2
player.powers[pw_nocontrol] = 1
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.hugging then return end
if player.mo.skin == "mint" and not player.powers[pw_super]
and P_IsObjectOnGround(player.mo)
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
and player.mo.state == S_PLAY_STND 
or player.mo.state == S_PLAY_MINTTAUNT4
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
or player.mo.state == S_PLAY_WAIT
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
or player.mo.state == S_PLAY_MINTWAIT0
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
or player.mo.state == S_PLAY_MINTWAIT1
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
or player.mo.state == S_PLAY_MINTWAIT2
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
or player.mo.state == S_PLAY_MINTWAIT3
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
or player.mo.state == S_PLAY_MINTWAIT4
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
or player.mo.state == S_PLAY_MINTWAIT5
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
or player.mo.state == S_PLAY_MINTWAIT6
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
or player.mo.state == S_PLAY_MINTTAUNT12
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3

player.mo.state = S_PLAY_MINTTAUNT5
S_StartSound(player.mo, sfx_s25a)
else return false end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" and not player.powers[pw_super]
and (player.mo.state == S_PLAY_MINTTAUNT5 or player.mo.state == S_PLAY_MINTTAUNT6
or player.mo.state == S_PLAY_MINTTAUNT7 or player.mo.state == S_PLAY_MINTTAUNT8)
and player.speed > 0*FRACUNIT 

player.mo.state = S_PLAY_STND
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT5

player.mo.frame = A
if player.mo.frame == A and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
player.powers[pw_nocontrol] = 1
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT6

player.mo.frame = B
if player.mo.frame == B and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
player.powers[pw_nocontrol] = 1
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT7

player.mo.frame = C
if player.mo.frame == C and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
player.powers[pw_nocontrol] = 1
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT8

player.mo.frame = D
if player.mo.frame == D and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM3
player.powers[pw_nocontrol] = 1
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.hugging then return end
if player.mo.skin == "mint" and not player.powers[pw_super]
and P_IsObjectOnGround(player.mo)
and player.mo.state == S_PLAY_STND 
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
or player.mo.state == S_PLAY_MINTTAUNT8
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
or player.mo.state == S_PLAY_MINTTAUNT4
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
or player.mo.state == S_PLAY_WAIT
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
or player.mo.state == S_PLAY_MINTWAIT0
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
or player.mo.state == S_PLAY_MINTWAIT1
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
or player.mo.state == S_PLAY_MINTWAIT2
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
or player.mo.state == S_PLAY_MINTWAIT3
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
or player.mo.state == S_PLAY_MINTWAIT4
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
or player.mo.state == S_PLAY_MINTWAIT5
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
or player.mo.state == S_PLAY_MINTWAIT6
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1

player.mo.state = S_PLAY_MINTTAUNT9
S_StartSound(player.mo, sfx_s25a)
else return false end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" and not player.powers[pw_super]
and (player.mo.state == S_PLAY_MINTTAUNT9 or player.mo.state == S_PLAY_MINTTAUNT10
or player.mo.state == S_PLAY_MINTTAUNT11 or player.mo.state == S_PLAY_MINTTAUNT12)
and player.speed > 0*FRACUNIT 

player.mo.state = S_PLAY_STND
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT9

player.mo.frame = A
if player.mo.frame == A and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
player.powers[pw_nocontrol] = 1
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT10

player.mo.frame = B
if player.mo.frame == B and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
player.powers[pw_nocontrol] = 1
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT11

player.mo.frame = C
if player.mo.frame == C and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
player.powers[pw_nocontrol] = 1
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT12

player.mo.frame = D
if player.mo.frame == D and player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG
and player.cmd.buttons & BT_CUSTOM1
player.powers[pw_nocontrol] = 1
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and player.mo.state == S_PLAY_MINTTAUNT1
or player.mo.state == S_PLAY_MINTTAUNT2
or player.mo.state == S_PLAY_MINTTAUNT3
or player.mo.state == S_PLAY_MINTTAUNT4
or player.mo.state == S_PLAY_MINTTAUNT5
or player.mo.state == S_PLAY_MINTTAUNT6
or player.mo.state == S_PLAY_MINTTAUNT7
or player.mo.state == S_PLAY_MINTTAUNT8
or player.mo.state == S_PLAY_MINTTAUNT9
or player.mo.state == S_PLAY_MINTTAUNT10
or player.mo.state == S_PLAY_MINTTAUNT11
or player.mo.state == S_PLAY_MINTTAUNT12
or player.mo.state == S_PLAY_MINTDANCE
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end;end)

-- Landing

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.state == S_PLAY_RIPBOR then return end
if player.burststomp == true then return end
if player.mo.skin == "mint" 
and (player.mo.state == S_PLAY_STND
or player.mo.state == S_PLAY_WALK) 
and player.speed < 15*FRACUNIT
and (player.mo.eflags&MFE_JUSTHITFLOOR) 
and P_IsObjectOnGround(player.mo)
and (player.cmd.forwardmove == 0 
and player.cmd.sidemove == 0)

    player.mo.state = S_PLAY_MINTLANDALT
    S_StartSound(player.mo, sfx_s3k4c)
	for i = 1, 6
    local dust = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_SPINDUST)
    dust.angle = ANG60*i
    P_InstaThrust(dust, dust.angle, 15*FRACUNIT)
      end
   end
end)

-- Mint Thok

freeslot("sfx_mthok")

local function thokhud(v, player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.powers[pw_shield] == SH_FIREFLOWER then return end
if not player.powers[pw_shield] then return end
if player.mo and player.mo.valid and player.mo.skin == "mint"
and player.powers[pw_shield]

	v.drawString(187, 169, "Custom 1: Thok", V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_PERPLAYER|V_HUDTRANS|V_SKYMAP, "thin")
	end
end
hud.add(thokhud, "game")

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.powers[pw_shield] and not player.powers[pw_shield] == SH_FIREFLOWER then return end
if player.powers[pw_carry] == CR_MACESPIN then return end
if player.mo.skin == "mint"
and (player.pflags & PF_JUMPED)
and not (player.pflags & PF_THOKKED)
and not (player.pflags & PF_SHIELDABILITY)
and not P_IsObjectOnGround(player.mo)
and not player.mspinpress
and player.cmd.buttons & BT_SPIN
or player.hoprele == true
and not player.mspinpress
and player.cmd.buttons & BT_SPIN
and not P_IsObjectOnGround(player.mo)
and player.mo.skin == "mint"
and player.mintslopelaunch == true
and not player.powers[pw_shield]
and not (player.pflags & PF_SHIELDABILITY)


player.burststomp = false
player.mspinpress = false
player.momangle2 = R_PointToAngle2(0,0,player.mo.momx,player.mo.momy)
player.drawangle = player.mo.angle
P_SpawnThokMobj(player)
player.pflags = $1&~PF_SPINNING
player.hoprele = false

if player.mo.eflags & MFE_UNDERWATER
P_InstaThrust(player.mo,player.mo.angle,30*FRACUNIT)
else 
P_InstaThrust(player.mo,player.mo.angle,60*FRACUNIT)
end


local minteffect = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_THOK)
	minteffect.state, minteffect.angle = S_FACESTABBERSPEAR, player.drawangle+ANGLE_90
	minteffect.blendmode, minteffect.color = AST_ADD, SKINCOLOR_SILVER
	minteffect.destscale, minteffect.fuse, minteffect.tics = minteffect.scale*2, 5, 20
player.pflags = $|PF_THOKKED
player.powers[pw_strong] = $ & ~ STR_SPRING
player.powers[pw_strong] = $ & ~ STR_BUST
S_StartSoundAtVolume(player.mo, sfx_mthok, 255, player)
if player.mintslopelaunch == true
player.mo.state = S_PLAY_SLOPELAUNCH
else
player.mo.state = S_PLAY_ROLL
end
end
end)

-- Mint Thok (Shield Edition)

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if not player.powers[pw_shield] then return end
if player.powers[pw_shield] == SH_FIREFLOWER then return end
if player.powers[pw_carry] == CR_MACESPIN then return end
if player.mo.skin == "mint"
and (player.pflags & PF_JUMPED)
and not (player.pflags & PF_THOKKED)
and not P_IsObjectOnGround(player.mo)
and not player.mc1press
and player.cmd.buttons & BT_CUSTOM1
or player.hoprele == true
and not player.mc1press
and player.cmd.buttons & BT_CUSTOM1
and not P_IsObjectOnGround(player.mo)
and player.mo.skin == "mint"
and player.mintslopelaunch == true
and not player.burststomp == true


player.burststomp = false
player.mc1press = false
player.momangle2 = R_PointToAngle2(0,0,player.mo.momx,player.mo.momy)
player.drawangle = player.mo.angle
P_SpawnThokMobj(player)
player.pflags = $1&~PF_SPINNING
player.hoprele = false

if player.mo.eflags & MFE_UNDERWATER
P_InstaThrust(player.mo,player.mo.angle,30*FRACUNIT)
else 
P_InstaThrust(player.mo,player.mo.angle,60*FRACUNIT)
end

local minteffect = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_THOK)
	minteffect.state, minteffect.angle = S_FACESTABBERSPEAR, player.drawangle+ANGLE_90
	minteffect.blendmode, minteffect.color = AST_ADD, SKINCOLOR_SILVER
	minteffect.destscale, minteffect.fuse, minteffect.tics = minteffect.scale*2, 5, 20
player.pflags = $|PF_THOKKED
player.powers[pw_strong] = $ & ~ STR_SPRING
player.powers[pw_strong] = $ & ~ STR_BUST
S_StartSoundAtVolume(player.mo, sfx_mthok, 255, player)
if player.mintslopelaunch == true
player.mo.state = S_PLAY_SLOPELAUNCH
else
player.mo.state = S_PLAY_ROLL
end
end
end)

-- Speedshoes color

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" and player.powers[pw_sneakers]

local speedshoeseffect = P_SpawnGhostMobj(player.mo)
speedshoeseffect.fuse = 13
speedshoeseffect.blendmode = AST_ADD
speedshoeseffect.color = SKINCOLOR_SCARLET
speedshoeseffect.colorized = true
end;end)

-- Speedshoes color

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if maptol & TOL_MARIO then return end
if player.mo.skin == "mint" and player.powers[pw_invulnerability]

local invulneffect = P_SpawnGhostMobj(player.mo)
invulneffect.fuse = 13
invulneffect.blendmode = AST_ADD
invulneffect.color = SKINCOLOR_SWEETNAM
invulneffect.colorized = true
end;end)


-- Burst Stomp

freeslot("sfx_bstomp", "S_PLAY_MINTLAND", "S_PLAY_MINTLANDALT")
states[S_PLAY_MINTLAND] = {SPR_PLAY, SPR2_EDGE, 17, nil, 0, 0, S_PLAY_STND}
states[S_PLAY_MINTLANDALT] = {SPR_PLAY, SPR2_EDGE, 17, nil, 0, 0, S_PLAY_STND}

addHook("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" and player.burststomp == true
and player.powers[pw_carry] == CR_MACESPIN
player.burststomp = false
end;end)
 
addHook("PlayerThink",function(player) 
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.powers[pw_carry] == CR_MACESPIN then return end
if player.mo.momz > 1 
and player.burststomp == true 
and player.playerstate == PST_LIVE 
and not (P_PlayerInPain(player)) 
and not P_IsObjectOnGround(player.mo)
and not (player.mo.eflags & MFE_JUSTHITFLOOR)

player.pflags = $|PF_JUMPED
player.pflags = $1&~PF_THOKKED
player.pflags = $1&~PF_SPINNING
if player.mo.eflags & MFE_VERTICALFLIP
player.mo.state = S_PLAY_ROLL
else
player.mo.state = S_PLAY_SPRING
return end
end

if player.mo.skin == "mint" and player.spinhop == true
and not player.mspinpress == true
and not P_IsObjectOnGround(player.mo)
and player.playerstate == PST_LIVE
and not P_IsObjectInGoop(player.mo,player.mo.angle)	
and not (player.playerstate == PST_DEAD)
and not (P_PlayerInPain(player))
and player.cmd.buttons & BT_SPIN

player.mspinpress = false
player.mo.state = S_PLAY_ROLL
player.pflags = $|PF_THOKKED
player.pflags = $1&~PF_SPINNING
S_StartSound(player.mo,sfx_zoom)
player.spinhop = false
player.burststomp = true
P_InstaThrust(player.mo,player.mo.angle,25*FRACUNIT)
P_SetObjectMomZ(player.mo,-30*FRACUNIT,true)
player.powers[pw_strong] = $|STR_SPRING
player.powers[pw_strong] = $|STR_BUST
end

if player.playerstate == PST_DEAD
player.burststomp = false
end

if (P_PlayerInPain(player))
player.burststomp = false
end

if player.powers[pw_justsprung]
return
end

if P_IsObjectOnGround(player.mo)
and player.burststomp == true
and player.playerstate == PST_LIVE
and not (P_PlayerInPain(player))
and not (player.cmd.buttons & BT_JUMP)

player.mo.state = S_PLAY_ROLL
S_StartSound(player.mo, sfx_bstomp)
player.pflags = $1&~PF_THOKKED
player.pflags = $1&~PF_JUMPED
player.pflags = $|PF_SPINNING
player.burststomp = false
player.powers[pw_strong] = $ & ~ STR_SPRING
player.powers[pw_strong] = $ & ~ STR_BUST
P_Thrust(player.mo, player.mo.angle, 40*FRACUNIT)
player.powers[pw_strong] = $ & ~ STR_SPRING
player.powers[pw_strong] = $ & ~ STR_BUST
local minteffect = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_THOK)
	minteffect.state, minteffect.angle = S_FACESTABBERSPEAR, player.drawangle+ANGLE_90
	minteffect.blendmode, minteffect.color = AST_ADD, SKINCOLOR_SILVER
	minteffect.destscale, minteffect.fuse, minteffect.tics = minteffect.scale*2, 5, 20

else if player.burststomp == true
and P_IsObjectOnGround(player.mo)
and player.playerstate == PST_LIVE
and player.cmd.buttons & BT_JUMP
and not (P_PlayerInPain(player))

player.mo.state = S_PLAY_MINTLAND
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
if not S_SoundPlaying(player.mo, sfx_pstop)
S_StartSound(player.mo, sfx_pstop)
P_StartQuake(10*FRACUNIT, 1*TICRATE*1/2)
P_NukeEnemies(player.mo, player.mo, 500*FRACUNIT)
player.burststomp = false
player.powers[pw_strong] = $ & ~ STR_SPRING
player.powers[pw_strong] = $ & ~ STR_FLOOR
player.powers[pw_strong] = $ & ~ STR_BUST
end
end

if player.mo.state == S_PLAY_MINTLAND
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end

if player.burststomp == true
and (player.mo.momz > (9000*P_MobjFlip(player.mo)))
				
P_SetObjectMomZ(player.mo, FixedMul(-55*FRACUNIT, player.mo.scale))
end

if P_IsObjectInGoop(player.mo,player.mo.angle) or player.powers[pw_carry] == CR_MINECART 
player.burststomp = false
player.powers[pw_strong] = $ & ~ STR_SPRING
player.powers[pw_strong] = $ & ~ STR_BUST
end

if P_IsObjectInGoop(player.mo,player.mo.angle) or player.powers[pw_carry] == CR_MACESPIN
player.burststomp = false
player.powers[pw_strong] = $ & ~ STR_SPRING
player.powers[pw_strong] = $ & ~ STR_BUST
end

if P_IsObjectInGoop(player.mo,player.mo.angle) or player.powers[pw_carry] == CR_ROLLOUT
player.burststomp = false
player.powers[pw_strong] = $ & ~ STR_SPRING
player.powers[pw_strong] = $ & ~ STR_BUST
end

if P_IsObjectInGoop(player.mo,player.mo.angle) or player.powers[pw_carry] == CR_MACESPIN
player.burststomp = false
player.powers[pw_strong] = $ & ~ STR_SPRING
player.powers[pw_strong] = $ & ~ STR_BUST
end

if P_IsObjectInGoop(player.mo,player.mo.angle) or player.powers[pw_carry] == CR_DUSTDEVIL
player.burststomp = false
end

if P_IsObjectInGoop(player.mo,player.mo.angle) or player.powers[pw_carry] == CR_ROPEHANG
player.burststomp = false
player.powers[pw_strong] = $ & ~ STR_SPRING
player.powers[pw_strong] = $ & ~ STR_BUST
end

if player.burststomp == true
and not P_IsObjectInGoop(player.mo,player.mo.angle)	
				
local ghost = P_SpawnGhostMobj(player.mo)
ghost.fuse = 3
ghost.colorized = true
ghost.color = player.mo.color
end
end
end)

-- Burst Stomp + Slope Launch damage

addHook("PlayerCanDamage", function(p)
	if p.mo and p.mo.skin == "mint"
and p.burststomp == true
or p.mintslopelaunch == true
		return true
	end
end)

-- Spin launch

addHook ("AbilitySpecial",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if (P_PlayerInPain(player)) or (player.playerstate == PST_DEAD) or player.powers[pw_justsprung] then return end
if player.mo.skin == "mint"
and not P_IsObjectOnGround(player.mo)
and not (player.pflags & PF_THOKKED)
and not player.spinhop == true
and not player.burststomp == true
and player.charability == CA_NONE
and not (P_PlayerInPain(player))

player.mo.state = S_PLAY_SPINDASH
player.pflags = $1&~PF_JUMPED
player.pflags = $|PF_THOKKED
player.pflags = $|PF_SPINNING
player.spinhop = true
end
end)

addHook("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if (P_PlayerInPain(player)) or player.playerstate == PST_DEAD then return end
if player.mo.skin == "mint"
and not P_IsObjectOnGround(player.mo)
and player.spinhop == true
and not (player.cmd.buttons & BT_JUMP)
and not player.powers[pw_justsprung]

player.pflags = $|PF_THOKKED
player.pflags = $1&~PF_JUMPED
player.pflags = $1&~PF_SPINNING
player.spinhop = false
player.hoprele = true
if player.mintslopelaunch == true
player.mo.state = S_PLAY_SLOPELAUNCH
else
player.mo.state = S_PLAY_SPRING
end
S_StartSound(player.mo,sfx_kc5b)
if player.mintslopelaunch == true
P_SetObjectMomZ(player.mo,30*FRACUNIT,false)
else
P_SetObjectMomZ(player.mo,19*FRACUNIT,false)
for i = 1, 6
local dust = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_SPINDUST)
dust.angle = ANG60*i
P_InstaThrust(dust, dust.angle, 15*FRACUNIT)
end
if P_IsObjectInGoop(player.mo,player.mo.angle) or player.powers[pw_carry] == CR_ROPEHANG
player.spinhop = false
end
end
end
end)

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint"
and P_IsObjectOnGround(player.mo)

player.spinhop = false
player.hoprele = false
end
end)

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint"
and player.spinhop == true
and player.powers[pw_justsprung]

player.spinhop = false
S_StopSound(player.mo,sfx_spndsh)
end
end)

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint"
and not P_IsObjectOnGround(player.mo)
and player.spinhop == true
and player.mo.frame == A
and player.playerstate == PST_LIVE

S_StartSound(player.mo,sfx_spndsh)
end
end)

local function spring_twirl(mo)
	//assign player to a variable to make our lives a little bit easier (and our code a little bit readable)
	local player = mo.player
	//is player.twirl_angle assigned? if not, create it.
	if player.twirl_angle == nil then
		player.twirl_angle = 0	//starts at 0
	end
	//are we currently in the spring animation?
	if player.burststomp == true and player.panim == PA_SPRING and mo.skin == "mint" 
	or mo.momz > 1*FRACUNIT and mo.state == S_PLAY_MMOJUMP and player.burststomp == true and mo.skin == "mint" then //add to our twirl angle
		player.twirl_angle = player.twirl_angle + FixedAngle(mo.momz)
		//make our draw angle twirl angle, therefore showing us spinning when we hit a spring
		player.drawangle = player.twirl_angle
	end
end

addHook("MobjThinker", spring_twirl, MT_PLAYER)

-- Ledge Grab

function A_PlayerRidePAnim(mo, var1, var2)
	local player = mo.player
	if not (player) then return end
	
	player.panim = PA_RIDE
end

addHook("MobjMoveBlocked", function(pmo)
	if not (pmo and pmo.valid and pmo.skin == "mint") then return end
	if (P_IsObjectOnGround(pmo) or pmo.eflags & MFE_JUSTHITFLOOR) then return end
	
	local player = pmo.player
	if not (player and player.valid) then return end
	if P_PlayerInPain(player) then return end
	if player.powers[pw_carry] then return end
	if player.actionstate then return end
	
	if (player.climbing or player.pflags & PF_GLIDING or player.glidetime) then return end

	player.lastlinehit = -1
	player.lastsidehit = -1
	P_SlideMove(pmo)
	player.powers[pw_pushing] = 3
	
	local line = lines[player.lastlinehit]
	if (line and line.valid) then
		if (line.flags & ML_IMPASSIBLE) then return end
		
		local wallangle = R_PointToAngle2(pmo.x, pmo.y, P_ClosestPointOnLine(pmo.x, pmo.y, line))
		local gravitydirection = P_MobjFlip(pmo)
		local playerradius = FixedMul(skins[player.skin].radius, pmo.scale)
		local playerheight = FixedMul(skins[player.skin].height, pmo.scale)
		local playerspinheight = FixedMul(skins[player.skin].spinheight, pmo.scale)
		local playergrabrange = pmo.scale*87
		local playergrabz
		if (gravitydirection > 0) then
			playergrabz = pmo.z + pmo.height - (pmo.scale*10)
		elseif (gravitydirection < 0) then
			playergrabz = pmo.z + (pmo.scale*10)
		else
			return
		end
		
		local linex, liney = P_ClosestPointOnLine(pmo.x, pmo.y, line)
		local ledgex = linex + P_ReturnThrustX(nil, wallangle, playerradius)
		local ledgey = liney + P_ReturnThrustY(nil, wallangle, playerradius)
		local ledgez = pmo.z
		local ledgeheight = pmo.scale*3
		
		local floorz, ceilingz
		if (gravitydirection > 0) then
			floorz = P_FloorzAtPos(ledgex, ledgey, ledgez, playerheight + ledgeheight)
			ceilingz = P_CeilingzAtPos(ledgex, ledgey, ledgez, playerheight + ledgeheight)
		elseif (gravitydirection < 0) then
			floorz = P_FloorzAtPos(ledgex, ledgey, ledgez, -ledgeheight)
			ceilingz = P_CeilingzAtPos(ledgex, ledgey, ledgez, -ledgeheight)
		else
			return
		end
		
		if (floorz == ceilingz) then
			return
		end
		
		if (abs(floorz - ceilingz) <= playerspinheight)
		or (gravitydirection > 0) and (abs(pmo.z + pmo.height + playerheight) >= pmo.ceilingz)
		or (gravitydirection < 0) and (abs(pmo.z - playerheight) <= pmo.floorz)
		or (gravitydirection == 0)
		then
			return
		end
		
		local ledgegrabrange, ledgegrabz
		if (gravitydirection > 0) then
			ledgegrabrange = (playergrabz < floorz) and (playergrabz > (floorz - playergrabrange))
			ledgegrabz = floorz - playerheight
		elseif (gravitydirection < 0) then
			ledgegrabrange = (playergrabz > ceilingz) and (playergrabz < (ceilingz + playergrabrange))
			ledgegrabz = ceilingz
		end
		
		if (ledgegrabrange and ledgegrabz)
			and ((pmo.momz*gravitydirection) < (pmo.scale*2))
			and (player.cmd.forwardmove)
		then
			if (pmo.state ~= S_PLAY_RIDE) 
			then
				S_StartSound(pmo, sfx_s3k4a)
				pmo.state = S_PLAY_RIDE
				P_ResetPlayer(player)
				player.ledge_bfr = true
				player.spinhop = false
				player.burststomp = false
				player.mintslopelaunch = false
				player.mo.rollangle = 0
				player.powers[pw_strong] = $ & ~ STR_SPRING
                player.powers[pw_strong] = $ & ~ STR_BUST
				else player.ledge_bfr = false
			end
			if (pmo.state == S_PLAY_RIDE) then
				pmo.z = ledgegrabz
				pmo.tics = 7
				P_InstaThrust(pmo, wallangle, playerradius/4)
				pmo.momz = max(-pmo.scale*2, min($, pmo.scale*2))
				player.drawangle = wallangle
				
				if (player.cmd.buttons & BT_JUMP) and not (player.ledge_bfr)
					P_DoJump(player, true)
			end
			return true
		end
	end
	end
end, MT_PLAYER)

-- The remains of Golden Mint + hyperform

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and (player.charflags & SF_SUPER)
	player.charflags = $ &~SF_SUPER
end
end)

addHook("PlayerThink",  function(p)
if not ((p.mo and p.mo.valid) and p.mo.health) return end
if p.mo.skin == "mint" then
	if p.hyper == nil
		local hyper = {
		isunlocked = false,
		capable = false,
		}
		if p.mo
			p.hyper = hyper
		else
			p.hyper = nil
		end
		end
	end
end)

-- Checks

-- Spawn Checks

addHook("PlayerSpawn", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
	if player.mo and player.mo.valid and player.mo.skin == "mint"
	player.burststomp = false
	player.spinhop = false
	player.hoprele = false
	player.mintvictorypose = false
	player.mintslopelaunch = false
    player.minthugged = false
    player.deadmint = false
	end
end)

-- Button Checks

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint"
and player.cmd.buttons & BT_CUSTOM1

player.mc1press = true
else
player.mc1press = false
end
end)

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint"
and player.cmd.buttons & BT_CUSTOM2

player.mc2press = true
else
player.mc2press = false
end
end)

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint"
and player.cmd.buttons & BT_CUSTOM3

player.mc3press = true
else
player.mc3press = false
end
end)

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint"
and player.cmd.buttons & BT_TOSSFLAG

player.mtfpress = true
else
player.mtfpress = false
end
end)

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint"
and player.cmd.buttons & BT_SPIN

player.mspinpress = true
else
player.mspinpress = false
end
end)

addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint"
and player.cmd.buttons & BT_JUMP

player.mjpress = true
else
player.mjpress = false
end
end)

-- Mint in Tutorial

addHook("PlayerSpawn", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if gamemap == 1000 and maptol & TOL_SP
R_SetPlayerSkin(player, "mint")
end
end)

-- Mario mode stuffs

freeslot("S_PLAY_MMOJUMP", "S_PLAY_MMAJUMP", "SPR2_MINT", "sfx_mjump2", "sfx_m1up")
states[S_PLAY_MMOJUMP] = {SPR_PLAY, SPR2_MINT}
states[S_PLAY_MMAJUMP] = {SPR_PLAY, SPR2_MINT}

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" and maptol & TOL_MARIO
and player.mo.state == S_PLAY_JUMP
or player.mo.state == S_PLAY_SPRING and maptol & TOL_MARIO
and player.mo.skin == "mint"
or player.mo.state == S_PLAY_FALL and maptol & TOL_MARIO
and player.mo.skin == "mint"
and not (player.mo.eflags&MFE_JUSTHITFLOOR) 

player.mo.state = S_PLAY_MMOJUMP

if player.mo.skin == "mint" and maptol & TOL_MARIO
and player.mo.state == S_PLAY_MMOJUMP 
and player.mo.momz < 1
player.mo.state = S_PLAY_MMAJUMP
if player.mo.state == S_PLAY_MMAJUMP and player.mo.momz > 1
player.mo.state = S_PLAY_MMOJUMP
end
end
end
end)

-- Fire flower stuffs

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" and not player.powers[pw_invulnerability]
and (player.powers[pw_shield] & SH_FIREFLOWER)

player.mo.color = SKINCOLOR_KETCHUP
end
end)

-- Misc

-- Momentum

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo and player.mo.valid and player.mo.skin == "mint"
and player.speed > player.normalspeed
and P_IsObjectOnGround(player.mo)
and (player.cmd.forwardmove or player.cmd.sidemove)
and not (player.pflags & PF_STARTDASH)

player.mo.friction = FRACUNIT
end
end)

freeslot("SPR2_FROZ")

-- Mint life icon

local function MintLifeIcon(v, bor)
if not ((bor.mo and bor.mo.valid) and bor.mo.skin == "mint") return end
	
	if not (bor.powers[pw_carry] == CR_NIGHTSMODE)
	and not (maptol & TOL_NIGHTS)
    and bor.mo.skin == "mint"
		local face = v.getSprite2Patch(bor.mo.skin, SPR2_XTRA, (bor.powers[pw_super] != 0), 0, 0)
		v.drawScaled(1*FRACUNIT, 161*FRACUNIT, 1*FRACUNIT, face, V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_PERPLAYER|V_HUDTRANS, v.getColormap(bor.mo.skin, bor.mo.color))
	end
end

hud.add(MintLifeIcon)

-- Dead Mint

freeslot("sfx_rip", "sfx_bor", "SPR2_DED")

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" and player.mo.state == S_PLAY_DEAD
and not player.deadmint == true

P_SetObjectMomZ(player.mo, 0*FRACUNIT, false)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" and player.deadtimer >= TICRATE then
				if player.deadtimer == TICRATE
                    player.deadmint = true
					player.mo.momz = 12*player.mo.scale * P_MobjFlip(player.mo)
					player.mo.spritexoffset = 0
					player.mo.spriteyoffset = 0
					S_StartSound(player.mo, sfx_bor)
                    player.sprite2 = SPR2_DED
                    player.spinhop = false
                    player.hoprele = false
				end
end;end)

-- Funny gravity moment

freeslot("SPR2_LOOK")

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" 
and (player.mo.state == S_PLAY_STND)
and player.mo.eflags & MFE_VERTICALFLIP
and player.speed == 0

player.mo.sprite2 = SPR2_LOOK
end
end)

-- Mint Dance

freeslot("S_PLAY_MINTDANCE", "SPR2_EPOC")
states[S_PLAY_MINTDANCE] = {SPR_PLAY, SPR2_EPOC, 2, nil, 0, 0, S_PLAY_MINTDANCE}

addHook("PlayerMsg", function(player, typ, target, msg)
if (typ) then return end
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if not (player.mo.skin == "mint") then return end
if maptol & TOL_MARIO and player.powers[pw_invulnerability] then return end
if player.speed then return end

msg = $:lower()
if msg == "epoc"
and player.speed == 0
and (P_IsObjectOnGround(player.mo))
and gamestate == GS_LEVEL
or msg == "Epoc"
and player.speed == 0
and (P_IsObjectOnGround(player.mo))
and gamestate == GS_LEVEL

player.mo.state = S_PLAY_MINTDANCE
end
if player.mo.state == S_PLAY_MINTDANCE
player.powers[pw_nocontrol] = 32768
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo.skin == "mint" and maptol & TOL_MARIO
and player.powers[pw_invulnerability]
and player.mo.state == S_PLAY_STND
and player.speed == 0
and (P_IsObjectOnGround(player.mo))

player.mo.state = S_PLAY_MINTDANCE
end;end)


-- Minecart escape

local function carthud(v, player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if not player.powers[pw_carry] == CR_MINECART then return end
if player.mo and player.mo.valid and player.mo.skin == "mint"
and player.powers[pw_carry] == CR_MINECART
	v.drawString(187, 189, "Custom 3: Eject", V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_PERPLAYER|V_HUDTRANS|V_SKYMAP, "thin")
	end
end
hud.add(carthud, "game")

addHook("MobjThinker",function(minecart)
if not minecart or not minecart.valid or not minecart.target
return end
if ((minecart.target) and (minecart.target.valid))
and minecart.target.skin == "mint"	
local p = minecart.target.player	
if (p.cmd.buttons & BT_CUSTOM3)
and (p.powers[pw_carry] == CR_MINECART)
p.powers[pw_carry] = CR_NONE		
p.mo.momx,p.mo.momy = minecart.momx,minecart.momy			
p.pflags = $|PF_JUMPED &~PF_THOKKED
p.mo.momz = (8*p.mo.scale)*P_MobjFlip(p.mo)
P_DoJump(p,true)
p.mo.state = S_PLAY_FALL
minecart.target = nil
p.pflags = $|PF_THOKKED
return
end;end;end,MT_MINECART)

-- Hug Support

freeslot("S_PLAY_MINTKICK", "SPR2_KICK")
states[S_PLAY_MINTKICK] = {SPR_PLAY, SPR2_KICK, 17, nil, 0, 0, S_PLAY_FALL}

rawset(_G, "Allhugs", {})
rawset(_G, "Hugbutton", {})
rawset(_G, "Heartbutton", {})
rawset(_G, "Hugsound", {})
rawset(_G, "Yelpsound", {})

Allhugs["mint"] = true
Allhugs["sonic"] = true
Allhugs["tails"] = true
Allhugs["knuckles"] = true
Allhugs["amy"] = true
Allhugs["fang"] = true
Allhugs["metalsonic"] = true
Hugsound["mint"] = sfx_s3k4a
Yelpsound["mint"] = sfx_mjump

-- Mint Kick

freeslot("S_PLAY_ALLHUG", "sfx_mkick", "sfx_whoosh")

addHook("MobjThinker",function(amy)
if amy 
and amy.state == S_ROSY_HUG 
and amy.target.skin == "mint"

amy.target.state = S_PLAY_MINTKICK
P_SetObjectMomZ(amy,25*FRACUNIT,false)
P_DamageMobj(amy, amy.target, amy.target)
S_StopSound(amy, sfx_cdpcm6)
S_StartSound(amy.target, sfx_mkick)
P_SpawnMobjFromMobj(amy, 0, 0, 0, MT_SPINDUST)
amy.target.player.minthugged = true
end
end)

-- Mint Kick 2: Electric Boogaloo

local function kickhud(v, player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if not player.hugged then return end
if player.mo and player.mo.valid and player.mo.skin == "mint"
and player.hugged
and not player.hugging

	v.drawString(187, 189, "Custom 3: Reject Hug", V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_PERPLAYER|V_HUDTRANS|V_SKYMAP, "thin")
    v.drawString(187, 179, "Must be touching a player!", V_PERPLAYER|V_HUDTRANS|V_YELLOWMAP|V_SNAPTOBOTTOM|V_SNAPTORIGHT, "thin")
	end
end
hud.add(kickhud, "game")

addHook("MobjCollide",function(amy, mint)
if amy
and amy.state == S_PLAY_ALLHUG
and amy.skin
and mint.player.hugged
and amy.player.hugging
and not mint.player.hugging
and mint.player.cmd.buttons & BT_CUSTOM3

mint.player.minthugged = true
mint.player.hugged = false
amy.player.hugging = false
P_DoPlayerPain(amy.player, mint, mint)
P_SetObjectMomZ(amy,25*FRACUNIT,false)
P_SpawnMobjFromMobj(amy, 0, 0, 0, MT_SPINDUST)
S_StopSound(amy, Hugsound[amy.player.skin])
if not S_SoundPlaying(amy, sfx_whoosh)
S_StartSound(amy, sfx_whoosh)
end
end
end, MT_PLAYER)

-- Amy Cameo

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo and player.mo.valid and (player.mo.skin == "mint")
and player.minthugged

player.mo.state = S_PLAY_MINTKICK
player.minthugged = false
if not S_SoundPlaying(player.mo, sfx_mkick)
S_StartSound(player.mo, sfx_mkick)
end
end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mo and player.mo.valid and (player.mo.skin == "mint")
and player.mo.state == S_PLAY_MINTKICK
P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
end;end)

-- Invincibility Music

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
	if player.mo and player.mo.valid and (player.mo.skin == "mint") then
		
			if S_MusicName(player) == "_inv"
			and S_MusicName(player) != "MINV"
			S_ChangeMusic("MINV", true, player) 
	   end  
    end
end)

-- Speed Shoes Music

addHook("MusicChange", function(oldname, newname)
if consoleplayer
		local species = skins[consoleplayer.skin].name
		
		if species == "mint"		
			if newname == "_shoes"
			return "MSHOES"
	   end  
    end
	end
end)

-- Level Clear Music

addHook("MusicChange", function(oldname, newname)
if consoleplayer
		local species = skins[consoleplayer.skin].name
		
		if species == "mint"		
			if newname == "_clear"
			return "MCLEAR"
	   end  
    end
	end
end)

-- Stretch

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return end
if player.mintslopelaunch == true then return end
if player.mo.eflags & MFE_VERTICALFLIP then return end
if player.mo.skin == "mint"

player.mo.spritexscale = FRACUNIT+FixedDiv(player.mo.momz/96,player.mo.scale)
player.mo.spriteyscale = FRACUNIT-FixedDiv(player.mo.momz/96,player.mo.scale)
player.mintstretch = true
end
end)

addHook("PlayerThink", function(player)
if player.mo
and player.mintstretch
and P_IsObjectOnGround(player.mo)

player.mo.spritexscale = player.mo.scale
player.mo.spriteyscale = player.mo.scale
player.mintstretch = false
end
end)

-- Faceplant

freeslot("S_PLAY_RIPBOR", "SPR2_OOF_")
states[S_PLAY_RIPBOR] = {SPR_PLAY, SPR2_OOF, 2, nil, 0, 0, S_PLAY_RIPBOR}

addHook("PlayerSpawn", function(player)
player.oldmomz = 0
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.powers[pw_carry] == CR_MACESPIN then return end
if not (player.playerstate == PST_LIVE) then return end
if player.burststomp == true then return end
if player.powers[pw_shield] == SH_BUBBLEWRAP then return end
if player.powers[pw_shield] == SH_ELEMENTAL then return end

local ripborcamera = skins[player.mo.skin].camerascale
	if player.camerascale != ripborcamera
		player.camerascale = ripborcamera
	end

	if player.mo.skin == "mint"
	and not (P_PlayerInPain(player))
			
			if player.oldmomz < -30*FRACUNIT and not P_IsObjectOnGround(player.mo) and not player.burststomp == true and not player.spinhop == true 
			player.mo.state = S_PLAY_PAIN
			player.pflags = $1&~PF_JUMPED
            player.pflags = $|PF_THOKKED
            player.pflags = $|PF_SPINNING
			
		elseif player.oldmomz < -30*FRACUNIT and P_IsObjectOnGround(player.mo) and not player.cmd.forwardmove and not player.cmd.sidemove and not player.cmd.buttons and not player.burststomp == true and not player.spinhop == true then
			
			S_StartSound(player.mo, sfx_s3k9b)
			player.mo.state = S_PLAY_RIPBOR
			player.powers[pw_nocontrol] = 32768
			P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
			P_StartQuake(20*FRACUNIT, 1*TICRATE*1/2)
			for i = 1, 6
local dust = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_SPINDUST)
dust.angle = ANG60*i
P_InstaThrust(dust, dust.angle, 15*FRACUNIT)
end
			end
			if player.mo.state == S_PLAY_RIPBOR
			P_InstaThrust(player.mo,player.mo.angle,0*FRACUNIT)
		end
		if player.mo.state == S_PLAY_PAIN and player.mo.momz > 1*FRACUNIT
		player.pflags = $1&~PF_SPINNING
		end
	end
		if player.mo.state == S_PLAY_RIPBOR
		player.camerascale = max(35000, ripborcamera-(24000-(player.mo.tics*1200)))
		end
        player.oldmomz = player.mo.momz
end)

-- Slope launch

freeslot("sfx_mlnch", "S_PLAY_SLOPELAUNCH", "SPR2_LNCH")
states[S_PLAY_SLOPELAUNCH] = {SPR_PLAY, SPR2_LNCH}

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
	if player.powers[pw_justlaunched] == 1 
	and (player.pflags & PF_JUMPED)
	and player.speed > 50*FRACUNIT
	and player.mo.momz > 1
	and player.mo.skin == "mint"
	and player.playerstate == PST_LIVE
	and not player.burststomp == true
	
	player.pflags = $|PF_JUMPED
	player.pflags = $1&~PF_SPINNING
	player.mintslopelaunch = true
	player.mo.state = S_PLAY_SLOPELAUNCH
	P_SetObjectMomZ(player.mo,40*FRACUNIT,false)
	P_StartQuake(10*FRACUNIT, 9)
	S_StartSound(player.mo, sfx_mlnch)
	S_StartSound(player.mo, sfx_zoom)
	S_StartSound(player.mo, sfx_kc5b)
    end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if not player.mo.skin == "mint" then return end
if player.mintslopelaunch == false then return end
	if player.mintslopelaunch == true
	and player.mo.skin == "mint"
	and player.playerstate == PST_LIVE
	player.mo.rollangle = $ - FixedAngle(player.speed*TICRATE)

local re = i*ANGLE_45
local minteffect = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_GHOST)
	minteffect.blendmode, minteffect.color = AST_ADD, player.mo.color
	minteffect.fuse = TICRATE*2 
	minteffect.angle = re
	minteffect.colorized = true
	P_InstaThrust(minteffect, minteffect.angle, FRACUNIT)
	P_SetObjectMomZ(minteffect, FRACUNIT*8, false)
	for i = 1, 6
local mintflair = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_IVSP)
mintflair.angle = ANG60*i
P_InstaThrust(mintflair, mintflair.angle, 0*FRACUNIT)	
	
    if player.mo.momz < 1
	and player.mintslopelaunch == true
	and player.mo.skin == "mint"
	player.mo.rollangle = 0
	player.mintslopelaunch = false
	player.pflags = $1&~PF_SPINNING
	player.pflags = $|PF_THOKKED
    player.spinhop = false
if player.burststomp == true
player.mo.state = S_PLAY_ROLL
else player.mo.state = S_PLAY_FALL
end
		for a=1,64 do
            local slopelaunchfinish = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_IVSP)
            slopelaunchfinish.momx = P_RandomRange(-32768, 32767) * 64
            slopelaunchfinish.momy = P_RandomRange(-32768, 32767) * 64
            slopelaunchfinish.momz = P_RandomFixed() * 5
			S_StartSound(player.mo, sfx_s3ka0)
			S_StartSound(player.mo, sfx_s3kb8)
			end
	end
if player.mintslopelaunch == true and player.mo.state == S_PLAY_FALL
player.mo.rollangle = 0
end
	if (player.mo.eflags&MFE_JUSTHITFLOOR) 
	and player.mintslopelaunch == true
	and player.mo.skin == "mint"
	player.mo.state = S_PLAY_FALL
	player.mo.rollangle = 0
	player.mintslopelaunch = false
	player.pflags = $1&~PF_SPINNING
	player.pflags = $|PF_THOKKED
		for a=1,64 do
            local slopelaunchfinish = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_IVSP)
            slopelaunchfinish.momx = P_RandomRange(-32768, 32767) * 64
            slopelaunchfinish.momy = P_RandomRange(-32768, 32767) * 64
            slopelaunchfinish.momz = P_RandomFixed() * 5
			S_StartSound(player.mo, sfx_s3ka0)
			S_StartSound(player.mo, sfx_s3kb8)
			end
	end
	end
	end
end)

-- Slope Launch collision

addHook("MobjMoveBlocked", function(mo)
local player = mo.player
if mo.skin == "mint"
and player.mintslopelaunch 
	P_SetObjectMomZ(mo,24*FRACUNIT,false)
	P_Thrust(mo, mo.angle, -20*FRACUNIT)
	mo.angle = R_PointToAngle2(0, 0, mo.momx, mo.momy)
	S_StartSound(mo, sfx_s3k49)
	end
end, MT_PLAYER)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mintslopelaunch == true
and not player.mo.skin == "mint"
player.mintslopelaunch = false
for a=1,64 do
            local slopelaunchfinish = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_IVSP)
            slopelaunchfinish.momx = P_RandomRange(-32768, 32767) * 64
            slopelaunchfinish.momy = P_RandomRange(-32768, 32767) * 64
            slopelaunchfinish.momz = P_RandomFixed() * 5
			S_StartSound(player.mo, sfx_s3ka0)
			S_StartSound(player.mo, sfx_s3kb8)
			end
			end
end)

addHook("PlayerThink", function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.mintslopelaunch == true
and (P_PlayerInPain(player)) 

player.mintslopelaunch = false
player.mo.rollangle = 0
end;end)						

addHook("ThinkFrame", do
for player in players.iterate do
if player.mo and player.mo.valid
if player.mo.skin == "mint" and not player.landsound == true
if player.pflags & PF_JUMPED or player.pflags & PF_THOKKED or player.pflags & PF_STASIS or player.pflags & PF_JUMPSTASIS return end
if (player.panim == PA_IDLE or player.panim == PA_WALK or player.panim == PA_RUN or player.panim == PA_DASH)
and not P_IsObjectOnGround(player.mo)
and player.mo.momz < 1
and not player.powers[pw_carry]
player.mo.state = S_PLAY_FALL
end
if (player.panim == PA_IDLE or player.panim == PA_WALK or player.panim == PA_RUN or player.panim == PA_DASH)
and not P_IsObjectOnGround(player.mo)
and player.mo.momz > 0
and not player.powers[pw_carry]
player.mo.state = S_PLAY_SPRING
end
end
end
end
end)

-- M I N T   O V E R L O A D

freeslot("sfx_mboom")
sfxinfo[sfx_mboom] = {
}

freeslot("SPR2_LAVA")
addHook ("PlayerThink",function(player)
if not ((player.mo and player.mo.valid) and player.mo.health and player.mo.skin == "mint") then return false end
if player.powers[pw_invulnerability] and maptol & TOL_MARIO then return end

if player.mo.color == SKINCOLOR_MINT
	and player.mo.skin == "mint"
	and player.playerstate == PST_LIVE

	    CONS_Printf(player, "\x82"+"ERROR\x80: TOO MUCH MINT. Please change your color.")
		P_DamageMobj(player.mo, nil, nil, 0, DMG_INSTAKILL)
		P_BlackOw(player)		
		S_StartSound(player.mo, sfx_mboom)
		S_StartSound(player.mo, sfx_kc3b)
		S_StartSound(player.mo, sfx_bkpoof)
		S_StartSound(player.mo, sfx_s3k4e)
		P_StartQuake(6*FRACUNIT, 9)
		player.mo.sprite2 = SPR2_LAVA
		for a=1,64 do
            local explode = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_BOSSEXPLODE)
            explode.momx = P_RandomRange(-32768, 32767) * 64
            explode.momy = P_RandomRange(-32768, 32767) * 64
            explode.momz = P_RandomFixed() * 32
		end
		end
end)

-- Animation bugfixes

addHook ("PlayerThink",function(player)
if player.mo
and player.mo.valid
and player.mo.skin != "mint"
and (player.mo.state == S_PLAY_MINTWAIT0
or player.mo.state == S_PLAY_MINTWAIT1
or player.mo.state == S_PLAY_MINTWAIT2
or player.mo.state == S_PLAY_MINTWAIT3
or player.mo.state == S_PLAY_MINTWAIT4
or player.mo.state == S_PLAY_MINTWAIT5
or player.mo.state == S_PLAY_MINTWAIT6
or player.mo.state == S_PLAY_MINTTAUNT1
or player.mo.state == S_PLAY_MINTTAUNT2
or player.mo.state == S_PLAY_MINTTAUNT3
or player.mo.state == S_PLAY_MINTTAUNT4
or player.mo.state == S_PLAY_MINTTAUNT5
or player.mo.state == S_PLAY_MINTTAUNT6
or player.mo.state == S_PLAY_MINTTAUNT7
or player.mo.state == S_PLAY_MINTTAUNT8
or player.mo.state == S_PLAY_MINTTAUNT9
or player.mo.state == S_PLAY_MINTTAUNT10
or player.mo.state == S_PLAY_MINTTAUNT11
or player.mo.state == S_PLAY_MINTTAUNT12
or player.mo.state == S_PLAY_RELA1
or player.mo.state == S_PLAY_RELA2
or player.mo.state == S_PLAY_RELA3
or player.mo.state == S_PLAY_RELA4
or player.mo.state == S_PLAY_RELA5
or player.mo.state == S_PLAY_RELA6
or player.mo.state == S_PLAY_RELA7
or player.mo.state == S_PLAY_RELA8
or player.mo.state == S_PLAY_RELA9
or player.mo.state == S_PLAY_RELA10
or player.mo.state == S_PLAY_RELA11
or player.mo.state == S_PLAY_RELA12
or player.mo.state == S_PLAY_RELA13
or player.mo.state == S_PLAY_RELA14
or player.mo.state == S_PLAY_RELA15
or player.mo.state == S_PLAY_RIPBOR
or player.mo.state == S_PLAY_MINTLAND
or player.mo.state == S_PLAY_MINTLANDALT)

player.mo.state = S_PLAY_STND
end
end)


-- Captions

sfxinfo[sfx_mjump].caption = "\x88"+"Mint Jump"+"\x80"
sfxinfo[sfx_mboom].caption = "\x88"+"rip bor"+"\x80"
sfxinfo[sfx_bor].caption = "\x88"+"rip bor"+"\x80"
sfxinfo[sfx_mlnch].caption = "\x88"+"Slope Launch"+"\x80"
sfxinfo[sfx_wav].caption = "\x88"+"Thumbs up!"+"\x80"
sfxinfo[sfx_bstomp].caption = "\x88"+"Burst Stomp Spin"+"\x80"
sfxinfo[sfx_mthok].caption = "\x88"+"Mint Thok"+"\x80"
sfxinfo[sfx_mkick].caption = "\x88"+"NOW THAS ALOTTA DAMAGE"+"\x80"
sfxinfo[sfx_whoosh].caption = "\x88"+"Whoosh"+"\x80"

-- Mint Tutorial be like:

COM_AddCommand("helpmemint", function(p, arg)
	if arg == nil
		CONS_Printf(p,"\n"+"A help page for Mint. Options are spinlaunch, burststomp, and slopelaunch. (i.e helpmemint burststomp)")
		S_StartSound(nil, sfx_ncspec, p)
	elseif arg == "spinlaunch"
		CONS_Printf(p, "\n"+"Jump (After Jumping): Spin Launch:\nThe Spin Launch is Mint's primary ability, it is a double jump.")
		 S_StartSound(nil, sfx_s1a1, p)
	elseif arg == "burststomp"
		CONS_Printf(p, "\n"+"Spin Launch + Spin: Burst Stomp:\nThe Burst Stomp's function is basically a faster Drop Dash, but if you hold jump whilst doing it, you'll do an actual stomp instead.")
		 S_StartSound(nil, sfx_s1a1, p)
	elseif arg == "slopelaunch"
		CONS_Printf(p, "\n"+"If you go JUST fast enough when jumping off a slope, you can get some INSANE air when you launch from it.")
		 S_StartSound(nil, sfx_s1a1, p)	 
	elseif arg == "re-"
		CONS_Printf(p, "\n"+"re-")
		S_StartSound(nil, sfx_s1a1, p)
	elseif arg == "hello" or arg == "hi" or arg == "hey" or arg == "yo"
		CONS_Printf(p, "\n"+"wsg B)")
	    S_StartSound(nil, sfx_s1a1, p)
	else CONS_Printf(p, "\n"+"Invalid.")
	    S_StartSound(nil, sfx_adderr, p)
	end
end)

-- Credits 

rawset(_G, "MintCredits", {})
local m = MintCredits
m.credits = TICRATE*2
addHook("ThinkFrame", do
	if titlemapinaction then return end
	if m.credits
		m.credits = $-1
		if not m.credits
		S_StartSound(nil, sfx_s1bf)
		print("\x88"+"----------"+"\x85"+"==============="+"\x88"+"--------------------------"+"\n")
		print("\n"+"\x88"+"Mint\x80 the\x85 AmyDroid\x80 [v3.0.2] - By\x88 SSNeoMint"+"\n")
		print("\n"+"\x88"+"SSNeoMint\x80 - Spriter, Main Coder"+"\n")
		print("\n"+"\x84"+"Jesus.B\x80 - Secondary Coder"+"\n")
		print("\n"+"\x82"+"KevinTSP\x80 - Early development help"+"\n")
		print("\n"+"Enter helpmemint in the console to see Mint's help page!"+"\n")
		print("\x88"+"----------"+"\x85"+"==============="+"\x88"+"--------------------------"+"\n")
		end
	end
end)