Compare View

switch
from
...
to
 
Commits (2)
src/actions/PvpAction.lua
... ... @@ -325,7 +325,7 @@ function _M.startBattleRpc(agent, data)
325 325  
326 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 330 local pvpFree = role.dailyData:getProperty("pvpFree")
331 331 if pvpFree >= globalCsv.pvp_battle_free_count then
... ... @@ -335,7 +335,9 @@ function _M.startBattleRpc(agent, data)
335 335 else
336 336 role.dailyData:updateProperty({field = "pvpFree", delta = 1})
337 337 end
  338 + end
338 339  
  340 + if not result then
339 341 key = tostring(math.random())
340 342 _pvpStartBattleCacheC = {idx = idx, key = key, revenge = revenge, pvpTC = pvpTC}
341 343  
... ... @@ -574,8 +576,9 @@ function _M.startBattleHRpc(agent, data)
574 576  
575 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 582 local pvpFreeH = role.dailyData:getProperty("pvpFreeH")
580 583 if pvpFreeH >= globalCsv.pvp_battle_free_count_high then
581 584 local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost}
... ... @@ -584,7 +587,9 @@ function _M.startBattleHRpc(agent, data)
584 587 else
585 588 role.dailyData:updateProperty({field = "pvpFreeH", delta = 1})
586 589 end
  590 + end
587 591  
  592 + if not result then
588 593  
589 594 -- 只发送指定的那个敌人
590 595 if enemyTeamRecord.robot then
... ... @@ -643,17 +648,6 @@ function _M.endBattleHRpc(agent, data)
643 648 match = _pvpRecordInfoCacheH[msg.idx]
644 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 651 else
658 652 local pvpMH = role:getProperty("pvpMH")
659 653 match = pvpMH[msg.idx]
... ... @@ -728,6 +722,17 @@ function _M.endBattleHRpc(agent, data)
728 722 }))
729 723 return true
730 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 738 local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpgroupBonus, true)
... ...