From a569a7bb683bb01edb14be508e123ba556305f9f Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 26 十二月 2025 14:00:40 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(曹操所有技能;增加触发方式50-敌方受控时(硬控);)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_Attr.py |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_Attr.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_Attr.py
index 643422c..ebbfb19 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_Attr.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_Attr.py
@@ -16,8 +16,9 @@
 #-------------------------------------------------------------------------------
 
 import GameWorld
+import TurnBuff
 
-def GetHappenValue(attacker, defender, curEffect, effSkill, effBuff, **skillkwargs):
+def GetHappenValue(attacker, defender, curEffect, effSkill, effBuff, connSkill, **skillkwargs):
     
     attrID = curEffect.GetEffectID()
     attrValue = curEffect.GetEffectValue(0)
@@ -26,6 +27,14 @@
     if calcType == 10:
         buffStateList = curEffect.GetEffectValue(2)
         maxValue = curEffect.GetEffectValue(3) # 累计最高增加值
+        checkBatType = curEffect.GetEffectValue(4) # 验证攻击类型 0-不验证;1-连击;2-追击;3-反击
+        if checkBatType:
+            if not connSkill:
+                return
+            if connSkill.GetBatType() != checkBatType:
+                #GameWorld.DebugLog("额外属性效果非该战斗类型不触发: checkBatType=%s,skillBatType=%s" % (checkBatType, connSkill.GetBatType()))
+                return
+            
         layerTotal = 0
         buffMgr = defender.GetBuffManager()
         for buffState in buffStateList:
@@ -34,8 +43,49 @@
         attrValue *= layerTotal
         if maxValue and attrValue > maxValue:
             attrValue = maxValue
-        GameWorld.DebugLog("按对方buff层级增加属性: attrID=%s,attrValue=%s,buffStateList=%s,layerTotal=%s,maxValue=%s" 
-                           % (attrID, attrValue, buffStateList, layerTotal, maxValue))
+        GameWorld.DebugLogEx("按对方buff层级增加属性: attrID=%s,attrValue=%s,buffStateList=%s,layerTotal=%s,maxValue=%s,checkBatType=%s", 
+                             attrID, attrValue, buffStateList, layerTotal, maxValue, checkBatType)
+    # 11-根据自己已损失血量百分比
+    elif calcType == 11:
+        curHP = attacker.GetHP()
+        maxHP = attacker.GetMaxHP()
+        lostPer = int((maxHP - curHP) / float(maxHP) * 100) # 只算取整
+        attrValue = lostPer * attrValue
+        GameWorld.DebugLog("按自身已损失生命百分比增加属性: attrID=%s,attrValue=%s,curHP=%s/%s,lostPer=%s" 
+                           % (attrID, attrValue, curHP, maxHP, lostPer))
+        
+    # 12-根据自己buff层级增加
+    elif calcType == 12:
+        if "turnFight" not in skillkwargs:
+            return
+        turnFight = skillkwargs["turnFight"]
+        buffState = curEffect.GetEffectValue(2) # 自己身上buff状态
+        isDelBuff = curEffect.GetEffectValue(3) # 触发效果后是否扣除buff
+        layerTotal = 0
+        buffMgr = attacker.GetBuffManager()
+        for buff in buffMgr.FindBuffListByState(buffState):
+            layerTotal += buff.GetLayer()
+            if isDelBuff:
+                TurnBuff.DoBuffDel(turnFight, attacker, buff, connSkill)
+        attrValue *= layerTotal
+        GameWorld.DebugLogEx("按自己buff层级增加属性: attrID=%s,attrValue=%s,buffState=%s,layerTotal=%s", attrID, attrValue, buffState, layerTotal)
+        
+    # 13-根据对方buff状态种数
+    elif calcType == 13:
+        buffStateList = curEffect.GetEffectValue(2) # 对方处于xx状态 [状态1, 状态2, ...]
+        isMulti = curEffect.GetEffectValue(3) # 存在多种状态时是否叠加属性
+        stateCount = 0
+        buffMgr = defender.GetBuffManager()
+        for buffState in buffStateList:
+            if buffMgr.IsInBuffState(buffState):
+                stateCount += 1
+        if not stateCount:
+            return
+        if isMulti and stateCount > 1:
+            attrValue *= stateCount
+        GameWorld.DebugLogEx("按目标buff状态种数增加属性: attrID=%s,attrValue=%s,buffStateList=%s,stateCount=%s,isMulti=%s", 
+                             attrID, attrValue, buffStateList, stateCount, isMulti)
+        
     else:
         checkInStateList = curEffect.GetEffectValue(2)
         if checkInStateList:

--
Gitblit v1.8.0