From 5db4c63a205ed5f36faa429a7ff987a01f0e0405 Mon Sep 17 00:00:00 2001 From: zqj <582132116@qq.com> Date: Thu, 26 Aug 2021 10:16:11 +0800 Subject: [PATCH] fix: 世界线积分, 修复计算错误bug --- src/models/RolePlugin.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index c1f9bfc..5d6ce52 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -581,7 +581,7 @@ function RolePlugin.bind(Role) function Role:costJade(param) self:addItem(param) self:checkTaskEnter("CostJade", {count = - param.count}) - self:checkWorldChangePoints({[ItemWorldLine.CostJade]=param.count}) + self:checkWorldChangePoints({[ItemWorldLine.CostJade]= -param.count}) end function Role:increBy(field, val) @@ -3270,18 +3270,19 @@ function RolePlugin.bind(Role) function Role:checkWorldChangePoints(param) local worldChangePoints = self:getProperty("worldChangePoints") or {} if param[ItemWorldLine.CostJade] then - worldChangePoints[ItemWorldLine.CostJade] = (worldChangePoints[ItemWorldLine.CostJade] or 0) + param[ItemWorldLine.CostDiamond] - local cost = math.floor(param[ItemWorldLine.CostJade] / globalCsv.worldline_count_currency) - worldChangePoints[ItemWorldLine.CostJade] = worldChangePoints[ItemWorldLine.CostJade] - cost - worldChangePoints[ItemWorldLine.RouletteCount] = worldChangePoints[ItemWorldLine.RouletteCount] + cost + worldChangePoints[ItemWorldLine.CostJade] = (worldChangePoints[ItemWorldLine.CostJade] or 0) + param[ItemWorldLine.CostJade] + local cost = math.floor(worldChangePoints[ItemWorldLine.CostJade] / globalCsv.worldline_gift) + worldChangePoints[ItemWorldLine.CostJade] = worldChangePoints[ItemWorldLine.CostJade] - cost * globalCsv.worldline_gift + worldChangePoints[ItemWorldLine.RouletteCount] = (worldChangePoints[ItemWorldLine.RouletteCount] or 0) + cost end if param[ItemWorldLine.CostDiamond] then worldChangePoints[ItemWorldLine.CostDiamond] = (worldChangePoints[ItemWorldLine.CostDiamond] or 0) + param[ItemWorldLine.CostDiamond] - local cost = math.floor(param[ItemWorldLine.CostDiamond] / globalCsv.worldline_count_currency) - worldChangePoints[ItemWorldLine.CostDiamond] = worldChangePoints[ItemWorldLine.CostDiamond] - cost - worldChangePoints[ItemWorldLine.Points] = worldChangePoints[ItemWorldLine.Points] + cost + local cost = math.floor(worldChangePoints[ItemWorldLine.CostDiamond] / globalCsv.worldline_count_currency) + worldChangePoints[ItemWorldLine.CostDiamond] = worldChangePoints[ItemWorldLine.CostDiamond] - cost * globalCsv.worldline_count_currency + worldChangePoints[ItemWorldLine.Points] = (worldChangePoints[ItemWorldLine.Points] or 0) + cost end + self:setProperty("worldChangePoints", worldChangePoints) end end -- libgit2 0.21.2