Commit 94449a7845a03a6c2d73bcc79db4e9eafb986ee4
1 parent
c1928949
英雄升级和突破增加关卡限制
Showing
1 changed file
with
22 additions
and
4 deletions
Show diff stats
src/actions/HeroAction.lua
... | ... | @@ -35,10 +35,19 @@ function _M.levelUpRpc( agent, data ) |
35 | 35 | local hero = role.heros[msg.id] |
36 | 36 | if not hero then return 1 end |
37 | 37 | |
38 | - if hero:getProperty("level") >= hero:getMaxLevel() then return 2 end | |
39 | - local curData = csvdb["unit_expCsv"][hero:getProperty("level")] | |
38 | + local level = hero:getProperty("level") | |
39 | + if level >= hero:getMaxLevel() then return 2 end | |
40 | + local curData = csvdb["unit_expCsv"][level] | |
40 | 41 | local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold} |
41 | 42 | if not role:checkItemEnough(cost) then return 3 end |
43 | + | |
44 | + -- 通过指定关卡后才能升级英雄等级 | |
45 | + local pass = globalCsv.unit_exp_level_pass[level + 1] | |
46 | + if pass then | |
47 | + local hangPass = self:getProperty("hangPass") | |
48 | + if not hangPass[pass] then return 4 end | |
49 | + end | |
50 | + | |
42 | 51 | role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}}) |
43 | 52 | |
44 | 53 | local oldAttr = hero:getTotalAttrs() |
... | ... | @@ -69,12 +78,21 @@ function _M.breakRpc( agent, data ) |
69 | 78 | local hero = role.heros[msg.id] |
70 | 79 | if not hero then return 1 end |
71 | 80 | |
81 | + local breakL = hero:getProperty("breakL") | |
72 | 82 | if hero:getProperty("level") < hero:getMaxLevel() then return 2 end |
73 | - if hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] then return 3 end | |
74 | - local curData = csvdb["unit_breakCsv"][hero:getProperty("breakL")] | |
83 | + if breakL >= #csvdb["unit_breakCsv"] then return 3 end | |
84 | + local curData = csvdb["unit_breakCsv"][breakL] | |
75 | 85 | if hero:getProperty("wakeL") < curData["starLimit"] then return 4 end |
76 | 86 | local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} |
77 | 87 | if not role:checkItemEnough(cost) then return 4 end |
88 | + | |
89 | + -- 通过指定关卡后才能突破英雄 | |
90 | + local pass = globalCsv.unit_break_level_pass[breakL + 1] | |
91 | + if pass then | |
92 | + local hangPass = self:getProperty("hangPass") | |
93 | + if not hangPass[pass] then return 4 end | |
94 | + end | |
95 | + | |
78 | 96 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) |
79 | 97 | local oldAttr = hero:getTotalAttrs() |
80 | 98 | hero:updateProperty({field = "breakL", delta = 1}) | ... | ... |