Commit 6fc397d60e0659fb871c3040842659f35676d1d0
1 parent
74a8fdc9
角色新突破 冒险优化点击地块
Showing
2 changed files
with
57 additions
and
39 deletions
Show diff stats
src/actions/AdvAction.lua
| @@ -350,15 +350,22 @@ function _M.clickBlockRpc(agent, data) | @@ -350,15 +350,22 @@ function _M.clickBlockRpc(agent, data) | ||
| 350 | local role = agent.role | 350 | local role = agent.role |
| 351 | local msg = MsgPack.unpack(data) | 351 | local msg = MsgPack.unpack(data) |
| 352 | 352 | ||
| 353 | - if not isCanContinue(role) then return end | 353 | + local function returnFail(status) |
| 354 | + SendPacket(actionCodes.Adv_clickBlockRpc, MsgPack.pack({events = {}})) | ||
| 355 | + return true or status -- 调试使用 status | ||
| 356 | + end | ||
| 357 | + | ||
| 358 | + if not isCanContinue(role) then | ||
| 359 | + return returnFail() | ||
| 360 | + end | ||
| 354 | local adv = role:getAdvData() | 361 | local adv = role:getAdvData() |
| 355 | 362 | ||
| 356 | - if adv:isWaitChooseArtifact() then return end | 363 | + if adv:isWaitChooseArtifact() then return returnFail() end |
| 357 | 364 | ||
| 358 | adv:log({desc = "clickBlock", int1 = msg.roomId, int2 = msg.blockId}) | 365 | adv:log({desc = "clickBlock", int1 = msg.roomId, int2 = msg.blockId}) |
| 359 | 366 | ||
| 360 | local status, errorCode = adv:clickBlock(msg.roomId, msg.blockId, msg) | 367 | local status, errorCode = adv:clickBlock(msg.roomId, msg.blockId, msg) |
| 361 | - if not status then return errorCode end | 368 | + if not status then return returnFail(errorCode) end |
| 362 | 369 | ||
| 363 | SendPacket(actionCodes.Adv_clickBlockRpc, MsgPack.pack({events = adv:popBackEvents()})) | 370 | SendPacket(actionCodes.Adv_clickBlockRpc, MsgPack.pack({events = adv:popBackEvents()})) |
| 364 | return true | 371 | return true |
src/actions/HeroAction.lua
| @@ -96,52 +96,62 @@ function _M.talentRpc(agent, data) | @@ -96,52 +96,62 @@ function _M.talentRpc(agent, data) | ||
| 96 | if not hero then return 1 end | 96 | if not hero then return 1 end |
| 97 | 97 | ||
| 98 | local index = msg.index -- 第几个天赋 | 98 | local index = msg.index -- 第几个天赋 |
| 99 | - local need = {[1] = 1, [2] = 1, [3] = 1, [4] = 1} | 99 | + local need = {[0] = 1, [1] = 1, [2] = 1, [3] = 1, [4] = 1} |
| 100 | if not need[index] then return 2 end | 100 | if not need[index] then return 2 end |
| 101 | 101 | ||
| 102 | - local talent = hero:getProperty("talent") | ||
| 103 | local curStage = talent:getv(0, 1) | 102 | local curStage = talent:getv(0, 1) |
| 104 | - if curStage > csvdb["unit_breakCsv"][hero:getProperty("breakL")].talent then return 3 end | ||
| 105 | - | ||
| 106 | local curData = csvdb["unit_talentCsv"][curStage] | 103 | local curData = csvdb["unit_talentCsv"][curStage] |
| 107 | if not curData then return 4 end | 104 | if not curData then return 4 end |
| 108 | 105 | ||
| 109 | - local level = talent:getv(index, 0) | ||
| 110 | - if level >= #curData then return 5 end | ||
| 111 | - | ||
| 112 | - local talentData = curData[level] | ||
| 113 | - if not talentData then return end | ||
| 114 | - local cost = talentData.money:toNumMap() | ||
| 115 | - local cost2 = talentData.cost:toNumMap() | ||
| 116 | - for k,v in pairs(cost2) do | ||
| 117 | - cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v | ||
| 118 | - end | ||
| 119 | - if not role:checkItemEnough(cost) then return 6 end | ||
| 120 | - role:costItems(cost, {log = {desc = "heroTalent", int1 = msg.id, int2 = hero:getProperty("type")}}) | ||
| 121 | - talent = talent:incrv(index, 1) | ||
| 122 | - | ||
| 123 | - --是否进阶 | ||
| 124 | - local max = true | ||
| 125 | - for i = 1, 4 do | ||
| 126 | - if talent:getv(i, 0) < #curData then | ||
| 127 | - max = false | ||
| 128 | - break | ||
| 129 | - end | ||
| 130 | - end | ||
| 131 | - if max then | ||
| 132 | - talent = talent:setv(0, curStage + 1) | 106 | + |
| 107 | + local talent = hero:getProperty("talent") | ||
| 108 | + if index == 0 then | ||
| 109 | + --是否进阶 | ||
| 110 | + local max = true | ||
| 133 | for i = 1, 4 do | 111 | for i = 1, 4 do |
| 134 | - talent = talent:setv(i, 0) | 112 | + if talent:getv(i, 0) < #curData then |
| 113 | + max = false | ||
| 114 | + break | ||
| 115 | + end | ||
| 135 | end | 116 | end |
| 117 | + if max then | ||
| 118 | + talent = talent:setv(0, curStage + 1) | ||
| 119 | + for i = 1, 4 do | ||
| 120 | + talent = talent:setv(i, 0) | ||
| 121 | + end | ||
| 122 | + else | ||
| 123 | + return 3 | ||
| 124 | + end | ||
| 125 | + else | ||
| 126 | + | ||
| 127 | + local level = talent:getv(index, 0) | ||
| 128 | + if level >= #curData then return 5 end | ||
| 129 | + | ||
| 130 | + local talentData = curData[level] | ||
| 131 | + if not talentData then return end | ||
| 132 | + | ||
| 133 | + if talentData.lvRequire > hero:getProperty("level") then return 6 end | ||
| 134 | + | ||
| 135 | + local cost = talentData.money:toNumMap() | ||
| 136 | + local cost2 = talentData.cost:toNumMap() | ||
| 137 | + for k,v in pairs(cost2) do | ||
| 138 | + cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v | ||
| 139 | + end | ||
| 140 | + if not role:checkItemEnough(cost) then return 6 end | ||
| 141 | + role:costItems(cost, {log = {desc = "heroTalent", int1 = msg.id, int2 = hero:getProperty("type")}}) | ||
| 142 | + talent = talent:incrv(index, 1) | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + local aheadLevel = 0 | ||
| 146 | + for i = 1, talent:getv(0, 1) - 1 do | ||
| 147 | + aheadLevel = aheadLevel + #csvdb["unit_talentCsv"][i] | ||
| 148 | + end | ||
| 149 | + aheadLevel = aheadLevel + talent:getv(index, 0) | ||
| 150 | + | ||
| 151 | + role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = aheadLevel}) | ||
| 136 | end | 152 | end |
| 137 | - hero:updateProperty({field = "talent", value = talent}) | ||
| 138 | - local aheadLevel = 0 | ||
| 139 | - for i = 1, talent:getv(0, 1) - 1 do | ||
| 140 | - aheadLevel = aheadLevel + #csvdb["unit_talentCsv"][i] | ||
| 141 | - end | ||
| 142 | - aheadLevel = aheadLevel + talent:getv(index, 0) | ||
| 143 | 153 | ||
| 144 | - role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = aheadLevel}) | 154 | + hero:updateProperty({field = "talent", value = talent}) |
| 145 | 155 | ||
| 146 | hero:log({desc = "talent", int1 = index, int2 = talent:getv(index, 0)}) | 156 | hero:log({desc = "talent", int1 = index, int2 = talent:getv(index, 0)}) |
| 147 | 157 | ||
| @@ -149,6 +159,7 @@ function _M.talentRpc(agent, data) | @@ -149,6 +159,7 @@ function _M.talentRpc(agent, data) | ||
| 149 | return true | 159 | return true |
| 150 | end | 160 | end |
| 151 | 161 | ||
| 162 | + | ||
| 152 | -- 暂时没有这个功能 | 163 | -- 暂时没有这个功能 |
| 153 | function _M.likeHeroRpc(agent, data) | 164 | function _M.likeHeroRpc(agent, data) |
| 154 | local role = agent.role | 165 | local role = agent.role |