| 🌟 | 現在、 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「モジュール:DamageTable」の版間の差分
ナビゲーションに移動
検索に移動
(レッグショットが1倍の場合,胴ダメージに統合する機能の追加) |
(ショットガンの破片計算に対応) |
||
| 40行目: | 40行目: | ||
end | end | ||
local function renderRow(table, name, damage, rowspan) | local function renderRowForSTK(row, damage, pellet, offset) | ||
offset = offset or 0 | |||
local allDamage = pellet * damage | |||
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(100 / allDamage) + offset) | |||
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(150 / allDamage) + offset) | |||
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(175 / allDamage) + offset) | |||
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(200 / allDamage) + offset) | |||
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(225 / allDamage) + offset) | |||
end | |||
local function renderRow(table, name, damage, pellet, rowspan) | |||
rowspan = rowspan or 0 | rowspan = rowspan or 0 | ||
rowspanForDamage = rowspanForDamage or 0 | rowspanForDamage = rowspanForDamage or 0 | ||
| 62行目: | 73行目: | ||
:wikitext(name) | :wikitext(name) | ||
end | end | ||
row:tag('td'):attr('align', 'right'):wikitext(damage | if pellet > 1 then | ||
row:tag('td'):attr('align', 'right'):wikitext(damage .. '<small> × ' .. pellet .. '</small>') | |||
row:tag('td'):attr('align', 'right'):wikitext( | else | ||
row:tag('td'):attr('align', 'right'):wikitext(damage) | |||
row | end | ||
renderRowForSTK(row, damage, pellet) | |||
end | end | ||
local function renderRowForGunShiled(table, damage, baseDamage) | local function renderRowForGunShiled(table, damage, baseDamage, pellet) | ||
local row = table:tag('tr') | local row = table:tag('tr') | ||
row:tag('th') | row:tag('th') | ||
| 79行目: | 90行目: | ||
:wikitext('+ガンシールド') | :wikitext('+ガンシールド') | ||
local countForGunShiled = math.ceil(50 / baseDamage) | local countForGunShiled = math.ceil(50 / (pellet * baseDamage)) | ||
row:tag('td'):attr('align', 'right'):wikitext(baseDamage | if pellet > 1 then | ||
row:tag('td'):attr('align', 'right'):wikitext(baseDamage .. '<small> × ' .. pellet .. '</small>') | |||
row:tag('td'):attr('align', 'right'):wikitext( | else | ||
row:tag('td'):attr('align', 'right'):wikitext(baseDamage) | |||
row | end | ||
renderRowForSTK(row, damage, pellet, countForGunShiled) | |||
end | end | ||
| 104行目: | 115行目: | ||
end | end | ||
local pellet = args.pellet or 1 | |||
local headMul = args.head or 2 | local headMul = args.head or 2 | ||
local headDamage = round(headMul * baseDamage) | local headDamage = round(headMul * baseDamage) | ||
| 115行目: | 127行目: | ||
"頭 (x" .. headMul .. ")", | "頭 (x" .. headMul .. ")", | ||
roundFunc(mul * headDamage), | roundFunc(mul * headDamage), | ||
pellet, | |||
4) | 4) | ||
| 121行目: | 134行目: | ||
table, | table, | ||
'<span class="text-rarity text-rarity-common">Lv.1 (x' .. hlmLv1Mul .. ')</span>', | '<span class="text-rarity text-rarity-common">Lv.1 (x' .. hlmLv1Mul .. ')</span>', | ||
roundFunc(mul * round(hlmLv1Mul * baseDamage))) | roundFunc(mul * round(hlmLv1Mul * baseDamage)), | ||
pellet) | |||
local hlmLv2Mul = 0.4 + 0.6 * headMul | local hlmLv2Mul = 0.4 + 0.6 * headMul | ||
| 127行目: | 141行目: | ||
table, | table, | ||
'<span class="text-rarity text-rarity-rare">Lv.2 (x' .. hlmLv2Mul .. ')</span>', | '<span class="text-rarity text-rarity-rare">Lv.2 (x' .. hlmLv2Mul .. ')</span>', | ||
roundFunc(mul * round(hlmLv2Mul * baseDamage))) | roundFunc(mul * round(hlmLv2Mul * baseDamage)), | ||
pellet) | |||
local hlmLv3Mul = 0.5 + 0.5 * headMul | local hlmLv3Mul = 0.5 + 0.5 * headMul | ||
| 133行目: | 148行目: | ||
table, | table, | ||
'<span class="text-rarity text-rarity-epic">Lv.3</span>/<span class="text-rarity text-rarity-legendary">4 (x' .. hlmLv3Mul .. ')</span>', | '<span class="text-rarity text-rarity-epic">Lv.3</span>/<span class="text-rarity text-rarity-legendary">4 (x' .. hlmLv3Mul .. ')</span>', | ||
roundFunc(mul * round(hlmLv3Mul * baseDamage))) | roundFunc(mul * round(hlmLv3Mul * baseDamage)), | ||
pellet) | |||
local bodyDamage = roundFunc(mul * baseDamage) | local bodyDamage = roundFunc(mul * baseDamage) | ||
if legMul == 1 then | if legMul == 1 then | ||
if mul == 0.85 then | if mul == 0.85 then | ||
renderRow(table, "胴・脚", bodyDamage, 2) | renderRow(table, "胴・脚", bodyDamage, pellet, 2) | ||
renderRowForGunShiled(table, bodyDamage, baseDamage) | renderRowForGunShiled(table, bodyDamage, baseDamage, pellet) | ||
else | else | ||
renderRow(table, "胴・脚", bodyDamage, 1) | renderRow(table, "胴・脚", bodyDamage, pellet, 1) | ||
end | end | ||
else | else | ||
local legDamage = roundFunc(mul * round(legMul * baseDamage)) | local legDamage = roundFunc(mul * round(legMul * baseDamage)) | ||
if mul == 1.05 then | if mul == 1.05 then | ||
renderRow(table, "胴・脚", bodyDamage, 1) | renderRow(table, "胴・脚", bodyDamage, pellet, 1) | ||
elseif mul == 0.85 then | elseif mul == 0.85 then | ||
renderRow(table, "胴", bodyDamage, 2) | renderRow(table, "胴", bodyDamage, pellet, 2) | ||
renderRowForGunShiled(table, bodyDamage, baseDamage) | renderRowForGunShiled(table, bodyDamage, baseDamage, pellet) | ||
renderRow(table, "脚 (x" .. legMul .. ")", legDamage, 1) | renderRow(table, "脚 (x" .. legMul .. ")", legDamage, pellet, 1) | ||
else | else | ||
renderRow(table, "胴", bodyDamage, pellet, 1) | |||
renderRow(table, "脚 (x" .. legMul .. ")", legDamage, pellet, 1) | |||
end | end | ||
end | end | ||
| 172行目: | 188行目: | ||
-- fix arguments | -- fix arguments | ||
args.damage = tonumber(args.damage) | args.damage = tonumber(args.damage) | ||
args.pellet = tonumber(args.pellet) | |||
args.head = tonumber(args.head) | args.head = tonumber(args.head) | ||
args.leg = tonumber(args.leg) | args.leg = tonumber(args.leg) | ||
2021年1月23日 (土) 09:18時点における版
このモジュールについての説明文ページを モジュール:DamageTable/doc に作成できます
local p = {}
local getArgs -- lazily initialized
local function round(num)
return math.floor(tonumber(string.format("%.3f", num)) + 0.5)
end
local function roundover(num)
return math.ceil(num - 0.5)
end
local function renderHeader(table, mul)
local row = table:tag('tr')
local cell = row:tag('th')
:attr('colspan', 2)
:attr('rowspan', 2)
if mul == 1 then
cell:wikitext('部位')
elseif mul == 1.05 then
cell:wikitext('部位 (小柄)')
elseif mul == 0.85 then
cell:wikitext('部位 (鉄壁)')
else
cell:wikitext('部位 (x' .. mul .. ')')
end
row:tag('th')
:attr('rowspan', 2)
:wikitext('ダメージ')
row:tag('th')
:attr('colspan', 5)
:wikitext('確殺数')
row = table:tag('tr')
row:tag('th'):wikitext('100<small> HP</small>')
row:tag('th'):wikitext('<span class="text-rarity text-rarity-common">150<small> HP</small></span>')
row:tag('th'):wikitext('<span class="text-rarity text-rarity-rare">175<small> HP</small></span>')
row:tag('th'):wikitext('<span class="text-rarity text-rarity-epic">200<small> HP</small></span>')
row:tag('th'):wikitext('<span class="text-rarity text-rarity-heirloom">225<small> HP</small></span>')
end
local function renderRowForSTK(row, damage, pellet, offset)
offset = offset or 0
local allDamage = pellet * damage
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(100 / allDamage) + offset)
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(150 / allDamage) + offset)
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(175 / allDamage) + offset)
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(200 / allDamage) + offset)
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(225 / allDamage) + offset)
end
local function renderRow(table, name, damage, pellet, rowspan)
rowspan = rowspan or 0
rowspanForDamage = rowspanForDamage or 0
local row = table:tag('tr')
if rowspan > 1 then
row:tag('th')
:attr('colspan', 2)
:css('border-bottom', "0 none transparent")
:wikitext(name)
elseif rowspan == 1 then
row:tag('th')
:attr('colspan', 2)
:wikitext(name)
else
row:tag('th')
:css('border-top', "0 none transparent")
:css('border-bottom', "0 none transparent")
:wikitext(' ')
row:tag('th')
:wikitext(name)
end
if pellet > 1 then
row:tag('td'):attr('align', 'right'):wikitext(damage .. '<small> × ' .. pellet .. '</small>')
else
row:tag('td'):attr('align', 'right'):wikitext(damage)
end
renderRowForSTK(row, damage, pellet)
end
local function renderRowForGunShiled(table, damage, baseDamage, pellet)
local row = table:tag('tr')
row:tag('th')
:css('border-top', "0 none transparent")
:css('border-bottom', "0 none transparent")
:wikitext(' ')
row:tag('th')
:wikitext('+ガンシールド')
local countForGunShiled = math.ceil(50 / (pellet * baseDamage))
if pellet > 1 then
row:tag('td'):attr('align', 'right'):wikitext(baseDamage .. '<small> × ' .. pellet .. '</small>')
else
row:tag('td'):attr('align', 'right'):wikitext(baseDamage)
end
renderRowForSTK(row, damage, pellet, countForGunShiled)
end
local function renderTable(args)
local mul = args.mul or 1
local roundFunc
if mul == 0.85 then
roundFunc = round
else
roundFunc = roundover
end
local baseDamage
if args.amped then
baseDamage = round(1.2 * (args.damage or 20))
else
baseDamage = args.damage or 20
end
local pellet = args.pellet or 1
local headMul = args.head or 2
local headDamage = round(headMul * baseDamage)
local legMul = args.leg or 0.8
local table = mw.html.create('table')
:addClass('wikitable')
renderHeader(table, mul)
renderRow(
table,
"頭 (x" .. headMul .. ")",
roundFunc(mul * headDamage),
pellet,
4)
local hlmLv1Mul = 0.2 + 0.8 * headMul
renderRow(
table,
'<span class="text-rarity text-rarity-common">Lv.1 (x' .. hlmLv1Mul .. ')</span>',
roundFunc(mul * round(hlmLv1Mul * baseDamage)),
pellet)
local hlmLv2Mul = 0.4 + 0.6 * headMul
renderRow(
table,
'<span class="text-rarity text-rarity-rare">Lv.2 (x' .. hlmLv2Mul .. ')</span>',
roundFunc(mul * round(hlmLv2Mul * baseDamage)),
pellet)
local hlmLv3Mul = 0.5 + 0.5 * headMul
renderRow(
table,
'<span class="text-rarity text-rarity-epic">Lv.3</span>/<span class="text-rarity text-rarity-legendary">4 (x' .. hlmLv3Mul .. ')</span>',
roundFunc(mul * round(hlmLv3Mul * baseDamage)),
pellet)
local bodyDamage = roundFunc(mul * baseDamage)
if legMul == 1 then
if mul == 0.85 then
renderRow(table, "胴・脚", bodyDamage, pellet, 2)
renderRowForGunShiled(table, bodyDamage, baseDamage, pellet)
else
renderRow(table, "胴・脚", bodyDamage, pellet, 1)
end
else
local legDamage = roundFunc(mul * round(legMul * baseDamage))
if mul == 1.05 then
renderRow(table, "胴・脚", bodyDamage, pellet, 1)
elseif mul == 0.85 then
renderRow(table, "胴", bodyDamage, pellet, 2)
renderRowForGunShiled(table, bodyDamage, baseDamage, pellet)
renderRow(table, "脚 (x" .. legMul .. ")", legDamage, pellet, 1)
else
renderRow(table, "胴", bodyDamage, pellet, 1)
renderRow(table, "脚 (x" .. legMul .. ")", legDamage, pellet, 1)
end
end
return table
end
function p._main(args)
return tostring(renderTable(args))
end
function p.main(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
args = getArgs(frame)
-- fix arguments
args.damage = tonumber(args.damage)
args.pellet = tonumber(args.pellet)
args.head = tonumber(args.head)
args.leg = tonumber(args.leg)
args.mul = tonumber(args.mul)
args.amped = args.amped == 'true'
return p._main(args)
end
return p