🌟 | 現在、 鉄壁ヘッドショットには対応済みです。 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「モジュール:StatTable/DamagePerSlot」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「local aw = require('Module:Utility/Library') local iu = require('Module:Utility/Image') local tableutil = require('Module:Utility/TableUtil/Apex') local Hop…」) |
(デバッグモードが有効になっていた問題の修正) |
||
6行目: | 6行目: | ||
local configuration = { | local configuration = { | ||
__debug__enableAllHopup = | __debug__enableAllHopup = false, | ||
en = { | en = { | ||
dmgslot = 'Damage per Slot', | dmgslot = 'Damage per Slot', |
2021年8月17日 (火) 17:19時点における版
このモジュールについての説明文ページを モジュール:StatTable/DamagePerSlot/doc に作成できます
local aw = require('Module:Utility/Library') 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 = { __debug__enableAllHopup = false, en = { dmgslot = 'Damage per Slot', graph = 'Graph', hopup = 'Hop-Up', infinity = '∞', maxcharge = 'Max charge', mincharge = 'Min charge', weaponname = 'Weapon name', }, ja = { dmgslot = 'スロット当たりのダメージ', graph = 'グラフ', hopup = 'ホップアップ', infinity = '∞', maxcharge = '最大溜め', mincharge = '最小溜め', weaponname = '武器名', }, } local p = {} function p._main(args) args = args or {} 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 baseDamage = stat.damage.base local baseData = { ammo = stat.ammo, dmgslot = ammoPerSlot * baseDamage, name = name, shortname = stat.localization['Japanese_Short'], } local ammoPerShot = stat.ammo_per_shot or 1 local virtualAmmoPerSlot = math.floor(ammoPerSlot / ammoPerShot) -- チャージビーム (チャージライフル) if stat.damage.beam then local tickData = aw.shallowCopy(baseData) tickData.dmgslot = virtualAmmoPerSlot * (baseDamage + stat.damage.beam.base * stat.damage.beam.ticks) table.insert(dataset, tickData) -- 散弾 (ショットガン・トリプルテイク) elseif aw.isNumberAndGreaterThanX(stat.pellet, 1) then local pelletData = aw.shallowCopy(baseData) pelletData.dmgslot = virtualAmmoPerSlot * baseDamage * stat.pellet table.insert(dataset, pelletData) -- ハンマーポイント弾 (モザンビーク) if (configuration.__debug__enableAllHopup or Hopup.hammerpoint_rounds.enabled) and aw.isNumberAndGreaterThanX(stat.damage.hammerpoint_rounds, 1) then local pelletUnshieldedData = aw.shallowCopy(pelletData) pelletUnshieldedData.dmgslot = virtualAmmoPerSlot * math.floor(stat.damage.hammerpoint_rounds * baseDamage) * stat.pellet pelletUnshieldedData.hopup = { 'hammerpoint_rounds' } table.insert(dataset, pelletUnshieldedData) end -- それ以外 else -- チャージ (30-30リピーター・ボセックコンパウンドボウ) if aw.isNumberAndGreaterThanX(stat.damage.charged, baseDamage) then local minChargeData = aw.shallowCopy(baseData) minChargeData.option = res.mincharge table.insert(dataset, minChargeData) local maxChargeData = aw.shallowCopy(baseData) maxChargeData.dmgslot = virtualAmmoPerSlot * stat.damage.charged maxChargeData.option = res.maxcharge table.insert(dataset, maxChargeData) -- チャージが無効の場合の通常出力 else table.insert(dataset, baseData) end -- 増幅モード (センチネル) if aw.isNumberAndGreaterThanX(stat.damage.amped, baseDamage) then local ampedData = aw.shallowCopy(baseData) ampedData.ammo = ampedData.ammo .. '_amped' ampedData.dmgslot = virtualAmmoPerSlot * stat.damage.amped ampedData.option = iu.item('シールドセル') .. ' <span class="text-desktoponly">増幅モード</span>' table.insert(dataset, ampedData) end -- セレクトファイアレシーバー (ハボックライフル) if (configuration.__debug__enableAllHopup 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.dmgslot = virtualAmmoPerSlot * stat.selectfire_receiver.damage.base selectfireReceiverData.hopup = { 'selectfire_receiver' } table.insert(dataset, selectfireReceiverData) end -- ハンマーポイント弾 (P2020) if (configuration.__debug__enableAllHopup or Hopup.hammerpoint_rounds.enabled) and aw.isNumberAndGreaterThanX(stat.damage.hammerpoint_rounds, 1) then local hammerpointRoundsData = aw.shallowCopy(baseData) hammerpointRoundsData.dmgslot = virtualAmmoPerSlot * math.floor(stat.damage.hammerpoint_rounds * baseDamage) hammerpointRoundsData.hopup = { 'hammerpoint_rounds' } table.insert(dataset, hammerpointRoundsData) end -- ディスラプター弾 (オルタネーター・RE-45オート) if (configuration.__debug__enableAllHopup or Hopup.disruptor_rounds.enabled or special) and aw.isNumberAndGreaterThanX(stat.damage.disruptor_rounds, 1) then local disruptorRoundsData = aw.shallowCopy(baseData) disruptorRoundsData.dmgslot = virtualAmmoPerSlot * math.floor(stat.damage.disruptor_rounds * baseDamage) disruptorRoundsData.hopup = { 'disruptor_rounds' } table.insert(dataset, disruptorRoundsData) end -- アンビルレシーバー (VK-47フラットライン・R-301カービン) if (configuration.__debug__enableAllHopup 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.dmgslot = math.floor(ammoPerSlot / anvilAmmoPerShot) * stat.anvil_receiver.damage.base anvilReceiverData.hopup = { 'anvil_receiver' } table.insert(dataset, anvilReceiverData) end -- シャッターキャップ (30-30リピーター・ボセックコンパウンドボウ) if (configuration.__debug__enableAllHopup 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.dmgslot = virtualAmmoPerSlot * stat.shatter_caps.damage.base * stat.shatter_caps.pellet shatterCapsMinChargeData.option = res.mincharge shatterCapsMinChargeData.hopup = { 'shatter_caps' } table.insert(dataset, shatterCapsMinChargeData) local shatterCapsMaxChargeData = aw.shallowCopy(shatterCapsMinChargeData) shatterCapsMaxChargeData.dmgslot = virtualAmmoPerSlot * stat.shatter_caps.damage.charged * stat.shatter_caps.pellet shatterCapsMaxChargeData.option = res.maxcharge table.insert(dataset, shatterCapsMaxChargeData) else local shatterCapsData = aw.shallowCopy(baseData) shatterCapsData.dmgslot = virtualAmmoPerSlot * stat.shatter_caps.damage.base * stat.shatter_caps.pellet shatterCapsData.hopup = { 'shatter_caps' } table.insert(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('', 'dmgslot', true), tableutil.AmmoCell.new('', 'ammo', { attributes = { align = 'center' }, 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', headerClass = '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', headerClass = 'st-dashed-left st-mobile-none-left st-mobile-padding0-left', headerColspan = 0, }), tableutil.LineValueCell.new(res.dmgslot, 'dmgslot', { cellClass = 'st-mobile-graph st-mobile-textshadow st-mobile-last', format = formatFunction, headerClass = 'st-mobile-graph st-mobile-last', headerStyle = { ['min-width'] = '75px', ['max-width'] = '8em', }, }), tableutil.LineCell.new(res.graph, 'dmgslot', { cellClass = 'st-desktop-graph', headerClass = 'st-desktop-graph', headerStyle = { ['min-width'] = '160px', }, }), } 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) end return p