Commit 498ca20083bdb051e62d2991342f9c27ae7e227a
1 parent
b3593354
取消爬塔次数
Showing
1 changed file
with
7 additions
and
2 deletions
Show diff stats
src/actions/TowerAction.lua
@@ -62,7 +62,7 @@ function _M.startBattleRpc(agent, data) | @@ -62,7 +62,7 @@ function _M.startBattleRpc(agent, data) | ||
62 | 62 | ||
63 | if not csvdb["tower_battleCsv"][id] then return end | 63 | if not csvdb["tower_battleCsv"][id] then return end |
64 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) | 64 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) |
65 | - if curCount < 1 then return end -- 没有次数返回 | 65 | + --if curCount < 1 then return end -- 没有次数返回 |
66 | 66 | ||
67 | --搞起来 | 67 | --搞起来 |
68 | towerInfo.c = curCount - 1 | 68 | towerInfo.c = curCount - 1 |
@@ -136,10 +136,15 @@ end | @@ -136,10 +136,15 @@ end | ||
136 | 136 | ||
137 | function _M.bugCountRpc(agent, data) | 137 | function _M.bugCountRpc(agent, data) |
138 | local role = agent.role | 138 | local role = agent.role |
139 | + local msg = MsgPack.unpack(data) | ||
140 | + local buyCount = msg.count | ||
139 | 141 | ||
140 | local towerInfo = role:getProperty("towerInfo") | 142 | local towerInfo = role:getProperty("towerInfo") |
141 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) | 143 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) |
142 | local needCount = globalCsv.tower_count_limit - curCount | 144 | local needCount = globalCsv.tower_count_limit - curCount |
145 | + if needCount > buyCount then | ||
146 | + needCount = buyCount | ||
147 | + end | ||
143 | if needCount > 0 then -- 补充 | 148 | if needCount > 0 then -- 补充 |
144 | local cost = globalCsv.tower_chance_item:toNumMap() | 149 | local cost = globalCsv.tower_chance_item:toNumMap() |
145 | for k , v in pairs(cost) do | 150 | for k , v in pairs(cost) do |
@@ -147,7 +152,7 @@ function _M.bugCountRpc(agent, data) | @@ -147,7 +152,7 @@ function _M.bugCountRpc(agent, data) | ||
147 | end | 152 | end |
148 | if not role:checkItemEnough(cost) then return end | 153 | if not role:checkItemEnough(cost) then return end |
149 | role:costItems(cost, {log = {desc = "towerCount"}}) | 154 | role:costItems(cost, {log = {desc = "towerCount"}}) |
150 | - curCount = globalCsv.tower_count_limit | 155 | + curCount = curCount + needCount |
151 | end | 156 | end |
152 | towerInfo.c = curCount | 157 | towerInfo.c = curCount |
153 | towerInfo.t = nextTime | 158 | towerInfo.t = nextTime |