Module:SSBC-Calc

From Mizuumi Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:SSBC-Calc/doc

local p = {}

-- Calculate weights
function p.weight(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	if value < 0.20 then
		text = "Balloonweight"
	elseif value >= 0.20 and value < 0.21 then
		text = "Featherweight"
	elseif value >= 0.21 and value < 0.24 then
		text = "Lightweight"
	elseif value >= 0.24 and value < 0.26 then
		text = "Middleweight"
	elseif value >= 0.26 and value < 0.30 then
		text = "Heavyweight"
	elseif value > 0.30 then
		text = "Super Heavyweight"
	else
		text = "Invalid Value"
	end
	
	return text
end

function p.gravity(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	if value < 0.20 then
		text = "Very Low"
	elseif value >= 0.20 and value < 0.24 then
		text = "Low"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "High"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very High"
	elseif value > 0.50 then
		text = "Super High"
	else
		text = "Invalid Value"
	end
	
	return text
end

function p.maxJumps(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	if value < 3 then
		local additionalJumps = value - 3
		text = additionalJumps .. " Additional Jumps"
	elseif value == 3 then
		text = "Average"
	else
		text = "Invalid Value"
	end
	
	return text
end

function p.walkSpeed(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	if value < 1.70 then
		text = "Very Slow"
	elseif value >= 1.70 and value < 1.95 then
		text = "Slow"
	elseif value >= 1.95 and value < 2.20 then
		text = "Average"
	elseif value >= 2.20 and value < 2.40 then
		text = "Fast"
	elseif value >= 2.40 and value < 2.70 then
		text = "Very Fast"
	elseif value > 2.70 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end
	
	return text
end

function p.runStart(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	if value < 2.10 then
		text = "Very Slow"
	elseif value >= 2.10 and value < 2.90 then
		text = "Slow"
	elseif value >= 2.90 and value < 3.40 then
		text = "Average"
	elseif value >= 3.40 and value < 4.00 then
		text = "Fast"
	elseif value >= 4.00 and value < 5.00 then
		text = "Very Fast"
	elseif value > 5.00 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end
	
	return text
end

function p.runAccel(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- I don't know the relationship between acceleration and speed here to make a determination on this
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.runSpeed(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- Set values here
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.friction(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- Set values here
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.jumpMomentum(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- Set values here
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.jumpSpeed(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- Set values here
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.midJumpSpeed(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- Set values here
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.shortHopSpeed(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- Set values here
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.airSpeed(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- Set values here
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.fallSpeed(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- Set values here
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.fastFall(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- Set values here
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.airAccel(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- Set values here
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.airFriction(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	-- Set values here
	--[[if value < 0.20 then
		text = "Very Slow"
	elseif value >= 0.20 and value < 0.24 then
		text = "Slow"
	elseif value >= 0.24 and value < 0.25 then
		text = "Average"
	elseif value >= 0.25 and value < 0.30 then
		text = "Fast"
	elseif value >= 0.30 and value < 0.50 then
		text = "Very Fast"
	elseif value > 0.50 then
		text = "Super Fast"
	else
		text = "Invalid Value"
	end]]--
	
	return text
end

function p.airDash(frame)
	local value = tonumber(frame.args[1])
	local text = ""
	
	if value <= 0.00 then
		text = "No Airdash"
	elseif value > 0 and value <= 5 then
		text = "Very Slow"
	elseif value >= 5 and value < 8 then
		text = "Slow"
	elseif value >= 8 and value < 9 then
		text = "Average"
	elseif value <= 9 then
		text = "Fast"
	else
		text = "Invalid Value"
	end
	
	return text
end

function p.specialActions(frame)
	local crawl	= frame.args['crawl']
	local wallJump	= frame.args['wallJump']
	local wallCling	= frame.args['wallCling']
	local wallClimb	= frame.args['wallClimb']
	local float	= frame.args['float']
	local floatInfo	= frame.args['floatInfo']
	local glide	= frame.args['glide']
	local djc	= frame.args['djc']
	local zAir	= frame.args['zAir']
	local zAirInfo	= frame.args['zAirInfo']
	local text = ""
	
	if crawl == "yes" or crawl == "1" then text = "Crawl" end
	if wallJump == "yes" or wallJump == "1" then text = addComma(text) .. "Wall Jump" end
	if wallCling == "yes" or wallCling == "1" then text = addComma(text) .. "Wall Cling" end
	if wallClimb == "yes" or wallClimb == "1" then text = addComma(text) .. "Wall Climb" end
	if float == "yes" or float == "1" then
		text = addComma(text) .. "Float"
		if floatInfo and string.len(floatInfo) > 0 then
			text = text .. " (" .. floatInfo .. ")"
		end
	end
	if glide == "yes" or glide == "1" then text = addComma(text) .. "Glide" end
	if djc == "yes" or djc == "1" then text = addComma(text) .. "Double Jump Cancel" end
	if zAir == "yes" or zAir == "1" then
		text = addComma(text) .. "ZAir"
		if zAirInfo and zAirInfo.len(zAirInfo) > 0 then
			text = text .. " (" .. zAirInfo .. ")"
		end
	end
	
	if string.len(text) == 0 then text = "None" end
	
	return text
end

function addComma(text)
	if string.len(text) > 0 then
		return text .. ", "
	else
		return text
	end
end

return p