From 4778d39a0d6aa96f3b29115ff65ce6adb1e8e252 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 22 十二月 2025 20:02:42 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(个人战报支持配置是否仅保留1份;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py |   54 ++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py
index dc46601..e196c5b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py
@@ -4,24 +4,62 @@
 #
 ##@package Skill.PassiveTrigger.PassiveEff_5022
 #
-# @todo:额外增加buff效果ID/属性ID值
+# @todo:额外增加/减少buff效果ID/属性ID值
 # @author hxp
 # @date 2025-10-30
 # @version 1.0
 #
-# 详细描述: 额外增加buff效果ID/属性ID值
+# 详细描述: 额外增加/减少buff效果ID/属性ID值
 #
 #-------------------------------------------------------------------------------
 #"""Version = 2025-10-30 16:00"""
 #-------------------------------------------------------------------------------
 
 import GameWorld
+import BattleObj
 
 def DoSkillEffectLogic(turnFight, batObj, tagObj, effSkill, curEffect, connSkill, connBuff, **kwargs):
-    effValues = curEffect.GetEffectValues()
-    for index in range(0, len(effValues), 2):
-        attrID = effValues[index]
-        attrValue = effValues[index + 1] if len(effValues) > index + 1 else 0
-        GameWorld.DebugLog("额外增加buff效果ID/属性ID值: attrID=%s,attrValue=%s" % (attrID, attrValue))
-        connBuff.AddEffectValueEx(attrID, attrValue)
+    effEx1 = curEffect.GetEffectValue(0) # 支持多个属性
+    effEx2 = curEffect.GetEffectValue(1) # 支持多个属性
+    calcRule = curEffect.GetEffectValue(2) # 附加计算规则,没配置默认增加固定值
+    
+    calcLayer = 1 # 没配置的默认1层,相当于固定值
+    if calcRule:
+        ruleType = calcRule[0]
+        # 100 - 按友方某个国家武将数  参数1:国家
+        if ruleType == 100:
+            country = calcRule[1] if len(calcRule) > 1 else 0
+            onlyAlive = calcRule[2] if len(calcRule) > 2 else 0
+            batLineup = batObj.GetBatLineup()
+            countryCnt = 0
+            batObjMgr = BattleObj.GetBatObjMgr()
+            for objID in batLineup.posObjIDDict.values():
+                batObj = batObjMgr.getBatObj(objID)
+                if not batObj:
+                    continue
+                if batObj.GetCountry() != country:
+                    continue
+                if onlyAlive and not batObj.IsAlive():
+                    continue
+                countryCnt += 1
+            calcLayer = countryCnt
+            GameWorld.DebugLogEx("按友方某个国家武将数计算额外buff属性: ruleType=%s,country=%s,countryCnt=%s,onlyAlive=%s", ruleType, country, countryCnt, onlyAlive)
+        # 101 - 仅对指定性别有效  参数1:性别
+        elif ruleType == 101:
+            onlySex = calcRule[1] if len(calcRule) > 1 else 0
+            if tagObj.GetSex() != onlySex:
+                GameWorld.DebugLogEx("5022额外buff对该性别无效: ruleType=%s,onlySex=%s,tagSex=%s,tagID=%s", ruleType, onlySex, tagObj.GetSex(), tagObj.GetID())
+                return
+            
+    if calcLayer <= 0:
+        return
+    
+    for effEX in [effEx1, effEx2]:
+        if not isinstance(effEX, list) or len(effEX) != 3:
+            continue
+        attrID, attrValue, calcType = effEX
+        if calcLayer > 1:
+            attrValue = int(attrValue * calcLayer)
+        GameWorld.DebugLogEx("额外buff效果ID/属性ID值: attrID=%s,attrValue=%s,calcType=%s", attrID, attrValue, calcType)
+        connBuff.AddEffectValueEx(attrID, attrValue, calcType)
     return True

--
Gitblit v1.8.0