Commit 6b5c9206ef649b86cea59258ad9734dc92967b00

Authored by zhouhaihai
1 parent 5e0e0aff

冒险资助升级属性奖励

src/actions/AdvAction.lua
@@ -527,10 +527,13 @@ function _M.wheelSurfRpc(agent, data) @@ -527,10 +527,13 @@ function _M.wheelSurfRpc(agent, data)
527 local count = countPool[ctype] 527 local count = countPool[ctype]
528 if not count then return end 528 if not count then return end
529 529
  530 + if ptype == 2 and not role:isFuncOpen(FuncOpenType.AdvEndless) then
  531 + return
  532 + end
530 533
531 local drawTypeData = csvdb["adv_wheelsurfCsv"][ptype] 534 local drawTypeData = csvdb["adv_wheelsurfCsv"][ptype]
532 if not drawTypeData then return end 535 if not drawTypeData then return end
533 - local drawData = drawTypeData[role:getFuncLv(FuncOpenType.AdvWheelSurf)] 536 + local drawData = drawTypeData[role:getAdvWheelSurfLv(ptype)]
534 if not drawData then return end 537 if not drawData then return end
535 538
536 local costs = drawData.cost:toNumMap() 539 local costs = drawData.cost:toNumMap()
@@ -540,7 +543,7 @@ function _M.wheelSurfRpc(agent, data) @@ -540,7 +543,7 @@ function _M.wheelSurfRpc(agent, data)
540 543
541 if not role:checkItemEnough(costs) then return end 544 if not role:checkItemEnough(costs) then return end
542 role:costItems(costs) 545 role:costItems(costs)
543 - 546 + role:addAdvLvExp(costs[ItemId.OldCoin] or 0)
544 -- 随机池子 547 -- 随机池子
545 local pool = drawData.weight:randWeight() 548 local pool = drawData.weight:randWeight()
546 local reward = {} 549 local reward = {}
@@ -356,8 +356,6 @@ function Adv:over(success, isAllPass) @@ -356,8 +356,6 @@ function Adv:over(success, isAllPass)
356 self.owner:checkTaskEnter("AdvAllPass", {id = self.chapterId}) 356 self.owner:checkTaskEnter("AdvAllPass", {id = self.chapterId})
357 end 357 end
358 358
359 - -- 冒险队等级升一下子  
360 - self.owner:checkAdvLvByAddWin()  
361 end 359 end
362 self:clearAdvUnlockCache() 360 self:clearAdvUnlockCache()
363 self:clear() 361 self:clear()
src/adv/AdvBattle.lua
@@ -35,16 +35,30 @@ end @@ -35,16 +35,30 @@ end
35 成长率 =(总生存力 / 80)^0.52 + INT(总角色等级 / 50)* 1 35 成长率 =(总生存力 / 80)^0.52 + INT(总角色等级 / 50)* 1
36 --]] 36 --]]
37 37
  38 +local function getAdvLvAttrUp(upAttrs, attrName, baseAttr)
  39 + -- 1=冒险队属性;1=点数/百分比=属性枚举=参数;属性枚举(1=生命上限/2=魔法上限/3=攻击/4=防御);点数/百分比(0=点数/1=百分比)
  40 + local Enem = {
  41 + hp = 1,
  42 + sp = 2,
  43 + atk = 3,
  44 + def = 4,
  45 + }
  46 + if not Enem[attrName] then return baseAttr end
  47 + return baseAttr + (upAttrs[Enem[attrName]] or 0)
  48 +end
  49 +
38 function Battle:initPlayer() 50 function Battle:initPlayer()
39 local advTeam = self.adv.owner:getProperty("advTeam") 51 local advTeam = self.adv.owner:getProperty("advTeam")
40 if not next(advTeam.heros) then return end 52 if not next(advTeam.heros) then return end
41 local leaderPassive = {} 53 local leaderPassive = {}
42 local player = advTeam.player 54 local player = advTeam.player
43 if not player then 55 if not player then
  56 + local advAddAttrs = self.adv.owner:getAdvLvAddAttr()
  57 +
44 player = {} 58 player = {}
45 player.level = 1 59 player.level = 1
46 player.exp = 0 60 player.exp = 0
47 - player.sp = 100 61 + player.sp = getAdvLvAttrUp(advAddAttrs, "sp", 100)
48 player.growth = {} 62 player.growth = {}
49 player.passives = {} 63 player.passives = {}
50 64
@@ -61,10 +75,13 @@ function Battle:initPlayer() @@ -61,10 +75,13 @@ function Battle:initPlayer()
61 end 75 end
62 76
63 local attrs = self.adv.owner:getTeamBattleInfo(advTeam).heros 77 local attrs = self.adv.owner:getTeamBattleInfo(advTeam).heros
  78 +
  79 +
64 for attrName, _ in pairs(AdvAttsEnum) do 80 for attrName, _ in pairs(AdvAttsEnum) do
65 for _, hero in pairs(attrs) do 81 for _, hero in pairs(attrs) do
66 player[attrName] = (player[attrName] or 0) + hero[attrName] 82 player[attrName] = (player[attrName] or 0) + hero[attrName]
67 end 83 end
  84 + player[attrName] = getAdvLvAttrUp(advAddAttrs, attrName, player[attrName])
68 player.growth[attrName] = player[attrName] * 0.025 85 player.growth[attrName] = player[attrName] * 0.025
69 end 86 end
70 87
1 -Subproject commit 15e0bd74f6d969ca483e1f271b95a331a824e2c7 1 +Subproject commit 4bc2e8bad2703202f82475c09e046b2d51a9fa2f
src/models/Role.lua
@@ -62,7 +62,7 @@ Role.schema = { @@ -62,7 +62,7 @@ Role.schema = {
62 advTask = {"table", {}}, -- 冒险已领取任务完成状态 {id = status} --每层重置 62 advTask = {"table", {}}, -- 冒险已领取任务完成状态 {id = status} --每层重置
63 advMTask = {"table", {id = 1, status = 0, lock = true}}, -- 冒险主线任务 -- {id = id, status = status, lock = true} -- 当前主线id 当前主线状态 是否锁定状态 63 advMTask = {"table", {id = 1, status = 0, lock = true}}, -- 冒险主线任务 -- {id = id, status = status, lock = true} -- 当前主线id 当前主线状态 是否锁定状态
64 advAchiev = {"table", {}}, -- 冒险成就 {chapterId = {achievId = status, -1 = pt, pts = {}}, } 64 advAchiev = {"table", {}}, -- 冒险成就 {chapterId = {achievId = status, -1 = pt, pts = {}}, }
65 - advL = {"table", {0, 0}}, -- 冒险队等级 {lv, winCount} 65 + advL = {"table", {0, 0}}, -- 冒险队等级 {lv, exp}
66 advElM = {"number", 0}, -- 无尽模式通关的最高层数 endless max layer 66 advElM = {"number", 0}, -- 无尽模式通关的最高层数 endless max layer
67 advElS = {"number", globalCsv.adv_endless_season}, -- 无尽模式记录的赛季 endless season 67 advElS = {"number", globalCsv.adv_endless_season}, -- 无尽模式记录的赛季 endless season
68 advAFOpen = {"table", {}}, -- 解锁的神器 {[id] = 1} 68 advAFOpen = {"table", {}}, -- 解锁的神器 {[id] = 1}
src/models/RolePlugin.lua
@@ -850,24 +850,61 @@ function RolePlugin.bind(Role) @@ -850,24 +850,61 @@ function RolePlugin.bind(Role)
850 end 850 end
851 end 851 end
852 852
853 - function Role:checkAdvLvByAddWin(winCount)  
854 - winCount = winCount or 1 853 + function Role:addAdvLvExp(exp)
855 local advL = self:getProperty("advL") 854 local advL = self:getProperty("advL")
856 - local oldL = advL[1]  
857 - advL[2] = (advL[2] or 0) + winCount  
858 - for level = ((advL[1] or 0) + 1), #csvdb["adv_rankCsv"] do  
859 - local ldata = csvdb["adv_rankCsv"][level]  
860 - if ldata.unlock <= advL[2] then  
861 - advL[1] = level  
862 - self:award(ldata.reward) 855 + local level = advL[1]
  856 + local newExp = (advL[2] or 0) + exp
  857 +
  858 + if not csvdb["adv_level_fundCsv"][level + 1] then
  859 + return
  860 + end
  861 +
  862 + while newExp >= csvdb["adv_level_fundCsv"][level].exp do
  863 + if csvdb["adv_level_fundCsv"][level + 1] and self:advChapterIsOpen(100 + csvdb["adv_level_fundCsv"][level + 1].chapter) then -- 有下一级
  864 + newExp = newExp - csvdb["adv_level_fundCsv"][level].exp
  865 + level = level + 1
  866 + else
  867 + newExp = csvdb["adv_level_fundCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除
863 end 868 end
864 end 869 end
865 - if advL[1] > oldL then  
866 - self:checkTaskEnter("AdvLevel", {level = advL[1]}) 870 +
  871 + if level > advL[1] then
  872 + self:checkTaskEnter("AdvLevel", {level = level})
867 end 873 end
  874 + advL[1] = level
  875 + advL[2] = newExp
868 self:updateProperty({field = "advL", value = advL}) 876 self:updateProperty({field = "advL", value = advL})
869 end 877 end
870 878
  879 + function Role:getAdvWheelSurfLv(ptype)
  880 + local level = 1
  881 + for i = 0, self:getProperty("advL")[1] do
  882 + local effects = csvdb["adv_level_fundCsv"][i].effect:toArray()
  883 + for _, one in ipairs(effects) do
  884 + local effect = one:toArray(true, "=")
  885 + if effect[1] == 2 and ptype == effect[2] then
  886 + level = effect[3]
  887 + end
  888 + end
  889 + end
  890 + return level
  891 + end
  892 +
  893 + function Role:getAdvLvAddAttrs()
  894 + -- 1=冒险队属性;1=点数/百分比=属性枚举=参数;属性枚举(1=生命上限/2=魔法上限/3=攻击/4=防御);点数/百分比(0=点数/1=百分比)
  895 + local attrs = {}
  896 + for i = 0, self:getProperty("advL")[1] do
  897 + local effects = csvdb["adv_level_fundCsv"][i].effect:toArray()
  898 + for _, one in ipairs(effects) do
  899 + local effect = one:toArray(true, "=")
  900 + if effect[1] == 1 then
  901 + attrs[effect[2]] = (attrs[effect[2]] or 0) + effect[3]
  902 + end
  903 + end
  904 + end
  905 + return attrs
  906 + end
  907 +
871 function Role:getTeamBattleInfo(team) 908 function Role:getTeamBattleInfo(team)
872 local teamInfo = {heros = {}, supports = {}} 909 local teamInfo = {heros = {}, supports = {}}
873 local activeRelation = self:getHeroActiveRelation(team.heros) 910 local activeRelation = self:getHeroActiveRelation(team.heros)