🌟 | 現在、 鉄壁ヘッドショットには対応済みです。 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「モジュール:StatTable/DamagePerSlot」の版間の差分
ナビゲーションに移動
検索に移動
(モバイル向けの軸の数値を「~k」表記に変更) |
(頭や脚も考慮したスロット火力の算出の実装) |
||
1行目: | 1行目: | ||
local aw = require('Module:Utility/Library') | local aw = require('Module:Utility/Library') | ||
local apex = require('Module:Utility/ApexLibrary') | |||
local iu = require('Module:Utility/Image') | local iu = require('Module:Utility/Image') | ||
local tableutil = require('Module:Utility/TableUtil/Apex') | local tableutil = require('Module:Utility/TableUtil/Apex') | ||
6行目: | 7行目: | ||
local configuration = { | local configuration = { | ||
en = { | en = { | ||
bodyshot = 'Body', | |||
dmgslot = 'Damage per Slot', | dmgslot = 'Damage per Slot', | ||
graph = 'Graph', | graph = 'Graph', | ||
headshot = 'Head', | |||
headlvl1 = 'Head w/Lvl1', | |||
headlvl2 = 'Head w/Lvl2', | |||
headlvl3 = 'Head w/Lvl3', | |||
hopup = 'Hop-Up', | hopup = 'Hop-Up', | ||
legsshot = 'Legs', | |||
infinity = '∞', | infinity = '∞', | ||
maxcharge = 'Max charge', | maxcharge = 'Max charge', | ||
17行目: | 23行目: | ||
}, | }, | ||
ja = { | ja = { | ||
bodyshot = '胴', | |||
dmgslot = 'スロット当たりのダメージ', | dmgslot = 'スロット当たりのダメージ', | ||
graph = 'グラフ', | graph = 'グラフ', | ||
headshot = '頭', | |||
headlvl1 = '頭 (Lv.1)', | |||
headlvl2 = '頭 (Lv.2)', | |||
headlvl3 = '頭 (Lv.3)', | |||
hopup = 'ホップアップ', | hopup = 'ホップアップ', | ||
legsshot = '脚', | |||
infinity = '∞', | infinity = '∞', | ||
maxcharge = '最大溜め', | maxcharge = '最大溜め', | ||
26行目: | 38行目: | ||
}, | }, | ||
} | } | ||
local function addData(dataset, data, fn) | |||
fn = fn or function(val) return val end | |||
local head = data.head | |||
local lvl1 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV1) | |||
local lvl2 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV2) | |||
local lvl3 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV3) | |||
local legs = data.legs | |||
local mul = data.pellets * data.slotammo | |||
data.bodyDmgslot = fn(data.damage, 1) * mul | |||
data.headDmgslot = fn(apex.calcPartDamage(data.damage, head), head) * mul | |||
data.lvl1Dmgslot = fn(apex.calcPartDamage(data.damage, lvl1), lvl1) * mul | |||
data.lvl2Dmgslot = fn(apex.calcPartDamage(data.damage, lvl2), lvl2) * mul | |||
data.lvl3Dmgslot = fn(apex.calcPartDamage(data.damage, lvl3), lvl3) * mul | |||
data.legsDmgslot = fn(apex.calcPartDamage(data.damage, legs), legs) * mul | |||
table.insert(dataset, data) | |||
end | |||
local p = {} | local p = {} | ||
function p._main(args) | function p._main(args, __debug) | ||
args = args or {} | args = args or {} | ||
if __debug == nil then | |||
__debug = true | |||
end | |||
local lang = args.lang or 'ja' | local lang = args.lang or 'ja' | ||
52行目: | 86行目: | ||
local ammoPerShot = stat.ammo_per_shot or 1 | local ammoPerShot = stat.ammo_per_shot or 1 | ||
local baseDamage = stat.damage.base | local baseDamage = stat.damage.base | ||
local baseData = { | local baseData = { | ||
ammo = stat.ammo, | ammo = stat.ammo, | ||
damage = baseDamage, | |||
head = stat.damage.headshot, | |||
legs = stat.damage.legshot, | |||
name = name, | name = name, | ||
pellets = stat.pellet or 1, | |||
shortname = stat.localization['Japanese_Short'], | shortname = stat.localization['Japanese_Short'], | ||
slotammo = math.floor(ammoPerSlot / ammoPerShot), | |||
} | } | ||
-- チャージビーム (チャージライフル) | -- チャージビーム (チャージライフル) | ||
if stat.damage.beam then | if stat.damage.beam then | ||
addData(dataset, baseData, function(val, mul) | |||
return val + apex.calcPartDamage(stat.damage.beam.base, mul) * stat.damage.beam.ticks | |||
end) | |||
-- 散弾 (ショットガン・トリプルテイク) | -- 散弾 (ショットガン・トリプルテイク) | ||
elseif aw.isNumberAndGreaterThanX(stat.pellet, 1) then | elseif aw.isNumberAndGreaterThanX(stat.pellet, 1) then | ||
addData(dataset, baseData) | |||
-- ハンマーポイント弾 (モザンビーク) | -- ハンマーポイント弾 (モザンビーク) | ||
if ( | if (__debug or Hopup.hammerpoint_rounds.enabled) and aw.isNumberAndGreaterThanX(stat.damage.hammerpoint_rounds, 1) then | ||
local pelletUnshieldedData = aw.shallowCopy( | local pelletUnshieldedData = aw.shallowCopy(baseData) | ||
pelletUnshieldedData. | pelletUnshieldedData.damage = math.floor(stat.damage.hammerpoint_rounds * baseDamage) | ||
pelletUnshieldedData.hopup = { 'hammerpoint_rounds' } | pelletUnshieldedData.hopup = { 'hammerpoint_rounds' } | ||
addData(dataset, pelletUnshieldedData) | |||
end | end | ||
87行目: | 122行目: | ||
local minChargeData = aw.shallowCopy(baseData) | local minChargeData = aw.shallowCopy(baseData) | ||
minChargeData.option = res.mincharge | minChargeData.option = res.mincharge | ||
addData(dataset, minChargeData) | |||
local maxChargeData = aw.shallowCopy(baseData) | local maxChargeData = aw.shallowCopy(baseData) | ||
maxChargeData. | maxChargeData.damage = stat.damage.charged | ||
maxChargeData.option = res.maxcharge | maxChargeData.option = res.maxcharge | ||
addData(dataset, maxChargeData) | |||
-- チャージが無効の場合の通常出力 | -- チャージが無効の場合の通常出力 | ||
else | else | ||
addData(dataset, baseData) | |||
end | end | ||
-- 増幅モード (センチネル) | -- 増幅モード (センチネル) | ||
if aw.isNumberAndGreaterThanX(stat.damage.amped, baseDamage) then | if aw.isNumberAndGreaterThanX(stat.damage.amped, baseDamage) then | ||
local ampedData = aw.shallowCopy(baseData) | local ampedData = aw.shallowCopy(baseData) | ||
ampedData.ammo | ampedData.ammo = ampedData.ammo .. '_amped' | ||
ampedData. | ampedData.damage = stat.damage.amped | ||
ampedData.option | ampedData.option = iu.item('シールドセル') .. '<span class="text-desktoponly"> 増幅モード</span>' | ||
addData(dataset, ampedData) | |||
end | end | ||
-- セレクトファイアレシーバー (ハボックライフル) | -- セレクトファイアレシーバー (ハボックライフル) | ||
if ( | if (__debug or Hopup.selectfire_receiver.enabled) and stat.selectfire_receiver and stat.selectfire_receiver.damage and aw.isNumberAndGreaterThanX(stat.selectfire_receiver.damage.base, baseDamage) then | ||
local selectfireReceiverData = aw.shallowCopy(baseData) | local selectfireReceiverData = aw.shallowCopy(baseData) | ||
selectfireReceiverData. | selectfireReceiverData.damage = stat.selectfire_receiver.damage.base | ||
selectfireReceiverData.hopup | selectfireReceiverData.hopup = { 'selectfire_receiver' } | ||
addData(dataset, selectfireReceiverData) | |||
end | end | ||
-- ハンマーポイント弾 (P2020) | -- ハンマーポイント弾 (P2020) | ||
if ( | if (__debug or Hopup.hammerpoint_rounds.enabled) and aw.isNumberAndGreaterThanX(stat.damage.hammerpoint_rounds, 1) then | ||
local hammerpointRoundsData = aw.shallowCopy(baseData) | local hammerpointRoundsData = aw.shallowCopy(baseData) | ||
hammerpointRoundsData. | hammerpointRoundsData.damage = math.floor(stat.damage.hammerpoint_rounds * baseDamage) | ||
hammerpointRoundsData.hopup | hammerpointRoundsData.hopup = { 'hammerpoint_rounds' } | ||
addData(dataset, hammerpointRoundsData) | |||
end | end | ||
-- ディスラプター弾 (オルタネーター・RE-45オート) | -- ディスラプター弾 (オルタネーター・RE-45オート) | ||
if ( | if (__debug or Hopup.disruptor_rounds.enabled or special) and aw.isNumberAndGreaterThanX(stat.damage.disruptor_rounds, 1) then | ||
local disruptorRoundsData = aw.shallowCopy(baseData) | local disruptorRoundsData = aw.shallowCopy(baseData) | ||
disruptorRoundsData.hopup = { 'disruptor_rounds' } | |||
disruptorRoundsData.hopup | addData(dataset, disruptorRoundsData, function(val) | ||
return apex.calcDisruptorDamage(val, stat.damage.disruptor_rounds) | |||
end) | |||
end | end | ||
-- アンビルレシーバー (VK-47フラットライン・R-301カービン) | -- アンビルレシーバー (VK-47フラットライン・R-301カービン) | ||
if ( | if (__debug or Hopup.anvil_receiver.enabled) and stat.anvil_receiver and aw.isNumberAndGreaterThanX(stat.anvil_receiver.damage.base, baseDamage) then | ||
local anvilAmmoPerShot = stat.anvil_receiver.ammo_per_shot or 2 | local anvilAmmoPerShot = stat.anvil_receiver.ammo_per_shot or 2 | ||
local anvilReceiverData = aw.shallowCopy(baseData) | local anvilReceiverData = aw.shallowCopy(baseData) | ||
anvilReceiverData. | anvilReceiverData.damage = stat.anvil_receiver.damage.base | ||
anvilReceiverData.hopup | anvilReceiverData.hopup = { 'anvil_receiver' } | ||
anvilReceiverData.slotammo = math.floor(ammoPerSlot / anvilAmmoPerShot) | |||
addData(dataset, anvilReceiverData) | |||
end | end | ||
-- シャッターキャップ (30-30リピーター・ボセックコンパウンドボウ) | -- シャッターキャップ (30-30リピーター・ボセックコンパウンドボウ) | ||
if ( | if (__debug or Hopup.shatter_caps.enabled) and stat.shatter_caps and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.base, 1) and aw.isNumberAndGreaterThanX(stat.shatter_caps.pellet, 1) then | ||
if aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then | if aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then | ||
local shatterCapsMinChargeData = aw.shallowCopy(baseData) | local shatterCapsMinChargeData = aw.shallowCopy(baseData) | ||
shatterCapsMinChargeData. | shatterCapsMinChargeData.damage = stat.shatter_caps.damage.base | ||
shatterCapsMinChargeData.option = res.mincharge | shatterCapsMinChargeData.option = res.mincharge | ||
shatterCapsMinChargeData.hopup = { 'shatter_caps' } | shatterCapsMinChargeData.hopup = { 'shatter_caps' } | ||
shatterCapsMinChargeData.pellets = stat.shatter_caps.pellet | |||
addData(dataset, shatterCapsMinChargeData) | |||
local shatterCapsMaxChargeData = aw.shallowCopy(shatterCapsMinChargeData) | local shatterCapsMaxChargeData = aw.shallowCopy(shatterCapsMinChargeData) | ||
shatterCapsMaxChargeData. | shatterCapsMaxChargeData.damage = stat.shatter_caps.damage.charged | ||
shatterCapsMaxChargeData.option | shatterCapsMaxChargeData.option = res.maxcharge | ||
addData(dataset, shatterCapsMaxChargeData) | |||
else | else | ||
local shatterCapsData = aw.shallowCopy(baseData) | local shatterCapsData = aw.shallowCopy(baseData) | ||
shatterCapsData. | shatterCapsData.damage = stat.shatter_caps.damage.base | ||
shatterCapsData.hopup = { 'shatter_caps' } | shatterCapsData.hopup = { 'shatter_caps' } | ||
shatterCapsData.pellets = stat.shatter_caps.pellet | |||
addData(dataset, shatterCapsData) | |||
end | end | ||
end | end | ||
172行目: | 211行目: | ||
end | end | ||
local metadata = { | local metadata = { | ||
tableutil.RankCell.new('', ' | tableutil.RankCell.new('', 'bodyDmgslot', true), | ||
tableutil.AmmoCell.new('', 'ammo', { | tableutil.AmmoCell.new('', 'ammo', { | ||
attributes | attributes = { align = 'center' }, | ||
headerStyle | cellClass = 'st-desktop', | ||
footerClass = 'st-desktop', | |||
headerClass = 'st-desktop', | |||
headerStyle = { width = '36px' }, | |||
}), | }), | ||
tableutil.WeaponNameCell.new(res.weaponname, 'name', { | tableutil.WeaponNameCell.new(res.weaponname, 'name', { | ||
190行目: | 232行目: | ||
headerColspan = 0, | headerColspan = 0, | ||
}), | }), | ||
tableutil.LineValueCell.new(res. | tableutil.ValueCell.new(res.legsshot, 'legsDmgslot', { | ||
cellClass = 'st-mobile-graph st-mobile-textshadow | cellClass = 'st-desktop', | ||
footerClass = 'st-mobile-axis | footerClass = 'st-desktop', | ||
format = formatFunction, | |||
headerClass = 'st-desktop', | |||
headerStyle = { | |||
['min-width'] = '40px', | |||
['max-width'] = '4em', | |||
}, | |||
}), | |||
tableutil.LineValueCell.new(res.bodyshot, 'bodyDmgslot', { | |||
startIndex = 'legsDmgslot', | |||
endIndex = 'lvl1Dmgslot', | |||
cellClass = 'st-mobile-graph st-mobile-textshadow', | |||
footerClass = 'st-mobile-axis', | |||
format = formatFunction, | format = formatFunction, | ||
headerStyle = { | headerStyle = { | ||
['min-width'] = ' | ['min-width'] = '80px', | ||
['max-width'] = '8em', | ['max-width'] = '8em', | ||
}, | }, | ||
204行目: | 257行目: | ||
end | end | ||
}), | }), | ||
tableutil.LineCell.new(res.graph, ' | tableutil.ValueCell.new(res.headlvl3, 'lvl3Dmgslot', { | ||
cellClass = 'st-desktop', | |||
footerClass = 'st-desktop', | |||
format = formatFunction, | |||
headerClass = 'st-desktop', | |||
headerStyle = { | |||
['min-width'] = '40px', | |||
['max-width'] = '4em', | |||
}, | |||
}), | |||
tableutil.ValueCell.new(res.headlvl2, 'lvl2Dmgslot', { | |||
cellClass = 'st-desktop', | |||
footerClass = 'st-desktop', | |||
format = formatFunction, | |||
headerClass = 'st-desktop', | |||
headerStyle = { | |||
['min-width'] = '40px', | |||
['max-width'] = '4em', | |||
}, | |||
}), | |||
tableutil.ValueCell.new(res.headlvl1, 'lvl1Dmgslot', { | |||
cellClass = 'st-mobile-last', | |||
footerClass = 'st-mobile-last', | |||
format = formatFunction, | |||
headerClass = 'st-mobile-last', | |||
headerStyle = { | |||
['min-width'] = '40px', | |||
['max-width'] = '4em', | |||
}, | |||
}), | |||
tableutil.LineCell.new(res.graph, 'bodyDmgslot', { | |||
startIndex = 'legsDmgslot', | |||
endIndex = 'lvl1Dmgslot', | |||
cellClass = 'st-desktop st-desktop-graph', | cellClass = 'st-desktop st-desktop-graph', | ||
footerClass = 'st-desktop', | footerClass = 'st-desktop', | ||
headerClass = 'st-desktop', | headerClass = 'st-desktop', | ||
headerStyle = { | headerStyle = { | ||
['min-width'] = ' | ['min-width'] = '200px', | ||
}, | }, | ||
}), | }), | ||
} | } | ||
local node = tableutil.createTable(dataset, metadata | local node = tableutil.createTable(dataset, metadata) | ||
return tostring(node) | return tostring(node) | ||
end | end | ||
223行目: | 308行目: | ||
args = getArgs(frame) | args = getArgs(frame) | ||
return p._main(args) | return p._main(args, false) | ||
end | end | ||
return p | return p |
2021年8月23日 (月) 18:09時点における版
このモジュールについての説明文ページを モジュール:StatTable/DamagePerSlot/doc に作成できます
local aw = require('Module:Utility/Library') local apex = require('Module:Utility/ApexLibrary') local iu = require('Module:Utility/Image') local tableutil = require('Module:Utility/TableUtil/Apex') local Hopup = mw.loadData('Module:Stat/Hopup') local getArgs -- lazily initialized local configuration = { en = { bodyshot = 'Body', dmgslot = 'Damage per Slot', graph = 'Graph', headshot = 'Head', headlvl1 = 'Head w/Lvl1', headlvl2 = 'Head w/Lvl2', headlvl3 = 'Head w/Lvl3', hopup = 'Hop-Up', legsshot = 'Legs', infinity = '∞', maxcharge = 'Max charge', mincharge = 'Min charge', weaponname = 'Weapon name', }, ja = { bodyshot = '胴', dmgslot = 'スロット当たりのダメージ', graph = 'グラフ', headshot = '頭', headlvl1 = '頭 (Lv.1)', headlvl2 = '頭 (Lv.2)', headlvl3 = '頭 (Lv.3)', hopup = 'ホップアップ', legsshot = '脚', infinity = '∞', maxcharge = '最大溜め', mincharge = '最小溜め', weaponname = '武器名', }, } local function addData(dataset, data, fn) fn = fn or function(val) return val end local head = data.head local lvl1 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV1) local lvl2 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV2) local lvl3 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV3) local legs = data.legs local mul = data.pellets * data.slotammo data.bodyDmgslot = fn(data.damage, 1) * mul data.headDmgslot = fn(apex.calcPartDamage(data.damage, head), head) * mul data.lvl1Dmgslot = fn(apex.calcPartDamage(data.damage, lvl1), lvl1) * mul data.lvl2Dmgslot = fn(apex.calcPartDamage(data.damage, lvl2), lvl2) * mul data.lvl3Dmgslot = fn(apex.calcPartDamage(data.damage, lvl3), lvl3) * mul data.legsDmgslot = fn(apex.calcPartDamage(data.damage, legs), legs) * mul table.insert(dataset, data) end local p = {} function p._main(args, __debug) args = args or {} if __debug == nil then __debug = true end local lang = args.lang or 'ja' local res = configuration[lang] local stats = mw.loadData('Module:Stat/Weapon') local ammoStats = mw.loadData('Module:Stat/Ammo') local dataset = {} for name, stat in pairs(stats) do local special = aw.stringstarts(stat.ammo, 'special_') local ammoPerSlot if special or stat.ammo == 'minigun' then if type(stat.magazine) == 'table' then ammoPerSlot = stat.magazine[4] + stat.magazine_reserve else ammoPerSlot = stat.magazine + stat.magazine_reserve end else ammoPerSlot = ammoStats[stat.ammo].slot end local ammoPerShot = stat.ammo_per_shot or 1 local baseDamage = stat.damage.base local baseData = { ammo = stat.ammo, damage = baseDamage, head = stat.damage.headshot, legs = stat.damage.legshot, name = name, pellets = stat.pellet or 1, shortname = stat.localization['Japanese_Short'], slotammo = math.floor(ammoPerSlot / ammoPerShot), } -- チャージビーム (チャージライフル) if stat.damage.beam then addData(dataset, baseData, function(val, mul) return val + apex.calcPartDamage(stat.damage.beam.base, mul) * stat.damage.beam.ticks end) -- 散弾 (ショットガン・トリプルテイク) elseif aw.isNumberAndGreaterThanX(stat.pellet, 1) then addData(dataset, baseData) -- ハンマーポイント弾 (モザンビーク) if (__debug or Hopup.hammerpoint_rounds.enabled) and aw.isNumberAndGreaterThanX(stat.damage.hammerpoint_rounds, 1) then local pelletUnshieldedData = aw.shallowCopy(baseData) pelletUnshieldedData.damage = math.floor(stat.damage.hammerpoint_rounds * baseDamage) pelletUnshieldedData.hopup = { 'hammerpoint_rounds' } addData(dataset, pelletUnshieldedData) end -- それ以外 else -- チャージ (30-30リピーター・ボセックコンパウンドボウ) if aw.isNumberAndGreaterThanX(stat.damage.charged, baseDamage) then local minChargeData = aw.shallowCopy(baseData) minChargeData.option = res.mincharge addData(dataset, minChargeData) local maxChargeData = aw.shallowCopy(baseData) maxChargeData.damage = stat.damage.charged maxChargeData.option = res.maxcharge addData(dataset, maxChargeData) -- チャージが無効の場合の通常出力 else addData(dataset, baseData) end -- 増幅モード (センチネル) if aw.isNumberAndGreaterThanX(stat.damage.amped, baseDamage) then local ampedData = aw.shallowCopy(baseData) ampedData.ammo = ampedData.ammo .. '_amped' ampedData.damage = stat.damage.amped ampedData.option = iu.item('シールドセル') .. '<span class="text-desktoponly"> 増幅モード</span>' addData(dataset, ampedData) end -- セレクトファイアレシーバー (ハボックライフル) if (__debug or Hopup.selectfire_receiver.enabled) and stat.selectfire_receiver and stat.selectfire_receiver.damage and aw.isNumberAndGreaterThanX(stat.selectfire_receiver.damage.base, baseDamage) then local selectfireReceiverData = aw.shallowCopy(baseData) selectfireReceiverData.damage = stat.selectfire_receiver.damage.base selectfireReceiverData.hopup = { 'selectfire_receiver' } addData(dataset, selectfireReceiverData) end -- ハンマーポイント弾 (P2020) if (__debug or Hopup.hammerpoint_rounds.enabled) and aw.isNumberAndGreaterThanX(stat.damage.hammerpoint_rounds, 1) then local hammerpointRoundsData = aw.shallowCopy(baseData) hammerpointRoundsData.damage = math.floor(stat.damage.hammerpoint_rounds * baseDamage) hammerpointRoundsData.hopup = { 'hammerpoint_rounds' } addData(dataset, hammerpointRoundsData) end -- ディスラプター弾 (オルタネーター・RE-45オート) if (__debug or Hopup.disruptor_rounds.enabled or special) and aw.isNumberAndGreaterThanX(stat.damage.disruptor_rounds, 1) then local disruptorRoundsData = aw.shallowCopy(baseData) disruptorRoundsData.hopup = { 'disruptor_rounds' } addData(dataset, disruptorRoundsData, function(val) return apex.calcDisruptorDamage(val, stat.damage.disruptor_rounds) end) end -- アンビルレシーバー (VK-47フラットライン・R-301カービン) if (__debug or Hopup.anvil_receiver.enabled) and stat.anvil_receiver and aw.isNumberAndGreaterThanX(stat.anvil_receiver.damage.base, baseDamage) then local anvilAmmoPerShot = stat.anvil_receiver.ammo_per_shot or 2 local anvilReceiverData = aw.shallowCopy(baseData) anvilReceiverData.damage = stat.anvil_receiver.damage.base anvilReceiverData.hopup = { 'anvil_receiver' } anvilReceiverData.slotammo = math.floor(ammoPerSlot / anvilAmmoPerShot) addData(dataset, anvilReceiverData) end -- シャッターキャップ (30-30リピーター・ボセックコンパウンドボウ) if (__debug or Hopup.shatter_caps.enabled) and stat.shatter_caps and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.base, 1) and aw.isNumberAndGreaterThanX(stat.shatter_caps.pellet, 1) then if aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then local shatterCapsMinChargeData = aw.shallowCopy(baseData) shatterCapsMinChargeData.damage = stat.shatter_caps.damage.base shatterCapsMinChargeData.option = res.mincharge shatterCapsMinChargeData.hopup = { 'shatter_caps' } shatterCapsMinChargeData.pellets = stat.shatter_caps.pellet addData(dataset, shatterCapsMinChargeData) local shatterCapsMaxChargeData = aw.shallowCopy(shatterCapsMinChargeData) shatterCapsMaxChargeData.damage = stat.shatter_caps.damage.charged shatterCapsMaxChargeData.option = res.maxcharge addData(dataset, shatterCapsMaxChargeData) else local shatterCapsData = aw.shallowCopy(baseData) shatterCapsData.damage = stat.shatter_caps.damage.base shatterCapsData.hopup = { 'shatter_caps' } shatterCapsData.pellets = stat.shatter_caps.pellet addData(dataset, shatterCapsData) end end end end local formatFunction = function(dmgslot) if dmgslot == math.huge then return res.infinity else return aw.comma(dmgslot) end end local metadata = { tableutil.RankCell.new('', 'bodyDmgslot', true), tableutil.AmmoCell.new('', 'ammo', { attributes = { align = 'center' }, cellClass = 'st-desktop', footerClass = 'st-desktop', headerClass = 'st-desktop', headerStyle = { width = '36px' }, }), tableutil.WeaponNameCell.new(res.weaponname, 'name', { ammoIndex = 'ammo', attributes = { align = 'left' }, cellClass = 'st-dashed-right st-mobile-none-right st-mobile-padding0-right', headerColspan = 2, optionIndex = 'option', shortnameIndex = 'shortname', }), tableutil.HopupCell.new(res.hopup, 'hopup', { attributes = { align = 'left' }, cellClass = 'st-dashed-left st-mobile-none-left st-mobile-padding0-left', headerColspan = 0, }), tableutil.ValueCell.new(res.legsshot, 'legsDmgslot', { cellClass = 'st-desktop', footerClass = 'st-desktop', format = formatFunction, headerClass = 'st-desktop', headerStyle = { ['min-width'] = '40px', ['max-width'] = '4em', }, }), tableutil.LineValueCell.new(res.bodyshot, 'bodyDmgslot', { startIndex = 'legsDmgslot', endIndex = 'lvl1Dmgslot', cellClass = 'st-mobile-graph st-mobile-textshadow', footerClass = 'st-mobile-axis', format = formatFunction, headerStyle = { ['min-width'] = '80px', ['max-width'] = '8em', }, preferredGridCount = 3, ticksFormat = function(val) return string.format('%sk', 0.001 * val) end }), tableutil.ValueCell.new(res.headlvl3, 'lvl3Dmgslot', { cellClass = 'st-desktop', footerClass = 'st-desktop', format = formatFunction, headerClass = 'st-desktop', headerStyle = { ['min-width'] = '40px', ['max-width'] = '4em', }, }), tableutil.ValueCell.new(res.headlvl2, 'lvl2Dmgslot', { cellClass = 'st-desktop', footerClass = 'st-desktop', format = formatFunction, headerClass = 'st-desktop', headerStyle = { ['min-width'] = '40px', ['max-width'] = '4em', }, }), tableutil.ValueCell.new(res.headlvl1, 'lvl1Dmgslot', { cellClass = 'st-mobile-last', footerClass = 'st-mobile-last', format = formatFunction, headerClass = 'st-mobile-last', headerStyle = { ['min-width'] = '40px', ['max-width'] = '4em', }, }), tableutil.LineCell.new(res.graph, 'bodyDmgslot', { startIndex = 'legsDmgslot', endIndex = 'lvl1Dmgslot', cellClass = 'st-desktop st-desktop-graph', footerClass = 'st-desktop', headerClass = 'st-desktop', headerStyle = { ['min-width'] = '200px', }, }), } local node = tableutil.createTable(dataset, metadata) return tostring(node) end function p.main(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end args = getArgs(frame) return p._main(args, false) end return p