|
|
@@ -17,10 +17,12 @@ local Util = require("common.Util")
|
|
|
local TriggerDefine = require("trigger.TriggerDefine")
|
|
|
local TriggerLogic = require("trigger.TriggerLogic")
|
|
|
|
|
|
+
|
|
|
local LOGTYPE = "WinnerRelic"
|
|
|
local relicUpgradeConfig = relicModule.RelicUpgrade -- 获取升级配置表
|
|
|
local relicDataConfig = relicModule.RelicData -- 获取遗物数据表
|
|
|
local COND_TOWER_LEVEL = 500 --开启本系统需要通关恶魔之塔的层数
|
|
|
+local WINNERRELIC_HEROSTAR = 14 -- 需要穿戴的星级
|
|
|
--[[
|
|
|
DB =
|
|
|
{{
|
|
|
@@ -616,4 +618,64 @@ function WinnerRelic_GetRateSpeed(nRelicID, nStar)
|
|
|
return 0
|
|
|
end
|
|
|
return tConfig.nSpeedBonus[nStar]
|
|
|
+end
|
|
|
+
|
|
|
+-- 英雄重置或转换取消圣遗物
|
|
|
+function WinnerRelic_CancelWinner(human, tHeroGrid, nHeroIndex)
|
|
|
+ local tRelicData = human.db.relicListData
|
|
|
+ if not tRelicData then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ if not tHeroGrid.relic or nil == _G.next(tHeroGrid.relic) then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ local nRelicID = tHeroGrid.relic.relicID
|
|
|
+
|
|
|
+ if not tRelicData.equipped or not tRelicData.equipped[nRelicID] then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ for _, v in ipairs(tRelicData.equipped[nRelicID]) do
|
|
|
+ if v == nHeroIndex then
|
|
|
+ table.remove(tRelicData.equipped[nRelicID], nHeroIndex)
|
|
|
+ break
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+function onLogin(human)
|
|
|
+ local tRelicData = human.db.relicListData
|
|
|
+ if not tRelicData then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ if not tRelicData.equipped then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ for nRelicID, tHeroIndex in pairs(tRelicData.equipped) do
|
|
|
+ local nLen = #tHeroIndex
|
|
|
+ for i = nLen, 1, -1 do
|
|
|
+ local nHeroIndex = tHeroIndex[i]
|
|
|
+ local nHeroID = HeroLogic.getHeroIdByIndex(human, nHeroIndex)
|
|
|
+ local tHeroGrid = HeroLogic.getHeroGrid(human, nHeroID, nHeroIndex)
|
|
|
+ -- 不存在对应的 herogrid了
|
|
|
+ if not tHeroGrid then
|
|
|
+ table.remove(tRelicData.equipped[nRelicID], i)
|
|
|
+ else
|
|
|
+ local nHeroStar = tHeroGrid.star
|
|
|
+ if WINNERRELIC_HEROSTAR > nHeroStar then
|
|
|
+ -- 先取消穿戴
|
|
|
+ if tHeroGrid.relic and nil ~= _G.next(tHeroGrid.relic) then
|
|
|
+ tHeroGrid.relic = {}
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 移除记录的数据
|
|
|
+ table.remove(tRelicData.equipped[nRelicID], i)
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|