From 2287e657195a6a77ea58c4984901d6ceb63fe6f7 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 12 一月 2024 11:38:31 +0800
Subject: [PATCH] 10019 【砍树】回合战斗(战斗结束处理,重置血量,清除回合buff等)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py |   68 ++++++++++++++++++++++++++++------
 1 files changed, 56 insertions(+), 12 deletions(-)

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 4b650a9..ad2a386 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -31,6 +31,7 @@
 import GameObj
 import PetControl
 import SkillShell
+import BuffSkill
 
 (
 FightState_Start,
@@ -171,7 +172,7 @@
             
             for obj in fightObjList:
                 TurnFightObjPerTurnActionnum(turnNum, actionNum, obj, tick)
-                                                
+                
             objType = gameObj.GetGameObjType()
             objID = gameObj.GetID()
             SyncTurnFightObjAction(curPlayer, turnNum, objType, objID)
@@ -180,7 +181,7 @@
                 # 复活时机在自己行动节点
                 if not DoReborn(gameObj):
                     continue
-                    
+                
             faction = GameObj.GetFaction(gameObj)
             objName = GetObjName(gameObj)
             curHP = GameObj.GetHP(gameObj)
@@ -202,12 +203,15 @@
             
         if isWin != None:
             break
-        
+                
+    GameWorld.DebugLog("--- 战斗结束处理 ---")
     overState = FightState_Win if isWin else FightState_Fail
     SyncTurnFightState(curPlayer, mapID, funcLineID, tagPlayerID, overState, turnNum, turnMax)
     
+    # 结算奖励...待扩展
+    
     for gameObj in fightObjList:
-        TurnFightObjOverReset(gameObj)
+        TurnFightObjOverReset(gameObj, tick)
         
     GameWorld.DebugLog("===== 回合制战斗结束: mapID=%s,funcLineID=%s,tagPlayerID=%s,isWin=%s,overState=%s" 
                        % (mapID, funcLineID, tagPlayerID, isWin, overState), playerID)
@@ -473,22 +477,62 @@
         
     return
 
-def TurnFightObjOverReset(gameObj):
+def TurnFightObjOverReset(gameObj, tick):
     ## 回合制战斗实例结束重置
     if not gameObj:
         return
+    
+    objType = gameObj.GetGameObjType()
+    
+    #NPC直接回收
+    if objType == IPY_GameWorld.gotNPC:
+        RecycleObj(gameObj)
+        return
+    
+    if objType != IPY_GameWorld.gotPlayer:
+        return
+    
+    timeline = gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightTimeline)
+    isDelRefresh = ClearTurnFightBuff(gameObj, timeline, tick)
     SetTimeline(gameObj, 0, 0)
     gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnBattleType, 0)
     GameObj.SetFaction(gameObj, 0)
-    
-    objType = gameObj.GetGameObjType()
-    if objType == IPY_GameWorld.gotPlayer:
-        pass
-    
-    elif objType == IPY_GameWorld.gotNPC:
-        RecycleObj(gameObj)
+    GameObj.SetHPFull(gameObj)
+    if isDelRefresh:
+        playerControl = PlayerControl.PlayerControl(gameObj)
+        playerControl.RefreshPlayerAttrByBuff()
     return
 
+def ClearTurnFightBuff(gameObj, timeLine, tick):
+    ## 清除回合制战斗相关buff
+    isDelRefresh = False
+    objType = gameObj.GetGameObjType()
+    objID = gameObj.GetID()
+    for buffType in range(IPY_GameWorld.bfBuff, IPY_GameWorld.btBufMax):
+        if objType != IPY_GameWorld.gotPlayer and buffType in ChConfig.Def_BuffType_OnlyPlayer:
+            continue
+        buffTuple = SkillCommon.GetBuffManagerByBuffType(gameObj, buffType)
+        if buffTuple == ():
+            continue
+        buffState = buffTuple[0]
+        for i in range(0, buffState.GetBuffCount())[::-1]:
+            curBuff = buffState.GetBuff(i)
+            curSkill = curBuff.GetSkill()
+            buffSkillID = curSkill.GetSkillID()
+            if not buffSkillID:
+                continue
+            if curBuff.GetCalcStartTick() > timeLine:
+                # 回合制中产生的buff是以timeline作为CalcStartTick的,所以超过timeline的可视为非回合制buff
+                continue
+            GameWorld.DebugLog("    删除回合制buff: buffSkillID=%s" % buffSkillID, objID)
+            ownerID, ownerType = curBuff.GetOwnerID(), curBuff.GetOwnerType()
+            BuffSkill.DoBuffDisApper(gameObj, curBuff, tick)
+            buffState.DeleteBuffByIndex(i)
+            SkillShell.ClearBuffEffectBySkillID(gameObj, buffSkillID, ownerID, ownerType)
+            #删除未知BUFF,刷新属性
+            isDelRefresh = True
+    return isDelRefresh
+
 def RecycleObj(gameObj):
     ## 释放回合制战斗对象
     

--
Gitblit v1.8.0