🌟 | 現在、 鉄壁ヘッドショットには対応済みです。 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「モジュール:DamageTable」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「local p = {} local function renderRow(table, name, damage) table :tag('tr') :tag('td'):wikitext(name) :tag('td'):wikitext(damage) end local function renderTabl…」) |
(改良) |
||
1行目: | 1行目: | ||
local p = {} | local p = {} | ||
local function renderRow(table, name, damage) | local function round(num) | ||
table | return math.floor(num + 0.5) | ||
:tag(' | end | ||
:tag(' | |||
:tag('td'):wikitext(damage) | local function renderHeader(table) | ||
local row = table:tag('tr') | |||
row:tag('th') | |||
:attr('colspan', 2) | |||
:attr('rowspan', 2) | |||
:wikitext('部位') | |||
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 style="color:#A8A8A8">150<small> HP</small></span>') | |||
row:tag('th'):wikitext('<span style="color:#51A8D6">175<small> HP</small></span>') | |||
row:tag('th'):wikitext('<span style="color:#B237C8">200<small> HP</small></span>') | |||
row:tag('th'):wikitext('<span style="color:#FF4E1D">225<small> HP</small></span>') | |||
end | |||
local function renderRow(table, name, damage, rowspan) | |||
rowspan = rowspan 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 | |||
row:tag('td'):attr('align', 'right'):wikitext(damage) | |||
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(100 / damage)) | |||
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(150 / damage)) | |||
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(175 / damage)) | |||
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(200 / damage)) | |||
row:tag('td'):attr('align', 'right'):wikitext(math.ceil(225 / damage)) | |||
end | end | ||
local function renderTable(args) | local function renderTable(args) | ||
local bodyDamage = args.damage or 20 | |||
local headMul = args.head or 2 | |||
local headDamage = round(headMul * bodyDamage) | |||
local legMul = args.leg or 0.8 | |||
local table = mw.html.create('table') | local table = mw.html.create('table') | ||
:addClass('wikitable') | :addClass('wikitable') | ||
renderRow(table, " | renderHeader(table) | ||
renderRow(table, "頭 (x" .. headMul .. ")", headDamage, 4) | |||
renderRow( | |||
table, | |||
'<span style="color:#A8A8A8">Lv.1</span>', | |||
round(0.9 * headDamage)) | |||
renderRow( | |||
table, | |||
'<span style="color:#51A8D6">Lv.2</span>', | |||
round(0.8 * headDamage)) | |||
renderRow( | |||
table, | |||
'<span style="color:#B237C8">Lv.3</span>/<span style="color:#CEAD21">4</span>', | |||
round(0.75 * headDamage)) | |||
renderRow(table, "胴", bodyDamage, 1) | |||
renderRow(table, "脚 (x" .. legMul .. ")", round(legMul * bodyDamage), 1) | |||
return table | return table | ||
end | end |
2021年1月20日 (水) 16:14時点における版
このモジュールについての説明文ページを モジュール:DamageTable/doc に作成できます
local p = {} local function round(num) return math.floor(num + 0.5) end local function renderHeader(table) local row = table:tag('tr') row:tag('th') :attr('colspan', 2) :attr('rowspan', 2) :wikitext('部位') 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 style="color:#A8A8A8">150<small> HP</small></span>') row:tag('th'):wikitext('<span style="color:#51A8D6">175<small> HP</small></span>') row:tag('th'):wikitext('<span style="color:#B237C8">200<small> HP</small></span>') row:tag('th'):wikitext('<span style="color:#FF4E1D">225<small> HP</small></span>') end local function renderRow(table, name, damage, rowspan) rowspan = rowspan 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 row:tag('td'):attr('align', 'right'):wikitext(damage) row:tag('td'):attr('align', 'right'):wikitext(math.ceil(100 / damage)) row:tag('td'):attr('align', 'right'):wikitext(math.ceil(150 / damage)) row:tag('td'):attr('align', 'right'):wikitext(math.ceil(175 / damage)) row:tag('td'):attr('align', 'right'):wikitext(math.ceil(200 / damage)) row:tag('td'):attr('align', 'right'):wikitext(math.ceil(225 / damage)) end local function renderTable(args) local bodyDamage = args.damage or 20 local headMul = args.head or 2 local headDamage = round(headMul * bodyDamage) local legMul = args.leg or 0.8 local table = mw.html.create('table') :addClass('wikitable') renderHeader(table) renderRow(table, "頭 (x" .. headMul .. ")", headDamage, 4) renderRow( table, '<span style="color:#A8A8A8">Lv.1</span>', round(0.9 * headDamage)) renderRow( table, '<span style="color:#51A8D6">Lv.2</span>', round(0.8 * headDamage)) renderRow( table, '<span style="color:#B237C8">Lv.3</span>/<span style="color:#CEAD21">4</span>', round(0.75 * headDamage)) renderRow(table, "胴", bodyDamage, 1) renderRow(table, "脚 (x" .. legMul .. ")", round(legMul * bodyDamage), 1) return table end function p._main(args) return tostring(renderTable(args)) end function p.main(frame) return p._main({}) end return p