79 548
contributi
m (Pokémon con evoluzioni diramate > Pokémon con evoluzioni ramificate) |
(Automatically adding category for unique BST in Stats *** sovrascritto il testo esistente ***) |
||
local eb = {}
-- stylua: ignore start
local
local tab = require('Modulo:Wikilib/tables')
local form = require('Modulo:Wikilib/forms')
local evolib = require('Modulo:Wikilib/evos')
local moves = mw.loadData('Modulo:Move/data')
local evodata = mw.loadData('Modulo:Evo/data')
-- stylua: ignore end
form.loadUseless(true)
local bothforms = form.allFormsData()
SMALL_TEXT_NEWLINE = [=[<div class="small-text">${text}</div>]=],
CAT_TRE_PHASES =
CAT_TWO_PHASES =
CAT_ONE_PHASE =
CAT_BRANCHED_PHASES =
}
eb.strings.desktoparrows = {
normal =
fixed =
reverse =
double =
}
eb.strings.mobilearrows = {
normal =
fixed =
reverse =
double =
}
-- this should be constant
eb.emptybox = {
--[[
--]]
eb.boxPokemon = function(args)
return
notes = args.notes and
text = args.notes,
}) or
background = css.radialGradLua({
type1 = args.type1,
type2 = args.type2,
}),
spr = args.spr,
phase = args.phase or "Non si evolve",
name = args.name,
shownName = args.shownName or args.name,
type1rect = links.colorType(
),
type2rect =
) or (args.type2 ~= args.type1 and links.colorType(
args.type2,
c[args.type2].dark
) or ""),
})
end
--[[
local methodsFunctionGenerator = function(text)
return function(param)
return
end
end
local smallMethodsFunctionGenerator = function(text)
text =
return function(param)
return
end
end
eb.boxArrow = { img = {}, desc = {} }
eb.boxArrow.img.methods = {
[evodata.methods.OTHER] = methodsFunctionGenerator(
[evodata.methods.LEVEL] = methodsFunctionGenerator(
links.bag("Caramella rara")
),
[evodata.methods.
links.bag("Calmanella")
),
[evodata.methods.STONE] = methodsFunctionGenerator(links.bag("${param}")),
[evodata.methods.TRADE] = methodsFunctionGenerator(
links.bag("Blocco Amici")
),
[evodata.methods.BREED] = methodsFunctionGenerator(
ms.staticLua({ "Uovo" })
),
[evodata.methods.UNKNOWN] = methodsFunctionGenerator(""),
}
eb.boxArrow.img.conditions = {
[evodata.conditions.OTHER] = nilConst,
[evodata.conditions.TIME] = nilConst,
[evodata.conditions.ITEM] = methodsFunctionGenerator(links.bag(
[evodata.conditions.LOCATION] = methodsFunctionGenerator(
links.bag("Mappa città")
),
[evodata.conditions.MOVE] = function(movename)
-- Takes move name and gets move type for the MT image
local movetype = multigen.getGenValue(moves[movename:lower()].type)
return links.bag(
end,
[evodata.conditions.GENDER] = nilConst,
[evodata.conditions.TRADED_FOR] = function(ndex)
return ms.staticLua({ ndex })
end,
[evodata.conditions.BREEDONLY] = methodsFunctionGenerator(
ms.staticLua({ "132" })
),
[evodata.conditions.REGION] = nilConst,
}
eb.boxArrow.desc.methods = {
[evodata.methods.OTHER] = methodsFunctionGenerator(
[evodata.methods.LEVEL] = function(level)
if not level then
return
end
return table.concat({
end,
[evodata.methods.HAPPINESS] = methodsFunctionGenerator(
"[[Affetto|Legame]]"
),
[evodata.methods.
[evodata.methods.
[evodata.methods.BREED] = methodsFunctionGenerator(
"[[Accoppiamento Pokémon|Accoppiamento]]"
),
[evodata.methods.UNKNOWN] = methodsFunctionGenerator("Sconosciuto"),
}
eb.boxArrow.desc.conditions = {
[evodata.conditions.OTHER] = smallMethodsFunctionGenerator(
[evodata.conditions.TIME] = smallMethodsFunctionGenerator(
[evodata.conditions.ITEM] = smallMethodsFunctionGenerator(
),
[evodata.conditions.LOCATION] = smallMethodsFunctionGenerator(
"presso: [[${param}]]"
),
[evodata.conditions.MOVE] = function(movename)
return
text = table.concat({
})
end,
[evodata.conditions.GENDER] = smallMethodsFunctionGenerator(
[evodata.conditions.TRADED_FOR] = function(ndex)
[evodata.conditions.BREEDONLY] = methodsFunctionGenerator(
[evodata.conditions.REGION] = smallMethodsFunctionGenerator(
"nella regione di [[${param}]]"
),
}
--[[
end
direction = direction
-- Only uses the first image found. The actual order is the keys' one
-- because there souldn't be more than one condition with an img at a time
local img =
return eb.boxArrow.img.conditions[condition](val)
end)
table.insert(img, eb.boxArrow.img.methods[data.method](data[data.method]))
local desc =
return eb.boxArrow.desc.conditions[condition](val)
end)
table.insert(
desc,
1,
eb.boxArrow.desc.methods[data.method](data[data.method])
)
local interpData = {
desktoparrow = eb.strings.desktoparrows[direction],
mobilearrow = eb.strings.mobilearrows[direction],
info =
}
local interpString = eb.strings.BOX_ARROW
if
and interpData.
and interpData.timegender == ""
then
interpString = eb.strings.BOX_ARROW_INFOLESS
elseif interpData.direction ==
interpString = eb.strings.BOX_ARROW_UNRESPONSIVE
end
return
end
--]]
eb.SingleArrow = function(data, direction)
return
boxarrow = eb.boxArrowGen(data, direction),
})
end
--]]
eb.DoubleArrow = function(data)
return
boxarrow1 = eb.boxArrowGen(data.evos[1]),
boxarrow2 = eb.boxArrowGen(data),
--]]
eb.TripleArrow = function(data)
return
boxarrow1 = eb.boxArrowGen(data.evos[1]),
boxarrow2 = eb.boxArrowGen(data),
if position == 1 then
if baseData.method == evodata.methods.BREED then
if
then
return "Non si evolve"
else
return
end
elseif not baseData.method and baseData.evos then
return
else
return
end
elseif position == 2 then
if
and baseData.conditions[evodata.conditions.BREEDONLY]
then
return "Genitore"
else
return
end
else
return
end
end
return ""
end
local poke = multigen.getGen(
)
ndex = type(ndex) == "string" and ndex or txt.threeFigures(ndex)
return eb.boxPokemon({
notes = notes,
type1 = poke.type1 or "sconosciuto",
phase = phase,
name = poke.name,
shownName = shownName,
})
end
local arrows, boxes = {}, {}
for k, v in ipairs(evos) do
local key =
arrows[key] = eb.SingleArrow(v)
boxes[key] = eb.boxPokemonAuto(
end
if
return
elseif
return table.concat({
})
else
return table.concat({
})
end
end
--]]
eb.makeManyEvosRow = function(evos)
local rowContent =
return
arrow = eb.SingleArrow(v,
box = eb.boxPokemonAuto(
v.ndex or v.name,
eb.phaseName(2, evodata[v.name]),
v.notes
),
})
end, ipairs)
return
boxes = table.concat(rowContent),
})
end
if data.conditions and data.conditions[evodata.conditions.BREEDONLY] then
-- Breedonly (aka Phione)
return table.concat({
box1 = eb.SingleArrow(data),
}),
box1 = eb.boxPokemonAuto(
data.evos[1].ndex or
data.evos[1].notes
),
}),
})
elseif
-- More than one phase one, even with breed
return table.concat({
eb.TripleArrow(data),
box1 = eb.boxPokemonAuto(
box2 = eb.boxPokemonAuto(
}),
})
else
-- There is one phase one evolution, but with double arrow
return table.concat({
box1 = eb.DoubleArrow(data),
}),
box1 = eb.boxPokemonAuto(
data.evos[1].ndex or
}),
})
end
end
local pokename = mw.text.decode(p[1]):lower()
local abbr = p.form or ""
local pokeData =
multigen.getGen(pokes[form.nameToDataindex(pokename .. abbr)])
local nameabbr = abbr == "" and pokename or pokename .. abbr
data = evolib.prunedEvotree(nameabbr)
end
assert(data)
local evoboxcontent = {}
-- Insert the first phase Pokémon box
table.insert(
evoboxcontent,
txt.interp(eb.strings.ROW_ONE, {
box1 = eb.boxPokemonAuto(
data.ndex or data.name,
eb.phaseName(1, data),
data.notes
),
})
)
local phase3evos
-- If there are more than 2 phase one evolutions the module assumes there
-- aren't higher level evolutions and uses the unresponsive layout
if
boxContainer = eb.strings.BOX_CONTAINER_UNRESPONSIVE
table.insert(evoboxcontent, eb.makeManyEvosRow(data.evos))
table.insert(evoboxcontent, eb.makePhaseRows(data.evos, 2))
end
phase3evos =
return v.evos or { eb.emptybox }
end)
if
tab.any(phase3evos, function(v)
return v ~= eb.emptybox
end)
then
table.insert(evoboxcontent, eb.makePhaseRows(phase3evos, 3))
end
local evobox = {
textcolor = cc.forModGradBgLua(
pokeData.type1 or
pokeData.type2 or
),
background = css.horizGradLua({
type1 = pokeData.type1 or
type2 = pokeData.type2 or
}),
content = table.concat(evoboxcontent),
}),
}
-- Adds categories
phase3evos = phase3evos
return
if
and not (
data.conditions
and data.conditions[evodata.conditions.BREEDONLY]
)
then
if tab.getn(phase3evos, "num") > 0 then
table.insert(evobox, eb.strings.CAT_TRE_PHASES)
elseif data.evos then
table.insert(evobox, eb.strings.CAT_ONE_PHASE)
end
if
or (data.evos and tab.getn(data.evos, "num") > 1)
then
table.insert(evobox, eb.strings.CAT_BRANCHED_PHASES)
end
return table.concat(evobox)
end
-- ========================== Non-automatic interface ==========================
--]]
eb.processInput.mapToLower =
-- Processes an argument: maps to lowercase when needed.
eb.processInput.processElement = function(v, k)
if
and tab.any(eb.processInput.mapToLower, function(pattern)
return string.match(k, pattern)
end)
then
v = string.lower(v)
end
end
local fakephase = p.family == "normale" and { evos = {} } or {}
return eb.boxPokemon({
notes = p["loc" .. suff],
type1 = p["type1-" .. suff],
spr = "[[File:" .. p["sprite" .. suff] .. ".png|150px]]",
phase = p["forme" .. suff]
name = p["name" .. suff],
shownName = p["displayname" .. suff],
})
end
eb.evotypeToMethod = {
livello = evodata.methods.LEVEL,
[
posizione = evodata.methods.LEVEL,
pietra = evodata.methods.STONE,
mossa = evodata.methods.LEVEL,
[
[
scambio = evodata.methods.TRADE,
other = evodata.methods.OTHER,
local fakeevo = { ndex = 000, conditions = {} }
fakeevo.method = eb.evotypeToMethod[p["evotype" .. suff]]
fakeevo[evodata.methods.LEVEL] = p["level" .. suff]
local result = {}
local evotypePhase = tostring(phase - 1)
if p[
if p[
-- There are two evolutions
table.insert(
box2 = eb.SingleArrowMaybe(p, evotypePhase .. "a"),
)
result,
txt.interp(eb.strings.ROW_TWO, {
box1 = eb.boxPokemonManual(p, tostring(phase)),
box2 = eb.boxPokemonManual(p, tostring(phase) .. "a"),
})
)
else
-- There's only one evolution
table.insert(
table.insert(
result,
txt.interp(eb.strings.ROW_ONE, {
box1 = eb.boxPokemonManual(p, tostring(phase)),
})
)
end
end
eb.GlitchEvobox = function(frame)
local p = w.trimAll(mw.clone(frame.args))
p =
p.family = p.family and p.family:lower() or
local evoboxcontent = {
}
table.insert(evoboxcontent, eb.makeGlitchPhaseRows(p, 4))
return
end
eb.glitchEvobox, eb.glitchevobox, eb.Glitchevobox =
eb.GlitchEvobox, eb.GlitchEvobox, eb.GlitchEvobox
-- ============================ Alternative forms box ==========================
local name, abbr = form.getnameabbr(ndex)
local altdata = bothforms[name]
shownname = shownname
or altdata.names[abbr] == "" and txt.fu(pokes[name].name)
return eb.boxPokemonAuto(ndex, "", notes, shownname)
end
ndex = 000,
method = evodata.methods.OTHER,
[evodata.methods.OTHER] = args.item and table.concat({
})
}
return
boxarrow = eb.boxArrowGen(fakeevo,
})
end
local newArgs = {}
for k, v in pairs(args) do
if k:match(ending ..
newArgs[k:match(
end
end
local result = {}
local evotypeIdx = tostring(index - 1)
if p[
-- There is at least one evolution
if p[
-- There are two evolutions
table.insert(
box1 = eb.FormArrow(eb.argsEndingSubset(p, evotypeIdx)),
),
txt.interp(eb.strings.ROW_TWO, {
box1 = eb.BoxForm(
p["sprite" .. tostring(index)],
p["loc" .. tostring(index)],
p["name" .. tostring(index)]
),
p["sprite" .. tostring(index) .. "a"],
p["loc" .. tostring(index) .. "a"],
p["name" .. tostring(index) .. "a"]
),
})
)
else
-- There's only one evolution
table.insert(
txt.interp(eb.strings.ROW_ONE,
p["sprite" .. tostring(index)],
p["loc" .. tostring(index)],
p["name" .. tostring(index)]
),
})
)
end
end
local p = w.trimAll(mw.clone(frame.args))
local pagename =
p[1] = nil
p.family = p.family or
local pagepoke = pokes[form.nameToDataindex(pagename)]
or {
name = "Sconosciuto",
ndex = 0,
type1 = "sconosciuto",
type2 = "sconosciuto",
}
pagepoke = multigen.getGen(pagepoke)
-- Insert the first phase Pokémon box
table.insert(
formboxcontent,
txt.interp(eb.strings.ROW_ONE, {
box1 = eb.BoxForm(p.sprite1, p.loc1, p.name1),
})
)
-- Adds any form passed as argument
local i = 2
while p[
table.insert(formboxcontent, eb.makeFormRows(p, i))
i = i + 1
end
return
textcolor = cc.forModGradBgLua(pagepoke.type1, pagepoke.type2),
background = css.horizGradLua({
type2 = pagepoke.type2,
}),
content = table.concat(formboxcontent),
})
end
|