diff --git a/src/actions/HeroAction.lua b/src/actions/HeroAction.lua index 9e44452..a41d764 100644 --- a/src/actions/HeroAction.lua +++ b/src/actions/HeroAction.lua @@ -35,10 +35,19 @@ function _M.levelUpRpc( agent, data ) local hero = role.heros[msg.id] if not hero then return 1 end - if hero:getProperty("level") >= hero:getMaxLevel() then return 2 end - local curData = csvdb["unit_expCsv"][hero:getProperty("level")] + local level = hero:getProperty("level") + if level >= hero:getMaxLevel() then return 2 end + local curData = csvdb["unit_expCsv"][level] local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold} if not role:checkItemEnough(cost) then return 3 end + + -- 通过指定关卡后才能升级英雄等级 + local pass = globalCsv.unit_exp_level_pass[level + 1] + if pass then + local hangPass = self:getProperty("hangPass") + if not hangPass[pass] then return 4 end + end + role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}}) local oldAttr = hero:getTotalAttrs() @@ -69,12 +78,21 @@ function _M.breakRpc( agent, data ) local hero = role.heros[msg.id] if not hero then return 1 end + local breakL = hero:getProperty("breakL") if hero:getProperty("level") < hero:getMaxLevel() then return 2 end - if hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] then return 3 end - local curData = csvdb["unit_breakCsv"][hero:getProperty("breakL")] + if breakL >= #csvdb["unit_breakCsv"] then return 3 end + local curData = csvdb["unit_breakCsv"][breakL] if hero:getProperty("wakeL") < curData["starLimit"] then return 4 end local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} if not role:checkItemEnough(cost) then return 4 end + + -- 通过指定关卡后才能突破英雄 + local pass = globalCsv.unit_break_level_pass[breakL + 1] + if pass then + local hangPass = self:getProperty("hangPass") + if not hangPass[pass] then return 4 end + end + role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) local oldAttr = hero:getTotalAttrs() hero:updateProperty({field = "breakL", delta = 1}) -- libgit2 0.21.2