129 【战斗】战斗系统-服务端(修复无法取非主线阵容进行战斗bug)
5个文件已修改
55 ■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Hero.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintFightPower.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -546,7 +546,7 @@
    ## 获取玩家阵容
    olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
    lineup = olPlayer.GetLineup(lineupID)
    if not lineup.lineupHeroDict:
    if lineup.IsEmpty():
        GameWorld.DebugLog("玩家没有目标阵容默认取主阵容! lineupID=%s" % lineupID)
        lineup = olPlayer.GetLineup(ShareDefine.Lineup_Main)
    return lineup
@@ -558,12 +558,12 @@
    
    playerID = curPlayer.GetPlayerID()
    lineup = GetPlayerLineup(curPlayer, lineupID)
    if not lineup.lineupHeroDict:
    if lineup.IsEmpty():
        return {}
    
    heroDict = {}
    curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
    for posNum in lineup.lineupHeroDict.keys():
    for posNum in lineup.GetPosNumList():
        hero = lineup.GetLineupHero(posNum)
        heroID = hero.heroID
        itemIndex = hero.itemIndex
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Hero.py
@@ -238,7 +238,7 @@
    for syncItem in syncItemDict.values():
        syncItem.Sync_Item()
        
    lineup = PlayerOnline.GetOnlinePlayer(curPlayer).GetLineup(lineupID)
    lineup = PlayerOnline.GetOnlinePlayer(curPlayer).GetLineup(lineupID, False)
    lineup.UpdLineup(heroItemDict, shapeType)
    GameWorld.DebugAnswer(curPlayer, "阵容(%s)上阵OK: %s" % (lineupID, heroItemDict))
    return
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintFightPower.py
@@ -61,7 +61,7 @@
            attrInfo += "%s-%s" % (attrID, attrValue)
        GameWorld.DebugAnswer(curPlayer, "%s:%s" % (calcName, attrInfo))
        
    posNumList = lineup.lineupHeroDict.keys()
    posNumList = lineup.GetPosNumList()
    posNumList.sort()
    for posNum in posNumList:
        lineupHero = lineup.GetLineupHero(posNum)
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
@@ -1415,7 +1415,7 @@
    for syncItem in syncItemDict.values():
        syncItem.Sync_Item()
        
    lineup = PlayerOnline.GetOnlinePlayer(curPlayer).GetLineup(lineupID)
    lineup = PlayerOnline.GetOnlinePlayer(curPlayer).GetLineup(lineupID, False)
    lineup.UpdLineup(heroItemDict, shapeType)
    return
@@ -1522,7 +1522,7 @@
    lineupList = []
    olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
    for lineupID in syncIDList:
        lineup = olPlayer.GetLineup(lineupID)
        lineup = olPlayer.GetLineup(lineupID, False)
        if not lineup:
            continue
        
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py
@@ -65,7 +65,7 @@
        self.__refreshState = 0 # 刷属性标记, 0-不需要刷新了,1-需要刷新
        
        self.__freeLineupHeroObjs = [] # 释放的空闲对象[LineupHero, ...]
        self.lineupHeroDict = {} # 阵容武将 {posNum:LineupHero, ...}
        self.__lineupHeroDict = {} # 刷新阵容后的武将信息 {posNum:LineupHero, ...}
        self.fightPower = 0 # 阵容总战力
        return
    
@@ -85,42 +85,41 @@
            PlayerHero.Sync_Lineup(self.olPlayer.curPlayer, self.lineupID)
        return
    
    def IsEmpty(self): return (not self.__lineupHeroDict or not self.heroItemDict)
    def GetPosNumList(self): return self.__lineupHeroDict.keys()
    def FreeLineupHero(self):
        ## 释放阵容武将对象,重新计算
        for freeObj in self.lineupHeroDict.values():
        for freeObj in self.__lineupHeroDict.values():
            if freeObj not in self.__freeLineupHeroObjs:
                self.__freeLineupHeroObjs.append(freeObj)
        self.lineupHeroDict = {}
        self.__lineupHeroDict = {}
        self.fightPower = 0
        return
    
    def GetLineupHero(self, posNum):
        lineupHero = None
        if posNum in self.lineupHeroDict:
            lineupHero = self.lineupHeroDict[posNum]
        if posNum in self.__lineupHeroDict:
            lineupHero = self.__lineupHeroDict[posNum]
        elif self.__freeLineupHeroObjs:
            lineupHero = self.__freeLineupHeroObjs.pop(0)
            lineupHero.Clear()
            self.lineupHeroDict[posNum] = lineupHero
            self.__lineupHeroDict[posNum] = lineupHero
        else:
            lineupHero = LineupHero()
            self.lineupHeroDict[posNum] = lineupHero
            self.__lineupHeroDict[posNum] = lineupHero
        return lineupHero
    
    def GetLineupHeroByID(self, heroID):
        lineupHero = None
        for posNum in self.lineupHeroDict.keys():
        for posNum in self.__lineupHeroDict.keys():
            lineupHero = self.GetLineupHero(posNum)
            if lineupHero.heroID == heroID:
                return lineupHero
        if False:
            lineupHero = LineupHero()
        return lineupHero
    def GetLineupInfo(self):
        ## 获取阵容信息,即要用到该阵容了,如战斗或者保存缓存信息等
        self.DoRefreshLineupAttr() # 取阵容时先检查
        return
    
    def SetNeedRefreshState(self):
        ## 设置需要刷属性
@@ -130,15 +129,16 @@
    def RefreshLineupAttr(self, refreshForce=False):
        self.__refreshState = 1 # 标记要刷新
        if refreshForce:
            self.DoRefreshLineupAttr()
            self.CheckRefreshLineupAttr()
        return
    
    def DoRefreshLineupAttr(self):
    def CheckRefreshLineupAttr(self):
        ## 检查刷新阵容属性
        if not self.__refreshState:
            return False
        self.__refreshState = 0
        doRefreshLineupAttr(self.olPlayer.curPlayer, self.olPlayer, self)
        self.lineupChange = False
        self.__refreshState = 0
        return True
    
    def CheckHeroItemUpdate(self, itemIndex):
@@ -177,7 +177,8 @@
        ## 是否真的在线
        return self.curPlayer != None
    
    def GetLineup(self, lineupID):
    def GetLineup(self, lineupID, checkAttr=True):
        # @param checkAttr: 检查刷新到最新阵容属性
        lineup = None
        if lineupID in self.lineupDict:
            lineup = self.lineupDict[lineupID]
@@ -185,6 +186,8 @@
            lineup = Lineup(self.playerID, lineupID)
            self.lineupDict[lineupID] = lineup
        lineup.olPlayer = self
        if checkAttr:
            lineup.CheckRefreshLineupAttr()
        return lineup
    
    def GetCalcAttr(self, calcIndex): return self.calcAttrDict.get(calcIndex, {})
@@ -232,7 +235,7 @@
        for lineupID, lineup in self.lineupDict.items():
            if not isAllLineup and lineupID != ShareDefine.Lineup_Main:
                continue
            if lineup.DoRefreshLineupAttr():
            if lineup.CheckRefreshLineupAttr():
                isRefresh = True
                
        return isRefresh
@@ -398,7 +401,7 @@
        
    GameWorld.DebugLog("重载阵容: %s" % lineupDict, curPlayer.GetPlayerID())
    for lineupID, heroItemDict in lineupDict.items():
        lineup = olPlayer.GetLineup(lineupID)
        lineup = olPlayer.GetLineup(lineupID, False)
        
        # 获取其他绑定该阵容的功能,如红颜、灵兽等