🌟現在、鉄壁 鉄壁ヘッドショットには対応済みです。
鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。

モジュール:Utility/ApexLibrary

提供:Apex Data
2021年2月23日 (火) 11:33時点におけるMntone (トーク | 投稿記録)による版 (calcDamage内の引数にoptsを指定しなかった不具合の修正)
ナビゲーションに移動 検索に移動

このモジュールについての説明文ページを モジュール:Utility/ApexLibrary/doc に作成できます

local apex = {}

local aw = require('Module:Utility/Library')

-- 部位ダメージ用定数
apex.HEAD        = 1
apex.HEAD_NOHLM  = 1
apex.HEAD_HLMLV1 = 2
apex.HEAD_HLMLV2 = 3
apex.HEAD_HLMLV3 = 4
apex.BODY        = 10
apex.LEGS        = 100
apex.SKY         = 1000

-- [[ ヘッドショット倍率の計算 ]]
function apex.calcHeadshotMultiplier(headmul, part)
	if part == apex.HEAD_HLMLV1 then
		return 0.2 + 0.8 * headmul
	elseif part == apex.HEAD_HLMLV2 then
		return 0.4 + 0.6 * headmul
	elseif part == apex.HEAD_HLMLV3 then
		return 0.5 + 0.5 * headmul
	else
		return headmul
	end
end

-- [[ 部位倍率とパッシブ倍率を考慮したダメージ計算 ]]
function apex.calcDamageFromPartAndPassive(base, partmul, passive, opts)
	-- 部位倍率
	if partmul ~= 1 then
		base = aw.round(partmul * base)
	end
	
	-- 小柄・鉄壁
	if passive == 1.05 then
		if not opts.round or opts.ampedCover then
			base = aw.roundover(passive * base)
		else
			base = aw.round(passive * base)
		end
	elseif passive ~= 1 then
		base = aw.round(passive * base)
	end
	
	return base
end

-- [[ ダメージ計算 ]]
function apex.calcDamage(base, partmul, passive, opts)
	opts = opts or {}
	opts.hammerpointRounds = opts.hammerpointRounds or 0
	
	-- 増幅バリケード
	if opts.ampedCover then
		base = aw.round(1.2 * base)
	end
	
	-- ハンマーポイント弾
	if opts.hammerpointRounds > 1 then
		base = math.floor(opts.hammerpointRounds * base)
	end
	
	-- 部位倍率/小柄・鉄壁
	base = apex.calcDamageFromPartAndPassive(base, partmul, passive, opts)
	
	-- ビームダメージ
	if opts.beam and aw.isNumberAndGreaterThanOrEqualToZero(opts.beam.damage) then
		local beamdamage = apex.calcDamageFromPartAndPassive(opts.beam.damage, partmul, passive, opts)
		base = base + opts.beam.ticks * beamdamage
	end
	
	return base
end

return apex