From b57f0bae30fa4fe6fcdc2b4ad08de8535e0c45cb Mon Sep 17 00:00:00 2001 From: gaofengduan Date: Thu, 27 Jun 2019 19:24:35 +0800 Subject: [PATCH] fix hero talent --- src/actions/HeroAction.lua | 22 ++++++++++------------ src/csvdata | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/actions/HeroAction.lua b/src/actions/HeroAction.lua index ed2c242..0cbe33c 100644 --- a/src/actions/HeroAction.lua +++ b/src/actions/HeroAction.lua @@ -109,32 +109,30 @@ function _M.talentRpc(agent, data) local role = agent.role local msg = MsgPack.unpack(data) local hero = role.heros[msg.id] - if not hero then return end + if not hero then return 1 end local index = msg.index -- 第几个天赋 local need = {[1] = 1, [2] = 1, [3] = 1, [4] = 1} - if not need[index] then return end + if not need[index] then return 2 end local talent = hero:getProperty("talent") local curStage = talent:getv(0, 1) - if curStage > csvdb["unit_breakCsv"][hero:getProperty("breakL")].talent then return end + if curStage > csvdb["unit_breakCsv"][hero:getProperty("breakL")].talent then return 3 end local curData = csvdb["unit_talentCsv"][curStage] - if not curData then return end + if not curData then return 4 end local level = talent:getv(index, 0) - if level >= #curData then return end + if level >= #curData then return 5 end local talentData = curData[level] if not talentData then return end - local cost = {} - local needCost = talentData.cost:toTableArray(true) - cost[needCost[1][1]] = needCost[1][2] - if needCost[2] then - cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][needCost[2][1]]] = needCost[2][2] + local cost = talentData.money:toNumMap() + local cost2 = talentData.cost:toNumMap() + for k,v in pairs(cost2) do + cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v end - - if not role:checkItemEnough(cost) then return end + if not role:checkItemEnough(cost) then return 6 end role:costItems(cost) talent = talent:incrv(index, 1) diff --git a/src/csvdata b/src/csvdata index b4fb9d3..6b0f915 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit b4fb9d39bc675e3d277e308f6f7c5f4184f8b55e +Subproject commit 6b0f915f5fcaf5f087661c42c75b669128d3b4cf -- libgit2 0.21.2