| | |
| | | import GameWorld
|
| | | import PlayerLLMJ
|
| | | import PlayerPrestigeSys
|
| | | import CrossServerPackLogic
|
| | | import DataRecordPack
|
| | | import PlayerSuccess
|
| | | import IpyGameDataPY
|
| | |
| | | import TurnBuff
|
| | | import FBCommon
|
| | | import CommFunc
|
| | | import CrossMsg
|
| | | import FBLogic
|
| | |
|
| | | import random
|
| | |
| | |
|
| | | def sortActionQueue(self):
|
| | | ## 刷新出手顺序队列
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | sortList = []
|
| | | for batFaction in self.factionDict.values():
|
| | | faction = batFaction.faction
|
| | | for num, batLineup in batFaction.lineupDict.items():
|
| | | isPlayer = 1 if batLineup.ownerID else 0 # 玩家阵容优先攻击
|
| | | atkSpeed = 0
|
| | | for objID in batLineup.getBatHeroObjIDList():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | | atkSpeed += batObj.GetBatAttrValue(ChConfig.AttrID_AtkSpeed)
|
| | | fightPower = batLineup.fightPower
|
| | | sortValue = -(faction * 10 + num)
|
| | | sortList.append([isPlayer, fightPower, sortValue, faction, num])
|
| | | sortList.append([isPlayer, atkSpeed, fightPower, sortValue, faction, num])
|
| | | sortList.sort(reverse=True) # 战力高的先手
|
| | |
|
| | | self.actionIndex = 0
|
| | | self.actionSortList = []
|
| | | for _, _, _, faction, num in sortList:
|
| | | for sortInfo in sortList:
|
| | | faction, num = sortInfo[-2:]
|
| | | self.actionSortList.append([faction, num])
|
| | |
|
| | | GameWorld.DebugLogEx("阵容战力排序[isPlayer, fp, sortV, f, n]: %s", sortList)
|
| | |
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | | if posNum == ChConfig.TFPosNum_Mingge: # 理论上要都同步,但是前端需要同步修改,等前端要改时再同步
|
| | | continue
|
| | | #if posNum == ChConfig.TFPosNum_Mingge: # 理论上要都同步,但是前端需要同步修改,等前端要改时再同步
|
| | | # continue
|
| | | tfObj = ChPyNetSendPack.tagSCTurnFightObj()
|
| | | tfObj.ObjID = batObj.GetID()
|
| | | tfObj.NPCID = batObj.GetNPCID()
|
| | |
| | | mgSkillLVDict = olPlayer.GetCalcSpecInfo(ChConfig.Def_CalcAttr_Mingge, mgPresetID)
|
| | | mgSkillIDList = []
|
| | | for skillTypeID, skillLV in mgSkillLVDict.items():
|
| | | skillID = skillTypeID + skillLV - 1
|
| | | skillID = SkillCommon.GetSkillIDBySkillTypeID(skillTypeID, skillLV)
|
| | | if skillID not in mgSkillIDList:
|
| | | mgSkillIDList.append(skillID)
|
| | | #shapeType = 0
|
| | |
| | | reModelID = lineupIpyData.GetReModelID()
|
| | | lvReIpyData = None
|
| | | heroIpyData = IpyGameDataPY.GetIpyGameData("Hero", heroID) if heroID else None
|
| | | npcStronger = IpyGameDataPY.GetIpyGameDataNotLog("NPCStronger", npcID)
|
| | | npcStronger = None
|
| | | npcStrongerList = IpyGameDataPY.GetIpyGameDataListNotLog("NPCStronger", npcID)
|
| | | if npcStrongerList and strongerLV:
|
| | | for strongerData in npcStrongerList:
|
| | | if not strongerData.GetNPCLV() or strongerLV <= strongerData.GetNPCLV():
|
| | | npcStronger = strongerData
|
| | | break
|
| | | if not npcStronger:
|
| | | npcStronger = npcStrongerList[-1] # 找不到时取最后一条
|
| | | |
| | | if npcStronger and strongerLV:
|
| | | lvReIpyData = IpyGameDataPY.GetIpyGameData("LVReValue", reModelID, strongerLV)
|
| | | if lvReIpyData:
|
| | |
| | | isMultiMap = True
|
| | |
|
| | | if isMultiMap:
|
| | | CrossServerPackLogic.SendBattleRequest(reqInfo, guid, mapID, funcLineID, reqPlayerID)
|
| | | CrossMsg.SendBattleRequest(reqInfo, guid, mapID, funcLineID, reqPlayerID)
|
| | | else:
|
| | | SSMsg_BattleRequest(reqInfo, fromServerID)
|
| | | S2B_BattleRequest(reqInfo, fromServerID)
|
| | | return
|
| | |
|
| | | def SSMsg_BattleRequest(reqInfo, fromServerID, msgType=""):
|
| | | def S2B_BattleRequest(reqInfo, fromServerID, msgType=""):
|
| | | ## 请求执行战斗,由本地图或其他服务器地图分配过来的战斗请求
|
| | | guid, mapID, funcLineID, lineupDictA, lineupDictB, reqPlayerID, playerServerID, npcLineupIDList, strongerLV, difficulty, reqData = reqInfo
|
| | | if msgType:
|
| | | GameWorld.Log("OnServerReceiveMsg => %s, fromServerID=%s,funcMapID=%s,funcLineID=%s,%s,%s" |
| | | % (msgType, fromServerID, mapID, funcLineID, guid, time.time()), reqPlayerID)
|
| | | #if msgType:
|
| | | # GameWorld.Log("OnServerReceiveMsg => %s, fromServerID=%s,funcMapID=%s,funcLineID=%s,%s,%s" |
| | | # % (msgType, fromServerID, mapID, funcLineID, guid, time.time()), reqPlayerID)
|
| | |
|
| | | if npcLineupIDList:
|
| | | turnFight = DoTurnFightPVE(guid, mapID, funcLineID, reqPlayerID, playerServerID, lineupDictA, npcLineupIDList, strongerLV, difficulty)
|
| | |
| | |
|
| | | # 本地图自己处理的
|
| | | if fromServerID == GameWorld.GetGameWorld().GetServerID():
|
| | | SSMsg_BattleResult(retInfo, fromServerID)
|
| | | B2S_BattleResult(retInfo, fromServerID)
|
| | |
|
| | | # 其他服务器地图请求的,发送战斗结果回去
|
| | | else:
|
| | | CrossServerPackLogic.SendBattleResult(retInfo, fromServerID, guid, mapID, funcLineID, reqPlayerID)
|
| | | CrossMsg.SendBattleResult(retInfo, fromServerID, guid, mapID, funcLineID, reqPlayerID)
|
| | | return
|
| | |
|
| | | def SSMsg_BattleResult(retInfo, fromServerID, msgType=""):
|
| | | def B2S_BattleResult(retInfo, fromServerID, msgType=""):
|
| | | ## 收到战斗结果信息
|
| | |
|
| | | guid, mapID, funcLineID, reqPlayerID, winFaction, statMsg, dateStr, reqData = retInfo
|
| | | if msgType:
|
| | | GameWorld.Log("OnServerReceiveMsg => %s, fromServerID=%s,funcMapID=%s,funcLineID=%s,%s,%s" |
| | | % (msgType, fromServerID, mapID, funcLineID, guid, time.time()), reqPlayerID)
|
| | | #if msgType:
|
| | | # GameWorld.Log("OnServerReceiveMsg => %s, fromServerID=%s,funcMapID=%s,funcLineID=%s,%s,%s" |
| | | # % (msgType, fromServerID, mapID, funcLineID, guid, time.time()), reqPlayerID)
|
| | |
|
| | | curPlayer = None
|
| | | if reqPlayerID:
|