Commit d86cc4d7fd24772fea2fafd4910b4ece7ec8981a

Authored by jiyue
2 parents 547dd794 2c3a1b31

Merge branch 'cn/develop' into cn/publish/preview

Showing 1 changed file with 18 additions and 13 deletions   Show diff stats
src/actions/PvpAction.lua
@@ -325,7 +325,7 @@ function _M.startBattleRpc(agent, data) @@ -325,7 +325,7 @@ function _M.startBattleRpc(agent, data)
325 325
326 if not result and not matchInfo then return 4 end 326 if not result and not matchInfo then return 4 end
327 327
328 - if not result then 328 + if not revenge then
329 -- 次数扣一波 329 -- 次数扣一波
330 local pvpFree = role.dailyData:getProperty("pvpFree") 330 local pvpFree = role.dailyData:getProperty("pvpFree")
331 if pvpFree >= globalCsv.pvp_battle_free_count then 331 if pvpFree >= globalCsv.pvp_battle_free_count then
@@ -335,7 +335,9 @@ function _M.startBattleRpc(agent, data) @@ -335,7 +335,9 @@ function _M.startBattleRpc(agent, data)
335 else 335 else
336 role.dailyData:updateProperty({field = "pvpFree", delta = 1}) 336 role.dailyData:updateProperty({field = "pvpFree", delta = 1})
337 end 337 end
  338 + end
338 339
  340 + if not result then
339 key = tostring(math.random()) 341 key = tostring(math.random())
340 _pvpStartBattleCacheC = {idx = idx, key = key, revenge = revenge, pvpTC = pvpTC} 342 _pvpStartBattleCacheC = {idx = idx, key = key, revenge = revenge, pvpTC = pvpTC}
341 343
@@ -574,8 +576,9 @@ function _M.startBattleHRpc(agent, data) @@ -574,8 +576,9 @@ function _M.startBattleHRpc(agent, data)
574 576
575 if not result and not enemyTeamRecord then return 4 end 577 if not result and not enemyTeamRecord then return 4 end
576 578
577 - if not result then 579 + if not revenge then
578 -- 次数扣一波 580 -- 次数扣一波
  581 + print("xxxxx")
579 local pvpFreeH = role.dailyData:getProperty("pvpFreeH") 582 local pvpFreeH = role.dailyData:getProperty("pvpFreeH")
580 if pvpFreeH >= globalCsv.pvp_battle_free_count_high then 583 if pvpFreeH >= globalCsv.pvp_battle_free_count_high then
581 local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} 584 local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost}
@@ -584,7 +587,9 @@ function _M.startBattleHRpc(agent, data) @@ -584,7 +587,9 @@ function _M.startBattleHRpc(agent, data)
584 else 587 else
585 role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) 588 role.dailyData:updateProperty({field = "pvpFreeH", delta = 1})
586 end 589 end
  590 + end
587 591
  592 + if not result then
588 593
589 -- 只发送指定的那个敌人 594 -- 只发送指定的那个敌人
590 if enemyTeamRecord.robot then 595 if enemyTeamRecord.robot then
@@ -643,17 +648,6 @@ function _M.endBattleHRpc(agent, data) @@ -643,17 +648,6 @@ function _M.endBattleHRpc(agent, data)
643 match = _pvpRecordInfoCacheH[msg.idx] 648 match = _pvpRecordInfoCacheH[msg.idx]
644 _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 649 _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打
645 650
646 - if isWin then  
647 - -- 次数扣一波  
648 - local pvpFreeH = role.dailyData:getProperty("pvpFreeH")  
649 - if pvpFreeH >= globalCsv.pvp_battle_free_count_high then  
650 - local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost}  
651 - if not role:checkItemEnough(cost) then return 5 end  
652 - role:costItems(cost, {log = {desc = "startPvp", int1 = 2}})  
653 - else  
654 - role.dailyData:updateProperty({field = "pvpFreeH", delta = 1})  
655 - end  
656 - end  
657 else 651 else
658 local pvpMH = role:getProperty("pvpMH") 652 local pvpMH = role:getProperty("pvpMH")
659 match = pvpMH[msg.idx] 653 match = pvpMH[msg.idx]
@@ -728,6 +722,17 @@ function _M.endBattleHRpc(agent, data) @@ -728,6 +722,17 @@ function _M.endBattleHRpc(agent, data)
728 })) 722 }))
729 return true 723 return true
730 end 724 end
  725 + if revenge and isWin then
  726 + -- 次数扣一波
  727 + local pvpFreeH = role.dailyData:getProperty("pvpFreeH")
  728 + if pvpFreeH >= globalCsv.pvp_battle_free_count_high then
  729 + local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost}
  730 + if not role:checkItemEnough(cost) then return 5 end
  731 + role:costItems(cost, {log = {desc = "startPvp", int1 = 2}})
  732 + else
  733 + role.dailyData:updateProperty({field = "pvpFreeH", delta = 1})
  734 + end
  735 + end
731 736
732 -- 战斗结束了发奖 737 -- 战斗结束了发奖
733 local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpgroupBonus, true) 738 local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpgroupBonus, true)