Commit 5db4c63a205ed5f36faa429a7ff987a01f0e0405

Authored by zhangqijia
1 parent 200652e6

fix: 世界线积分, 修复计算错误bug

Showing 1 changed file with 9 additions and 8 deletions   Show diff stats
src/models/RolePlugin.lua
... ... @@ -581,7 +581,7 @@ function RolePlugin.bind(Role)
581 581 function Role:costJade(param)
582 582 self:addItem(param)
583 583 self:checkTaskEnter("CostJade", {count = - param.count})
584   - self:checkWorldChangePoints({[ItemWorldLine.CostJade]=param.count})
  584 + self:checkWorldChangePoints({[ItemWorldLine.CostJade]= -param.count})
585 585 end
586 586  
587 587 function Role:increBy(field, val)
... ... @@ -3270,18 +3270,19 @@ function RolePlugin.bind(Role)
3270 3270 function Role:checkWorldChangePoints(param)
3271 3271 local worldChangePoints = self:getProperty("worldChangePoints") or {}
3272 3272 if param[ItemWorldLine.CostJade] then
3273   - worldChangePoints[ItemWorldLine.CostJade] = (worldChangePoints[ItemWorldLine.CostJade] or 0) + param[ItemWorldLine.CostDiamond]
3274   - local cost = math.floor(param[ItemWorldLine.CostJade] / globalCsv.worldline_count_currency)
3275   - worldChangePoints[ItemWorldLine.CostJade] = worldChangePoints[ItemWorldLine.CostJade] - cost
3276   - worldChangePoints[ItemWorldLine.RouletteCount] = worldChangePoints[ItemWorldLine.RouletteCount] + cost
  3273 + worldChangePoints[ItemWorldLine.CostJade] = (worldChangePoints[ItemWorldLine.CostJade] or 0) + param[ItemWorldLine.CostJade]
  3274 + local cost = math.floor(worldChangePoints[ItemWorldLine.CostJade] / globalCsv.worldline_gift)
  3275 + worldChangePoints[ItemWorldLine.CostJade] = worldChangePoints[ItemWorldLine.CostJade] - cost * globalCsv.worldline_gift
  3276 + worldChangePoints[ItemWorldLine.RouletteCount] = (worldChangePoints[ItemWorldLine.RouletteCount] or 0) + cost
3277 3277 end
3278 3278  
3279 3279 if param[ItemWorldLine.CostDiamond] then
3280 3280 worldChangePoints[ItemWorldLine.CostDiamond] = (worldChangePoints[ItemWorldLine.CostDiamond] or 0) + param[ItemWorldLine.CostDiamond]
3281   - local cost = math.floor(param[ItemWorldLine.CostDiamond] / globalCsv.worldline_count_currency)
3282   - worldChangePoints[ItemWorldLine.CostDiamond] = worldChangePoints[ItemWorldLine.CostDiamond] - cost
3283   - worldChangePoints[ItemWorldLine.Points] = worldChangePoints[ItemWorldLine.Points] + cost
  3281 + local cost = math.floor(worldChangePoints[ItemWorldLine.CostDiamond] / globalCsv.worldline_count_currency)
  3282 + worldChangePoints[ItemWorldLine.CostDiamond] = worldChangePoints[ItemWorldLine.CostDiamond] - cost * globalCsv.worldline_count_currency
  3283 + worldChangePoints[ItemWorldLine.Points] = (worldChangePoints[ItemWorldLine.Points] or 0) + cost
3284 3284 end
  3285 + self:setProperty("worldChangePoints", worldChangePoints)
3285 3286 end
3286 3287 end
3287 3288  
... ...