| 🌟 | 現在、 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「モジュール:StatTable/DamagePerMagazine」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「local aw = require('Module:Utility/Library') local iu = require('Module:Utility/Image') local tableutil = require('Module:Utility/TableUtil/Apex') local Hop…」) |
(ブーステッドローダーに対応) |
||
| 245行目: | 245行目: | ||
addData(dataset, shatterCapsData, stat.magazine, special) | addData(dataset, shatterCapsData, stat.magazine, special) | ||
end | end | ||
end | |||
-- アンビルレシーバー (ウィングマン・ヘムロックバーストAR) | |||
if (configuration.__debug__enableAllHopup or Hopup.boosted_loader.enabled) and stat.boosted_loader then | |||
local boostedLoaderData = aw.shallowCopy(baseData) | |||
boostedLoaderData.hopup = { 'boosted_loader' } | |||
addData(dataset, boostedLoaderData, stat.boosted_loader.magazine, special) | |||
end | end | ||
end | end | ||
2021年8月19日 (木) 00:15時点における版
このモジュールについての説明文ページを モジュール:StatTable/DamagePerMagazine/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 = {
dmgmag = 'Damage per Mag',
graph = 'Graph',
hopup = 'Hop-Up',
infinity = '∞',
maxcharge = 'Max charge',
mincharge = 'Min charge',
weaponname = 'Weapon name',
},
ja = {
dmgmag = 'マガジン当たりのダメージ',
graph = 'グラフ',
hopup = 'ホップアップ',
infinity = '∞',
maxcharge = '最大溜め',
mincharge = '最小溜め',
weaponname = '武器名',
},
}
local function addData(dataset, data, magazines, special)
local magazinesType = type(magazines)
-- 拡張マガジンがつく場合
if magazinesType == 'table' then
if special then
local specialData = aw.shallowCopy(data)
specialData.dmgmag = data.dmgmag * math.floor(magazines[4] / data.ammopershot)
table.insert(dataset, specialData)
else
for level, magazine in ipairs(magazines) do
local magData = aw.shallowCopy(data)
magData.dmgmag = data.dmgmag * math.floor(magazine / data.ammopershot)
magData.level = level - 1
table.insert(dataset, magData)
end
end
-- 拡張マガジンがつかない場合
elseif magazinesType == 'number' then
local nomagData = aw.shallowCopy(data)
nomagData.dmgmag = data.dmgmag * math.floor(magazines / data.ammopershot)
table.insert(dataset, nomagData)
end
end
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 dataset = {}
for name, stat in pairs(stats) do
local special = aw.stringstarts(stat.ammo, 'special_')
local baseDamage = stat.damage.base
local baseData = {
ammo = stat.ammo,
ammoicon = stat.ammo,
ammopershot = stat.ammo_per_shot or 1,
dmgmag = baseDamage,
level = -1,
name = name,
shortname = stat.localization['Japanese_Short'],
}
-- マガジンがバックパック (L-スターEMG)
if stat.magazine == math.huge then
if aw.isNumberAndGreaterThanZero(stat.firerate.auto) then
local overheatType = type(stat.overheat)
if overheatType == 'table' then
local virtualMagazines = {
math.ceil(stat.overheat[1] * stat.firerate.auto),
math.ceil(stat.overheat[2] * stat.firerate.auto),
math.ceil(stat.overheat[3] * stat.firerate.auto),
math.ceil(stat.overheat[4] * stat.firerate.auto),
}
addData(dataset, baseData, virtualMagazines, special)
-- 改造ローダー
if stat.category == 'light_machine_gun' then
local moddedLoaderVirtualMagazines = {
math.ceil(1.15 * stat.overheat[1] * stat.firerate.auto),
math.ceil(1.15 * stat.overheat[2] * stat.firerate.auto),
math.ceil(1.15 * stat.overheat[3] * stat.firerate.auto),
math.ceil(1.15 * stat.overheat[4] * stat.firerate.auto),
}
local moddedLoaderData = aw.shallowCopy(baseData)
moddedLoaderData.hopup = { 'modded_loader' }
addData(dataset, moddedLoaderData, moddedLoaderVirtualMagazines, special)
end
elseif overheatType == 'number' then
local virtualMagazine = math.ceil(stat.overheat * stat.firerate.auto)
addData(dataset, baseData, virtualMagazines, special)
-- 改造ローダー
if stat.category == 'light_machine_gun' then
local virtualMagazine = math.ceil(stat.overheat * stat.firerate.auto)
local moddedLoaderData = aw.shallowCopy(baseData)
moddedLoaderData.hopup = { 'modded_loader' }
addData(dataset, moddedLoaderData, virtualMagazines, special)
end
end
end
-- チャージビーム (チャージライフル)
elseif stat.damage.beam then
local tickData = aw.shallowCopy(baseData)
tickData.dmgmag = baseDamage + stat.damage.beam.base * stat.damage.beam.ticks
addData(dataset, tickData, stat.magazine, special)
-- 散弾 (ショットガン・トリプルテイク)
elseif aw.isNumberAndGreaterThanX(stat.pellet, 1) then
local pelletData = aw.shallowCopy(baseData)
pelletData.dmgmag = baseDamage * stat.pellet
addData(dataset, pelletData, stat.magazine, special)
-- ハンマーポイント弾 (モザンビーク)
if (configuration.__debug__enableAllHopup or Hopup.hammerpoint_rounds.enabled) and aw.isNumberAndGreaterThanX(stat.damage.hammerpoint_rounds, 1) then
local pelletUnshieldedData = aw.shallowCopy(pelletData)
pelletUnshieldedData.dmgmag = math.floor(stat.damage.hammerpoint_rounds * baseDamage) * stat.pellet
pelletUnshieldedData.hopup = { 'hammerpoint_rounds' }
addData(dataset, pelletUnshieldedData, stat.magazine, special)
end
-- それ以外
else
-- チャージ (30-30リピーター・ボセックコンパウンドボウ)
if aw.isNumberAndGreaterThanX(stat.damage.charged, baseDamage) then
local minChargeData = aw.shallowCopy(baseData)
minChargeData.option = res.mincharge
addData(dataset, minChargeData, stat.magazine, special)
local maxChargeData = aw.shallowCopy(baseData)
maxChargeData.dmgmag = stat.damage.charged
maxChargeData.option = res.maxcharge
addData(dataset, maxChargeData, stat.magazine, special)
-- チャージが無効の場合の通常出力
else
addData(dataset, baseData, stat.magazine, special)
end
-- 改造ローダー (ディヴォーションLMG・M600スピットファイア・ランページ)
if stat.category == 'light_machine_gun' then
local moddedLoaderData = aw.shallowCopy(baseData)
moddedLoaderData.hopup = { 'modded_loader' }
local magazinesType = type(stat.magazine)
if magazinesType == 'table' then
local moddedLoaderMagazines = {
aw.round(1.15 * stat.magazine[1]),
aw.round(1.15 * stat.magazine[2]),
aw.round(1.15 * stat.magazine[3]),
aw.round(1.15 * stat.magazine[4]),
}
addData(dataset, moddedLoaderData, moddedLoaderMagazines, special)
elseif magazinesType == 'number' then
local moddedLoaderMagazine = aw.round(1.15 * stat.magazine)
addData(dataset, moddedLoaderData, moddedLoaderMagazine, special)
end
end
-- ミニガン「シーラ」
if stat.ammo == 'minigun' then
local moddedLoaderData = aw.shallowCopy(baseData)
moddedLoaderData.hopup = { 'modded_loader' }
if type(stat.magazine) == 'number' then
local moddedLoaderMagazine = aw.round(1.15 * stat.magazine)
addData(dataset, moddedLoaderData, moddedLoaderMagazine, special)
end
end
-- 増幅モード (センチネル)
if aw.isNumberAndGreaterThanX(stat.damage.amped, baseDamage) then
local ampedData = aw.shallowCopy(baseData)
ampedData.ammoicon = ampedData.ammo .. '_amped'
ampedData.dmgmag = stat.damage.amped
ampedData.option = iu.item('シールドセル') .. '<span class="text-desktoponly"> 増幅モード</span>'
addData(dataset, ampedData, stat.magazine, special)
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.ammopershot = stat.selectfire_receiver.ammo_per_shot or 1
selectfireReceiverData.dmgmag = stat.selectfire_receiver.damage.base
selectfireReceiverData.hopup = { 'selectfire_receiver' }
addData(dataset, selectfireReceiverData, stat.magazine, special)
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.dmgmag = math.floor(stat.damage.hammerpoint_rounds * baseDamage)
hammerpointRoundsData.hopup = { 'hammerpoint_rounds' }
addData(dataset, hammerpointRoundsData, stat.magazine, special)
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.dmgmag = math.floor(stat.damage.disruptor_rounds * baseDamage)
disruptorRoundsData.hopup = { 'disruptor_rounds' }
addData(dataset, disruptorRoundsData, stat.magazine, special)
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 anvilReceiverData = aw.shallowCopy(baseData)
anvilReceiverData.ammopershot = stat.anvil_receiver.ammo_per_shot or 2
anvilReceiverData.dmgmag = stat.anvil_receiver.damage.base
anvilReceiverData.hopup = { 'anvil_receiver' }
addData(dataset, anvilReceiverData, stat.magazine, special)
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.dmgmag = stat.shatter_caps.damage.base * stat.shatter_caps.pellet
shatterCapsMinChargeData.option = res.mincharge
shatterCapsMinChargeData.hopup = { 'shatter_caps' }
addData(dataset, shatterCapsMinChargeData, stat.magazine, special)
local shatterCapsMaxChargeData = aw.shallowCopy(shatterCapsMinChargeData)
shatterCapsMaxChargeData.dmgmag = stat.shatter_caps.damage.charged * stat.shatter_caps.pellet
shatterCapsMaxChargeData.option = res.maxcharge
addData(dataset, shatterCapsMaxChargeData, stat.magazine, special)
else
local shatterCapsData = aw.shallowCopy(baseData)
shatterCapsData.dmgmag = stat.shatter_caps.damage.base * stat.shatter_caps.pellet
shatterCapsData.hopup = { 'shatter_caps' }
addData(dataset, shatterCapsData, stat.magazine, special)
end
end
-- アンビルレシーバー (ウィングマン・ヘムロックバーストAR)
if (configuration.__debug__enableAllHopup or Hopup.boosted_loader.enabled) and stat.boosted_loader then
local boostedLoaderData = aw.shallowCopy(baseData)
boostedLoaderData.hopup = { 'boosted_loader' }
addData(dataset, boostedLoaderData, stat.boosted_loader.magazine, special)
end
end
end
local formatFunction = function(dmgmag)
if dmgmag == math.huge then
return res.infinity
else
return aw.comma(dmgmag)
end
end
local metadata = {
tableutil.RankCell.new('', 'dmgmag', true),
tableutil.AmmoCell.new('', 'ammoicon', {
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',
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-left',
headerColspan = 0,
}),
tableutil.LineValueCell.new(res.dmgslot, 'dmgmag', {
cellClass = 'st-graph st-mobile-graph st-mobile-textshadow st-mobile-last',
format = formatFunction,
headerClass = 'st-graph st-mobile-graph st-mobile-last',
headerStyle = {
['min-width'] = '75px',
['max-width'] = '8em',
},
}),
tableutil.LineCell.new(res.graph, 'dmgmag', {
cellClass = 'st-graph st-desktop-graph',
headerClass = 'st-graph st-desktop-graph',
headerStyle = {
['min-width'] = '160px',
},
}),
}
local opts = { tableClass = 'st-grid st-grid-5' }
local node = tableutil.createTable(dataset, metadata, opts)
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