Differenze tra le versioni di "Modulo:Evobox"

2 070 byte aggiunti ,  02:00, 6 gen 2020
Support for Mr. Mime evoline and update of Evo-data *** sovrascritto il testo esistente ***
(Multigen in move-data *** sovrascritto il testo esistente ***)
(Support for Mr. Mime evoline and update of Evo-data *** sovrascritto il testo esistente ***)
SINGLE_ARROW = [=[<div style="margin: 1em 0.5em;">${boxarrow}</div>]=],
DOUBLE_ARROW = [=[<div class="inline-block-md"><div class="flex-md flex-row flex-nowrap flex-items-center" style="margin: 1em 0;"><div class="width-md-50" style="padding: 1em;">${boxarrow1}</div><div class="width-md-50" style="padding: 1em;">${boxarrow2}</div></div></div>]=],
TRIPLE_ARROW = [=[<div class="flex-md flex-row flex-nowrap flex-items-center"><div class="width-md-30" style="padding: 0.5em; height: 25%;">${boxarrow1}</div><div class="width-md-40 vert-middle" style="height: 50%;"><div>${boxarrow2}</div></div><div class="width-md-30" style="padding: 0.5em; height: 25%;">${boxarrow3}</div></div>]=],
 
SMALL_TEXT_NEWLINE = [=[<div class="small-text">${text}</div>]=],
double = '↕'
}
 
-- this should be constant
eb.emptybox = { }
 
--[[
infos on the method and conditions of evolution.
The second optional parameter is the arrow's direction.
 
TODO: doesn't work with FormBox and GlitchEvobox
 
--]]
eb.boxArrowGen = function(data, direction)
if not data.ndex and not data.name then
return ""
end
direction = direction
or (data.method == evodata.methods.BREED
--[[
 
Returns a pair of arrowarrows, that is an arrow directed and one reversed, used in
case of baby Pokémon.
 
The parameter is the single table of evo-data correspondig to the Pokémon with
method = BREED (ie: the baby phase). The normaldirected arrow use datas of the first evolution.
evolution.
 
--]]
boxarrow1 = eb.boxArrowGen(data.evos[1]),
boxarrow2 = eb.boxArrowGen(data),
})
end
 
--[[
 
Returns a triple of arrows, that is two arrows directed and one reversed in
between, used in case of baby Pokémon with two evolutions.
 
The parameter is the single table of evo-data correspondig to the Pokémon with
method = BREED (ie: the baby phase). The two directed arrows use datas of the
evolutions.
 
--]]
eb.TripleArrow = function(data)
return string.interp(eb.strings.TRIPLE_ARROW, {
boxarrow1 = eb.boxArrowGen(data.evos[1]),
boxarrow2 = eb.boxArrowGen(data),
boxarrow3 = eb.boxArrowGen(data.evos[2]),
})
end
--]]
eb.boxPokemonAuto = function(ndex, phase, notes, shownName)
if not ndex then
return ""
end
local poke = multigen.getGen(pokes[ndex]
or pokes[tonumber(ndex)]
eb.makePhaseRows = function(evos, phase)
local arrows, boxes = {}, {}
for k, v in ipairs(evos) do
table.map(evos, function(v, k)
local key = 'box' .. tostring(k)
arrows[key] = eb.SingleArrow(v)
v.notes
)
return vend
end, ipairs)
 
if table.getn(arrows) == 0 then
boxes = table.concat(rowContent)
})
end
 
--[[
 
Prints two rows, one with arrows and the other with Pokémon boxes, when the
base for is a baby, so it should add the backward arrow for breeding.
 
The parameter is the table of the base form (ie: the baby Pokémon).
 
--]]
eb.makeBreedRow = function(data)
if data.conditions and data.conditions[evodata.conditions.BREEDONLY] then
-- Breedonly (aka Phione)
return table.concat{
string.interp(eb.strings.ROW_ONE, {
box1 = eb.SingleArrow(data)
}),
string.interp(eb.strings.ROW_ONE, {
box1 = eb.boxPokemonAuto(data.evos[1].ndex or data.evos[1].name,
eb.phaseName(2, data),
data.evos[1].notes)
}),
}
elseif #data.evos > 1 then
-- More than one phase one, even with breed
return table.concat{
eb.TripleArrow(data),
string.interp(eb.strings.ROW_TWO, {
box1 = eb.boxPokemonAuto(
data.evos[1].ndex or data.evos[1].name,
eb.phaseName(1, data),
data.evos[1].notes
),
box2 = eb.boxPokemonAuto(
data.evos[2].ndex or data.evos[2].name,
eb.phaseName(1, data),
data.evos[2].notes
),
})
}
else
-- There is one phase one evolution, but with double arrow
return table.concat{
string.interp(eb.strings.ROW_ONE, {
box1 = eb.DoubleArrow(data)
}),
string.interp(eb.strings.ROW_ONE, {
box1 = eb.boxPokemonAuto(data.evos[1].ndex or data.evos[1].name,
eb.phaseName(2, data),
data.evos[1].notes)
})
}
end
end
 
boxContainer = eb.strings.BOX_CONTAINER_UNRESPONSIVE
table.insert(evoboxcontent, eb.makeManyEvosRow(data.evos))
-- If the familybase form is 'a baby' or(ie: 'incenso'method the== secondBREED) phaseit should be handledadd
-- "bythe hand"arrow, otherwise there'swe thecan functionhandle thatit createswith the row.standard function
elseif data.method == evodata.methods.BREED then
iftable.insert(evoboxcontent, dataeb.conditionsmakeBreedRow(data))
and data.conditions[evodata.conditions.BREEDONLY] then
-- Breedonly (aka Phione)
table.insert(evoboxcontent, string.interp(eb.strings.ROW_ONE, {
box1 = eb.SingleArrow(data)
}))
table.insert(evoboxcontent, string.interp(eb.strings.ROW_ONE, {
box1 = eb.boxPokemonAuto(data.evos[1].ndex or data.evos[1].name,
eb.phaseName(2, data),
data.evos[1].notes)
}))
else
-- There is one phase one evolution, but with double arrow
table.insert(evoboxcontent, string.interp(eb.strings.ROW_ONE, {
box1 = eb.DoubleArrow(data)
}))
table.insert(evoboxcontent, string.interp(eb.strings.ROW_ONE, {
box1 = eb.boxPokemonAuto(data.evos[1].ndex or data.evos[1].name,
eb.phaseName(2, data),
data.evos[1].notes)
}))
end
else
table.insert(evoboxcontent, eb.makePhaseRows(data.evos, 2))
end
phase3evos = table.flatMapToNum(data.evos, function(v)
return v.evos or { eb.emptybox }
end)
if table.insertany(evoboxcontentphase3evos, function(v) return v ~= eb.makePhaseRows(phase3evos,emptybox 3)end) then
table.insert(evoboxcontent, eb.makePhaseRows(phase3evos, 3))
end
end
 
end
 
local fakeevo = { ndex = 000, conditions = {} }
fakeevo.method = eb.evotypeToMethod[p["evotype" .. suff]]
or evodata.methods.OTHER
eb.FormArrow = function(args)
local fakeevo = {
ndex = 000,
method = evodata.methods.OTHER,
[evodata.methods.OTHER] = args.item
79 548

contributi