| | |
| | | ## 回合战斗管理器
|
| | |
|
| | | def __init__(self):
|
| | | self.lastRequestTick = 0
|
| | | self.turnFightDict = {} # {guid:TurnFight, ...}
|
| | | return
|
| | |
|
| | |
| | | ## 获取玩家阵容
|
| | | 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
|
| | |
| | |
|
| | | 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
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def CheckFightCD(curPlayer, tick, selfKey):
|
| | | ## 是否战斗请求CD中
|
| | | |
| | | # 所有玩家公共CD,待扩展
|
| | | tfMgr = GetTurnFightMgr()
|
| | | pubCD = IpyGameDataPY.GetFuncCfg("TurnFightCD", 1)
|
| | | if pubCD:
|
| | | if tfMgr.lastRequestTick and tick - tfMgr.lastRequestTick <= pubCD:
|
| | | GameWorld.DebugLog("回合制战斗请求服务器公共CD中!")
|
| | | PlayerControl.NotifyCode(curPlayer, "BattleCoolDown")
|
| | | return True
|
| | | |
| | | # 个人CD
|
| | | selfCD = IpyGameDataPY.GetFuncCfg("TurnFightCD", 2)
|
| | | lastTick = curPlayer.GetDictByKey(selfKey)
|
| | | if selfCD and lastTick and tick - lastTick <= selfCD:
|
| | | GameWorld.DebugLog("回合制战斗请求CD中: %s" % selfKey)
|
| | | PlayerControl.NotifyCode(curPlayer, "BattleCoolDown")
|
| | | return True
|
| | | |
| | | tfMgr.lastRequestTick = tick
|
| | | curPlayer.SetDict(selfKey, tick)
|
| | | return False
|
| | |
|
| | | #// B4 10 回合制战斗 #tagCMTurnFight
|
| | | #
|
| | | #struct tagCMTurnFight
|
| | |
| | | # 攻防方所使用的阵容ID
|
| | | atkLineupID, defLineupID = FBLogic.GetFBPlayerLineupID(curPlayer, mapID, funcLineID)
|
| | | if atkLineupID not in ShareDefine.LineupList or defLineupID not in ShareDefine.LineupList:
|
| | | return
|
| | | |
| | | if CheckFightCD(curPlayer, tick, "TurnFightReqTick"):
|
| | | return
|
| | |
|
| | | # 玩家
|
| | |
| | |
|
| | | # 限制请求CD
|
| | | if tick:
|
| | | key = "MainFightReqTick"
|
| | | lastTick = curPlayer.GetDictByKey(key)
|
| | | if lastTick and tick - lastTick <= 1000:
|
| | | GameWorld.DebugLog("主线战斗请求CD中")
|
| | | if CheckFightCD(curPlayer, tick, "MainFightReqTick"):
|
| | | return
|
| | | curPlayer.SetDict(key, tick)
|
| | |
|
| | | mainFightMgr = GetMainFightMgr(curPlayer)
|
| | | turnFight = mainFightMgr.turnFight
|