Commit cf9eda88cec208bf5aec29efdfe9bcbefbd75487

Authored by zhouhaihai
2 parents e1f521ec b3ca5d1f

Merge branch 'tr/bugfix-qa' into tr/develop

* tr/bugfix-qa:
  进入中继层补给药剂,补足到上限,扣除错误
  宝藏怪
Showing 2 changed files with 29 additions and 20 deletions   Show diff stats
@@ -1187,10 +1187,17 @@ function Adv:supplyPotion() @@ -1187,10 +1187,17 @@ function Adv:supplyPotion()
1187 for potionId, set in pairs(potionCsv) do 1187 for potionId, set in pairs(potionCsv) do
1188 local count = potionBag[potionId] or 0 1188 local count = potionBag[potionId] or 0
1189 if count > 0 then 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 end 1201 end
1195 end 1202 end
1196 self.owner:updateProperties({ 1203 self.owner:updateProperties({
src/models/Activity.lua
@@ -963,25 +963,27 @@ activityFunc[Activity.ActivityType.Crisis] = { @@ -963,25 +963,27 @@ activityFunc[Activity.ActivityType.Crisis] = {
963 for id, actSet in pairs(actCsv) do 963 for id, actSet in pairs(actCsv) do
964 if actSet.type == atype then 964 if actSet.type == atype then
965 local status = actData.task[id] or 0 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 end 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 end 986 end
983 - actData.task[id] = status  
984 - change = true  
985 end 987 end
986 end 988 end
987 if change then 989 if change then