Commit 666d0bfc9c221e88df297a374913c9b616b78d04
1 parent
3e6d391b
fix: 扫荡关卡奖励叠加bug
Showing
1 changed file
with
13 additions
and
15 deletions
Show diff stats
src/models/RolePlugin.lua
@@ -2788,30 +2788,32 @@ function RolePlugin.bind(Role) | @@ -2788,30 +2788,32 @@ function RolePlugin.bind(Role) | ||
2788 | end | 2788 | end |
2789 | 2789 | ||
2790 | local function appendAdvBnous(dstBnous, srcBnous) | 2790 | local function appendAdvBnous(dstBnous, srcBnous) |
2791 | - if not dstBnous and not srcBnous then return end | 2791 | + if not dstBnous and not srcBnous then return {} end |
2792 | + local result = clone(dstBnous or {}) | ||
2792 | for time, set in pairs(srcBnous) do | 2793 | for time, set in pairs(srcBnous) do |
2793 | - if not dstBnous[time] then | ||
2794 | - dstBnous[time] = {} | 2794 | + if not result[time] then |
2795 | + result[time] = {} | ||
2795 | end | 2796 | end |
2796 | for key, value in pairs(set) do | 2797 | for key, value in pairs(set) do |
2797 | - dstBnous[time][key] = (dstBnous[time][key] or 0) + value | 2798 | + result[time][key] = (result[time][key] or 0) + value |
2798 | end | 2799 | end |
2799 | end | 2800 | end |
2801 | + return result | ||
2800 | end | 2802 | end |
2801 | 2803 | ||
2802 | local function appendTableBnous(dstBnous, srcBnous) | 2804 | local function appendTableBnous(dstBnous, srcBnous) |
2803 | - if not dstBnous and not srcBnous then return end | 2805 | + if not dstBnous and not srcBnous then return {} end |
2806 | + local result = clone(dstBnous or {}) | ||
2804 | for k, v in pairs(srcBnous) do | 2807 | for k, v in pairs(srcBnous) do |
2805 | - dstBnous[k] = (dstBnous[k] or 0) + v | 2808 | + result[k] = (result[k] or 0) + v |
2806 | end | 2809 | end |
2810 | + return result | ||
2807 | end | 2811 | end |
2808 | function Role:getBnousAdv() | 2812 | function Role:getBnousAdv() |
2809 | local towerBnous = self:getTowerBnousActive() | 2813 | local towerBnous = self:getTowerBnousActive() |
2810 | local levelBnous = self:getLevelBnous() | 2814 | local levelBnous = self:getLevelBnous() |
2811 | local adv = levelBnous[SystemBnousType.Adv] or {} | 2815 | local adv = levelBnous[SystemBnousType.Adv] or {} |
2812 | - towerBnous[SystemBnousType.Adv] = towerBnous[SystemBnousType.Adv] or {} | ||
2813 | - appendAdvBnous(towerBnous[SystemBnousType.Adv], adv) | ||
2814 | - return towerBnous[SystemBnousType.Adv] | 2816 | + return appendAdvBnous(towerBnous[SystemBnousType.Adv], adv) |
2815 | end | 2817 | end |
2816 | 2818 | ||
2817 | function Role:getBnousHangTime() | 2819 | function Role:getBnousHangTime() |
@@ -2825,18 +2827,14 @@ function RolePlugin.bind(Role) | @@ -2825,18 +2827,14 @@ function RolePlugin.bind(Role) | ||
2825 | local towerBnous = self:getTowerBnousActive() | 2827 | local towerBnous = self:getTowerBnousActive() |
2826 | local levelBnous = self:getLevelBnous() | 2828 | local levelBnous = self:getLevelBnous() |
2827 | local pvpTicket = levelBnous[SystemBnousType.PvpTicket] or {} | 2829 | local pvpTicket = levelBnous[SystemBnousType.PvpTicket] or {} |
2828 | - towerBnous[SystemBnousType.PvpTicket] = towerBnous[SystemBnousType.PvpTicket] or {} | ||
2829 | - appendTableBnous(towerBnous[SystemBnousType.PvpTicket], pvpTicket) | ||
2830 | - return towerBnous[SystemBnousType.PvpTicket] | 2830 | + return appendTableBnous(towerBnous[SystemBnousType.PvpTicket], pvpTicket) |
2831 | end | 2831 | end |
2832 | 2832 | ||
2833 | function Role:getBnousSweep() | 2833 | function Role:getBnousSweep() |
2834 | local towerBnous = self:getTowerBnousActive() | 2834 | local towerBnous = self:getTowerBnousActive() |
2835 | local levelBnous = self:getLevelBnous() | 2835 | local levelBnous = self:getLevelBnous() |
2836 | local sweepReward = levelBnous[SystemBnousType.SweepReward] or {} | 2836 | local sweepReward = levelBnous[SystemBnousType.SweepReward] or {} |
2837 | - towerBnous[SystemBnousType.SweepReward] = towerBnous[SystemBnousType.SweepReward] or {} | ||
2838 | - appendTableBnous(towerBnous[SystemBnousType.SweepReward], sweepReward) | ||
2839 | - return towerBnous[SystemBnousType.SweepReward] | 2837 | + return appendTableBnous(towerBnous[SystemBnousType.SweepReward], sweepReward) |
2840 | end | 2838 | end |
2841 | 2839 | ||
2842 | function Role:getBnousDismantlingMaximum() | 2840 | function Role:getBnousDismantlingMaximum() |