| 🌟 | 現在、 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「モジュール:DamageTables」の版間の差分
ナビゲーションに移動
検索に移動
(表の構成形式の変更) |
(lowprofile, fortifiedの変数が指定された場合にエラーが出る不具合の修正) |
||
| 179行目: | 179行目: | ||
-- overwrite lowprofile & fortified to context | -- overwrite lowprofile & fortified to context | ||
ctx.lowprofile = args.lowprofile or shieldinfo.lowprofile | ctx.lowprofile = aw.getAsNumber(args.lowprofile or shieldinfo.lowprofile) | ||
ctx.fortified = args.fortified or shieldinfo.fortified | ctx.fortified = aw.getAsNumber(args.fortified or shieldinfo.fortified) | ||
-- fix arguments | -- fix arguments | ||
2021年5月13日 (木) 11:19時点における版
このモジュールについての説明文ページを モジュール:DamageTables/doc に作成できます
local p = {}
local cfg = mw.loadData('Module:DamageTables/configuration')
local aw = require('Module:Utility/Library')
local iu = require('Module:Utility/Image')
local inu = require('Module:Utility/ImageWithName')
local DamageTable = require('Module:DamageTable')
local getArgs -- lazily initialized
local indexableValues = {
damage = 20,
beamdamage = 0,
ticks = 0,
pellet = 1,
head = 2,
leg = 0.8,
charged = 1,
rps = 0,
}
local copiedValues = {
damagemin = 1000,
damagemax = 0,
beamdamagemin = 0,
beamdamagemax = 0,
pelletmin = 0,
pelletmax = 0,
headmax = -1,
legmin = 0,
mulmin = 0.85,
mulmax = 1.05,
skullpiercer = 1,
rpsratio1 = 0,
rpsratio2 = 0,
rpsratio3 = 0,
raise = 0,
reload = 0,
reloadratio2 = 0,
reloadratio3 = 0,
extmag0 = 0,
extmag1 = 0,
extmag2 = 0,
extmag3 = 0,
}
local copiedBooleanValues = {
round = false,
amped = false,
forcegunshield = false,
}
local copiedStringValues = {
skullpiercerrarity = 'legendary',
lang = 'ja',
}
local function rebuildArguments(base, idx, mul)
local ret = {}
-- 再構築する変数
for key, value in pairs(indexableValues) do
local temp = aw.getAsNumber(base[key .. idx], -1)
if temp < 0 then
temp = aw.getAsNumber(base[key], -1)
if temp < 0 then
temp = value
end
end
ret[key] = temp
end
-- コピーする変数
for key, value in pairs(copiedValues) do
local temp = aw.getAsNumber(base[key], -1)
if temp < 0 then
temp = value
end
ret[key] = temp
end
for key, value in pairs(copiedBooleanValues) do
ret[key] = aw.getAsBoolean(base[key], value)
end
for key, value in pairs(copiedStringValues) do
ret[key] = base[key] or value
end
return ret
end
local function appendGroupTables(builder, name, args, idx, mul, ctx, opts)
if not opts.notCreateNewGroup then
builder
:append('</div>\n')
:append('<div class="group-container">\n')
end
local args2 = rebuildArguments(args, idx, mul)
args2.amped = false
args2.caption = name
args2.mul = mul
args2.shieldinfo = args.shieldinfo
if opts.useDisruptor then
args2.disruptor = args.disruptor
else
args2.disruptorsup = args.disruptor
end
if opts.useHammerpoint then
args2.hammerpoint = args.hammerpoint
else
args2.hammerpointsup = args.hammerpoint
end
if opts.usePassthrough then
args2.passthrough = args.passthrough
else
args2.passthroughsup = args.passthrough
end
builder:append(DamageTable._main(args2, ctx.frame))
if args.amped then
local ampedCover = inu.tactical('amped_cover', { lang = ctx.lang })
if name == ctx.res.normal then
args2.caption = ampedCover
else
args2.caption = string.format('%s%s%s', name, ctx.cfg.separator, ampedCover)
end
args2.amped = true
builder:append(DamageTable._main(args2, frame))
end
end
local function appendGroupsTables(builder, args, idx, ctx, opts)
local firstOpts = aw.shallowCopy(opts)
firstOpts.notCreateNewGroup = true
appendGroupTables(builder, ctx.res.normal, args, idx, 1, ctx, firstOpts)
-- Low Profile
if ctx.lowprofile > 1 then
appendGroupTables(builder, ctx.res.lowprofile, args, idx, ctx.lowprofile, ctx, opts)
end
-- Fortified
if ctx.fortified < 1 then
appendGroupTables(builder, ctx.res.fortified, args, idx, ctx.fortified, ctx, opts)
end
end
local maxcount = 8
local empty = {}
function p._main(args, frame)
-- load resources
local lang = args.lang or 'ja'
args.lang = lang
local res = cfg[lang]
local ctx = {
frame = frame,
lang = lang,
cfg = cfg,
res = res,
lowprofile = 1,
fortified = 1,
}
-- init value
local initValues = {
lowprofile = -1,
fortified = -1,
disruptor = 1,
hammerpoint = 1,
passthrough = 1,
}
-- load shield info
args.shieldpreset = args.shieldpreset or 'removelowprofile'
local shieldinfo = require('Module:Stat/Shield')[args.shieldpreset]
args.shieldinfo = shieldinfo
-- overwrite lowprofile & fortified to context
ctx.lowprofile = aw.getAsNumber(args.lowprofile or shieldinfo.lowprofile)
ctx.fortified = aw.getAsNumber(args.fortified or shieldinfo.fortified)
-- fix arguments
for key, value in pairs(initValues) do
args[key] = aw.getAsNumber(args[key], value)
if args[key] == -1 then
args[key] = nil
end
end
args.amped = aw.getAsBoolean(args.amped, shieldinfo.ampedCover)
-- build node
local builder = require('Module:Utility/StringBuilder').new()
if args.name1 then
builder:append(string.format('=== %s ===\n', args.name1))
end
builder:append('<div class="group-container">\n')
appendGroupsTables(builder, args, 1, ctx, empty)
-- Piercing Shots
if args.passthrough < 1 then
builder
:append('\n</div>\n')
:append(string.format('==== %s (x%s) ====\n', res.piercing_shots, args.passthrough))
:append('<div class="group-container">\n')
appendGroupsTables(builder, args, 1, ctx, { usePassthrough = true })
end
-- from twice to 'maxcount' times
for i = 2, maxcount do
local varname = string.format('name%d', i)
if args[varname] then
builder
:append('\n</div>\n')
:append(string.format('=== %s ===\n', args[varname]))
:append('<div class="group-container">\n')
appendGroupsTables(builder, args, i, ctx, empty)
-- Piercing Shots
if args.passthrough < 1 then
builder
:append('\n</div>\n')
:append(string.format('==== %s (x%s) ====\n', res.piercing_shots, args.passthrough))
:append('<div class="group-container">\n')
appendGroupsTables(builder, args, i, ctx, { usePassthrough = true })
end
end
end
-- Disruptor Rounds
if args.disruptor > 1 then
local label = string.format('%s <span class="text-rarity text-rarity-epic">ディスラプター弾 (x%s)</span>', iu.hopup('disruptor_rounds'), args.disruptor)
builder
:append('\n</div>\n')
:append(string.format('=== %s ===\n', label))
:append('<div class="group-container">\n')
appendGroupsTables(builder, args, 'D', ctx, { useDisruptor = true })
end
-- Hammerpoint Rounds
if args.hammerpoint > 1 then
local label = string.format('%s <span class="text-rarity text-rarity-epic">ハンマーポイント弾 (x%s)</span>', iu.hopup('hammerpoint_rounds'), args.hammerpoint)
builder
:append('\n</div>\n')
:append(string.format('=== %s ===\n', label))
:append('<div class="group-container">\n')
appendGroupsTables(builder, args, 'H', ctx, { useHammerpoint = true })
end
-- close tag
builder:append('\n</div>')
return tostring(builder)
end
function p.main(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
args = getArgs(frame)
return p._main(args, frame)
end
return p