From 3746d33910465a715ff31dca487bd04692f798f0 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 23 九月 2025 18:12:42 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(刘备技能;增加效果5004-概率随机移除随机目标身上某种buff;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5004.py |   84 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5004.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5004.py
new file mode 100644
index 0000000..8da8fe6
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5004.py
@@ -0,0 +1,84 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package Skill.PassiveTrigger.PassiveEff_5004
+#
+# @todo:概率随机移除随机目标身上某种buff
+# @author hxp
+# @date 2025-09-23
+# @version 1.0
+#
+# 详细描述: 概率随机移除随机目标身上某种buff
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2025-09-23 18:30"""
+#-------------------------------------------------------------------------------
+
+import ChConfig
+import BattleObj
+import GameWorld
+import TurnBuff
+import random
+
+def DoSkillEffectLogic(turnFight, batObj, tagObj, effSkill, curEffect, connSkill, connBuff, **kwargs):
+    # buff技能类型    移除个数,0为全部    敌友,1-敌方;2-友方    随机目标个数    概率
+    skillType = curEffect.GetEffectValue(0) # buff技能类型
+    delBuffCnt = curEffect.GetEffectValue(1) # 移除个数,0为全部
+    isFriend = curEffect.GetEffectValue(2) # 敌友,0-敌方;1-友方
+    delObjCnt = curEffect.GetEffectValue(3) # 随机目标个数
+    rate = curEffect.GetEffectValue(4) # 概率
+    if not GameWorld.CanHappen(rate):
+        return
+    
+    faction = batObj.GetFaction()
+    lineupNum = batObj.GetLineupNum()
+    if isFriend:
+        tagFaction = faction
+    else:
+        tagFaction = ChConfig.Def_FactionB if faction == ChConfig.Def_FactionA else ChConfig.Def_FactionA
+        
+    batFaction = turnFight.getBatFaction(tagFaction)
+    batLineup = batFaction.getBatlineup(lineupNum)
+    
+    objBuffList = []
+    batObjMgr = BattleObj.GetBatObjMgr()
+    for objID in batLineup.posObjIDDict.values():
+        tagObj = batObjMgr.getBatObj(objID)
+        if not tagObj:
+            continue
+        
+        buffList = []
+        buffMgr = tagObj.GetBuffManager()
+        for index in range(buffMgr.GetBuffCount()):
+            buff = buffMgr.GetBuffByIndex(index)
+            skillData = buff.GetSkillData()
+            if skillData.GetSkillType() != skillType:
+                continue
+            buffList.append(buff)
+            
+        if buffList:
+            objBuffList.append([tagObj, buffList])
+            
+    GameWorld.DebugLog("概率随机移除随机目标身上某种buff: skillType=%s,objLen=%s" % (skillType, len(objBuffList)))
+    if not objBuffList:
+        return
+    
+    if delObjCnt < len(objBuffList):
+        random.shuffle(objBuffList) # 随机目标
+        objBuffList = objBuffList[:delObjCnt]
+        
+    for tagObj, buffList in objBuffList:
+        GameWorld.DebugLog("目标身上某种类型buff个数: tagID=%s,buffLen=%s" % (tagObj.GetID(), len(buffList)))
+        if not buffList:
+            continue
+        
+        if delBuffCnt > len(buffList):
+            random.shuffle(buffList) # 随机buff
+            buffList = buffList[:delBuffCnt]
+            
+        for buff in buffList:
+            GameWorld.DebugLog("    随机移除buff: tagID=%s,buffID=%s" % (tagObj.GetID(), buff.GetBuffID()))
+            TurnBuff.DoBuffDel(turnFight, tagObj, buff)
+            
+    return True

--
Gitblit v1.8.0