|
|
@@ -168,7 +168,7 @@ local function qualityAdd(heroConfig, quality, attrs)
|
|
|
end
|
|
|
|
|
|
-- 伙伴基础
|
|
|
-function doCalcHero(grid, attrs, isMerge)
|
|
|
+function doCalcHero(grid, attrs)
|
|
|
if not grid and attrs then return end
|
|
|
local heroConfig = HeroExcel.hero[grid.id]
|
|
|
local attrConfig = HeroDefine.getAttrConfig(grid.id, grid.star)
|
|
|
@@ -176,7 +176,30 @@ function doCalcHero(grid, attrs, isMerge)
|
|
|
assert(nil, "attrConfig is nil id " .. grid.id .. " star " .. grid.star)
|
|
|
end
|
|
|
|
|
|
- if isMerge == nil then
|
|
|
+ for _, v in ipairs(attrConfig.attrs) do
|
|
|
+ RoleAttr.updateValue(v[1], v[2], attrs)
|
|
|
+ end
|
|
|
+
|
|
|
+ lvAdd(grid.lv, attrConfig.up, attrs)
|
|
|
+ starAdd(grid.star, attrConfig.atkStarRate, attrConfig.hpStarRate, attrs)
|
|
|
+ qualityAdd(heroConfig, grid.quality, attrs)
|
|
|
+end
|
|
|
+
|
|
|
+-- 融合伙伴基础
|
|
|
+function doCalcMergeHero(grid, attrs)
|
|
|
+ if not grid and attrs then return end
|
|
|
+ local mergeHeroAttrs = grid.mergeHeroAttrs
|
|
|
+ local heroConfig = HeroExcel.hero[grid.id]
|
|
|
+ local attrConfig = HeroDefine.getAttrConfig(grid.id, grid.star)
|
|
|
+ if not attrConfig then
|
|
|
+ assert(nil, "attrConfig is nil id " .. grid.id .. " star " .. grid.star)
|
|
|
+ end
|
|
|
+
|
|
|
+ if type(mergeHeroAttrs) == "table" and next(mergeHeroAttrs) ~= nil then
|
|
|
+ for k, v in pairs(mergeHeroAttrs) do
|
|
|
+ RoleAttr.updateValue(k, v, attrs)
|
|
|
+ end
|
|
|
+ else
|
|
|
for _, v in ipairs(attrConfig.attrs) do
|
|
|
RoleAttr.updateValue(v[1], v[2], attrs)
|
|
|
end
|
|
|
@@ -411,15 +434,19 @@ function addHero(human, id, star, cnt, logType, noSend)
|
|
|
if not heroConfig then return end
|
|
|
|
|
|
local xLv = 0
|
|
|
- local heroAttrs = nil
|
|
|
+ local mergeHeroAttrs = nil
|
|
|
if logType == "hero_merge" then
|
|
|
human.db.mergeInfo = human.db.mergeInfo or {}
|
|
|
human.db.mergeInfo.heroInfo.xLv = human.db.mergeInfo.heroInfo.xLv or 0
|
|
|
human.db.mergeInfo.heroInfo.heroAttrs = human.db.mergeInfo.heroInfo.heroAttrs or RoleDefine.PANEL_ATTR_KEY
|
|
|
|
|
|
xLv = human.db.mergeInfo.heroInfo.xLv
|
|
|
- heroAttrs = human.db.mergeInfo.heroInfo.heroAttrs
|
|
|
- Log.write(Log.LOGID_TEST, "添加融合英雄属性 heroAttrs : " .. Json.Encode(heroAttrs))
|
|
|
+ mergeHeroAttrs = mergeHeroAttrs or {}
|
|
|
+ for k, v in pairs(human.db.mergeInfo.heroInfo.heroAttrs) do
|
|
|
+ mergeHeroAttrs[k] = v
|
|
|
+ end
|
|
|
+
|
|
|
+ Log.write(Log.LOGID_TEST, "添加融合英雄属性 heroAttrs : " .. Json.Encode(mergeHeroAttrs))
|
|
|
end
|
|
|
|
|
|
-- 某些英雄自动分解
|
|
|
@@ -435,8 +462,9 @@ function addHero(human, id, star, cnt, logType, noSend)
|
|
|
|
|
|
local heroIndex, uuid = nil
|
|
|
for i = 1, cnt do
|
|
|
- local heroGrid = HeroGrid.createHeroGrid(id, star, xLv)
|
|
|
- heroIndex = addHeroByGrid(human, heroGrid, logType, noSend,heroAttrs)
|
|
|
+ local heroGrid = HeroGrid.createHeroGrid(id, star, xLv, mergeHeroAttrs)
|
|
|
+ Log.write(Log.LOGID_TEST, "添加融合英雄属性 heroGrid : " .. Json.Encode(heroGrid))
|
|
|
+ heroIndex = addHeroByGrid(human, heroGrid, logType, noSend)
|
|
|
uuid = heroGrid.uuid
|
|
|
end
|
|
|
return heroIndex, uuid
|
|
|
@@ -455,7 +483,7 @@ function writeLogHeroDel(human, logType, heroGrid)
|
|
|
end
|
|
|
|
|
|
-- 新增英雄
|
|
|
-function addHeroByGrid(human, heroGrid, logType, noSend, heroAttrs)
|
|
|
+function addHeroByGrid(human, heroGrid, logType, noSend)
|
|
|
if not LogDefine.DEFINE[logType] or not LogDefine.TYPE["hero"] then
|
|
|
assert()
|
|
|
end
|
|
|
@@ -476,13 +504,11 @@ function addHeroByGrid(human, heroGrid, logType, noSend, heroAttrs)
|
|
|
|
|
|
local emptyIndex = getEmptyIndex(human)
|
|
|
|
|
|
- Log.write(Log.LOGID_TEST, "emptyIndex " .. emptyIndex)
|
|
|
-
|
|
|
if not emptyIndex then return end
|
|
|
|
|
|
heroGrid.bagIndex = emptyIndex
|
|
|
human.db.heroBag[emptyIndex] = heroGrid
|
|
|
- ObjHuman.doCalcHero(human, emptyIndex, heroAttrs)
|
|
|
+ ObjHuman.doCalcHero(human, emptyIndex)
|
|
|
if not noSend then
|
|
|
sendHeroBagUpdate(human, emptyIndex)
|
|
|
end
|
|
|
@@ -1020,7 +1046,6 @@ function heroJueXingDo(human, heroID, heroIndex, inputIDList, inputIndexList)
|
|
|
for i = 1, diffCnt do
|
|
|
makeSkillNet(msgRet.skillUp[i], diffList[i][2])
|
|
|
end
|
|
|
-
|
|
|
msgRet.itemList[0] = 0
|
|
|
if fenjieList then
|
|
|
for itemID, itemCnt in pairs(fenjieList) do
|