From f611ba2ca93e527c98b2d05ffefdcc21a6ed0bd1 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 30 十月 2025 15:42:49 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(何太后技能;优化孙坚技能buff额外属性逻辑;增加技能计算伤害类型6-按自残血量值;增加效果7008 5021 5022;)

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

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 a1ba7d3..0f82ce0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
@@ -521,6 +521,9 @@
     
     atkType = useSkill.GetAtkType()
     GameWorld.DebugLog("__doUseSkill: curID=%s,skillID=%s,atkType=%s" % (curBatObj.GetID(), useSkill.GetSkillID(), atkType))
+    
+    __doHarmSelf(turnFight, curBatObj, useSkill)
+    
     # 通用攻击
     if atkType == 1:
         SkillModule_1(turnFight, curBatObj, useSkill)
@@ -549,6 +552,36 @@
     elif atkType == 9:
         SkillModule_9(turnFight, curBatObj, useSkill)
         
+    return
+
+def __doHarmSelf(turnFight, curBatObj, useSkill):
+    harmEff = useSkill.GetEffectByID(ChConfig.SkillEff_UseSkillHarmSelf)
+    if not harmEff:
+        return
+    harmPer = harmEff.GetEffectValue(0) # 自残百分比
+    noEnoughDo = harmEff.GetEffectValue(1) # 不足时扣除方式 0-不扣;1-自杀;2-扣剩1点
+    curHP = curBatObj.GetHP()
+    maxHP = curBatObj.GetMaxHP()
+    harmHP = int(maxHP * harmPer / 100.0)
+    lostHP = harmHP
+    if curHP <= harmHP:
+        if noEnoughDo == 0:
+            lostHP = 0
+        elif noEnoughDo == 2:
+            lostHP -= 1
+            
+    updHP = max(curHP - lostHP, 0)
+    curBatObj.SetHP(updHP, False)
+    GameWorld.DebugLog("使用技能时自残: curHP=%s/%s,harmPer=%s,harmHP=%s,lostHP=%s,updHP=%s,noEnoughDo=%s" 
+                       % (curHP, maxHP, harmPer, harmHP, lostHP, updHP, noEnoughDo))
+    
+    curBatObj.SetHarmSelfHP(harmHP) # 无视实际扣血量,直接更新
+    
+    # 单独通知前端表现
+    hurtTypes = pow(2, ChConfig.HurtType_HarmSelf)
+    diffType, diffValue = 0, lostHP
+    skillID = relatedSkillID = useSkill.GetSkillID()
+    Sync_PropertyRefreshView(turnFight, curBatObj, ChConfig.AttrID_HP, updHP, diffValue, diffType, skillID, relatedSkillID, hurtTypes)
     return
 
 def SkillModule_1(turnFight, curBatObj, useSkill):
@@ -1400,6 +1433,7 @@
         hurtTypes |= pow(2, ChConfig.HurtType_Parry)
         
     if ignoreDef:
+        GameWorld.DebugLog("无视防御/真实伤害!")
         hurtTypes |= pow(2, ChConfig.HurtType_IgnoreDef)
         
     if isStun:
@@ -1822,6 +1856,10 @@
         if byBuff:
             baseValue = byBuff.GetValue1() + byBuff.GetValue2() * ChConfig.Def_PerPointValue
             GameWorld.DebugLog("根据buff值: %s" % baseValue)
+    elif calcType == ChConfig.Def_Calc_HarmSelfHP:
+        baseValue = curObj.GetHarmSelfHP()
+        GameWorld.DebugLog("根据自残值: %s" % baseValue)
+        
     return baseValue
 
 def DoDOTAttack(turnFight, batObj, curBuff, hurtValue, hurtTypes, **kwargs):

--
Gitblit v1.8.0