Commit cf9eda88cec208bf5aec29efdfe9bcbefbd75487
Merge branch 'tr/bugfix-qa' into tr/develop
* tr/bugfix-qa: 进入中继层补给药剂,补足到上限,扣除错误 宝藏怪
Showing
2 changed files
with
29 additions
and
20 deletions
Show diff stats
src/adv/Adv.lua
| ... | ... | @@ -1187,10 +1187,17 @@ function Adv:supplyPotion() |
| 1187 | 1187 | for potionId, set in pairs(potionCsv) do |
| 1188 | 1188 | local count = potionBag[potionId] or 0 |
| 1189 | 1189 | if count > 0 then |
| 1190 | - local level = dishTree:getv(potionId,1) | |
| 1191 | - local num = math.min(set[level].limit,count) | |
| 1192 | - advItems = advItems:setv(potionId,num) | |
| 1193 | - potionBag[potionId] = num ~= count and (count - num) or nil | |
| 1190 | + local max = set[dishTree:getv(potionId,1)].limit | |
| 1191 | + local old = advItems:getv(potionId,0) | |
| 1192 | + local need = max - old | |
| 1193 | + | |
| 1194 | + if need < count then | |
| 1195 | + advItems = advItems:setv(potionId,max) | |
| 1196 | + potionBag[potionId] = count - need | |
| 1197 | + else | |
| 1198 | + advItems = advItems:setv(potionId,old + count) | |
| 1199 | + potionBag[potionId] = nil | |
| 1200 | + end | |
| 1194 | 1201 | end |
| 1195 | 1202 | end |
| 1196 | 1203 | self.owner:updateProperties({ | ... | ... |
src/models/Activity.lua
| ... | ... | @@ -963,25 +963,27 @@ activityFunc[Activity.ActivityType.Crisis] = { |
| 963 | 963 | for id, actSet in pairs(actCsv) do |
| 964 | 964 | if actSet.type == atype then |
| 965 | 965 | local status = actData.task[id] or 0 |
| 966 | - status = status + count | |
| 967 | - if status >= actSet.condition1 then | |
| 968 | - local reward | |
| 969 | - if actSet.loop == 1 then | |
| 970 | - local rcount = math.floor(status / actSet.condition1) | |
| 971 | - reward = actSet.reward:toNumMap() | |
| 972 | - for itemId, itemC in pairs(reward) do | |
| 973 | - reward[itemId] = itemC * rcount | |
| 966 | + if status ~= -1 then | |
| 967 | + status = status + count | |
| 968 | + if status >= actSet.condition1 then | |
| 969 | + local reward | |
| 970 | + if actSet.loop == 1 then | |
| 971 | + local rcount = math.floor(status / actSet.condition1) | |
| 972 | + reward = actSet.reward:toNumMap() | |
| 973 | + for itemId, itemC in pairs(reward) do | |
| 974 | + reward[itemId] = itemC * rcount | |
| 975 | + end | |
| 976 | + status = status % actSet.condition1 | |
| 977 | + else | |
| 978 | + reward = actSet.reward | |
| 979 | + status = -1 | |
| 974 | 980 | end |
| 975 | - status = status % actSet.condition1 | |
| 976 | - else | |
| 977 | - reward = actSet.reward | |
| 978 | - status = -1 | |
| 979 | - end | |
| 980 | 981 | |
| 981 | - self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify}) | |
| 982 | + self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify}) | |
| 983 | + end | |
| 984 | + actData.task[id] = status | |
| 985 | + change = true | |
| 982 | 986 | end |
| 983 | - actData.task[id] = status | |
| 984 | - change = true | |
| 985 | 987 | end |
| 986 | 988 | end |
| 987 | 989 | if change then | ... | ... |