FANDOM

 
18,246 Pages

-- Module to generate the Arts table for an Enemy in Xenoblade Chronicles X.
 
-- <nowiki>  Hide this module's contents from the wikitext parser ...
 
local XenemyArts = {}
 
-- Format of a table row
--  art, type, category, hits, range, effect, app, homing
local rowFormat = [[
|-
| '''%s''' || %s || %s || %s || %s || %s || %s || %s
]]
 
--[==[ ------------------------------------------
 
Function to generate the Arts table for an enemy.
 
]==]
function XenemyArts.arts( frame )
  local arglist = frame:getParent().args
  local noValue = true
 
  -- get enemy type, which will be used as one of the classes of the table
  theme = arglist[ "type" ]
  if theme == nil then theme = " " end
 
  -- Start of table and column headers
  local result = {}
  table.insert( result,
    mw.ustring.format(  '{| class="xcx %s" style="width: 100%%;"', theme )
  )
  table.insert( result,
    '! Art !! Attribute !! Category !! Hits !! Range !! Effect !! Appendage !! Homing'
  )
 
  for i=1,50 do
    artname   = arglist[ "art" .. i ]
    if artname == nil then break end
    element   = arglist[ "type" .. i ] or "–"
    category  = arglist[ "category" .. i ] or "??"
    hits      = arglist[ "hits" .. i ] or "–"
    range     = arglist[ "range" .. i ] or "–"
    effect    = arglist[ "effect" .. i ] or "–"
    appendage = arglist[ "app" .. i ] or "–"
    homing    = arglist[ "homing" .. i ] or "–"
 
    table.insert( result,
      mw.ustring.format( rowFormat, artname, element, category, hits, range, effect, appendage, homing )
    )
  end
 
  -- End of the table
  table.insert( result, "|}" )
 
  -- Merge the array elements into one string, separated by newline characters.
  return table.concat( result, '\n' )
end
 
return XenemyArts
 
-- </nowiki>  ... end of this module's contents
Community content is available under CC-BY-SA unless otherwise noted.