From fd4e0f4f951c4ed5b93dcfc0451164f6632dc0fa Mon Sep 17 00:00:00 2001 From: suhongyang <1609423485@qq.com> Date: Wed, 22 Jan 2020 15:21:51 +0800 Subject: [PATCH] 不能直接突破满 --- src/actions/GmAction.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/actions/GmAction.lua b/src/actions/GmAction.lua index d6aed3d..b62055a 100644 --- a/src/actions/GmAction.lua +++ b/src/actions/GmAction.lua @@ -38,9 +38,16 @@ function _M.herol(role, pms) if not hero or (hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] and hero:getProperty("level") >= hero:getMaxLevel()) then return "失败" end - local addbl = #csvdb["unit_breakCsv"] - hero:getProperty("breakL") - if addbl > 0 then - hero:updateProperty({field = "breakL", delta = addbl}) + local nextLevel = math.min(addLevel + hero:getProperty("level"), 200) + for i = 0, 10 do + local upLimit = csvdb["unit_breakCsv"][i].levelLimit + local lowLimit = csvdb["unit_breakCsv"][i - 1] and csvdb["unit_breakCsv"][i - 1].levelLimit or 0 + if upLimit > nextLevel and lowLimit <= nextLevel then + local addbl = i - hero:getProperty("breakL") + if addbl > 0 then + hero:updateProperty({field = "breakL", delta = addbl}) + end + end end addLevel = math.min(hero:getMaxLevel() - hero:getProperty("level"), addLevel) hero:updateProperty({field = "level", delta = addLevel}) -- libgit2 0.21.2