Commit fd4e0f4f951c4ed5b93dcfc0451164f6632dc0fa
1 parent
d8c07167
不能直接突破满
Showing
1 changed file
with
10 additions
and
3 deletions
Show diff stats
src/actions/GmAction.lua
@@ -38,9 +38,16 @@ function _M.herol(role, pms) | @@ -38,9 +38,16 @@ function _M.herol(role, pms) | ||
38 | if not hero or (hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] and hero:getProperty("level") >= hero:getMaxLevel()) then | 38 | if not hero or (hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] and hero:getProperty("level") >= hero:getMaxLevel()) then |
39 | return "失败" | 39 | return "失败" |
40 | end | 40 | end |
41 | - local addbl = #csvdb["unit_breakCsv"] - hero:getProperty("breakL") | ||
42 | - if addbl > 0 then | ||
43 | - hero:updateProperty({field = "breakL", delta = addbl}) | 41 | + local nextLevel = math.min(addLevel + hero:getProperty("level"), 200) |
42 | + for i = 0, 10 do | ||
43 | + local upLimit = csvdb["unit_breakCsv"][i].levelLimit | ||
44 | + local lowLimit = csvdb["unit_breakCsv"][i - 1] and csvdb["unit_breakCsv"][i - 1].levelLimit or 0 | ||
45 | + if upLimit > nextLevel and lowLimit <= nextLevel then | ||
46 | + local addbl = i - hero:getProperty("breakL") | ||
47 | + if addbl > 0 then | ||
48 | + hero:updateProperty({field = "breakL", delta = addbl}) | ||
49 | + end | ||
50 | + end | ||
44 | end | 51 | end |
45 | addLevel = math.min(hero:getMaxLevel() - hero:getProperty("level"), addLevel) | 52 | addLevel = math.min(hero:getMaxLevel() - hero:getProperty("level"), addLevel) |
46 | hero:updateProperty({field = "level", delta = addLevel}) | 53 | hero:updateProperty({field = "level", delta = addLevel}) |