1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GameWorldLogic.FBProcess.GameLogic_MirrorBattle
#
# @todo:¾µÏñPKÇдè
# @author hxp
# @date 2024-10-17
# @version 1.0
#
# ÏêϸÃèÊö: ¾µÏñPKÇдè
#
#-------------------------------------------------------------------------------
#"""Version = 2024-10-17 15:00"""
#-------------------------------------------------------------------------------
 
import GameWorld
import MirrorAttack
import FBCommon
import GameObj
 
## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë
def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
    return True
 
## ¿Í»§¶Ë½øÈë×Ô¶¨Ò峡¾°
def OnEnterCustomScene(curPlayer, mapID, lineID):
    return
 
##´¦Àí¸±±¾ÖÐɱËÀÍæ¼ÒÂß¼­
def DoFBOnKill_Player(atkobj, defender, tick):
    GameWorld.DebugLog("¾µÏñÇдè»÷É±Íæ¼Ò: defID=%s" % (defender.GetID()), atkobj.GetID())
    return True
 
def OnMirrorBattleOver(battleID):
    ## ¾µÏñÕ½¶·½áÊø
    
    battle = MirrorAttack.GetMirrorBattleByID(battleID)
    if not battle:
        return
    isLogout = battle.isLogout
    
    mapID = battle.mapID
    funcLineID = battle.funcLineID
    winFaction = battle.winFaction
    curPlayerID = battle.requestID # ¸±±¾ËùÊôÍæ¼ÒID£¬¸ÃÍæ¼Ò²»Ò»¶¨²ÎÓëʵ¼ÊÕ½¶·
    curIsWin = 0
    GameWorld.DebugLog("¾µÏñÕ½¶·½áËã: mapID=%s,funcLineID=%s,winFaction=%s,isLogout=%s" % (mapID, funcLineID, winFaction, isLogout), battleID)
    
    playerMgr = GameWorld.GetMapCopyPlayerManager()
    for playerID, faction in battle.playerFactionDict.items():
        curPlayer = playerMgr.FindPlayerByID(playerID)
        if not curPlayer:
            continue
        realPlayerID = curPlayer.GetRealPlayerID()
        isWin = (faction == winFaction)
        GameWorld.DebugLog("Ê£ÓàѪÁ¿: %s/%s,playerID=%s,realPlayerID=%s,faction=%s,isWin=%s" 
                           % (GameObj.GetHP(curPlayer), GameObj.GetMaxHP(curPlayer), playerID, realPlayerID, faction, isWin), battleID)
        if isWin and faction == 1:
            curIsWin = 1
            
    if not curPlayerID:
        return
    
    curPlayer = playerMgr.FindPlayerByID(curPlayerID)
    if not curPlayer:
        return
    # ½áËã½±Àø£¬Í¨Öª½á¹û
    giveItemList = []
    overDict = {"isWin":curIsWin, FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(giveItemList)}
    FBCommon.NotifyFBOver(curPlayer, mapID, funcLineID, isWin, overDict)    
    return