129 【战斗】战斗系统-服务端(命格青龙、白虎调整为光环技能;优化光环技能支持层级;增加出发方式60-冰冻目标时;优化触发方式受控时、敌方受控时触发时机,解决受控触发被动导致的技能标签嵌套顺序问题;)
| | |
| | | def GetPosNum(self): return self.posNum
|
| | | def GetFaction(self): return self.faction
|
| | | def SetFaction(self, faction): self.faction = faction
|
| | | def GetBatObjType(self):
|
| | | ## 战斗对象实例类型
|
| | | if 1 <= self.posNum <= ShareDefine.LineupObjMax:
|
| | | return ChConfig.BatObjType_BatHero
|
| | | if self.posNum == ChConfig.TFPosNum_Mingge:
|
| | | return ChConfig.BatObjType_Mingge
|
| | | if ChConfig.TFPosNum_Lingshou <= self.posNum:
|
| | | return ChConfig.BatObjType_Lingshou
|
| | | return 0
|
| | | def GetFightPower(self): return self.fightPower
|
| | | def SetFightPower(self, fightPower): self.fightPower = fightPower
|
| | | def GetLV(self): return self.lv
|
| | |
| | | self.lineupInfo = {} # 传入初始化的阵容信息
|
| | | self.shapeType = 0 # 阵型
|
| | | self.fightPower = 0 # 阵容总战力
|
| | | self.minggeObj = None # 命格战斗对象
|
| | | self.posObjIDDict = {} # 站位对应战斗实体 {站位编号:batObjID, ...}, 站位编号小于0为非主战单位,如主公、红颜等
|
| | | self.heroObjIDDict = {} # 武将ID对应ObjID {heroID:batObjID, ...}
|
| | | self.lingshouObjIDDict = {} # 灵兽战斗单位 {位置编号:batObjID, ...}
|
| | | |
| | | self._posObjIDDict = {} # 站位对应战斗实体 {站位编号:batObjID, ...},如主公、命格、灵兽等
|
| | | self._heroObjIDDict = {} # 武将ID对应ObjID {heroID:batObjID, ...}
|
| | | self._batHeroObjIDList = [] # 主战武将对象ID列表
|
| | | self._minggeObjID = 0 # 命格对象ID
|
| | | self.actionNum = ActionNumStart # 行动位置,从1开始
|
| | | self.totalHurt = 0 # 阵容总输出
|
| | |
|
| | |
| | |
|
| | | def getReqPlayerID(self): return self.turnFight.getReqPlayerID() # 发起的玩家ID
|
| | |
|
| | | def isEmpty(self): return not self.posObjIDDict
|
| | | def isEmpty(self): return not self._batHeroObjIDList
|
| | |
|
| | | def setLineupInfo(self, lineupInfo):
|
| | | ## 设置阵容
|
| | |
| | | def clearLineup(self):
|
| | | ## 清除阵容
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for objID in self.posObjIDDict.values():
|
| | | for objID in self._posObjIDDict.values():
|
| | | batObjMgr.delBatObj(objID)
|
| | | for objID in self.lingshouObjIDDict.values():
|
| | | batObjMgr.delBatObj(objID)
|
| | | if self.minggeObj:
|
| | | batObjMgr.delBatObj(self.minggeObj.GetID())
|
| | | self.lineupInfo = {}
|
| | | self.posObjIDDict = {}
|
| | | self.heroObjIDDict = {}
|
| | | self.lingshouObjIDDict = {}
|
| | | self._posObjIDDict = {}
|
| | | self._heroObjIDDict = {}
|
| | | self._batHeroObjIDList = []
|
| | | self._minggeObjID = 0
|
| | | self.fightPower = 0
|
| | | self.totalHurt = 0
|
| | | return
|
| | | |
| | | def addObj(self, batObj):
|
| | | objID = batObj.GetID()
|
| | | posNum = batObj.GetPosNum()
|
| | | heroID = batObj.GetHeroID()
|
| | | batObjType = batObj.GetBatObjType()
|
| | | self._posObjIDDict[posNum] = objID
|
| | | if heroID:
|
| | | self._heroObjIDDict[heroID] = objID
|
| | | |
| | | if batObjType == ChConfig.BatObjType_BatHero:
|
| | | if objID not in self._batHeroObjIDList:
|
| | | self._batHeroObjIDList.append(objID)
|
| | | elif batObjType == ChConfig.BatObjType_Mingge:
|
| | | self._minggeObjID = objID
|
| | | elif batObjType == ChConfig.BatObjType_Lingshou:
|
| | | pass
|
| | | return
|
| | | |
| | | def getPosObjIDDict(self): return self._posObjIDDict
|
| | | def getAllPosObjIDList(self): return self._posObjIDDict.values()
|
| | | |
| | | def getBatHeroObjIDList(self): return self._batHeroObjIDList ## 获取主战武将对象ID列表
|
| | | |
| | | def getHeroObj(self, heroID):
|
| | | if heroID not in self._heroObjIDDict:
|
| | | return
|
| | | return BattleObj.GetBatObjMgr().getBatObj(self._heroObjIDDict[heroID])
|
| | | |
| | | def getMinggeObj(self):
|
| | | if not self._minggeObjID:
|
| | | return
|
| | | return BattleObj.GetBatObjMgr().getBatObj(self._minggeObjID) |
| | |
|
| | | def getDeadObjCnt(self):
|
| | | ## 获取本阵容目前死亡队员数
|
| | | deadCnt = 0
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for objID in self.posObjIDDict.values():
|
| | | for objID in self._batHeroObjIDList:
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | |
| | | continue
|
| | | deadCnt += 1
|
| | | return deadCnt
|
| | | |
| | | def getHeroObj(self, heroID):
|
| | | if heroID not in self.heroObjIDDict:
|
| | | return
|
| | | return BattleObj.GetBatObjMgr().getBatObj(self.heroObjIDDict[heroID])
|
| | | |
| | | def getMinggeObj(self): return self.minggeObj
|
| | |
|
| | | class BatFaction():
|
| | | ## 战斗阵营
|
| | |
| | | for batLineup in batFaction.lineupDict.values():
|
| | | if not allKilled:
|
| | | break
|
| | | for posNum, objID in batLineup.posObjIDDict.items():
|
| | | if posNum <= 0:
|
| | | # 非主战位置不判断
|
| | | continue
|
| | | for objID in batLineup.getBatHeroObjIDList():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | |
| | | tfLineup.OwnerID = batLineup.ownerID
|
| | | tfLineup.ShapeType = batLineup.shapeType
|
| | | tfLineup.ObjList = []
|
| | | for posNum, objID in batLineup.posObjIDDict.items():
|
| | | for posNum, objID in batLineup.getPosObjIDDict().items():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | | if posNum == ChConfig.TFPosNum_Mingge: # 理论上要都同步,但是前端需要同步修改,等前端要改时再同步
|
| | | continue
|
| | | tfObj = ChPyNetSendPack.tagSCTurnFightObj()
|
| | | tfObj.ObjID = batObj.GetID()
|
| | |
| | | if mgSkillIDList:
|
| | | minggeObj = batObjMgr.addBatObj()
|
| | | if minggeObj:
|
| | | batLineup.minggeObj = minggeObj
|
| | | minggeObj.SetOwnerID(lineupPlayerID)
|
| | | minggeObj.SetTFGUID(tfGUID)
|
| | | minggeObj.SetFaction(faction)
|
| | |
| | | skillManager.SkillReset()
|
| | | for skillID in mgSkillIDList:
|
| | | skillManager.LearnSkillByID(skillID)
|
| | | batLineup.addObj(minggeObj)
|
| | | GameWorld.DebugLogEx("AddBatObj 命格: faction:%s,num:%s,objID=%s,skillIDList=%s", faction, num, minggeObj.GetID(), skillManager.GetSkillIDList())
|
| | | ResetObjSkill(minggeObj)
|
| | | minggeObj.InitBatAttr({ChConfig.AttrID_MaxHP:1})
|
| | |
| | | batObj = batObjMgr.addBatObj()
|
| | | if not batObj:
|
| | | break
|
| | | objID = batObj.GetID()
|
| | | #objID = batObj.GetID()
|
| | | if npcID:
|
| | | batObj.SetNPCID(npcID)
|
| | | elif lineupPlayerID:
|
| | |
| | | for skillID in skillIDList:
|
| | | skillManager.LearnSkillByID(skillID)
|
| | |
|
| | | batLineup.posObjIDDict[posNum] = objID
|
| | | batLineup.heroObjIDDict[heroID] = objID
|
| | | batLineup.addObj(batObj)
|
| | | GameWorld.DebugLogEx("AddBatObj %s,lv=%s,star=%s,skill=%s", GetObjName(batObj), lv, star, skillManager.GetSkillIDList())
|
| | | ResetObjSkill(batObj)
|
| | |
|
| | |
| | | GameWorld.DebugLogEx("切换小队重置玩家阵容武将...")
|
| | | batLineup = batFaction.getBatlineup(1) # 只处理玩家阵容
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | for objID in batLineup.getAllPosObjIDList():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | |
| | | turnFight.syncState(FightState_Fighting)
|
| | | TurnFightPerTurnBigStart(turnFight, turnNum)
|
| | |
|
| | | # 红颜
|
| | | # 灵兽
|
| | |
|
| | | if turnFight.winFaction:
|
| | |
| | | faction, num = turnFight.actionSortList[turnFight.actionIndex]
|
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | batLineup = batFaction.getBatlineup(num)
|
| | | posObjIDDict = batLineup.getPosObjIDDict()
|
| | | for posNum in range(batLineup.actionNum, PosNumMax + 1):
|
| | | #GameWorld.DebugLogEx("武将位置: faction=%s,posNum=%s", faction, posNum)
|
| | | if posNum not in batLineup.posObjIDDict:
|
| | | if posNum not in posObjIDDict:
|
| | | batLineup.actionNum = posNum + 1
|
| | | #GameWorld.DebugLogEx("没有武将: faction=%s,posNum=%s", faction, posNum)
|
| | | continue
|
| | |
|
| | | objID = batLineup.posObjIDDict[posNum]
|
| | | objID = posObjIDDict[posNum]
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | |
|
| | | # 玩家自己阵营,预判可否行动
|
| | |
| | | faction, num = turnFight.actionSortList[turnFight.actionIndex]
|
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | batLineup = batFaction.getBatlineup(num)
|
| | | posObjIDDict = batLineup.getPosObjIDDict()
|
| | | for posNum in range(batLineup.actionNum, PosNumMax + 1):
|
| | | batLineup.actionNum = posNum + 1
|
| | | if posNum not in batLineup.posObjIDDict:
|
| | | if posNum not in posObjIDDict:
|
| | | continue
|
| | | objID = batLineup.posObjIDDict[posNum]
|
| | | objID = posObjIDDict[posNum]
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | TurnFightHeroTurnStart(turnFight, batObj, turnNum)
|
| | | isAction = OnObjAction(turnFight, batObj)
|
| | |
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | batLineup = batFaction.getBatlineup(num)
|
| | | batLineup.actionNum = ActionNumStart
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | for objID in batLineup.getAllPosObjIDList():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | turnFight.ResetOneActionUseSkillCnt()
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, batObj, ChConfig.TriggerWay_FightStart)
|
| | |
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | batLineup = batFaction.getBatlineup(num)
|
| | | batLineup.actionNum = 1
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | for objID in batLineup.getAllPosObjIDList():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | |
| | | GameWorld.DebugLogEx("回合结束逻辑: turnNum=%s,faction=%s, num=%s", turnNum, faction, num)
|
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | batLineup = batFaction.getBatlineup(num)
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | for objID in batLineup.getAllPosObjIDList():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | |
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | for lineupNum in batFaction.lineupDict.keys():
|
| | | batLineup = batFaction.getBatlineup(lineupNum)
|
| | | for lineupObjID in batLineup.posObjIDDict.values():
|
| | | for lineupObjID in batLineup.getBatHeroObjIDList():
|
| | | lineupObj = batObjMgr.getBatObj(lineupObjID)
|
| | | if not lineupObj.IsAlive():
|
| | | continue
|
| | |
| | | batLineup.totalHurt = 0
|
| | | facDRLineupInfo[str(num)] = batLineup.lineupInfo
|
| | | GameWorld.DebugLogEx("阵容明细: faction=%s,num=%s", faction, num)
|
| | | posObjIDList = [[posNum, objID] for posNum, objID in batLineup.posObjIDDict.items()]
|
| | | # 命格不算战斗单位,主体视为触发的武将
|
| | | # 灵兽
|
| | | for posNum, objID in posObjIDList:
|
| | | for posNum, objID in batLineup.getPosObjIDDict().items():
|
| | | if posNum == ChConfig.TFPosNum_Mingge:
|
| | | #命格不统计
|
| | | continue
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | |
| | | AfterLogic_DelBuff = "DelBuff"
|
| | | AfterLogic_AddBuff = "AddBuff"
|
| | | AfterLogic_SyncBuff = "SyncBuff"
|
| | | AfterLogic_TriggerAddBuff = "TriggerAddBuff" # 后置处理添加buff后的被动触发
|
| | |
|
| | | #伤害飘血类型
|
| | | (
|
| | |
| | | # 回合战斗站位定义, 1~20 以内为战斗武将固定位置
|
| | | TFPosNum_Mingge = 99 # 命格固定站位
|
| | | TFPosNum_Lingshou = 101 # 灵兽起始站位 101~xxx
|
| | |
|
| | | # 战斗对象类型,根据 PosNum 区分
|
| | | BatObjType_BatHero = 1 # 主战斗武将
|
| | | BatObjType_Mingge = 2 # 命格
|
| | | BatObjType_Lingshou = 3 # 灵兽
|
| | |
|
| | | # 性别
|
| | | BatObjSex_Male = 1 # 男
|
| | |
| | | TriggerWay_SuckHPOne, # 吸血时(多目标仅触发一次) 57
|
| | | TriggerWay_EnemyBeControlledHard, # 敌方受控时(硬控) 58
|
| | | TriggerWay_PursueAtk, # 追击直接攻击时 59
|
| | | ) = range(1, 1 + 59)
|
| | | TriggerWay_Frozen, # 冰冻目标时 60
|
| | | ) = range(1, 1 + 60)
|
| | |
|
| | | # 不加载的被动触发方式,一般用于本技能固定触发逻辑用的
|
| | | TriggerWayNoLoadList = [TriggerWay_CurSkillEff, TriggerWay_CurSkillEffLst]
|
| | |
| | | continue
|
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | batLineup = batFaction.getBatlineup(1)
|
| | | posNumList = [pNum] if pNum else batLineup.posObjIDDict.keys()
|
| | | posObjIDDict = batLineup.getPosObjIDDict()
|
| | | posNumList = [pNum] if pNum else posObjIDDict.keys()
|
| | | for posNum in posNumList:
|
| | | objID = batLineup.posObjIDDict.get(posNum)
|
| | | objID = posObjIDDict.get(posNum)
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | GameWorld.DebugAnswer(curPlayer, "对象不存在:阵营:%s,位置:%s" % (faction, posNum))
|
| | |
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | batLineup = batFaction.getBatlineup(1)
|
| | | posObjIDDict = batLineup.getPosObjIDDict()
|
| | | for posNum in posNumList:
|
| | | objID = batLineup.posObjIDDict.get(posNum)
|
| | | objID = posObjIDDict.get(posNum)
|
| | | if not objID:
|
| | | continue
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | |
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | batLineup = batFaction.getBatlineup(1)
|
| | | objID = batLineup.posObjIDDict.get(posNum)
|
| | | objID = batLineup.getPosObjIDDict().get(posNum)
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | GameWorld.DebugAnswer(curPlayer, "对象不存在:阵营:%s,位置:%s" % (faction, posNum))
|
| | |
| | |
|
| | | ownerFaction = turnFight.getBatFaction(ownerFaction)
|
| | | ownerLineup = ownerFaction.getBatlineup(1)
|
| | | ownerID = ownerLineup.posObjIDDict.get(ownerPosNum)
|
| | | ownerID = ownerLineup.getPosObjIDDict().get(ownerPosNum)
|
| | | buffOwner = batObjMgr.getBatObj(ownerID)
|
| | | if not buffOwner:
|
| | | GameWorld.DebugAnswer(curPlayer, "对象不存在:阵营:%s,位置:%s" % (ownerFaction, ownerPosNum))
|
| | |
| | | skillMgr = mgObj.GetSkillManager()
|
| | | skillIDList = skillMgr.GetSkillIDList()
|
| | | GameWorld.DebugAnswer(curPlayer, "技能: %s,%s" % (len(skillIDList), skillIDList))
|
| | | |
| | | buffMgr = mgObj.GetBuffManager()
|
| | | GameWorld.DebugAnswer(curPlayer, "Buff: %s" % buffMgr.GetBuffCount())
|
| | | for index in range(buffMgr.GetBuffCount()):
|
| | | buff = buffMgr.GetBuffByIndex(index)
|
| | | buffName = GameWorld.CodeToGbk(buff.GetSkillData().GetSkillName())
|
| | | GameWorld.DebugAnswer(curPlayer, "ID:%s,%s(%s),回合:%s,层:%s,V:%s,来源:%s,光环:%s" |
| | | % (buff.GetBuffID(), buffName, buff.GetSkillID(), buff.GetRemainTime(), buff.GetLayer(), |
| | | [buff.GetValue1(), buff.GetValue2(), buff.GetValue3()], buff.GetOwnerID(), buff.GetHaloObjIDList()
|
| | | ))
|
| | | |
| | | posObjIDDict = batLineup.getPosObjIDDict()
|
| | | for posNum in posNumList:
|
| | | objID = batLineup.posObjIDDict.get(posNum)
|
| | | objID = posObjIDDict.get(posNum)
|
| | | if not objID:
|
| | | continue
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | |
| | | atkObj = None
|
| | | batFactionA = turnFight.getBatFaction(ChConfig.Def_FactionA)
|
| | | batLineup = batFactionA.getBatlineup(1)
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | for objID in batLineup.getBatHeroObjIDList():
|
| | | atkObj = batObjMgr.getBatObj(objID)
|
| | | if atkObj.IsAlive():
|
| | | break
|
| | |
| | | killObjList = []
|
| | | batFactionB = turnFight.getBatFaction(ChConfig.Def_FactionB)
|
| | | batLineup = batFactionB.getBatlineup(1)
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | for objID in batLineup.getBatHeroObjIDList():
|
| | | tagObj = batObjMgr.getBatObj(objID)
|
| | | if tagObj.IsAlive():
|
| | | killObjList.append(tagObj)
|
| | |
| | | faction, num = ChConfig.Def_FactionA, 1 # 主线战斗玩家自己默认阵营A的第1个战斗阵容
|
| | | batLineup = mainTurnFight.getBatFaction(faction).getBatlineup(num)
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for posNum, objID in batLineup.posObjIDDict.items():
|
| | | for posNum, objID in batLineup.getPosObjIDDict().items():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | | if batObj.GetBatObjType() != ChConfig.BatObjType_BatHero:
|
| | | continue
|
| | | lineupHero = presetLineup.GetLineupHero(posNum)
|
| | | if lineupHero.heroBatAttrDict:
|
| | | batObj.UpdInitBatAttr(lineupHero.heroBatAttrDict, lineupHero.heroSkillIDList)
|
| | |
| | |
|
| | | objBuffList = []
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | for objID in batLineup.getBatHeroObjIDList():
|
| | | tagObj = batObjMgr.getBatObj(objID)
|
| | | if not tagObj:
|
| | | continue
|
| | |
| | | maxLayer = 0
|
| | | maxLayerBuffList = []
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | for objID in batLineup.getBatHeroObjIDList():
|
| | | tObj = batObjMgr.getBatObj(objID)
|
| | | if not tObj:
|
| | | continue
|
| | |
| | |
|
| | | objList = []
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | for objID in batLineup.getBatHeroObjIDList():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | |
| | |
|
| | | objList = []
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | for objID in batLineup.getBatHeroObjIDList():
|
| | | curBatObj = batObjMgr.getBatObj(objID)
|
| | | if not curBatObj:
|
| | | continue
|
| | |
| | | batLineup = batObj.GetTFBatLineup()
|
| | | countryCnt = 0
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | for objID in batLineup.getBatHeroObjIDList():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | |
| | | buff.SetLayer(updLayerCnt)
|
| | | buff.SetBuffValueList(buffValueList)
|
| | | buff.ResetEffectValueEx()
|
| | | if afterLogic and bySkill:
|
| | | bySkill.AddAfterLogic(ChConfig.AfterLogic_AddBuff, [batObj, buff, buffOwner])
|
| | | if afterLogic and buffSkill:
|
| | | buffSkill.AddAfterLogic(ChConfig.AfterLogic_AddBuff, [batObj, buff, buffOwner])
|
| | | elif isSync:
|
| | | SyncBuffRefresh(turnFight, batObj, buff, relatedSkillID, isNewAdd=True)
|
| | |
|
| | | RefreshBuffEffect(turnFight, batObj, buff, buffSkill, buffOwner, refreshType=2)
|
| | | return buff
|
| | |
|
| | | newBuff = __addNewBuff(turnFight, batObj, buffMgr, buffSkill, buffValueList, buffOwner, bySkill, afterLogic, setLayerCnt=addLayerCnt, isSync=isSync)
|
| | | if skillType == ChConfig.Def_SkillType_Halo and newBuff:
|
| | | __addHaloBuffEffObjID(curID, newBuff, skillID, ownerID, haloSrcBuff)
|
| | | newBuff = __addNewBuff(turnFight, batObj, buffMgr, buffSkill, buffValueList, buffOwner, bySkill, afterLogic, setLayerCnt=addLayerCnt, isSync=isSync, haloSrcBuff=haloSrcBuff)
|
| | | return newBuff
|
| | |
|
| | | def __addNewBuff(turnFight, batObj, buffMgr, buffSkill, buffValueList, buffOwner, bySkill=None, afterLogic=False, setLayerCnt=0, isSync=True):
|
| | | def __addNewBuff(turnFight, batObj, buffMgr, buffSkill, buffValueList, buffOwner, bySkill=None, afterLogic=False, setLayerCnt=0, isSync=True, haloSrcBuff=None):
|
| | | curID = batObj.GetID()
|
| | | skillID = buffSkill.GetSkillID()
|
| | | buff = buffMgr.AddBuff(skillID)
|
| | |
| | | if curBuffState:
|
| | | buffMgr.AddBuffState(curBuffState, buffID)
|
| | |
|
| | | if afterLogic and bySkill:
|
| | | bySkill.AddAfterLogic(ChConfig.AfterLogic_AddBuff, [batObj, buff, buffOwner])
|
| | | if buffSkill.GetSkillType() == ChConfig.Def_SkillType_Halo:
|
| | | __addHaloBuffEffObjID(curID, buff, skillID, ownerID, haloSrcBuff)
|
| | | |
| | | if afterLogic and buffSkill:
|
| | | buffSkill.AddAfterLogic(ChConfig.AfterLogic_AddBuff, [batObj, buff, buffOwner])
|
| | | elif isSync:
|
| | | SyncBuffRefresh(turnFight, batObj, buff, relatedSkillID, isNewAdd=True)
|
| | |
|
| | | RefreshBuffEffect(turnFight, batObj, buff, buffSkill, buffOwner, refreshType=1)
|
| | |
|
| | | #受控时
|
| | | #添加buff时有需要后置处理触发被动的,如受控
|
| | | if curBuffState and IsControlledHardState(curBuffState):
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, batObj, ChConfig.TriggerWay_BeControlledHard, tagObj=buffOwner, connSkill=buffSkill, connBuff=buff)
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | ownerBatLineup = buffOwner.GetTFBatLineup()
|
| | | for lineupObjID in ownerBatLineup.posObjIDDict.values():
|
| | | lineupObj = batObjMgr.getBatObj(lineupObjID)
|
| | | if not lineupObj.IsAlive():
|
| | | continue
|
| | | # 敌方被控时
|
| | | if lineupObj.GetFaction() != batObj.GetFaction():
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_EnemyBeControlledHard, batObj, connSkill=buffSkill)
|
| | | |
| | | buffSkill.AddAfterLogic(ChConfig.AfterLogic_TriggerAddBuff, [ChConfig.TriggerWay_BeControlledHard, batObj, buff, buffOwner])
|
| | | |
| | | return buff
|
| | |
|
| | | def IsControlledHardState(state):
|
| | |
| | | if not batFaction:
|
| | | return
|
| | | batLineup = batFaction.getBatlineup(1)
|
| | | if ChConfig.HeroID_Simayi not in batLineup.heroObjIDDict:
|
| | | return
|
| | | smyObjID = batLineup.heroObjIDDict[ChConfig.HeroID_Simayi]
|
| | | smyObj = BattleObj.GetBatObjMgr().getBatObj(smyObjID)
|
| | | smyObj = batLineup.getHeroObj(ChConfig.HeroID_Simayi)
|
| | | if not smyObj or not smyObj.IsAlive():
|
| | | return
|
| | | smySkillID = ChConfig.SkillID_SmyFanzhao
|
| | |
| | | haloSrcBuff.AddHaloObjID(curID) # 光源先添加新目标
|
| | | haloObjIDList = haloSrcBuff.GetHaloObjIDList()
|
| | | newBuff.SetHaloObjIDList(haloObjIDList) # 新buff直接同步设置为光源有效目标
|
| | | newBuff.SetLayer(haloSrcBuff.GetLayer()) # 同步为光源的层级
|
| | |
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for haloObjID in haloObjIDList:
|
| | |
| | | # 重新添加本阵营有效光环
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | batLineup = batObj.GetTFBatLineup()
|
| | | for tagObjID in batLineup.posObjIDDict.values():
|
| | | for tagObjID in batLineup.getAllPosObjIDList():
|
| | | tagObj = batObjMgr.getBatObj(tagObjID)
|
| | | if not tagObj.IsAlive():
|
| | | continue
|
| | |
| | | GameWorld.DebugLogEx("复活后重新添加本阵营光环: objID=%s,ownerID=%s,haloSkillID=%s", objID, tagObjID, haloSkillID)
|
| | | haloSkill = tagObj.GetSkillManager().FindSkillByID(haloSkillID)
|
| | | if not haloSkill:
|
| | | DoAddBuffBySkillID(turnFight, batObj, haloSkillID, buffOwner=tagObj)
|
| | | continue
|
| | | OnAddBuff(turnFight, batObj, haloSkill, buffOwner=tagObj)
|
| | |
|
| | |
| | | colNumList.insert(0, specInColNum)
|
| | |
|
| | | GameWorld.DebugLogEx("纵排: colNumList=%s,specObjID-PosNum=%s-%s", colNumList, specObjID, specObjPosNum)
|
| | | posObjIDDict = batLineup.getPosObjIDDict()
|
| | | for col in colNumList:
|
| | | for row in range(1, 1 + ChConfig.TurnFightRows):
|
| | | pNum = (row - 1) * ChConfig.TurnFightCols + col
|
| | | #GameWorld.DebugLogEx(" col=%s,row=%s,pNum=%s", col, row, pNum)
|
| | | if pNum not in batLineup.posObjIDDict:
|
| | | if pNum not in posObjIDDict:
|
| | | continue
|
| | | tagObjID = batLineup.posObjIDDict[pNum]
|
| | | tagObjID = posObjIDDict[pNum]
|
| | | tagBatObj = batObjMgr.getBatObj(tagObjID)
|
| | | if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
|
| | | continue
|
| | |
| | |
|
| | | GameWorld.DebugLogEx("全部: colNumList=%s,specObjID-PosNum=%s-%s", colNumList, specObjID, specObjPosNum)
|
| | | # 按前排优先原则
|
| | | posObjIDDict = batLineup.getPosObjIDDict()
|
| | | for row in range(1, 1 + ChConfig.TurnFightRows):
|
| | | for col in colNumList:
|
| | | pNum = (row - 1) * ChConfig.TurnFightCols + col
|
| | | #GameWorld.DebugLogEx(" col=%s,row=%s,pNum=%s", col, row, pNum)
|
| | | if pNum not in batLineup.posObjIDDict:
|
| | | if pNum not in posObjIDDict:
|
| | | continue
|
| | | tagObjID = batLineup.posObjIDDict[pNum]
|
| | | tagObjID = posObjIDDict[pNum]
|
| | | tagBatObj = batObjMgr.getBatObj(tagObjID)
|
| | | if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
|
| | | continue
|
| | |
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for num in lineupNumList:
|
| | | batLineup = batFaction.getBatlineup(num)
|
| | | for tagID in batLineup.posObjIDDict.values():
|
| | | for tagID in batLineup.getBatHeroObjIDList():
|
| | | tagObj = batObjMgr.getBatObj(tagID)
|
| | | if tagObj.IsAlive() and tagObj.CheckInState(checkInStates):
|
| | | return lineupNum, changeTagSet
|
| | |
| | |
|
| | | GameWorld.DebugLogEx("前后排: rowNumList=%s,colNumList=%s,specObjID-PosNum=%s-%s", rowNumList, colNumList, specObjID, specObjPosNum)
|
| | | aimObjList = []
|
| | | posObjIDDict = batLineup.getPosObjIDDict()
|
| | | for row in rowNumList:
|
| | | for col in colNumList:
|
| | | pNum = (row - 1) * ChConfig.TurnFightCols + col
|
| | | #GameWorld.DebugLogEx(" row=%s,col=%s,pNum=%s", row, col, pNum)
|
| | | if pNum not in batLineup.posObjIDDict:
|
| | | if pNum not in posObjIDDict:
|
| | | continue
|
| | | tagObjID = batLineup.posObjIDDict[pNum]
|
| | | tagObjID = posObjIDDict[pNum]
|
| | | tagBatObj = batObjMgr.getBatObj(tagObjID)
|
| | | if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
|
| | | continue
|
| | |
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | batLineup = tagObj.GetTFBatLineup()
|
| | | aimObjList = []
|
| | | posObjIDDict = batLineup.getPosObjIDDict()
|
| | | for col in colNumList:
|
| | | pNum = (row - 1) * ChConfig.TurnFightCols + col
|
| | | if pNum not in batLineup.posObjIDDict:
|
| | | if pNum not in posObjIDDict:
|
| | | continue
|
| | | tagObjID = batLineup.posObjIDDict[pNum]
|
| | | tagObjID = posObjIDDict[pNum]
|
| | | tagBatObj = batObjMgr.getBatObj(tagObjID)
|
| | | if not tagBatObj.IsAlive():
|
| | | continue
|
| | |
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | batLineup = tagObj.GetTFBatLineup()
|
| | | aimObjList = []
|
| | | posObjIDDict = batLineup.getPosObjIDDict()
|
| | | for row in range(1, 1 + ChConfig.TurnFightRows):
|
| | | pNum = (row - 1) * ChConfig.TurnFightCols + col
|
| | | if pNum not in batLineup.posObjIDDict:
|
| | | if pNum not in posObjIDDict:
|
| | | continue
|
| | | tagObjID = batLineup.posObjIDDict[pNum]
|
| | | tagObjID = posObjIDDict[pNum]
|
| | | tagBatObj = batObjMgr.getBatObj(tagObjID)
|
| | | if not tagBatObj.IsAlive():
|
| | | continue
|
| | |
| | | colNumList.insert(0, inColNum)
|
| | |
|
| | | # 按前排优先原则
|
| | | posObjIDDict = batLineup.getPosObjIDDict()
|
| | | for row in range(ChConfig.TurnFightRows):
|
| | | for col in colNumList:
|
| | | pNum = row * ChConfig.TurnFightCols + col
|
| | | if pNum not in batLineup.posObjIDDict:
|
| | | if pNum not in posObjIDDict:
|
| | | continue
|
| | | tagObjID = batLineup.posObjIDDict[pNum]
|
| | | tagObjID = posObjIDDict[pNum]
|
| | | tagBatObj = batObjMgr.getBatObj(tagObjID)
|
| | | if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf=True):
|
| | | continue
|
| | |
| | | # 优先处理afterLogic,可再预先汇总一些会触发被动的信息
|
| | | relatedSkillID = useSkill.GetSkillID()
|
| | | delBuffAfterEffList = [] # buff消失后要触发的被动,一般用于后置处理的逻辑
|
| | | beControlledHardDict = {} # 受控目标 {objID:buff, ...}
|
| | | afterLogicList = useSkill.GetAfterLogicList()
|
| | | for logicType, logicData in afterLogicList:
|
| | | if logicType == ChConfig.AfterLogic_DelBuff:
|
| | |
| | | buff = logicData[1]
|
| | | TurnBuff.SyncBuffRefresh(turnFight, buffObj, buff, relatedSkillID)
|
| | |
|
| | | # 统计添加buff需要触发的被动
|
| | | elif logicType == ChConfig.AfterLogic_TriggerAddBuff:
|
| | | triggerType, batObj, buff, buffOwner = logicData
|
| | | if buffOwner.GetID() == curID:
|
| | | if triggerType == ChConfig.TriggerWay_BeControlledHard:
|
| | | beControlledHardDict[batObj.GetID()] = buff
|
| | | |
| | | # 统计击杀
|
| | | killObjList = [] # 击杀其他阵营目标列表
|
| | | dieObjList = [] # 死亡的单位列表,包含友方单位或自己
|
| | |
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | for lineupNum in batFaction.lineupDict.keys():
|
| | | batLineup = batFaction.getBatlineup(lineupNum)
|
| | | for lineupObjID in batLineup.posObjIDDict.values():
|
| | | for lineupObjID in batLineup.getBatHeroObjIDList():
|
| | | lineupObj = batObjMgr.getBatObj(lineupObjID)
|
| | | if not lineupObj.IsAlive():
|
| | | continue
|
| | |
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, curObj, ChConfig.TriggerWay_Stun, tagObj, connSkill=useSkill)
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, tagObj, ChConfig.TriggerWay_BeStun, curObj, connSkill=useSkill)
|
| | |
|
| | | # 控制
|
| | | if tagID in beControlledHardDict:
|
| | | buff = beControlledHardDict[tagID]
|
| | | if buff.GetCurBuffState() == ChConfig.BatObjState_Frozen:
|
| | | if curMGObj:
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, curMGObj, ChConfig.TriggerWay_Frozen, tagObj, connSkill=useSkill, byBatObj=curObj)
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, tagObj, ChConfig.TriggerWay_BeControlledHard, curObj, connSkill=useSkill, connBuff=buff)
|
| | | |
| | | # 暴击
|
| | | if tagID in superHitObjIDList:
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, curObj, ChConfig.TriggerWay_SuperHit, tagObj, connSkill=useSkill)
|
| | |
| | |
|
| | |
|
| | | # 敌友方
|
| | | if isAttackDirect or batType in [ChConfig.TurnBattleType_Combo, ChConfig.TurnBattleType_Pursue] or isDotHurt:
|
| | | for lineupObjID in curBatLineup.posObjIDDict.values():
|
| | | if isAttackDirect or batType in [ChConfig.TurnBattleType_Combo, ChConfig.TurnBattleType_Pursue] or isDotHurt or tagID in beControlledHardDict:
|
| | | for lineupObjID in curBatLineup.getBatHeroObjIDList():
|
| | | lineupObj = batObjMgr.getBatObj(lineupObjID)
|
| | | if not lineupObj.IsAlive():
|
| | | continue
|
| | |
| | | if not triggerOne:
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_FriendDotHurt, tagObj, connSkill=useSkill, byFriendObj=curObj)
|
| | |
|
| | | # 敌方被控时
|
| | | if tagID in beControlledHardDict and lineupObj.GetFaction() != tagObj.GetFaction():
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_EnemyBeControlledHard, tagObj, connSkill=useSkill)
|
| | | |
| | | # 连击
|
| | | if batType == ChConfig.TurnBattleType_Combo:
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_FriendCombo, tagObj, connSkill=useSkill, byFriendObj=curObj)
|
| | |
| | | if not batFaction:
|
| | | return
|
| | | batLineup = batFaction.getBatlineup(1)
|
| | | if ChConfig.HeroID_Dongbai not in batLineup.heroObjIDDict:
|
| | | return
|
| | | dongbaiObj = BattleObj.GetBatObjMgr().getBatObj(batLineup.heroObjIDDict[ChConfig.HeroID_Dongbai])
|
| | | dongbaiObj = batLineup.getHeroObj(ChConfig.HeroID_Dongbai)
|
| | | if not dongbaiObj or dongbaiObj.IsAlive():
|
| | | return
|
| | | skill = dongbaiObj.GetSkillManager().FindSkillByID(ChConfig.SkillID_DongbaiRevive)
|
| | |
| | | faction, lineupNum, hurtValueDict, immuneHurtDict)
|
| | | # 按优先级顺序处理拥有分摊效果的武将
|
| | | for effHeroID in effHeroIDList:
|
| | | if effHeroID not in batLineup.heroObjIDDict:
|
| | | continue
|
| | | objID = batLineup.heroObjIDDict[effHeroID]
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | batObj = batLineup.getHeroObj(effHeroID)
|
| | | if not batObj or not batObj.IsAlive():
|
| | | continue
|
| | | objID = batObj.GetID()
|
| | | buffMgr = batObj.GetBuffManager()
|
| | |
|
| | | inHurt = objID in hurtValueDict # 光环里的人员是否有受伤
|