diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index 5c5f8b8..6449408 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -527,10 +527,13 @@ function _M.wheelSurfRpc(agent, data) local count = countPool[ctype] if not count then return end + if ptype == 2 and not role:isFuncOpen(FuncOpenType.AdvEndless) then + return + end local drawTypeData = csvdb["adv_wheelsurfCsv"][ptype] if not drawTypeData then return end - local drawData = drawTypeData[role:getFuncLv(FuncOpenType.AdvWheelSurf)] + local drawData = drawTypeData[role:getAdvWheelSurfLv(ptype)] if not drawData then return end local costs = drawData.cost:toNumMap() @@ -540,7 +543,7 @@ function _M.wheelSurfRpc(agent, data) if not role:checkItemEnough(costs) then return end role:costItems(costs) - + role:addAdvLvExp(costs[ItemId.OldCoin] or 0) -- 随机池子 local pool = drawData.weight:randWeight() local reward = {} diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index bf0287f..51b8bb7 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -356,8 +356,6 @@ function Adv:over(success, isAllPass) self.owner:checkTaskEnter("AdvAllPass", {id = self.chapterId}) end - -- 冒险队等级升一下子 - self.owner:checkAdvLvByAddWin() end self:clearAdvUnlockCache() self:clear() diff --git a/src/adv/AdvBattle.lua b/src/adv/AdvBattle.lua index 1585ad5..c439a71 100644 --- a/src/adv/AdvBattle.lua +++ b/src/adv/AdvBattle.lua @@ -35,16 +35,30 @@ end 成长率 =(总生存力 / 80)^0.52 + INT(总角色等级 / 50)* 1 --]] +local function getAdvLvAttrUp(upAttrs, attrName, baseAttr) + -- 1=冒险队属性;1=点数/百分比=属性枚举=参数;属性枚举(1=生命上限/2=魔法上限/3=攻击/4=防御);点数/百分比(0=点数/1=百分比) + local Enem = { + hp = 1, + sp = 2, + atk = 3, + def = 4, + } + if not Enem[attrName] then return baseAttr end + return baseAttr + (upAttrs[Enem[attrName]] or 0) +end + function Battle:initPlayer() local advTeam = self.adv.owner:getProperty("advTeam") if not next(advTeam.heros) then return end local leaderPassive = {} local player = advTeam.player if not player then + local advAddAttrs = self.adv.owner:getAdvLvAddAttr() + player = {} player.level = 1 player.exp = 0 - player.sp = 100 + player.sp = getAdvLvAttrUp(advAddAttrs, "sp", 100) player.growth = {} player.passives = {} @@ -61,10 +75,13 @@ function Battle:initPlayer() end local attrs = self.adv.owner:getTeamBattleInfo(advTeam).heros + + for attrName, _ in pairs(AdvAttsEnum) do for _, hero in pairs(attrs) do player[attrName] = (player[attrName] or 0) + hero[attrName] end + player[attrName] = getAdvLvAttrUp(advAddAttrs, attrName, player[attrName]) player.growth[attrName] = player[attrName] * 0.025 end diff --git a/src/csvdata b/src/csvdata index 15e0bd7..4bc2e8b 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit 15e0bd74f6d969ca483e1f271b95a331a824e2c7 +Subproject commit 4bc2e8bad2703202f82475c09e046b2d51a9fa2f diff --git a/src/models/Role.lua b/src/models/Role.lua index cc929fd..71b9e3a 100644 --- a/src/models/Role.lua +++ b/src/models/Role.lua @@ -62,7 +62,7 @@ Role.schema = { advTask = {"table", {}}, -- 冒险已领取任务完成状态 {id = status} --每层重置 advMTask = {"table", {id = 1, status = 0, lock = true}}, -- 冒险主线任务 -- {id = id, status = status, lock = true} -- 当前主线id 当前主线状态 是否锁定状态 advAchiev = {"table", {}}, -- 冒险成就 {chapterId = {achievId = status, -1 = pt, pts = {}}, } - advL = {"table", {0, 0}}, -- 冒险队等级 {lv, winCount} + advL = {"table", {0, 0}}, -- 冒险队等级 {lv, exp} advElM = {"number", 0}, -- 无尽模式通关的最高层数 endless max layer advElS = {"number", globalCsv.adv_endless_season}, -- 无尽模式记录的赛季 endless season advAFOpen = {"table", {}}, -- 解锁的神器 {[id] = 1} diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 3573383..2cfb883 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -850,24 +850,61 @@ function RolePlugin.bind(Role) end end - function Role:checkAdvLvByAddWin(winCount) - winCount = winCount or 1 + function Role:addAdvLvExp(exp) local advL = self:getProperty("advL") - local oldL = advL[1] - advL[2] = (advL[2] or 0) + winCount - for level = ((advL[1] or 0) + 1), #csvdb["adv_rankCsv"] do - local ldata = csvdb["adv_rankCsv"][level] - if ldata.unlock <= advL[2] then - advL[1] = level - self:award(ldata.reward) + local level = advL[1] + local newExp = (advL[2] or 0) + exp + + if not csvdb["adv_level_fundCsv"][level + 1] then + return + end + + while newExp >= csvdb["adv_level_fundCsv"][level].exp do + if csvdb["adv_level_fundCsv"][level + 1] and self:advChapterIsOpen(100 + csvdb["adv_level_fundCsv"][level + 1].chapter) then -- 有下一级 + newExp = newExp - csvdb["adv_level_fundCsv"][level].exp + level = level + 1 + else + newExp = csvdb["adv_level_fundCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除 end end - if advL[1] > oldL then - self:checkTaskEnter("AdvLevel", {level = advL[1]}) + + if level > advL[1] then + self:checkTaskEnter("AdvLevel", {level = level}) end + advL[1] = level + advL[2] = newExp self:updateProperty({field = "advL", value = advL}) end + function Role:getAdvWheelSurfLv(ptype) + local level = 1 + for i = 0, self:getProperty("advL")[1] do + local effects = csvdb["adv_level_fundCsv"][i].effect:toArray() + for _, one in ipairs(effects) do + local effect = one:toArray(true, "=") + if effect[1] == 2 and ptype == effect[2] then + level = effect[3] + end + end + end + return level + end + + function Role:getAdvLvAddAttrs() + -- 1=冒险队属性;1=点数/百分比=属性枚举=参数;属性枚举(1=生命上限/2=魔法上限/3=攻击/4=防御);点数/百分比(0=点数/1=百分比) + local attrs = {} + for i = 0, self:getProperty("advL")[1] do + local effects = csvdb["adv_level_fundCsv"][i].effect:toArray() + for _, one in ipairs(effects) do + local effect = one:toArray(true, "=") + if effect[1] == 1 then + attrs[effect[2]] = (attrs[effect[2]] or 0) + effect[3] + end + end + end + return attrs + end + function Role:getTeamBattleInfo(team) local teamInfo = {heros = {}, supports = {}} local activeRelation = self:getHeroActiveRelation(team.heros) -- libgit2 0.21.2