FANDOM


local p = {}
 
function p.mazo(frame)
    local c = require('Módulo:Cartas')
    -- If someone knows a better way, tell me. User:Pintor_Kagamine
    local carta = {
        [1] = c[mw.ustring.lower(frame.args[1])],
        [2] = c[mw.ustring.lower(frame.args[2])],
        [3] = c[mw.ustring.lower(frame.args[3])],
        [4] = c[mw.ustring.lower(frame.args[4])],
        [5] = c[mw.ustring.lower(frame.args[5])],
        [6] = c[mw.ustring.lower(frame.args[6])],
        [7] = c[mw.ustring.lower(frame.args[7])],
        [8] = c[mw.ustring.lower(frame.args[8])]
    }
    local promedio = carta[1].costo + carta[2].costo + carta[3].costo + carta[4].costo + carta[5].costo + carta[6].costo + carta[7].costo + carta[8].costo
    local promedio = promedio / 8
    local promedio = math.floor(promedio * 10) / 10
    local struct = '<table class="mazo" align="center"><tr><td>[[File:' .. carta[1].imagen .. '|100px]]</td><td>[[File:' .. carta[2].imagen .. '|100px]]</td><td>[[File:' .. carta[3].imagen .. '|100px]]</td><td>[[File:' .. carta[4].imagen .. '|100px]]</td></tr><tr><th>[[' .. carta[1].nombre .. ']]</th><th>[[' .. carta[2].nombre .. ']]</th><th>[[' .. carta[3].nombre .. ']]</th><th>[[' .. carta[4].nombre .. ']]</th></tr><tr><td>[[File:' .. carta[5].imagen .. '|100px]]</td><td>[[File:' .. carta[6].imagen .. '|100px]]</td><td>[[File:' .. carta[7].imagen .. '|100px]]</td><td>[[File:' .. carta[8].imagen .. '|100px]]</td></tr><tr><th>[[' .. carta[5].nombre .. ']]</th><th>[[' .. carta[6].nombre .. ']]</th><th>[[' .. carta[7].nombre .. ']]</th><th>[[' .. carta[8].nombre .. ']]</th></tr><tr><th colspan="4">Costo promedio de elíxir: ' .. promedio .. '</th></tr></table>'
    return struct
end
return p