//ok so Rem made every line of code here all i did was make it work with the colors by copy pasting it way too many times
//https://mb.srb2.org/addons/skincolor-effects.933/

local flashColor = skincolors[SKINCOLOR_COOLFLAMEWAVE]
local flashDelay = 1

local rampPos = 1
local rampDir = true
local ramps = {}

//convert the ramp to a table
ramps[1] = {}
for i = 0, 15, 1
	ramps[1][i+1] = flashColor.ramp[i]
end

//create the offset versions of the ramp
for i = 2, 16,1
	ramps[i] = {}

	for pos,val in ipairs(ramps[i-1]) do
		if not (pos == 16) then
			ramps[i][pos+1] = val
		else
			ramps[i][1] = val
		end
	end
end

local function RampWave()
	if not (leveltime % flashDelay) then

		rampPos = $1+1
		
		//too high, time to go back
		if not (ramps[rampPos])
			rampPos = 1
		end

		flashColor.ramp = ramps[rampPos]
	end
end

addHook("ThinkFrame", RampWave)

//color 2

local flashColor2 = skincolors[SKINCOLOR_REPURPWAVE]
local flashDelay2 = 3

local rampPos2 = 1
local rampDir2 = true
local ramps2 = {}

ramps2[1] = {}
for i = 0, 15, 1
	ramps2[1][i+1] = flashColor2.ramp[i]
end

for i = 2, 16,1
	ramps2[i] = {}

	for pos,val in ipairs(ramps2[i-1]) do
		if not (pos == 16) then
			ramps2[i][pos+1] = val
		else
			ramps2[i][1] = val
		end
	end
end

local function RampWave2()
	if not (leveltime % flashDelay2) then

		rampPos2 = $1+1
		
		if not (ramps2[rampPos2])
			rampPos2 = 1
		end

		flashColor2.ramp = ramps2[rampPos2]
	end
end

addHook("ThinkFrame", RampWave2)

//color 3

local flashColor3 = skincolors[SKINCOLOR_RINGWAVE]
local flashDelay3 = 2

local rampPos3 = 1
local rampDir3 = true
local ramps3 = {}

ramps3[1] = {}
for i = 0, 15, 1
	ramps3[1][i+1] = flashColor3.ramp[i]
end

for i = 2, 16,1
	ramps3[i] = {}

	for pos,val in ipairs(ramps3[i-1]) do
		if not (pos == 16) then
			ramps3[i][pos+1] = val
		else
			ramps3[i][1] = val
		end
	end
end

local function RampWave3()
	if not (leveltime % flashDelay3) then

		rampPos3 = $1+1
		
		if not (ramps3[rampPos3])
			rampPos3 = 1
		end

		flashColor3.ramp = ramps3[rampPos3]
	end
end

addHook("ThinkFrame", RampWave3)

//color 4

local flashColor4 = skincolors[SKINCOLOR_PENCILWAVE]
local flashDelay4 = 4

local rampPos4 = 1
local rampDir4 = true
local ramps4 = {}

ramps4[1] = {}
for i = 0, 15, 1
	ramps4[1][i+1] = flashColor4.ramp[i]
end

for i = 2, 16,1
	ramps4[i] = {}

	for pos,val in ipairs(ramps4[i-1]) do
		if not (pos == 16) then
			ramps4[i][pos+1] = val
		else
			ramps4[i][1] = val
		end
	end
end

local function RampWave4()
	if not (leveltime % flashDelay4) then

		rampPos4 = $1+1
		
		if not (ramps4[rampPos4])
			rampPos4 = 1
		end

		flashColor4.ramp = ramps4[rampPos4]
	end
end

addHook("ThinkFrame", RampWave4)

//color 5

local flashColor5 = skincolors[SKINCOLOR_EGGWAVE]
local flashDelay5 = 2

local rampPos5 = 1
local rampDir5 = true
local ramps5 = {}

ramps5[1] = {}
for i = 0, 15, 1
	ramps5[1][i+1] = flashColor5.ramp[i]
end

for i = 2, 16,1
	ramps5[i] = {}

	for pos,val in ipairs(ramps5[i-1]) do
		if not (pos == 16) then
			ramps5[i][pos+1] = val
		else
			ramps5[i][1] = val
		end
	end
end

local function RampWave5()
	if not (leveltime % flashDelay5) then

		rampPos5 = $1+1
		
		if not (ramps5[rampPos5])
			rampPos5 = 1
		end

		flashColor5.ramp = ramps5[rampPos5]
	end
end

addHook("ThinkFrame", RampWave5)

//color 6

local flashColor6 = skincolors[SKINCOLOR_XBOXWAVE]
local flashDelay6 = 2

local rampPos6 = 1
local rampDir6 = true
local ramps6 = {}

ramps6[1] = {}
for i = 0, 15, 1
	ramps6[1][i+1] = flashColor6.ramp[i]
end

for i = 2, 16,1
	ramps6[i] = {}

	for pos,val in ipairs(ramps6[i-1]) do
		if not (pos == 16) then
			ramps6[i][pos+1] = val
		else
			ramps6[i][1] = val
		end
	end
end

local function RampWave6()
	if not (leveltime % flashDelay6) then

		rampPos6 = $1+1
		
		if not (ramps6[rampPos6])
			rampPos6 = 1
		end

		flashColor6.ramp = ramps6[rampPos6]
	end
end

addHook("ThinkFrame", RampWave6)

//color 7

local flashColor7 = skincolors[SKINCOLOR_PS2WAVE]
local flashDelay7 = 1

local rampPos7 = 1
local rampDir7 = true
local ramps7 = {}

ramps7[1] = {}
for i = 0, 15, 1
	ramps7[1][i+1] = flashColor7.ramp[i]
end

for i = 2, 16,1
	ramps7[i] = {}

	for pos,val in ipairs(ramps7[i-1]) do
		if not (pos == 16) then
			ramps7[i][pos+1] = val
		else
			ramps7[i][1] = val
		end
	end
end

local function RampWave7()
	if not (leveltime % flashDelay7) then

		rampPos7 = $1+1
		
		if not (ramps7[rampPos7])
			rampPos7 = 1
		end

		flashColor7.ramp = ramps7[rampPos7]
	end
end

addHook("ThinkFrame", RampWave7)

//color 8

local flashColor8 = skincolors[SKINCOLOR_WEEDWAVE]
local flashDelay8 = 3

local rampPos8 = 1
local rampDir8 = true
local ramps8 = {}

ramps8[1] = {}
for i = 0, 15, 1
	ramps8[1][i+1] = flashColor8.ramp[i]
end

for i = 2, 16,1
	ramps8[i] = {}

	for pos,val in ipairs(ramps8[i-1]) do
		if not (pos == 16) then
			ramps8[i][pos+1] = val
		else
			ramps8[i][1] = val
		end
	end
end

local function RampWave8()
	if not (leveltime % flashDelay8) then

		rampPos8 = $1+1
		
		if not (ramps5[rampPos8])
			rampPos8 = 1
		end

		flashColor8.ramp = ramps8[rampPos8]
	end
end

addHook("ThinkFrame", RampWave8)

//color 9

local flashColor9 = skincolors[SKINCOLOR_BRAKWAVE]
local flashDelay9 = 2

local rampPos9 = 1
local rampDir9 = true
local ramps9 = {}

ramps9[1] = {}
for i = 0, 15, 1
	ramps9[1][i+1] = flashColor9.ramp[i]
end

for i = 2, 16,1
	ramps9[i] = {}

	for pos,val in ipairs(ramps9[i-1]) do
		if not (pos == 16) then
			ramps9[i][pos+1] = val
		else
			ramps9[i][1] = val
		end
	end
end

local function RampWave9()
	if not (leveltime % flashDelay9) then

		rampPos9 = $1+1
		
		if not (ramps5[rampPos9])
			rampPos9 = 1
		end

		flashColor9.ramp = ramps9[rampPos9]
	end
end

addHook("ThinkFrame", RampWave9)

//color 10

local flashColor10 = skincolors[SKINCOLOR_SONIC2012WAVE]
local flashDelay10 = 5

local rampPos10 = 1
local rampDir10 = true
local ramps10 = {}

ramps10[1] = {}
for i = 0, 15, 1
	ramps10[1][i+1] = flashColor10.ramp[i]
end

for i = 2, 16,1
	ramps10[i] = {}

	for pos,val in ipairs(ramps10[i-1]) do
		if not (pos == 16) then
			ramps10[i][pos+1] = val
		else
			ramps10[i][1] = val
		end
	end
end

local function RampWave10()
	if not (leveltime % flashDelay10) then

		rampPos10 = $1+1
		
		if not (ramps10[rampPos10])
			rampPos10 = 1
		end

		flashColor10.ramp = ramps10[rampPos10]
	end
end

addHook("ThinkFrame", RampWave10)