| | |
| | | deadCnt += 1
|
| | | return deadCnt
|
| | |
|
| | | def getHeroObj(self, heroID):
|
| | | if heroID not in self.heroObjIDDict:
|
| | | return
|
| | | return BattleObj.GetBatObjMgr().getBatObj(self.heroObjIDDict[heroID])
|
| | | |
| | | class BatFaction():
|
| | | ## 战斗阵营
|
| | |
|
| | |
| | | batObj.SetTiming(ChConfig.TurnTiming_Before) # 重置时机到回合前
|
| | | if turnNum > 1: # 第1回合不用刷新技能
|
| | | RefreshObjSkillByBigTurn(batObj)
|
| | | RefreshObjByBigTurn(turnFight, batObj)
|
| | | RefreshObjByBigTurn(turnFight, batObj, turnNum)
|
| | | batObj.ResetBigTurn() # 每大回合重置
|
| | |
|
| | | if not batObj.IsAlive():
|
| | |
| | | GameWorld.DebugLogEx(" 更新技能CD: curID=%s,skillID=%s,remainTime=%s", curID, skillID, remainTime)
|
| | | return
|
| | |
|
| | | def RefreshObjByBigTurn(turnFight, batObj):
|
| | | def RefreshObjByBigTurn(turnFight, batObj, turnNum):
|
| | | ## 根据大回合开始刷新buff持续时间,每个大回合-1,第1回合不处理
|
| | | curID = batObj.GetID()
|
| | | buffMgr = batObj.GetBuffManager()
|
| | |
| | | skillData = buff.GetSkillData()
|
| | | lastType = skillData.GetLastTimeType()
|
| | |
|
| | | if lastType not in [ChConfig.BuffLastTimeType_BigTurn, ChConfig.BuffLastTimeType_BigTurnLayer]:
|
| | | if lastType not in [ChConfig.BuffLastTimeType_BigTurn, ChConfig.BuffLastTimeType_BigTurnLayer, ChConfig.BuffLastTimeType_BigTurnLimit]:
|
| | | continue
|
| | |
|
| | | if skillData.GetSkillType() in ChConfig.Def_LstBuff_List:
|
| | |
| | | continue
|
| | |
|
| | | # 每大回合固定减1回合
|
| | | if lastType == ChConfig.BuffLastTimeType_BigTurn:
|
| | | if lastType in [ChConfig.BuffLastTimeType_BigTurn, ChConfig.BuffLastTimeType_BigTurnLimit]:
|
| | | remainTime = buff.GetRemainTime()
|
| | | if remainTime <= 0:
|
| | | continue
|
| | | remainTime -= 1
|
| | | GameWorld.DebugLogEx(" 更新buff回合: curID=%s,buffID=%s,skillID=%s,remainTime=%s", curID, buffID, skillID, remainTime)
|
| | | if lastType == ChConfig.BuffLastTimeType_BigTurnLimit and remainTime > 0:
|
| | | lastTurnMax = skillData.GetLastTime()
|
| | | if lastTurnMax and turnNum > lastTurnMax:
|
| | | remainTime = 0
|
| | | GameWorld.DebugLogEx(" 超过最大限制回合数,强制清除!: curID=%s,buffID=%s,skillID=%s,remainTime=%s", curID, buffID, skillID, remainTime)
|
| | | TurnBuff.SetBuffRemainTime(turnFight, batObj, buff, remainTime)
|
| | |
|
| | | # 每大回合固定减1层
|
| | |
| | | buffMgr = batObj.GetBuffManager()
|
| | | for index in range(buffMgr.GetBuffCount())[::-1]:
|
| | | buff = buffMgr.GetBuffByIndex(index)
|
| | | if not buff: # 有出现过报错,先做下防范,理论上不太可能
|
| | | continue
|
| | | buffID = buff.GetBuffID()
|
| | | skillID = buff.GetSkillID()
|
| | | skillData = buff.GetSkillData()
|
| | |
| | | killerObjID = killer.GetID() if killer else 0
|
| | | skillID = useSkill.GetSkillID() if useSkill else 0
|
| | | GameWorld.DebugLogEx(" %s 回合战斗主体被击杀: curID=%s,killerObjID=%s,skillID=%s", GetObjName(gameObj), objID, killerObjID, skillID)
|
| | | gameObj.SetDead()
|
| | | gameObj.SetDead(killer)
|
| | | TurnBuff.DoBuffByDead(turnFight, gameObj)
|
| | |
|
| | | clientPack = ChPyNetSendPack.tagMCTurnFightObjDead()
|
| | |
| | | if not os.path.exists(ReportDir):
|
| | | os.makedirs(ReportDir)
|
| | | else:
|
| | | items = os.listdir(ReportDir)
|
| | | for item in items:
|
| | | fullPath = os.path.join(ReportDir, item)
|
| | | try:
|
| | | os.remove(fullPath)
|
| | | except:
|
| | | pass
|
| | | isSaveOne = IpyGameDataPY.GetFuncCfg("TurnFightProcess", 2) # 个人战报是否只保留1份
|
| | | if isSaveOne:
|
| | | items = os.listdir(ReportDir)
|
| | | for item in items:
|
| | | fullPath = os.path.join(ReportDir, item)
|
| | | try:
|
| | | os.remove(fullPath)
|
| | | except:
|
| | | pass
|
| | |
|
| | | saveFilePath = os.path.join(ReportDir, "%s.tfr" % guid)
|
| | | GameWorld.DebugLogEx("战报路径=%s", saveFilePath)
|