◆少前百科是非盈利性、非官方的少女前线维基百科。
◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科
◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科
◆To foreigners,You can use twitter to contact us.
Icon Nyto Silver.png

更改

跳转至: 导航搜索

模块:Gun info

添加904字节2022年5月23日 (一) 23:01
无编辑摘要
local data = mw.loadData('Module:Gun info/data')
local infobox = require('Module:Infobox').infobox
local guntype = { {'手枪(HG)手枪', '冲锋枪(SMG)冲锋枪', '步枪(RF)步枪', '突击步枪(AR)突击步枪', '机枪(MG)机枪', '霰弹枪(SG)霰弹枪'},local modrank = {'HG', 'SMG', '4RF', '4AR', '5MG', '6SG'} }local base_attr = { {0.60, 0.60, 0.80, 1.20, 1.80, 0.00}, {1.60, 0.60, 1.20, 0.30, 1.60, 0.00}, {0.80, 2.40, 0.50, 1.60, 0.80, 0.00}, {1.00, 1.00, 1.00, 1.00, 1.00, 0.00}, {1.50, 1.80, 1.60, 0.60, 0.60, 0.00}, {2.00, 0.70, 0.40, 0.30, 0.30, 1.00}}
local basic = {16, 45, 5, 5}
local basic_lifearmor basic_lifearmors = {
{{55, 0.555}, {2, 0.161}},
{{96.283, 0.138}, {13.979, 0.04}}}
local grow grows = {
{{0.242, 0}, {0.181, 0}, {0.303, 0}, {0.303, 0}},
{{0.06, 18.018}, {0.022, 15.741}, {0.075, 22.572}, {0.075, 22.572}}}
 
local function calc(lv, guntype, mindupdate, attr, ratio, growth)
local base = basic[attr-1]*base_attr[guntype][attr]*ratio/100
local accretion = (grow[mindupdate][attr-1][2] +
(lv-1)*grow[mindupdate][attr-1][1])*base_attr[guntype][attr]*ratio*growth/100/100
return ceil(base) + ceil(accretion)
end
 
local function calcLifeArmor(lv, guntype, mindupdate, attr, ratio)
return ceil((basic_life_armor[mindupdate][attr%4][1] +
(lv-1)*basic_life_armor[mindupdate][attr%4][2])*base_attr[guntype][attr]*ratio/100)
end
local function addImages()
root:wikitext('== 人形外观 ==')
root:newline()
local guncode = string.gsub(gundata.code, ' ', '_')
local skindata = mw.loadData('Module:Gun info/skin_data')
end
showcase:tag('div'):attr('id', 'live2d-control'):cssText('display:none')
root:newline()
end
 
local function getGridPositions(center, pos)
local self_pos = 4 - floor(self_pos / 5) + 3 * (self_pos % 5 - 2)
local effect_poses = {}
for i, v in ipairs(pos) do
effect_poses[i] = 3*(2 - (v - 1)%5) + floor((v - 1)/5) - 2 + self_pos
end
return self_pos, effect_poses
end
 
local function makeEffectTable(self_pos, effect_poses)
local effect_table = root:tag('table')
local index = 1
for i = 0, 2 do
local tr = effect_table:tag('tr')
for j = 1, 3 do
local td = tr:tag('td')
if i*3 + j == effect_poses[index] then
td:addClass('effect-cell')
index = index + 1
elseif i*3 + j == self_pos then
td:attr('id', 'self-cell')
index = index + 1
end
end
end
end
 
local function addCombatInfo()
root:wikitext('== 战斗数据 ==')
root:newline()
local ratios = { gundata.life, gundata.power, gundata.rate,
gundata.hit, gundata.dodge }
local attrtable = root:tag('table'):attr{
id = 'attr-table',
['data-growing'] = table.concat(ratios, ','),
['data-growth'] = gundata.growth
}
local self_pos
local effect_poses
self_pos, effect_poses = getGridPositions(gundata.grid_center or 13, gundata.grid_pos)
makeEffectTable(self_pos, effect_poses)
if moddata then
local ratios = { moddata.life, moddata.power, moddata.rate,
moddata.hit, moddata.dodge }
attrtable:attr{
['data-growing-mod'] = table.concat(ratios, ','),
['data-growth-mod'] = moddata.growth
}
self_pos, effect_poses = getGridPositions(moddata.grid_center or 13, moddata.grid_pos)
makeEffectTable(self_pos, effect_poses)
end
end
local function addInfobox()
local modrank = {'', '4', '4', '5', '6'}
root:wikitext(infobox{
above = gundata.name,
data1 = gundata.id,
label2 = '武器类型',
data2 = guntype[1][gundata['type']],
label3 = '稀有度',
data3 = tostring(gundata.rank) ..
(moddata and '(心智升级:' .. modrank[gundata.rank] .. ')' or '')
})
root:newline()
end
addInfobox()
addCombatInfo()
addImages()

导航菜单