From ad6a669af7002ce115b322f5f10ad44c7992bb7b Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 22 十二月 2025 14:43:09 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(吕玲绮技能,除了突破8潜能; buff持续回合计算增加规则3;技能目标范围增加男女;增加效果6030-掉血保护;5022效果支持配置仅对指定性别有效;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py |    6 +++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py                       |    9 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_6030.py |   27 +++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py                     |   13 +++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py                    |   13 ++++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py                      |   35 +++++++++++++----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                             |   12 +++++-
 7 files changed, 97 insertions(+), 18 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 298d6dd..e389169 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
@@ -1029,9 +1029,16 @@
     def SetLV(self, lv): self.lv = lv
     def GetStar(self): return self._star
     def SetStar(self, star): self._star = star
-    def GetDictByKey(self, key): return self._kvDict.get(key, 0)
-    def SetDict(self, key, value): self._kvDict[key] = value
-    
+    def GetDictByKey(self, key): 
+        if key in self._kvDict:
+            return self._kvDict[key]
+        return 0
+    def SetDict(self, key, value):
+        if not value:
+            self._kvDict.pop(key, None)
+        else:
+            self._kvDict[key] = value
+            
     def GetSkillManager(self): return self._skillMgr
     def GetBuffManager(self):return self._buffMgr
     def GetPassiveEffManager(self):return self._passiveEffMgr
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
index 2d1b1bd..a8e07ca 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -1711,7 +1711,7 @@
             batObj.SetTiming(ChConfig.TurnTiming_Before) # 重置时机到回合前
             if turnNum > 1: # 第1回合不用刷新技能
                 RefreshObjSkillByBigTurn(batObj)
-                RefreshObjByBigTurn(turnFight, batObj)
+                RefreshObjByBigTurn(turnFight, batObj, turnNum)
             batObj.ResetBigTurn() # 每大回合重置
             
             if not batObj.IsAlive():
@@ -1813,7 +1813,7 @@
         GameWorld.DebugLogEx("    更新技能CD: curID=%s,skillID=%s,remainTime=%s", curID, skillID, remainTime)
     return
 
-def RefreshObjByBigTurn(turnFight, batObj):
+def RefreshObjByBigTurn(turnFight, batObj, turnNum):
     ## 根据大回合开始刷新buff持续时间,每个大回合-1,第1回合不处理
     curID = batObj.GetID()
     buffMgr = batObj.GetBuffManager()
@@ -1824,7 +1824,7 @@
         skillData = buff.GetSkillData()
         lastType = skillData.GetLastTimeType()
         
-        if lastType not in [ChConfig.BuffLastTimeType_BigTurn, ChConfig.BuffLastTimeType_BigTurnLayer]:
+        if lastType not in [ChConfig.BuffLastTimeType_BigTurn, ChConfig.BuffLastTimeType_BigTurnLayer, ChConfig.BuffLastTimeType_BigTurnLimit]:
             continue
         
         if skillData.GetSkillType() in ChConfig.Def_LstBuff_List:
@@ -1835,12 +1835,17 @@
             continue
         
         # 每大回合固定减1回合
-        if lastType == ChConfig.BuffLastTimeType_BigTurn:
+        if lastType in [ChConfig.BuffLastTimeType_BigTurn, ChConfig.BuffLastTimeType_BigTurnLimit]:
             remainTime = buff.GetRemainTime()
             if remainTime <= 0:
                 continue
             remainTime -= 1
             GameWorld.DebugLogEx("    更新buff回合: curID=%s,buffID=%s,skillID=%s,remainTime=%s", curID, buffID, skillID, remainTime)
+            if lastType == ChConfig.BuffLastTimeType_BigTurnLimit and remainTime > 0:
+                lastTurnMax = skillData.GetLastTime()
+                if lastTurnMax and turnNum > lastTurnMax:
+                    remainTime = 0
+                    GameWorld.DebugLogEx("        超过最大限制回合数,强制清除!: curID=%s,buffID=%s,skillID=%s,remainTime=%s", curID, buffID, skillID, remainTime)
             TurnBuff.SetBuffRemainTime(turnFight, batObj, buff, remainTime)
             
         # 每大回合固定减1层
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index f3ef64c..7ea8031 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -1339,6 +1339,10 @@
     # @return:  1 ~ 总行数
     return (posNum - 1) / TurnFightCols + 1
 
+# 性别
+BatObjSex_Male = 1 # 男
+BatObjSex_Female = 2 # 女
+
 # 技能目标 - 瞄准范围
 (
 SkillTagAim_All, # 全部 0
@@ -1350,7 +1354,9 @@
 SkillTagAim_MainSkill, # 继承主技能目标 6
 SkillTagAim_MainSkillEx, # 继承主技能目标一次性处理 7
 SkillTagAim_MainSkillFriend, # 继承主技能友军 8
-) = range(9)
+SkillTagAim_Male, # 男性 9
+SkillTagAim_Female, # 女性 10
+) = range(11)
 
 # 技能目标 - 细分
 (
@@ -1551,6 +1557,7 @@
 BuffLastTimeType_Default = 0 # 默认以获得buff时自身回合前后判断
 BuffLastTimeType_BigTurn = 1 # 大回合buff,每大回合开始固定减1回合
 BuffLastTimeType_BigTurnLayer = 2 # 大回合buff,每大回合开始固定减1层
+BuffLastTimeType_BigTurnLimit = 3 # 在1的基础上,额外限制不超过战场当前回合
 
 #动作类区分标识
 (
@@ -4065,6 +4072,7 @@
 PassiveEff_AddHurtAtkPerMax = 6027 # 增加技能最大攻击万分比限制
 PassiveEff_AddChangeLayers5008 = 6028 # 增减5008效果的转化层数
 PassiveEff_AddBatDamPerByLayer = 6029 # 提升技能战斗伤害(根据身上buff状态层数)
+PassiveEff_LostHPProtect = 6030 # 掉血上限保护
 
 # 被动效果ID有触发值时就返回的
 PassiveEffHappenValueList = [PassiveEff_ChangeHurtType, PassiveEff_ImmuneControlBuff, PassiveEff_MustSuperHit, PassiveEff_SkillInvalid, 
@@ -4072,7 +4080,7 @@
 # 被动效果ID触发值取最大值的
 PassiveEffValueMaxList = [PassiveEff_ChangeHurtMulti]
 # 被动效果ID触发值取最小值的
-PassiveEffValueMinList = []
+PassiveEffValueMinList = [PassiveEff_LostHPProtect]
 
 # 技能效果 - 不需要配置触发方式的
 SkillEff_CureWayEx = 7001 # 额外治疗值计算(对CalcType、SkillPer治疗计算方式扩展): 值1-计算方式;值2-万分比
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 bf3848c..db19eb2 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
@@ -43,6 +43,12 @@
                 countryCnt += 1
             calcLayer = countryCnt
             GameWorld.DebugLogEx("按友方某个国家武将数计算额外buff属性: ruleType=%s,country=%s,countryCnt=%s", ruleType, country, countryCnt)
+        # 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
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_6030.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_6030.py
new file mode 100644
index 0000000..601325a
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_6030.py
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package Skill.PassiveTrigger.PassiveEff_6030
+#
+# @todo:掉血上限保护
+# @author hxp
+# @date 2025-12-22
+# @version 1.0
+#
+# 详细描述: 掉血上限保护
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2025-12-22 14:00"""
+#-------------------------------------------------------------------------------
+
+def GetHappenValue(attacker, defender, curEffect, effSkill, effBuff, connSkill, **skillkwargs):
+    maxPer = curEffect.GetEffectValue(0) # 最大不超过计算方式的万分比
+    calcType = curEffect.GetEffectValue(1) # 计算方式 1-最大血量
+    calcValue = attacker.GetMaxHP() # 默认按最大血量
+    
+    # 其他方式可支持
+    if calcType == 1:
+        pass
+    
+    return int(calcValue * maxPer / 10000.0)
\ No newline at end of file
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py
index 6845f8b..13a686b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py
@@ -452,6 +452,15 @@
     if haveBuffPassiveEff:
         batObj.GetPassiveEffManager().DelBuffPassiveEffect(buffID)
         
+    # 判断是否有额外属性的
+    if not isRefreshAttr:
+        effExDict = curBuff.GetEffectExDict()
+        for effCalcInfo in effExDict.keys():
+            effID = effCalcInfo[0]
+            if effID in ChConfig.AttrIDList:
+                isRefreshAttr = True
+                break
+            
     if isRefreshAttr and not noRefreshAttr:
         RefreshBuffAttr(batObj)
         
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 f967ef2..d593e48 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
@@ -133,12 +133,13 @@
     
     # 子技能怒气溢出值也有效,所以子技能不处理
     curXP = curBatObj.GetXP()
-    if batType == ChConfig.TurnBattleType_Enhance:
-        pass
-    elif SkillCommon.isAngerSkill(useSkill):
+    if SkillCommon.isAngerSkill(useSkill):
         maxXP = IpyGameDataPY.GetFuncCfg("AngerXP", 2)
         angerOverflow = max(curXP - maxXP, 0)
         curBatObj.SetAngerOverflow(angerOverflow)
+        GameWorld.DebugLogEx("怒气溢出值: curXP=%s/%s,angerOverflow=%s", curXP, maxXP, angerOverflow)
+    if batType == ChConfig.TurnBattleType_Enhance:
+        pass
     else:
         curBatObj.SetAngerOverflow(0)        
     angerOverflow = curBatObj.GetAngerOverflow()
@@ -410,6 +411,13 @@
                     tagBatObj = batObjMgr.getBatObj(tagObjID)
                     if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
                         continue
+                    
+                    if tagAim == ChConfig.SkillTagAim_Male:
+                        if tagBatObj.GetSex() != ChConfig.BatObjSex_Male:
+                            continue
+                    elif tagAim == ChConfig.SkillTagAim_Female:
+                        if tagBatObj.GetSex() != ChConfig.BatObjSex_Female:
+                            continue
                     aimObjList.append(tagBatObj)
                     
     # 目标细分
@@ -1124,7 +1132,7 @@
         else:
             diffType = 1
             tagXP = tagBatObj.GetXP()
-            diffValue = GetEnhanceXP(tagBatObj, calcValue)
+            diffValue = GetEnhanceXP(tagBatObj, calcValue, useSkill)
             updValue = tagXP + diffValue
             tagBatObj.SetXP(updValue, False)
             GameWorld.DebugLogEx("    加怒气: tagID=%s,diffValue=%s,tagXP=%s,updXP=%s", tagID, diffValue, tagXP, updValue)
@@ -1702,11 +1710,14 @@
     Sync_PropertyRefreshView(turnFight, gameObj, ChConfig.AttrID_XP, updXP, addXP, diffType=1, relatedSkillID=relatedSkillID)
     return
 
-def GetEnhanceXP(gameObj, addXP):
+def GetEnhanceXP(gameObj, addXP, useSkill=None):
     ## 获取提升后的xp值
     addPer = gameObj.GetBatAttrValue(ChConfig.AttrID_XPRecoverPer)
     # 其他强化、弱化
     if addPer == 0:
+        return addXP
+    if useSkill and useSkill.GetFuncType() == ChConfig.Def_SkillFuncType_PotentialSkill and useSkill.GetSkillValue() == 50:
+        GameWorld.DebugLogEx("潜能初始50点暂时写死不受限: objID=%s,addXP=%s,skillID=%s", gameObj.GetID(), addXP, useSkill.GetSkillID())
         return addXP
     objID = gameObj.GetID()
     updAddXP = int(addXP * max(10000 + addPer, 0) / 10000.0)
@@ -2241,7 +2252,7 @@
         defObj, hurtValue, hurtTypes, immuneHurt = hurtInfo[:4]
         isEx = hurtInfo[4] if len(hurtInfo) > 4 else 0 # 是否是额外目标
         
-        lostHP, ignoreShield = DoLostHP(turnFight, atkObj, defObj, hurtValue, curSkill, lostType, hpCanNegative=True, immuneHurt=immuneHurt)
+        lostHP, ignoreShield, hurtValue = DoLostHP(turnFight, atkObj, defObj, hurtValue, curSkill, lostType, hpCanNegative=True, immuneHurt=immuneHurt)
         if ignoreShield:
             hurtTypes |= pow(2, ChConfig.HurtAtkType_IgnoreShield)
             
@@ -2531,7 +2542,7 @@
     @param hpCanNegative: 扣除后的生命是否允许负值
     @param immuneHurt: 免疫的伤害值
     @param isSkillSelfTag: 是否技能自身的直接目标,如平摊伤害目标、溅射伤害目标这种就不算直接目标
-    @return: lostHP, ignoreShield
+    @return: lostHP, ignoreShield, hurtValue
     '''
     
     ignoreShield = None
@@ -2549,8 +2560,14 @@
                                  defObj.GetID(), buff.GetBuffID(), buffSkillID, buffValue, immuneHurt, updBuffValue, lostType)
             
     if hurtValue <= 0:
-        return 0, ignoreShield
+        return 0, ignoreShield, hurtValue
     
+    # 伤血上限保护
+    lostHPProtect = TurnPassive.GetTriggerEffectValue(turnFight, defObj, atkObj, ChConfig.PassiveEff_LostHPProtect, curSkill)
+    if lostHPProtect > 0 and hurtValue > lostHPProtect:
+        GameWorld.DebugLogEx("    扣血时最大伤血保护: defID=%s,hurtValue=%s,lostHPProtect=%s", defObj.GetID(), hurtValue, lostHPProtect)
+        hurtValue = lostHPProtect
+        
     atkID = atkObj.GetID()
     defID = defObj.GetID()
     skillID = curSkill.GetSkillID()
@@ -2616,7 +2633,7 @@
     GameWorld.DebugLogEx("    扣血: atkID=%s,defID=%s,hurtValue=%s,lostType=%s,lostHP=%s,dHP=%s,updHP=%s/%s", 
                          atkID, defID, hurtValue, lostType, lostHP, dHP, defObj.GetHP(), defObj.GetMaxHP())
     TurnAttack.AddTurnObjHurtValue(atkObj, defObj, hurtValue, lostHP, skillID, lostType)
-    return lostHP, ignoreShield
+    return lostHP, ignoreShield, hurtValue
 
 def CalcBounceHP(turnFight, atkObj, defObj, hurtObj, curSkill):
     '''计算反弹反弹伤害

--
Gitblit v1.8.0