From 491a52c412d57216da83f9aec2a5e1c21ed07006 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 18 十二月 2025 21:17:15 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(诸葛亮潜能;增加触发类型51;效果5012支持配置同国概率及消耗buff状态;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
index 0fc0d02..298d6dd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
@@ -32,6 +32,7 @@
     def __init__(self, batObj):
         self._batObj = batObj
         self._objID = batObj.GetID() if batObj else 0
+        self._skillIDList = [] # 已有技能ID列表,获取被动中快速判断已学技能用
         
         # 技能
         self._AffectSkillDict = {} # 被动技能 {(触发方式, 有效来源):{技能ID:[effID, ...], ...}, ...}
@@ -56,9 +57,9 @@
         '''
         effList = []
         
-        # 额外子技能的一般是未学习的技能,直接加载自身的被动效果
+        # 触发自己未学习的技能,直接加载自身的被动效果,如额外子技能等
         if connSkill and not isinstance(connSkill, IpyGameDataPY.IPY_Skill) and self._objID == connSkill.GetObjID() \
-            and connSkill.GetBatType() == ChConfig.TurnBattleType_Enhance:
+            and connSkill.GetSkillID() not in self._skillIDList:
             skillID = connSkill.GetSkillID()
             if skillID not in self._affectSkillEnhanceDict:
                 effDict = {}
@@ -81,15 +82,17 @@
                         
                     key = (tWay, tSrc)
                     if key not in effDict:
-                        effDict[key] = {}
-                    effList = effDict[key]
-                    if effectID not in effList:
-                        effList.append(effList)
+                        effDict[key] = []
+                    effIDList = effDict[key]
+                    if effectID not in effIDList:
+                        effIDList.append(effectID)
                 self._affectSkillEnhanceDict[skillID] = effDict
+                GameWorld.DebugLogEx("加载未学技能被动: objID=%s,skillID=%s,%s", self._objID, skillID, effDict)
                 
+            key = (triggerWay, ChConfig.TriggerSrc_SkillSelf)
             effDict = self._affectSkillEnhanceDict[skillID]
-            if triggerWay in effDict:
-                effList.append(["skill", skillID, 0, effDict[triggerWay]])
+            if key in effDict:
+                effList.append(["skill", skillID, 0, effDict[key]])
                 
         if triggerWay not in self._skillTriggerWayList and triggerWay not in self._buffTriggerWayList:
             return effList
@@ -143,6 +146,10 @@
             curSkill = skillManager.GetSkillByIndex(index)
             if not curSkill:
                 continue
+            skillID = curSkill.GetSkillID()
+            # 附加添加已学技能,用于判断是否自身技能
+            if skillID not in self._skillIDList:
+                self._skillIDList.append(skillID)
             for index in xrange(curSkill.GetEffectCount()):
                 curEffect = curSkill.GetEffect(index)
                 effectID = curEffect.GetEffectID()
@@ -877,10 +884,10 @@
 class BatObj():
     ## 战斗实体对象数据,目前与某个NPCObj绑定
     
-    def __init__(self):
+    def __init__(self, objID):
         self.tfGUID = "" # 所属的某场回合战斗的guid
         self.ownerID = 0 # 所属玩家ID,可能为0,0代表非玩家的战斗实体
-        self.objID = 0
+        self.objID = objID
         self.objName = ""
         self.npcID = 0
         self.heroID = 0
@@ -1236,8 +1243,7 @@
         newObjID = self.__getNewObjID()
         if not newObjID:
             return newBatObj
-        newBatObj = BatObj()
-        newBatObj.objID = newObjID
+        newBatObj = BatObj(newObjID)
         self.batObjDict[newObjID] = newBatObj
         GameWorld.DebugLogEx("添加战斗单位: objID=%s", newObjID)
         if False:

--
Gitblit v1.8.0