From 2c3a1b311c4b787c45e9ae460db68cc85d58b29e Mon Sep 17 00:00:00 2001 From: zqj <582132116@qq.com> Date: Wed, 2 Jun 2021 21:27:34 +0800 Subject: [PATCH] fix: 修复复仇扣除3门票的BUG --- src/actions/PvpAction.lua | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/actions/PvpAction.lua b/src/actions/PvpAction.lua index ffda473..53e802d 100644 --- a/src/actions/PvpAction.lua +++ b/src/actions/PvpAction.lua @@ -325,7 +325,7 @@ function _M.startBattleRpc(agent, data) if not result and not matchInfo then return 4 end - if not result then + if not revenge then -- 次数扣一波 local pvpFree = role.dailyData:getProperty("pvpFree") if pvpFree >= globalCsv.pvp_battle_free_count then @@ -335,7 +335,9 @@ function _M.startBattleRpc(agent, data) else role.dailyData:updateProperty({field = "pvpFree", delta = 1}) end + end + if not result then key = tostring(math.random()) _pvpStartBattleCacheC = {idx = idx, key = key, revenge = revenge, pvpTC = pvpTC} @@ -574,8 +576,9 @@ function _M.startBattleHRpc(agent, data) if not result and not enemyTeamRecord then return 4 end - if not result then + if not revenge then -- 次数扣一波 + print("xxxxx") local pvpFreeH = role.dailyData:getProperty("pvpFreeH") if pvpFreeH >= globalCsv.pvp_battle_free_count_high then local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} @@ -584,7 +587,9 @@ function _M.startBattleHRpc(agent, data) else role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) end + end + if not result then -- 只发送指定的那个敌人 if enemyTeamRecord.robot then @@ -643,17 +648,6 @@ function _M.endBattleHRpc(agent, data) match = _pvpRecordInfoCacheH[msg.idx] _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 - if isWin then - -- 次数扣一波 - local pvpFreeH = role.dailyData:getProperty("pvpFreeH") - if pvpFreeH >= globalCsv.pvp_battle_free_count_high then - local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} - if not role:checkItemEnough(cost) then return 5 end - role:costItems(cost, {log = {desc = "startPvp", int1 = 2}}) - else - role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) - end - end else local pvpMH = role:getProperty("pvpMH") match = pvpMH[msg.idx] @@ -728,6 +722,17 @@ function _M.endBattleHRpc(agent, data) })) return true end + if revenge and isWin then + -- 次数扣一波 + local pvpFreeH = role.dailyData:getProperty("pvpFreeH") + if pvpFreeH >= globalCsv.pvp_battle_free_count_high then + local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} + if not role:checkItemEnough(cost) then return 5 end + role:costItems(cost, {log = {desc = "startPvp", int1 = 2}}) + else + role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) + end + end -- 战斗结束了发奖 local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpgroupBonus, true) -- libgit2 0.21.2