Commit b57f0bae30fa4fe6fcdc2b4ad08de8535e0c45cb
1 parent
1c35c4cf
fix hero talent
Showing
2 changed files
with
11 additions
and
13 deletions
 
Show diff stats
src/actions/HeroAction.lua
| ... | ... | @@ -109,32 +109,30 @@ function _M.talentRpc(agent, data) | 
| 109 | 109 | local role = agent.role | 
| 110 | 110 | local msg = MsgPack.unpack(data) | 
| 111 | 111 | local hero = role.heros[msg.id] | 
| 112 | - if not hero then return end | |
| 112 | + if not hero then return 1 end | |
| 113 | 113 | |
| 114 | 114 | local index = msg.index -- 第几个天赋 | 
| 115 | 115 | local need = {[1] = 1, [2] = 1, [3] = 1, [4] = 1} | 
| 116 | - if not need[index] then return end | |
| 116 | + if not need[index] then return 2 end | |
| 117 | 117 | |
| 118 | 118 | local talent = hero:getProperty("talent") | 
| 119 | 119 | local curStage = talent:getv(0, 1) | 
| 120 | - if curStage > csvdb["unit_breakCsv"][hero:getProperty("breakL")].talent then return end | |
| 120 | + if curStage > csvdb["unit_breakCsv"][hero:getProperty("breakL")].talent then return 3 end | |
| 121 | 121 | |
| 122 | 122 | local curData = csvdb["unit_talentCsv"][curStage] | 
| 123 | - if not curData then return end | |
| 123 | + if not curData then return 4 end | |
| 124 | 124 | |
| 125 | 125 | local level = talent:getv(index, 0) | 
| 126 | - if level >= #curData then return end | |
| 126 | + if level >= #curData then return 5 end | |
| 127 | 127 | |
| 128 | 128 | local talentData = curData[level] | 
| 129 | 129 | if not talentData then return end | 
| 130 | - local cost = {} | |
| 131 | - local needCost = talentData.cost:toTableArray(true) | |
| 132 | - cost[needCost[1][1]] = needCost[1][2] | |
| 133 | - if needCost[2] then | |
| 134 | - cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][needCost[2][1]]] = needCost[2][2] | |
| 130 | + local cost = talentData.money:toNumMap() | |
| 131 | + local cost2 = talentData.cost:toNumMap() | |
| 132 | + for k,v in pairs(cost2) do | |
| 133 | + cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v | |
| 135 | 134 | end | 
| 136 | - | |
| 137 | - if not role:checkItemEnough(cost) then return end | |
| 135 | + if not role:checkItemEnough(cost) then return 6 end | |
| 138 | 136 | role:costItems(cost) | 
| 139 | 137 | talent = talent:incrv(index, 1) | 
| 140 | 138 | ... | ... | 
