模块:SkillString

来自Mooncell - 玩家共同构筑的FGO中文Wiki
跳到导航 跳到搜索

可在模块:SkillString/doc创建此模块的帮助文档

local p = {}

local target_icon_class = 
{
	["自身"] = 'nptarget nptar-self',
	["己方单体"] = 'nptarget nptar-friendly',
	["己方全体"] = 'nptarget nptar-friendly-all',
	["除自身外的己方全体"] = 'nptarget nptar-friendly-all-noself',
	["敌方单体"] = 'nptarget nptar-enemy',
	["敌方全体"] = 'nptarget nptar-enemy-all',
	["获得暴击星"] = 'nptarget nptar-stars'
}

function p.target_icon(frame)
	local args = (frame == mw.getCurrentFrame() and frame.args) or frame
	
	local str_des = (args.str_des or "")
	local target_type = (args.target or "")
	
	if target_type ~= "" then
		return frame:callParserFunction('#vardefine:currentclass', target_icon_class[target_type])
	end
	
	if string.find(str_des, "己方全体") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["己方全体"]) end
	if string.find(str_des, "己方单体") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["己方单体"]) end
	if string.find(str_des, "自身") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["自身"]) end
	if string.find(str_des, "获得") ~= nil and string.find(str_des, "暴击星") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["获得暴击星"]) end
	if string.find(str_des, "敌方全体") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["敌方全体"]) end
	if string.find(str_des, "敌方单体") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["敌方单体"]) end
	
	return ""
end

return p