Commit 6b5c9206ef649b86cea59258ad9734dc92967b00
1 parent
5e0e0aff
冒险资助升级属性奖励
Showing
6 changed files
with
73 additions
and
18 deletions
Show diff stats
src/actions/AdvAction.lua
... | ... | @@ -527,10 +527,13 @@ function _M.wheelSurfRpc(agent, data) |
527 | 527 | local count = countPool[ctype] |
528 | 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 | 534 | local drawTypeData = csvdb["adv_wheelsurfCsv"][ptype] |
532 | 535 | if not drawTypeData then return end |
533 | - local drawData = drawTypeData[role:getFuncLv(FuncOpenType.AdvWheelSurf)] | |
536 | + local drawData = drawTypeData[role:getAdvWheelSurfLv(ptype)] | |
534 | 537 | if not drawData then return end |
535 | 538 | |
536 | 539 | local costs = drawData.cost:toNumMap() |
... | ... | @@ -540,7 +543,7 @@ function _M.wheelSurfRpc(agent, data) |
540 | 543 | |
541 | 544 | if not role:checkItemEnough(costs) then return end |
542 | 545 | role:costItems(costs) |
543 | - | |
546 | + role:addAdvLvExp(costs[ItemId.OldCoin] or 0) | |
544 | 547 | -- 随机池子 |
545 | 548 | local pool = drawData.weight:randWeight() |
546 | 549 | local reward = {} | ... | ... |
src/adv/Adv.lua
src/adv/AdvBattle.lua
... | ... | @@ -35,16 +35,30 @@ end |
35 | 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 | 50 | function Battle:initPlayer() |
39 | 51 | local advTeam = self.adv.owner:getProperty("advTeam") |
40 | 52 | if not next(advTeam.heros) then return end |
41 | 53 | local leaderPassive = {} |
42 | 54 | local player = advTeam.player |
43 | 55 | if not player then |
56 | + local advAddAttrs = self.adv.owner:getAdvLvAddAttr() | |
57 | + | |
44 | 58 | player = {} |
45 | 59 | player.level = 1 |
46 | 60 | player.exp = 0 |
47 | - player.sp = 100 | |
61 | + player.sp = getAdvLvAttrUp(advAddAttrs, "sp", 100) | |
48 | 62 | player.growth = {} |
49 | 63 | player.passives = {} |
50 | 64 | |
... | ... | @@ -61,10 +75,13 @@ function Battle:initPlayer() |
61 | 75 | end |
62 | 76 | |
63 | 77 | local attrs = self.adv.owner:getTeamBattleInfo(advTeam).heros |
78 | + | |
79 | + | |
64 | 80 | for attrName, _ in pairs(AdvAttsEnum) do |
65 | 81 | for _, hero in pairs(attrs) do |
66 | 82 | player[attrName] = (player[attrName] or 0) + hero[attrName] |
67 | 83 | end |
84 | + player[attrName] = getAdvLvAttrUp(advAddAttrs, attrName, player[attrName]) | |
68 | 85 | player.growth[attrName] = player[attrName] * 0.025 |
69 | 86 | end |
70 | 87 | ... | ... |
src/models/Role.lua
... | ... | @@ -62,7 +62,7 @@ Role.schema = { |
62 | 62 | advTask = {"table", {}}, -- 冒险已领取任务完成状态 {id = status} --每层重置 |
63 | 63 | advMTask = {"table", {id = 1, status = 0, lock = true}}, -- 冒险主线任务 -- {id = id, status = status, lock = true} -- 当前主线id 当前主线状态 是否锁定状态 |
64 | 64 | advAchiev = {"table", {}}, -- 冒险成就 {chapterId = {achievId = status, -1 = pt, pts = {}}, } |
65 | - advL = {"table", {0, 0}}, -- 冒险队等级 {lv, winCount} | |
65 | + advL = {"table", {0, 0}}, -- 冒险队等级 {lv, exp} | |
66 | 66 | advElM = {"number", 0}, -- 无尽模式通关的最高层数 endless max layer |
67 | 67 | advElS = {"number", globalCsv.adv_endless_season}, -- 无尽模式记录的赛季 endless season |
68 | 68 | advAFOpen = {"table", {}}, -- 解锁的神器 {[id] = 1} | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -850,24 +850,61 @@ function RolePlugin.bind(Role) |
850 | 850 | end |
851 | 851 | end |
852 | 852 | |
853 | - function Role:checkAdvLvByAddWin(winCount) | |
854 | - winCount = winCount or 1 | |
853 | + function Role:addAdvLvExp(exp) | |
855 | 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 | 868 | end |
864 | 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 | 873 | end |
874 | + advL[1] = level | |
875 | + advL[2] = newExp | |
868 | 876 | self:updateProperty({field = "advL", value = advL}) |
869 | 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 | 908 | function Role:getTeamBattleInfo(team) |
872 | 909 | local teamInfo = {heros = {}, supports = {}} |
873 | 910 | local activeRelation = self:getHeroActiveRelation(team.heros) | ... | ... |