Commit bdfc994d45b81a30752b60ecbc7aa93c20332fef
Merge branch 'develop' into qa
* develop: 双倍掉掉落bug
Showing
2 changed files
with
36 additions
and
29 deletions
Show diff stats
src/actions/HangAction.lua
@@ -19,7 +19,7 @@ local _M = {} | @@ -19,7 +19,7 @@ local _M = {} | ||
19 | local function checkReward(role) | 19 | local function checkReward(role) |
20 | local hangInfo = role:getProperty("hangInfo") | 20 | local hangInfo = role:getProperty("hangInfo") |
21 | if not hangInfo.carbonId or not hangInfo.coinTime or not hangInfo.itemTime then | 21 | if not hangInfo.carbonId or not hangInfo.coinTime or not hangInfo.itemTime then |
22 | - return | 22 | + return false |
23 | end | 23 | end |
24 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | 24 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] |
25 | local nowCoinTime = math.min(skynet.timex(), hangInfo.endCoinTime or 0) | 25 | local nowCoinTime = math.min(skynet.timex(), hangInfo.endCoinTime or 0) |
@@ -33,11 +33,8 @@ local function checkReward(role) | @@ -33,11 +33,8 @@ local function checkReward(role) | ||
33 | local coinDoubleCount = math.max(0, math.floor((doubleTime) / globalCsv.idle_money_produce_cd)) * 2 | 33 | local coinDoubleCount = math.max(0, math.floor((doubleTime) / globalCsv.idle_money_produce_cd)) * 2 |
34 | hangInfo.coinTime = nowCoinTime | 34 | hangInfo.coinTime = nowCoinTime |
35 | 35 | ||
36 | - doubleTime = role.activity:getActHangDoubleTime(hangInfo.itemTime, nowitemTime) | ||
37 | - normalTime = nowItemTime - hangInfo.coinTime - doubleTime | 36 | + normalTime = nowItemTime - hangInfo.itemTime |
38 | local itemCount = math.max(0, math.floor((normalTime) / globalCsv.idle_item_produce_cd)) | 37 | local itemCount = math.max(0, math.floor((normalTime) / globalCsv.idle_item_produce_cd)) |
39 | - local itemDoubleCount = math.max(0, math.floor((doubleTime) / globalCsv.idle_item_produce_cd)) | ||
40 | - itemCount = itemCount + itemDoubleCount | ||
41 | hangInfo.itemTime = nowItemTime | 38 | hangInfo.itemTime = nowItemTime |
42 | 39 | ||
43 | local items = role:getProperty("hangBag") | 40 | local items = role:getProperty("hangBag") |
@@ -71,34 +68,42 @@ local function checkReward(role) | @@ -71,34 +68,42 @@ local function checkReward(role) | ||
71 | local tempPool = clone(pool) | 68 | local tempPool = clone(pool) |
72 | while #tempPool > 0 do | 69 | while #tempPool > 0 do |
73 | local idx = math.randWeight(tempPool, 3) | 70 | local idx = math.randWeight(tempPool, 3) |
74 | - local cur = pool[idx] | ||
75 | - if (items[cur[1]] and math.ceil((items[cur[1]] + cur[2]) / globalCsv.idle_field_limit) > math.ceil(items[cur[1]] / globalCsv.idle_field_limit)) | ||
76 | - or not items[cur[1]] then --要占用新栏位的情况 | ||
77 | - local addFC | ||
78 | - if not items[cur[1]] then | ||
79 | - addFC = math.ceil(cur[2] / globalCsv.idle_field_limit) | ||
80 | - else | ||
81 | - local frontC = items[cur[1]] % globalCsv.idle_field_limit | ||
82 | - if frontC == 0 then | ||
83 | - frontC = globalCsv.idle_field_limit | ||
84 | - end | ||
85 | - addFC = math.ceil((cur[2] - (globalCsv.idle_field_limit - frontC)) / globalCsv.idle_field_limit) | 71 | + local cur = clone(pool[idx]) |
72 | + if cur[1] ~= 1 then -- 轮空 id | ||
73 | + if cur[1] == ItemId.BreakCost and doubleTime > 0 then | ||
74 | + cur[2] = cur[2] * 2 | ||
86 | end | 75 | end |
87 | - if curFC + addFC <= selfFC then | ||
88 | - curFC = curFC + addFC | ||
89 | - items[cur[1]] = (items[cur[1]] or 0) + cur[2] | ||
90 | - break | 76 | + if (items[cur[1]] and math.ceil((items[cur[1]] + cur[2]) / globalCsv.idle_field_limit) > math.ceil(items[cur[1]] / globalCsv.idle_field_limit)) |
77 | + or not items[cur[1]] then --要占用新栏位的情况 | ||
78 | + local addFC | ||
79 | + if not items[cur[1]] then | ||
80 | + addFC = math.ceil(cur[2] / globalCsv.idle_field_limit) | ||
81 | + else | ||
82 | + local frontC = items[cur[1]] % globalCsv.idle_field_limit | ||
83 | + if frontC == 0 then | ||
84 | + frontC = globalCsv.idle_field_limit | ||
85 | + end | ||
86 | + addFC = math.ceil((cur[2] - (globalCsv.idle_field_limit - frontC)) / globalCsv.idle_field_limit) | ||
87 | + end | ||
88 | + if curFC + addFC <= selfFC then | ||
89 | + curFC = curFC + addFC | ||
90 | + items[cur[1]] = (items[cur[1]] or 0) + cur[2] | ||
91 | + break | ||
92 | + else | ||
93 | + --加不了,换别的东西 | ||
94 | + table.remove(tempPool, idx) | ||
95 | + end | ||
91 | else | 96 | else |
92 | - --加不了,换别的东西 | ||
93 | - table.remove(tempPool, idx) | 97 | + items[cur[1]] = items[cur[1]] + cur[2] |
98 | + break | ||
94 | end | 99 | end |
95 | else | 100 | else |
96 | - items[cur[1]] = items[cur[1]] + cur[2] | ||
97 | break | 101 | break |
98 | end | 102 | end |
99 | end | 103 | end |
100 | curIC = curIC + 1 | 104 | curIC = curIC + 1 |
101 | end | 105 | end |
106 | + | ||
102 | for i = 1, itemCount do | 107 | for i = 1, itemCount do |
103 | randomItem() | 108 | randomItem() |
104 | end | 109 | end |
@@ -106,6 +111,8 @@ local function checkReward(role) | @@ -106,6 +111,8 @@ local function checkReward(role) | ||
106 | if coinCount > 0 or itemCount > 0 then | 111 | if coinCount > 0 or itemCount > 0 then |
107 | return true | 112 | return true |
108 | end | 113 | end |
114 | + | ||
115 | + return false | ||
109 | end | 116 | end |
110 | 117 | ||
111 | --开始一个新的关卡 | 118 | --开始一个新的关卡 |
src/models/Activity.lua
@@ -4,10 +4,10 @@ local string_format = string.format | @@ -4,10 +4,10 @@ local string_format = string.format | ||
4 | Activity.ActivityType = { | 4 | Activity.ActivityType = { |
5 | Sign = 1, -- 签到 | 5 | Sign = 1, -- 签到 |
6 | DoubleDrop = 2, -- 双倍掉落 | 6 | DoubleDrop = 2, -- 双倍掉落 |
7 | - DrawHero = 3, --抽卡周 | ||
8 | - FoodSell = 4, --贩卖周 | ||
9 | - OpenBox = 5, --拆解周 | ||
10 | - AdvDraw = 6, --拾荒抽周 | 7 | + FoodSell = 3, --贩卖周 料理 |
8 | + DrawHero = 4, --抽卡周 招募 | ||
9 | + AdvDraw = 5, --拾荒抽周 资助 | ||
10 | + OpenBox = 6, --拆解周 时钟箱 | ||
11 | } | 11 | } |
12 | 12 | ||
13 | 13 | ||
@@ -346,7 +346,7 @@ function Activity:getActHangDoubleTime(lastTs, nowTs) | @@ -346,7 +346,7 @@ function Activity:getActHangDoubleTime(lastTs, nowTs) | ||
346 | local timeNow = skynet.timex() | 346 | local timeNow = skynet.timex() |
347 | lastTs = math.max(lastTs, openTs) | 347 | lastTs = math.max(lastTs, openTs) |
348 | if isOpen then | 348 | if isOpen then |
349 | - if nowTs > openTs then | 349 | + if nowTs > openTs and nowTs > lastTs then |
350 | return nowTs - lastTs | 350 | return nowTs - lastTs |
351 | else | 351 | else |
352 | return 0 | 352 | return 0 |