模組:Scoring/DC18

local final_assessment = {}
function final_assessment.calculate()
	local args = mw.getCurrentFrame().args
	local cat = tonumber(args.cat, 10)
	local score = 0
	local multiplier = 0
	local length = tonumber(args.length, 10)
	local spokenlength = tonumber(args.spokenlength, 10)
	local picnum = tonumber(args.picnum, 10)
	local fpicnum = tonumber(args.fpicnum, 10)
	local piclimit = math.min(6, math.floor(length/2000))
	local pictranslength = tonumber(args.pictranslength, 10)
	local videolength = tonumber(args.videolength, 10)
	if args.rank == 'FA' then
		score = 18.75 + 1.5 * length / 1000
	elseif args.rank == 'FL' then
		score = 18.75 + 1.25 * length / 1000
	elseif args.rank == 'GA' then
		score = 15 + length / 1000
	elseif args.rank == 'normal' then
		if length <= 100000 then
			score = -0.0025 * (length / 1000) ^ 2 + 0.52 * (length / 1000) + 1
		else
			score = 28
		end
	end
	--如果长度不合标准则归零
	if length < 3500 then
		score = 0
	end
	if args.isnew == '0' then
		--如果不是新条目
		if length == 3500 then
			score = 0
		end
		if args.rank == 'normal' then
			multiplier = 1.05
		elseif args.rank == 'FA' then
			multiplier = 1.15
		else
			multiplier = 1.10
		end
		--不同动员令改善条目加成修正,大(cat=1):中(2):小(3)= 0 : 3% : 5%
		multiplier = multiplier + ((-0.5 * cat * cat + 4.5 * cat - 4) / 100)
		score = score * multiplier
	end
	--大中小动员令加成
	score = score * cat
	--如果有有聲條目則加成
	if args.spokencheck == '1' then
		score = score + 0.15 * spokenlength / 1000
	end
	--如果有原創圖片條目則加成
	if args.piccheck == '1' then
		--原创图片总数量如果超过上限,尽可能地多保留特色原创图片 fpicnum
		if picnum + fpicnum > piclimit then
			if fpicnum > piclimit then
				fpicnum = piclimit
				picnum = 0
			else
				picnum = piclimit - fpicnum	
			end
		end
		score = score + (10 * (picnum + 2.5 * fpicnum)) ^ 0.7
		score = score + 0.3 * pictranslength ^ 0.7
	end
	--如果有原創影片則加成
	if args.videocheck == '1' then
		score = score + 7 * math.min(videolength, 45) ^ 0.3 - 6
	end
	--四舍五入到十分位(Lua 没有 math.round)
	score = math.floor(score * 10 + 5) / 10
	return score
end
return final_assessment