-- Create an empty Type object
local Type = {
name = nil,
link = nil,
category = nil,
colorClass = nil,
nonStandard = nil
}
-- Table with data on each Type
local typesData = {
['Dragon'] = { category = 'Type' },
['Spellcaster'] = { category = 'Type' },
['Zombie'] = { category = 'Type' },
['Warrior'] = { category = 'Type' },
['Beast-Warrior'] = { category = 'Type' },
['Beast'] = { category = 'Type' },
['Winged Beast'] = { category = 'Type' },
['Fiend'] = { category = 'Type' },
['Fairy'] = { category = 'Type' },
['Insect'] = { category = 'Type' },
['Dinosaur'] = { category = 'Type' },
['Reptile'] = { category = 'Type' },
['Fish'] = { category = 'Type' },
['Sea Serpent'] = { category = 'Type' },
['Machine'] = { category = 'Type' },
['Thunder'] = { category = 'Type' },
['Aqua'] = { category = 'Type' },
['Pyro'] = { category = 'Type' },
['Rock'] = { category = 'Type' },
['Plant'] = { category = 'Type' },
['Divine-Beast'] = { category = 'Type' },
['Psychic'] = { category = 'Type' },
['Creator God'] = { category = 'Type' },
['Wyrm'] = { category = 'Type' },
['Cyberse'] = { category = 'Type' },
['Illusion'] = { category = 'Type' },
['Charisma'] = { category = 'Type', link = 'Type#Non-game Types', nonStandard = true },
['Human'] = { category = 'Type', link = 'Type#Non-game Types', nonStandard = true },
-- Manga
['Black Magic'] = { category = 'Type' },
['White Magic'] = { category = 'Type' },
['Dark Knight'] = { category = 'Type' },
['Wild Beast'] = { category = 'Type' },
['Gadget'] = { category = 'Type', link = 'Gadget (Type)' },
['God'] = { category = 'Type', link = 'Divine-Beast' },
['Yokai'] = { category = 'Type' },
-- Bandai
['Dragon Magic'] = { category = 'Type' },
['Electroid'] = { category = 'Type' },
['Plantfolk'] = { category = 'Type' },
['Sea Beast'] = { category = 'Type' },
['Immortal'] = { category = 'Type' },
-- Rush Duel
['Galaxy'] = { category = 'Type', link = 'Galaxy (Type)' },
['Celestial Warrior'] = { category = 'Type' },
['Cyborg'] = { category = 'Type' },
['High Dragon'] = { category = 'Type' },
['Magical Knight'] = { category = 'Type' },
['Omega Psychic'] = { category = 'Type' },
['Business'] = { category = 'Type', link = 'Type#Non-game Types', nonStandard = true },
['Newspaper'] = { category = 'Type', link = 'Type#Non-game Types', nonStandard = true },
['Swindler'] = { category = 'Type', link = 'Type#Non-game Types', nonStandard = true },
['Son'] = { category = 'Type', link = 'Type#Non-game Types', nonStandard = true },
['Swirls'] = { category = 'Type', link = 'Type#Non-game Types', nonStandard = true },
['Fusion'] = { category = 'Summon', link = 'Fusion Monster', colorClass = 'fusion-card' },
['Ritual'] = { category = 'Summon', link = 'Ritual Monster', colorClass = 'ritual-card' },
['Synchro'] = { category = 'Summon', link = 'Synchro Monster', colorClass = 'synchro-card' },
['Dark Synchro'] = { category = 'Summon', link = 'Dark Synchro Monster', colorClass = 'dark-synchro-card' },
['Accel Synchro'] = { category = 'Summon', link = 'Accel Synchro Monster', colorClass = 'synchro-card' },
['Delta Accel Synchro'] = { category = 'Summon', link = 'Delta Accel Synchro Monster', colorClass = 'synchro-card' },
['Limit Over Accel Synchro'] = { category = 'Summon', link = 'Limit Over Accel Synchro Monster', colorClass = 'synchro-card' },
['Xyz'] = { category = 'Summon', link = 'Xyz Monster', colorClass = 'xyz-card' },
['Special Summon'] = { category = 'Summon', link = 'Special Summon Monster', colorClass = 'effect-card' },
['Link'] = { category = 'Summon', link = 'Xyz Monster', colorClass = 'link-card' },
['Pendulum'] = { category = 'Pendulum', link = 'Pendulum Monster' },
['Maximum'] = { category = 'Maximum', link = 'Maximum Monster' },
-- Ordinarily "Token" is not included in the Type line,
-- But it is used this way in some video games.
['Token'] = { category = 'Token', link = 'Monster Token' },
['Flip'] = { category = 'Ability', link = 'Flip monster' },
['Toon'] = { category = 'Ability', link = 'Toon monster' },
['Spirit'] = { category = 'Ability', link = 'Spirit monster' },
['Union'] = { category = 'Ability', link = 'Union monster' },
['Gemini'] = { category = 'Ability', link = 'Gemini monster' },
['Magnet'] = { category = 'Ability', link = 'Magnet monster' },
['Armor'] = { category = 'Ability', link = 'Armor monster' },
['Plus'] = { category = 'Ability', link = 'Plus monster' },
['Minus'] = { category = 'Ability', link = 'Minus monster' },
['Plus Minus'] = { category = 'Ability', link = 'Plus Minus monster' },
['Tuner'] = { category = 'Tuner', link = 'Tuner monster' },
['Dark Tuner'] = { category = 'Tuner', link = 'Dark Tuner monster' },
['Normal'] = { category = 'Normal', link = 'Normal Monster' },
['Effect'] = { category = 'Effect', link = 'Effect Monster' },
['Special Ability'] = { category = 'Effect', link = 'Effect Monster' },
['?'] = { category = 'Unknown' },
['???'] = { category = 'Unknown' }
}
-- Create a new instance of a Type object
function Type:new(name)
-- Create a new instance of the Type class with all the default values
local t = mw.clone(Type)
-- Look up data based on the supplied name
data = typesData[name] or {}
-- Populate the instance with found data
t.name = data.name or name
t.link = data.link or name
t.category = data.category or nil
t.colorClass = data.colorClass or nil
t.nonStandard = data.nonStandard or false
return t
end
return Type