User:Moxian/SandboxTemplate2

From Dustloop Wiki
Jump to navigation Jump to search

local p = {}

local currentFrame = 0

local wikitext = "

"

function p.drawFrameData(frame)

 -- Startup is the first active frame. Sets to true if empty. Otherwise it's false.
 local startupIsFirstActive
 if frame.args['startupIsFirstActive'] == nil then
   startupIsFirstActive = true
 else
   startupIsFirstActive = false
 end
 
 -- Startup of move, substract 1 if startupIsFirstActive
 local startup = frame.args['startup']
 if tonumber(startup) ~= nil then
   if startupIsFirstActive and tonumber(startup) > 0 then
     startup = tonumber(startup) - 1
   end
 end
 
 -- Active of move
 local active = frame.args['active']
 -- Inactive of move
 local inactive = frame.args['inactive']
 -- Recovery of move
 local recovery = frame.args['recovery']
 -- Special Recovery of move
 local specialRecovery = frame.args['specialRecovery']
 -- How many frames into active frames the inactive period occurs
 local offset = frame.args['offset']
 -- Display projectile spawn bar after startup?
 local isProjectile = frame.args['isProjectile']
 
 drawFrame(startup,  "startup")
 if isProjectile ~= nil then
wikitext = wikitext .. "
"
 end
 -- Alternate way of inputting multihits
 if offset ~= nil then
   drawFrame(offset,   "active")
   drawFrame(inactive, "inactive")
   drawFrame(active-offset,   "active")
 else
   drawFrame(active,   "active")
 end
 
 local index = 2
 while tonumber(frame.args['active' .. index]) ~= nil or tonumber(frame.args['inactive' .. index]) ~= nil do
   drawFrame(frame.args['active' .. index], "active")
   drawFrame(frame.args['inactive' .. index], "inactive")
   index = index + 1
 end
 
 drawFrame(recovery, "recovery")
 drawFrame(specialRecovery, "specialRecovery")
wikitext = wikitext .. "

"

 return wikitext

end

function drawFrame(frames, frameType)

 if tonumber(frames) ~= nil then
   for i=1, tonumber(frames) do
     currentFrame = currentFrame + 1

wikitext = wikitext .. "

"

   end
 end

end

return p