local Card = require('Module:Card')
local TableTools = require('Module:TableTools')
-- ------------------------------------
-- Overwrite `Module:Card` data
-- ------------------------------------
Card.config.defaultImage = 'Back-Anime-Toei.png'
Card.config.icons.level = '★'
Card.config.icons.cardTypes = '' -- No icons for card types
Card.config.baseClass = 'toei-card'
Card.config.colorCoded = false
Card.config.footerText = "[[Yu-Gi-Oh! (Toei anime)|''Yu-Gi-Oh!'' (Toei anime) cards]]"
.. " ([[List of Yu-Gi-Oh! (Toei) cards|list]] '''·''' [[Gallery of Yu-Gi-Oh! (Toei) cards|gallery]])"
Card.config.langs = { 'en', 'ja' }
Card.config.rows = {
'cardType',
'category',
'level',
'atkDef',
'atkDefLevels',
'finishingMove',
'lore',
'number'
}
table.insert(Card.categories, 'Toei cards')
-- ------------------------------------
-- Override `Module:Card` methods
-- ------------------------------------
-- Set additional attributes
-- @param args table
function Card:setCustomArgs(args)
self.category = args.category
self.atkLevel = args.atk_level
self.defLevel = args.def_level
self.locales.en.finishingMove = args.finishing_move
end
-- ------------------------------------
-- Custom methods
-- ------------------------------------
function Card:renderCategoryIcon()
if (TableTools.inArray({'Light', 'Dark', 'Legend'}, self.category)) then
return '[[File:' .. self.category .. '-Toei.png|28px|alt=|class=noviewer]]'
end
end
function Card:addCategoryRow()
-- Exit early if there is no category
if (self.category == nil) then return end
local icon = self:renderCategoryIcon()
local text = self.category .. ' Monster'
if (TableTools.inArray({'Light', 'Dark'}, self.category)) then
text = self.category .. ' Side Monster'
end
self:addRow('Category', text .. ' ' .. icon)
end
function Card:addAtkDefLevelsRow()
if (self.atkLevel or self.defLevel) then
self:addRow('ATK / DEF [[Level (grade)|Levels]]', self.atkLevel .. ' / ' .. self.defLevel)
end
end
function Card:addFinishingMoveRow()
self.addRow('Finishing Move', self.locales.en.finishingMove)
end
return Card