🌟 | 現在、 鉄壁ヘッドショットには対応済みです。 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
モジュール:StatTable/DamagePerSecond
ナビゲーションに移動
検索に移動
このモジュールについての説明文ページを モジュール:StatTable/DamagePerSecond/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 = { auto = 'Auto', bodyshot = 'Body', burst = 'Burst', duration = 'Duration [sec]', graph = 'Graph', headshot = 'Head', headlvl1 = iu.gear('ヘルメット', 1), headlvl2 = iu.gear('ヘルメット', 2), headlvl3 = iu.gear('ヘルメット', 3), legsshot = 'Legs', maxcharge = 'Max charge', mincharge = 'Min charge', nocharge = 'No charge', single = 'Single', weaponname = 'Weapon name', }, ja = { auto = 'オート', bodyshot = '胴', burst = 'バースト', duration = '射撃継続時間 [秒]', graph = 'グラフ', headshot = '頭', headlvl1 = iu.gear('ヘルメット', 1), headlvl2 = iu.gear('ヘルメット', 2), headlvl3 = iu.gear('ヘルメット', 3), legsshot = '脚', maxcharge = '最大溜め', mincharge = '最小溜め', nocharge = '溜めなし', single = '単発', weaponname = '武器名', }, } local function _addData(dataset, data, firerate, fn) 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 = firerate * data.pellets data.bodyDPS = fn(data.damage, 1) * mul data.headDPS = fn(apex.calcPartDamage(data.damage, head), head) * mul data.lvl1DPS = fn(apex.calcPartDamage(data.damage, lvl1), lvl1) * mul data.lvl2DPS = fn(apex.calcPartDamage(data.damage, lvl2), lvl2) * mul data.lvl3DPS = fn(apex.calcPartDamage(data.damage, lvl3), lvl3) * mul data.legsDPS = fn(apex.calcPartDamage(data.damage, legs), legs) * mul table.insert(dataset, data) end local function addData(dataset, data, special, fn) fn = fn or function(val) return val end local fireratesType = type(data.firerates) -- ファイアレートが可変 if fireratesType == 'table' then if special then _addData(dataset, data, data.firerates[4], fn) else for level, firerate in ipairs(data.firerates) do local data2 = aw.shallowCopy(data) data2.level = level - 1 _addData(dataset, data2, firerate, fn) end end -- ファイアレートが固定 elseif fireratesType == 'number' then _addData(dataset, data, data.firerates, fn) end end local function createDataset(dataset, stats, res, addData, __debug) for name, stat in pairs(stats) do local baseData = { ammo = stat.ammo, ammoicon = stat.ammo, damage = stat.damage.base, firerates = stat.firerate, head = stat.damage.headshot, legs = stat.damage.legshot, level = -1, name = name, pellets = stat.pellet or 1, shortname = stat.localization['Japanese_Short'], } local special = aw.stringstarts(stat.ammo, 'special_') -- Altfire mode if type(stat.altfire) == 'table' and aw.isNumberAndGreaterThanZero(stat.altfire.firerate) then local burstfireData = aw.shallowCopy(baseData) burstfireData.firerates = apex.calcBurstAverageFirerate(stat.burst_count, stat.burst_delay, stat.firerate) burstfireData.option = res.burst addData(dataset, burstfireData, special) local altfireData = aw.shallowCopy(baseData) altfireData.firerates = stat.altfire.firerate altfireData.semiauto = stat.altfire.is_semi_auto == nil and stat.is_semi_auto or stat.altfire.is_semi_auto altfireData.option = altfireData.semiauto and res.single or res.auto addData(dataset, altfireData, special) -- Burst mode elseif aw.isNumberAndGreaterThanOrEqualToX(stat.burst_count, 2) then local burstfireData = aw.shallowCopy(baseData) burstfireData.firerates = apex.calcBurstAverageFirerate(stat.burst_count, stat.burst_delay, stat.firerate) addData(dataset, burstfireData, special) -- Rechamber fire elseif type(stat.rechamber) == 'table' then baseData.firerates = { apex.calcRechamberFirerate(stat.firerate, stat.rechamber[1]), apex.calcRechamberFirerate(stat.firerate, stat.rechamber[2]), apex.calcRechamberFirerate(stat.firerate, stat.rechamber[3]), apex.calcRechamberFirerate(stat.firerate, stat.rechamber[4]), } addData(dataset, baseData, special) elseif aw.isNumberAndGreaterThanZero(stat.rechamber) then local isCharge = aw.isNumberAndGreaterThanZero(stat.charge) if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber + stat.charge_minimum) baseData.option = res.mincharge else baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber) if isCharge then baseData.option = res.nocharge end end addData(dataset, baseData, special) -- Chargefire if isCharge then local maxData = aw.shallowCopy(baseData) maxData.damage = stat.damage.charged maxData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber + stat.charge) maxData.head = stat.damage.headshot_charged or stat.damage.headshot maxData.legs = stat.damage.legshot_charged or stat.damage.legshot maxData.option = res.maxcharge addData(dataset, maxData, special) end -- Chargefire elseif aw.isNumberAndGreaterThanZero(stat.charge) then if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.charge_minimum) baseData.option = res.mincharge else baseData.option = res.nocharge end addData(dataset, baseData, special) local maxData = aw.shallowCopy(baseData) maxData.damage = stat.damage.charged maxData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.charge) maxData.head = stat.damage.headshot_charged or stat.damage.headshot maxData.legs = stat.damage.legshot_charged or stat.damage.legshot maxData.option = res.maxcharge addData(dataset, maxData, special) -- Charge Rifle elseif aw.isNumberAndGreaterThanZero(stat.sustained_discharge_duration) then baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.sustained_discharge_duration) addData(dataset, baseData, special, function(val, mul) return val + apex.calcPartDamage(stat.damage.beam.base, mul) * stat.damage.beam.ticks end) -- Other else addData(dataset, baseData, special) end -- Amped mode if aw.isNumberAndGreaterThanX(stat.damage.amped, stat.damage.base) then local ampedData = aw.shallowCopy(baseData) ampedData.ammoicon = stat.ammo .. '_amped' ampedData.damage = stat.damage.amped ampedData.option = iu.item('シールドセル') .. ' <span class="text-desktoponly">増幅モード</span>' addData(dataset, ampedData) end -- Revved Up mode if aw.isNumberAndGreaterThanOrEqualToX(stat.firerate_revvedup, stat.firerate) then local revvedUpData = aw.shallowCopy(baseData) revvedUpData.ammoicon = stat.ammo .. '_revved_up' revvedUpData.firerates = stat.firerate_revvedup revvedUpData.option = iu.grenade('テルミットグレネード') .. ' <span class="text-desktoponly">連射速度上昇モード</span>' addData(dataset, revvedUpData, special) end -- Turbocharger --[[if (__debug or Hopup.turbocharger.enabled) and type(stat.turbocharger) == 'table' and aw.isNumberAndGreaterThanZero(stat.turbocharger.raise) then local turbochargerData = aw.shallowCopy(baseData) turbochargerData.hopup = { 'turbocharger' } turbochargerData.raise = stat.turbocharger.raise or stat.raise or 0 addData(dataset, turbochargerData, special) end]] -- Selectfire Receiver if (__debug or Hopup.selectfire_receiver.enabled) and type(stat.selectfire_receiver) == 'table' and aw.isNumberAndGreaterThanZero(stat.selectfire_receiver.firerate) then local semiauto if stat.selectfire_receiver.is_semi_auto then semiauto = stat.selectfire_receiver.is_semi_auto else semiauto = stat.is_semi_auto end local firerate if semiauto then local raiseTime = stat.selectfire_receiver.raise or stat.raise or 0 if raiseTime > 0 then firerate = apex.calcRechamberFirerate(stat.selectfire_receiver.firerate, raiseTime) else firerate = stat.selectfire_receiver.firerate end else firerate = stat.selectfire_receiver.firerate end local selectfireReceiverData = aw.shallowCopy(baseData) selectfireReceiverData.firerates = firerate selectfireReceiverData.hopup = { 'selectfire_receiver' } if stat.selectfire_receiver.damage then selectfireReceiverData.damage = stat.selectfire_receiver.damage.base or stat.damage.base selectfireReceiverData.head = stat.selectfire_receiver.damage.headshot or stat.damage.headshot selectfireReceiverData.legs = stat.selectfire_receiver.damage.legshot or stat.damage.legshot end addData(dataset, selectfireReceiverData, special) end -- Hammerpoint Rounds 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 * stat.damage.base) hammerpointRoundsData.hopup = { 'hammerpoint_rounds' } addData(dataset, hammerpointRoundsData, special) end -- Disruptor Rounds 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, special, function(val) return apex.calcDisruptorDamage(val, stat.damage.disruptor_rounds) end) end -- Anvil Receiver if (__debug or Hopup.anvil_receiver.enabled) and type(stat.anvil_receiver) == 'table' and aw.isNumberAndGreaterThanZero(stat.anvil_receiver.firerate) then local anvilReceiverData = aw.shallowCopy(baseData) anvilReceiverData.damage = stat.anvil_receiver.damage.base anvilReceiverData.firerates = stat.anvil_receiver.firerate if stat.anvil_receiver.damage.headshot then anvilReceiverData.head = stat.anvil_receiver.damage.headshot end anvilReceiverData.hopup = { 'anvil_receiver' } if stat.anvil_receiver.damage.legshot then anvilReceiverData.legs = stat.anvil_receiver.damage.legshot end addData(dataset, anvilReceiverData, special) end -- Double Tap Trigger if (__debug or Hopup.double_tap_trigger.enabled) and type(stat.double_tap_trigger) == 'table' and aw.isNumberAndGreaterThanOrEqualToX(stat.double_tap_trigger.burst_count, 2) then local doubleTapTriggerData = aw.shallowCopy(baseData) local delay = stat.double_tap_trigger.burst_delay if type(delay) == 'table' then doubleTapTriggerData.firerates = { apex.calcBurstAverageFirerate(stat.double_tap_trigger.burst_count, delay[1], stat.double_tap_trigger.firerate), apex.calcBurstAverageFirerate(stat.double_tap_trigger.burst_count, delay[2], stat.double_tap_trigger.firerate), apex.calcBurstAverageFirerate(stat.double_tap_trigger.burst_count, delay[3], stat.double_tap_trigger.firerate), apex.calcBurstAverageFirerate(stat.double_tap_trigger.burst_count, delay[4], stat.double_tap_trigger.firerate), } else doubleTapTriggerData.firerates = apex.calcBurstAverageFirerate(stat.double_tap_trigger.burst_count, delay, stat.double_tap_trigger.firerate) end doubleTapTriggerData.hopup = { 'double_tap_trigger' } addData(dataset, doubleTapTriggerData, special) end -- Shatter Caps if (__debug or Hopup.shatter_caps.enabled) and type(stat.shatter_caps) == 'table' and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.base, 1) and aw.isNumberAndGreaterThanX(stat.shatter_caps.pellet, 1) then local shatterCapsData = aw.shallowCopy(baseData) shatterCapsData.damage = stat.shatter_caps.damage.base if stat.shatter_caps.damage.headshot then shatterCapsData.head = stat.shatter_caps.damage.headshot end shatterCapsData.hopup = { 'shatter_caps' } if stat.shatter_caps.damage.legshot then shatterCapsData.legs = stat.shatter_caps.damage.legshot end shatterCapsData.pellets = stat.shatter_caps.pellet -- Chargefire if aw.isNumberAndGreaterThanZero(stat.charge) and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then shatterCapsData.option = res.mincharge addData(dataset, shatterCapsData) local chargedShatterCapsData = aw.shallowCopy(shatterCapsData) chargedShatterCapsData.damage = stat.shatter_caps.damage.charged if aw.isNumberAndGreaterThanZero(stat.rechamber) then chargedShatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber + stat.charge) else chargedShatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.charge) end if stat.shatter_caps.damage.headshot_charged then chargedShatterCapsData.head = stat.shatter_caps.damage.headshot_charged end if stat.shatter_caps.damage.legshot_charged then chargedShatterCapsData.legs = stat.shatter_caps.damage.legshot_charged end chargedShatterCapsData.option = res.maxcharge addData(dataset, chargedShatterCapsData) else addData(dataset, shatterCapsData) end -- Deadeye's Tempo if (__debug or Hopup.deadeyes_tempo.enabled) and type(stat.deadeyes_tempo) == 'table' then local deadeyesTempoShatterCapsData = aw.shallowCopy(shatterCapsData) if aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.charge_minimum) then deadeyesTempoShatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.charge_minimum) elseif aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.rechamber) then deadeyesTempoShatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.rechamber) end deadeyesTempoShatterCapsData.hopup = { 'shatter_caps', 'deadeyes_tempo' } -- Chargefire if aw.isNumberAndGreaterThanZero(stat.charge) and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then deadeyesTempoShatterCapsData.option = res.mincharge addData(dataset, deadeyesTempoShatterCapsData) local chargedDeadeyesTempoShatterCapsData = aw.shallowCopy(deadeyesTempoShatterCapsData) chargedDeadeyesTempoShatterCapsData.damage = stat.shatter_caps.damage.charged chargedDeadeyesTempoShatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.charge) if stat.shatter_caps.damage.headshot_charged then chargedDeadeyesTempoShatterCapsData.head = stat.shatter_caps.damage.headshot_charged end if stat.shatter_caps.damage.legshot_charged then chargedDeadeyesTempoShatterCapsData.legs = stat.shatter_caps.damage.legshot_charged end chargedDeadeyesTempoShatterCapsData.option = res.maxcharge addData(dataset, chargedDeadeyesTempoShatterCapsData) else addData(dataset, deadeyesTempoShatterCapsData) end end end -- Deadeye's Tempo if (__debug or Hopup.deadeyes_tempo.enabled) and type(stat.deadeyes_tempo) == 'table' then local deadeyesTempoData = aw.shallowCopy(baseData) if aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.charge_minimum) then deadeyesTempoData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.charge_minimum) elseif aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.rechamber) then deadeyesTempoData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.rechamber) end deadeyesTempoData.hopup = { 'deadeyes_tempo' } -- Chargefire if aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.charge) and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then deadeyesTempoData.option = res.mincharge addData(dataset, deadeyesTempoData) local chargedDeadeyesTempoData = aw.shallowCopy(deadeyesTempoData) chargedDeadeyesTempoData.damage = stat.damage.charged chargedDeadeyesTempoData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.charge) chargedDeadeyesTempoData.option = res.maxcharge addData(dataset, chargedDeadeyesTempoData) else addData(dataset, deadeyesTempoData, special) end -- Amped mode if aw.isNumberAndGreaterThanX(stat.damage.amped, stat.damage.base) then local ampedDeadeyesTempoData = aw.shallowCopy(deadeyesTempoData) ampedDeadeyesTempoData.ammoicon = stat.ammo .. '_amped' ampedDeadeyesTempoData.damage = stat.damage.amped ampedDeadeyesTempoData.option = iu.item('シールドセル') .. ' <span class="text-desktoponly">増幅モード</span>' addData(dataset, ampedDeadeyesTempoData) end end end 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 dataset = {} createDataset(dataset, stats, res, addData, __debug) local formatFunction = function(dps) return string.format('%.1f', dps) end local metadata = { tableutil.RankCell.new('', 'bodyDPS', true), tableutil.AmmoCell.new('', 'ammoicon', { 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 = 3, optionIndex = 'option', shortnameIndex = 'shortname', }), tableutil.MagazineCell.new(res.mag, 'level', { ammoIndex = 'ammo', attributes = { align = 'left' }, cellClass = 'st-dashed-both st-mobile-none-both st-mobile-padding0-both', headerColspan = 0, }), tableutil.HopupCell.new(res.hopup, 'hopup', { attributes = { align = 'left' }, cellClass = 'st-dashed-left st-mobile-none-left st-mobile-padding0-both', headerColspan = 0, }), tableutil.ValueCell.new(res.legsshot, 'legsDPS', { cellClass = 'st-desktop', footerClass = 'st-desktop', format = formatFunction, headerClass = 'st-desktop', headerStyle = { ['min-width'] = '40px', ['max-width'] = '4em', }, }), tableutil.LineValueCell.new(res.bodyshot, 'bodyDPS', { startIndex = 'legsDPS', endIndex = 'lvl1DPS', 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, 'lvl3DPS', { cellClass = 'st-desktop', footerClass = 'st-desktop', format = formatFunction, headerClass = 'st-desktop', headerStyle = { ['min-width'] = '40px', ['max-width'] = '4em', }, }), tableutil.ValueCell.new(res.headlvl2, 'lvl2DPS', { cellClass = 'st-desktop', footerClass = 'st-desktop', format = formatFunction, headerClass = 'st-desktop', headerStyle = { ['min-width'] = '40px', ['max-width'] = '4em', }, }), tableutil.ValueCell.new(res.headlvl1, 'lvl1DPS', { 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, 'bodyDPS', { startIndex = 'legsDPS', endIndex = 'lvl1DPS', cellClass = 'st-desktop st-desktop-graph', footerClass = 'st-desktop', headerClass = 'st-desktop', headerStyle = { ['min-width'] = '200px', }, maximumValue = 500, }), } 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