| | |
| | | import PlayerLLMJ
|
| | | import PlayerPrestigeSys
|
| | | import CrossServerPackLogic
|
| | | import DataRecordPack
|
| | | import PlayerSuccess
|
| | | import IpyGameDataPY
|
| | | import PlayerOnline
|
| | |
| | | import TurnBuff
|
| | | import FBCommon
|
| | | import CommFunc
|
| | | import ObjPool
|
| | | import FBLogic
|
| | |
|
| | | import random
|
| | |
| | | self.faction = faction # 所属阵营
|
| | | self.num = num # 该阵容所在阵营中的编号,不同阵营可重复,多V多
|
| | | self.ownerID = 0 # 阵容所属玩家ID,可能为0,0代表非玩家阵容
|
| | | self.lineupInfo = {} # 传入初始化的阵容信息
|
| | | self.shapeType = 0 # 阵型
|
| | | self.fightPower = 0 # 阵容总战力
|
| | | self.posObjIDDict = {} # 站位对应战斗实体 {站位编号:batObjID, ...}, 站位编号小于0为非主战单位,如主公、红颜等
|
| | |
| | | ## 设置阵容
|
| | | # @param lineupInfo: 阵容信息
|
| | | self.clearLineup()
|
| | | self.lineupInfo = lineupInfo
|
| | | self.ownerID = lineupInfo.get("PlayerID", 0) # 阵容所属的玩家ID
|
| | | self.shapeType = lineupInfo.get("ShapeType", 0)
|
| | | self.fightPower = lineupInfo.get("FightPower", 0)
|
| | |
| | | batObjMgr.delBatObj(objID)
|
| | | for objID in self.beautyObjIDDict.values():
|
| | | batObjMgr.delBatObj(objID)
|
| | | self.lineupInfo = {}
|
| | | self.posObjIDDict = {}
|
| | | self.heroObjIDDict = {}
|
| | | self.lingshouObjIDDict = {}
|
| | |
| | | break
|
| | |
|
| | | if allKilled:
|
| | | self.winFaction = ChConfig.Def_FactionA if faction == ChConfig.Def_FactionB else ChConfig.Def_FactionB
|
| | | if self.mapID in ChConfig.PlayerWinMapIDList:
|
| | | self.winFaction = ChConfig.Def_FactionA
|
| | | else:
|
| | | self.winFaction = ChConfig.Def_FactionA if faction == ChConfig.Def_FactionB else ChConfig.Def_FactionB
|
| | | DoTurnFightOver(self.guid)
|
| | | return self.winFaction
|
| | |
|
| | |
| | | GameWorld.DebugLogEx("回合战斗过程封包: %s, len:%s", headStr, buffLen)
|
| | | self.batBuffer += CommFunc.WriteWORD("", buffLen)
|
| | | self.batBuffer += packBuff
|
| | | ObjPool.GetPoolMgr().release(clientPack)
|
| | | else:
|
| | | GameWorld.DebugLogEx("回合战斗过程封包: %s", headStr)
|
| | | # 有玩家的统一每个包单独发送,同样也支持战报统计
|
| | | if self.curPlayer:
|
| | | NetPackCommon.SendFakePack(self.curPlayer, clientPack)
|
| | | else:
|
| | | ObjPool.GetPoolMgr().release(clientPack)
|
| | | return
|
| | |
|
| | | def ResetOneActionUseSkillCnt(self): self._oneActionUseSkillCntDict = {}
|
| | |
| | | return
|
| | |
|
| | | def addTurnFight(self, guid, mapID, funcLineID=0, reqPlayerID=0, reqServerID=0):
|
| | | tf = ObjPool.GetPoolMgr().acquire(TurnFight, guid, mapID, funcLineID, reqPlayerID, reqServerID)
|
| | | tf = TurnFight(guid, mapID, funcLineID, reqPlayerID, reqServerID)
|
| | | if not tf:
|
| | | tf = TurnFight(guid, mapID, funcLineID, reqPlayerID, reqServerID) # 一般是不可能,为了点出代码
|
| | | self.turnFightDict[tf.guid] = tf
|
| | |
| | | return
|
| | | turnFight.exitFight()
|
| | | self.turnFightDict.pop(guid, None)
|
| | | ObjPool.GetPoolMgr().release(turnFight)
|
| | | return
|
| | |
|
| | | def getTurnFight(self, guid):
|
| | |
| | | break
|
| | |
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, curBatObj, ChConfig.TriggerWay_HeroActionEnd)
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for faction in [ChConfig.Def_FactionA, ChConfig.Def_FactionB]:
|
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | for lineupNum in batFaction.lineupDict.keys():
|
| | | batLineup = batFaction.getBatlineup(lineupNum)
|
| | | for lineupObjID in batLineup.posObjIDDict.values():
|
| | | lineupObj = batObjMgr.getBatObj(lineupObjID)
|
| | | if not lineupObj.IsAlive():
|
| | | continue
|
| | | if lineupObj.GetFaction() != curBatObj.GetFaction():
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_EnemyAction, curBatObj)
|
| | | else:
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_FriendAction, curBatObj)
|
| | | return True
|
| | |
|
| | | def SetObjKilled(turnFight, gameObj, killer=None, useSkill=None):
|
| | |
| | | gameObj.SetDead()
|
| | | TurnBuff.DoBuffByDead(turnFight, gameObj)
|
| | |
|
| | | clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagMCTurnFightObjDead)
|
| | | clientPack = ChPyNetSendPack.tagMCTurnFightObjDead()
|
| | | clientPack.ObjID = objID
|
| | | clientPack.KillerObjID = killerObjID
|
| | | clientPack.SkillID = skillID
|
| | |
| | |
|
| | | if turnFight.getReqPlayerID():
|
| | | # 玩家发起的,未击杀对方,算玩家输
|
| | | turnFight.winFaction = ChConfig.Def_FactionB
|
| | | if turnFight.mapID in ChConfig.PlayerWinMapIDList:
|
| | | turnFight.winFaction = ChConfig.Def_FactionA
|
| | | else:
|
| | | turnFight.winFaction = ChConfig.Def_FactionB
|
| | | else:
|
| | | # 系统场次,按一定规则来,这里先随机
|
| | | turnFight.winFaction = random.choice([ChConfig.Def_FactionA, ChConfig.Def_FactionB])
|
| | |
| | | turnFight.isWin = (winFaction == ChConfig.Def_FactionA)
|
| | | mapID = turnFight.mapID
|
| | | funcLineID = turnFight.funcLineID
|
| | | reqPlayerID = turnFight.getReqPlayerID()
|
| | | GameWorld.DebugLogEx("--- 战斗结束处理 ---, winFaction=%s, costTime=%ss, %s", winFaction, turnFight.costTime, guid)
|
| | | if mapID != ChConfig.Def_FBMapID_Main:
|
| | | GameWorld.Log("战斗耗时: %ss, mapID=%s,funcLineID=%s,turnNum=%s/%s" % (turnFight.costTime, mapID, funcLineID, turnFight.turnNum, turnFight.turnMax))
|
| | |
|
| | | # 统计明细
|
| | | heroCount = 0
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | statInfo = {}
|
| | | drLineupInfo = {}
|
| | | for faction in turnFight.factionDict.keys():
|
| | | if str(faction) not in statInfo:
|
| | | statInfo[str(faction)] = {}
|
| | | facStatInfo = statInfo[str(faction)]
|
| | | if str(faction) not in drLineupInfo:
|
| | | drLineupInfo[str(faction)] = {}
|
| | | facDRLineupInfo = drLineupInfo[str(faction)]
|
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | batFaction.totalHurt = 0
|
| | | for num in batFaction.lineupDict.keys():
|
| | |
| | | lineupStatInfo = facStatInfo[str(num)]
|
| | | batLineup = batFaction.getBatlineup(num)
|
| | | batLineup.totalHurt = 0
|
| | | facDRLineupInfo[str(num)] = batLineup.lineupInfo
|
| | | GameWorld.DebugLogEx("阵容明细: faction=%s,num=%s", faction, num)
|
| | | for posNum, objID in batLineup.posObjIDDict.items():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | | heroCount += 1
|
| | | objID = batObj.GetID()
|
| | | npcID = batObj.GetNPCID()
|
| | | heroID = batObj.GetHeroID()
|
| | |
| | | FBLogic.OnTurnFightOver(turnFight, mapID, funcLineID, statMsg)
|
| | |
|
| | | turnFight.syncState(FightState_Award, statMsg)
|
| | | |
| | | # 流向记录
|
| | | if mapID != ChConfig.Def_FBMapID_Main and reqPlayerID:
|
| | | DataRecordPack.DR_FightStat(reqPlayerID, mapID, funcLineID, turnFight.isWin, turnFight.turnNum, turnFight.turnMax, |
| | | heroCount, turnFight.costTime, statInfo, drLineupInfo)
|
| | | return
|
| | |
|
| | | #// B4 14 查看战报 #tagCSTurnFightReportView
|