-- GetScreenEffectOffset()函数用
local Offset = {
	danger1024 = { x=0, y=-30 },
	["red-flower-small"] = { x=395, y=255 },
	["white-flower-small"] = { x=395, y=280 },
	["NEW-flower-small"] = { x=395, y=280 },
	["tulip-flower-small"] = { x=395, y=280 },
	["red-flower-full"] = { x=512, y=1000 },
	["white-flower-full"] = { x=512, y=1000 },
	["NEW-flower-full"] = { x=512, y=800 },
	["tulip-flower-full"] = { x=512, y=1000 },
	["red-flower-smallrain"] = { x=300, y=100 },
	["white-flower-smallrain"] = { x=300, y=100 },
	["NEW-flower-smallrain"] = { x=300, y=100 },
	["tulip-flower-smallrain"] = { x=300, y=100 },
	["red-flower-rain"] = { x=300, y=100 },
	["white-flower-rain"] = { x=300, y=100 },
	["NEW-flower-rain"] = { x=300, y=100 },
	["tulip-flower-rain"] = { x=300, y=100 },
	["PirateJX_skill5xh"] = { x=60, y= 100},
	["PirateJX_skill5"] = { x=60, y= 100},
	["flower_mudan_small"] = { x=395, y=280 },
	["flower_mudan_big"] = { x=512, y=700 },
	["yuanshen_gs_skill1mzxh"] = { x=0, y=-400 },
	-- 以下是光效配置缺失或偏移值全零的
	-- openxiao
	-- RedGuangbo
	-- cyclonehanddart
	-- endureXPscreen
	-- dot_cha_lig
	-- TSM_YZ_PF_xl
	-- RedOpen
	-- RedFall
}

-- 参数
-- 	Effect	屏幕光效名
-- 	Axis	坐标轴，为"x"或"y"
-- 	Scale	放大系数
-- 返回值
--	屏幕光效中心点的偏移值，单位像素
local function GetScreenEffectOffset(Effect, Axis, Scale)
	if Effect == nil or Axis == nil or Scale == nil or Offset[Effect] == nil then
		return 0
	end
	local f = Offset[Effect][Axis]
	if (f) then return f * (Scale - 1) end
	return 0
end


-- 参数
-- 	Effect	屏幕光效名
-- 	Axis	坐标轴，为"x"或"y"
-- 返回值
--	屏幕光效偏移值，单位像素
local function GetScreenEffectOffsetEx(Effect, Axis)
	if Effect == nil or Axis == nil or Offset[Effect] == nil then
		return 0
	end
	local f = Offset[Effect][Axis]
	if (f) then 
		return f 
	end
	return 0
end

--具体公式询问策划
local function GetchangeAttackPercent(nMonster, nHero)
	if nMonster > nHero then
		local nDecadePer = (nMonster - nHero)/100*(5000/10000)
		if nDecadePer > 80 then 
			nDecadePer = 80
		end 
		return nDecadePer
	end

	return 0
end

local function GetAbilityScoreInfo(Type)
	if Type == "FontSize" then
		return 16
	elseif Type == "OffsetY" then
		return -2
	end
end

local function NeedShowMonsterAbility()
	if (UserData_IsOldSoldierServer() == true) or (UserData_IsCoinsServer() == true) then
		return false
	else
		return true
	end
end
-- 清理变量释放内存
local function Unload()
	Hero_GetScreenEffectOffset = nil
	Hero_Unload = nil
	GetchangeAttackPercent = nil
	GetAbilityScoreInfo = nil
	Hero_NeedShowMonsterAbility = nil
	Hero_GetYHGYInfo = nil
end

local YHGYInfo = {
 ["icon"] = "MagicSkillType24940",
 ["iconeff"] = "gjcl_kuang",
 ["bodyeff"] = "gjcl_buff",
 ["iconeffx"] = 25,
 ["iconeffy"] = 25,
}

local function GetYHGYInfo(key)
 return YHGYInfo[key]
end




-- 通过require传给其他Lua脚本使用
local Hero = {
	GetScreenEffectOffset = GetScreenEffectOffset,
	GetScreenEffectOffsetEx = GetScreenEffectOffsetEx,
	GetchangeAttackPercent = GetchangeAttackPercent,
	GetAbilityScoreInfo = GetAbilityScoreInfo,
	NeedShowMonsterAbility = NeedShowMonsterAbility,
	Unload = Unload,
	GetYHGYInfo = GetYHGYInfo,
	

}

-- C++程序使用的global函数名
Hero_GetScreenEffectOffset = Hero.GetScreenEffectOffset
Hero_GetScreenEffectOffsetEx = Hero.GetScreenEffectOffsetEx
Hero_GetchangeAttackPercent = Hero.GetchangeAttackPercent
Hero_GetAbilityScoreInfo = Hero.GetAbilityScoreInfo
Hero_Unload = Hero.Unload
Hero_NeedShowMonsterAbility = Hero.NeedShowMonsterAbility
Hero_GetYHGYInfo = Hero.GetYHGYInfo
-- require返回值
return Hero

