From b100e60651bd69472519d964f2e225148cfe7774 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 20 一月 2026 18:27:05 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(命格青龙、白虎调整为光环技能;优化光环技能支持层级;增加出发方式60-冰冻目标时;优化触发方式受控时、敌方受控时触发时机,解决受控触发被动导致的技能标签嵌套顺序问题;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py |   96 +++++++++++++++++++++++++++++++-----------------
 1 files changed, 62 insertions(+), 34 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
index 51f1029..6851048 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
@@ -65,6 +65,19 @@
         return
     
     skillType = useSkill.GetSkillType()
+    byBatObj = kwargs.pop("byBatObj", None)
+    if useSkill.GetFuncType() == ChConfig.Def_SkillFuncType_MinggeSkill:
+        if useSkill.GetSkillType() in ChConfig.Def_HurtSkill_List:
+            if not byBatObj:
+                return
+            GameWorld.DebugLogEx("命格攻击类技能施法方算触发者! mgObjID=%s,byObjID=%s,skillID=%s", curBatObj.GetID(), byBatObj.GetID(), skillID)
+            curBatObj = byBatObj
+        else:
+            # 因为命格攻击类技能修改了施法者,后续如果有子技能触发会变成还是变更后的施法者,导致命格全体buff可能存在多个施法来源,可能导致bug
+            batLineup = curBatObj.GetTFBatLineup()
+            curBatObj = batLineup.getMinggeObj()
+            GameWorld.DebugLogEx("命格非攻击类技能强制施法者为命格自己! mgObjID=%s,skillID=%s", curBatObj.GetID(), skillID)
+            
     byTriggerWay = kwargs["byTriggerWay"] if "byTriggerWay" in kwargs else 0 # 不使用参数名 triggerWay, 防止传递过程中参数混乱
     if not curBatObj.IsAlive():
         if skillType == ChConfig.Def_SkillType_Revive:
@@ -385,13 +398,14 @@
                     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
@@ -410,13 +424,14 @@
                 
             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
@@ -548,7 +563,7 @@
     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
@@ -584,13 +599,14 @@
         
     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
@@ -615,13 +631,14 @@
     row = inRowNum # 目标玩家所在横排
     
     batObjMgr = BattleObj.GetBatObjMgr()
-    batLineup = tagObj.GetBatLineup()
+    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
@@ -644,13 +661,14 @@
     col = inColNum # 目标玩家所在纵排
     
     batObjMgr = BattleObj.GetBatObjMgr()
-    batLineup = tagObj.GetBatLineup()
+    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
@@ -702,12 +720,13 @@
         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
@@ -1402,6 +1421,7 @@
     # 优先处理afterLogic,可再预先汇总一些会触发被动的信息
     relatedSkillID = useSkill.GetSkillID()
     delBuffAfterEffList = [] # buff消失后要触发的被动,一般用于后置处理的逻辑
+    beControlledHardDict = {} # 受控目标 {objID:buff, ...}
     afterLogicList = useSkill.GetAfterLogicList()
     for logicType, logicData in afterLogicList:
         if logicType == ChConfig.AfterLogic_DelBuff:
@@ -1420,6 +1440,13 @@
             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 = [] # 死亡的单位列表,包含友方单位或自己
@@ -1562,7 +1589,7 @@
             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
@@ -1588,7 +1615,7 @@
         
     # 曹仁防护触发,暂写死
     for tagObj in caorenProtectList:
-        tagBatLineup = tagObj.GetBatLineup()
+        tagBatLineup = tagObj.GetTFBatLineup()
         caorenObj = tagBatLineup.getHeroObj(ChConfig.HeroID_Caoren) # 获取被防护目标阵容的曹仁
         if not caorenObj or not caorenObj.IsAlive():
             continue
@@ -1603,7 +1630,7 @@
     triggerOne = False
     batType = useSkill.GetBatType()
     isAttackDirect = (isUseSkill and SkillCommon.isAttackDirectSkill(useSkill)) # 是否直接攻击
-    curBatLineup = curObj.GetBatLineup()
+    curBatLineup = curObj.GetTFBatLineup()
     curMGObj = curBatLineup.getMinggeObj()
     for tagObj in tagObjListAll:
         tagID = tagObj.GetID()
@@ -1661,6 +1688,14 @@
             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)
@@ -1695,8 +1730,8 @@
             
             
         # 敌友方
-        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
@@ -1712,6 +1747,10 @@
                     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)
@@ -1736,9 +1775,7 @@
     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)
@@ -2075,13 +2112,6 @@
     '''
     
     skillID = curSkill.GetSkillID()
-    # 命格攻击类技能,取触发者为施法方,因为部分战斗属性需要取施法方的,如最终增伤等
-    if curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_MinggeSkill:
-        byBatObj = curSkill.GetByBatObj()
-        if byBatObj:
-            GameWorld.DebugLogEx("命格攻击类技能计算伤害属性取触发者! mgObjID=%s,byObjID=%s,skillID=%s", atkObj.GetID(), byBatObj.GetID(), skillID)
-            atkObj = byBatObj
-            
     #mapID = turnFight.mapID
     pmType = GetPMType(atkObj, curSkill)
     ignoreDef = IsIgnoreDef(curSkill)
@@ -2612,12 +2642,10 @@
                          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 # 光环里的人员是否有受伤

--
Gitblit v1.8.0