From cec8b67d82c2c2c1662d55c818c4a46bcc0487db Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 25 八月 2025 17:36:02 +0800
Subject: [PATCH] 125 【战斗】战斗系统 战斗技能

---
 Main/System/Team/TeamBase.cs |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/Main/System/Team/TeamBase.cs b/Main/System/Team/TeamBase.cs
index 14622c7..b0de245 100644
--- a/Main/System/Team/TeamBase.cs
+++ b/Main/System/Team/TeamBase.cs
@@ -53,8 +53,8 @@
             {
                 var fightObj = lineUp.ObjList[i];
                 TeamHero hero = new TeamHero(fightObj, this);
-                tempHeroes[fightObj.PosNum] = hero;
-                serverHeroes[fightObj.PosNum] = hero;
+                tempHeroes[hero.positionNum] = hero;
+                serverHeroes[hero.positionNum] = hero;
             }
             else
             {
@@ -226,6 +226,18 @@
         return false;
     }
 
+    public bool HasHeroInServer(string guid)
+    {
+        foreach (var hero in serverHeroes)
+        {
+            if (hero != null && hero.guid == guid)
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
     //瀹㈡埛绔粠0寮�濮嬶紝鏈嶅姟绔粠1寮�濮�
     public int GetEmptyPosition()
     {
@@ -252,6 +264,16 @@
         tempHeroes[posNum] = hero;
     }
 
+    //  甯冮樀鎺ュ彛: 鎭㈠闃靛
+    public void RestoreTeam()
+    {
+        for (int i = 0; i < tempHeroes.Length; i++)
+        {
+            tempHeroes[i] = serverHeroes[i];
+        }
+    }
+    
+
     public void AddHero(HeroInfo heroInfo, int targetPosition)
     {
         if (targetPosition < 0 || targetPosition >= tempHeroes.Length)
@@ -260,17 +282,7 @@
             return;
         }
 
-        TeamHero targetHero = tempHeroes[targetPosition];
-
-        if (null == targetHero)
-        {
-            TeamHero newHero = new TeamHero(heroInfo, targetPosition, this);
-            SetTeamHero(targetPosition, newHero);
-        }
-        else
-        {
-            SetTeamHero(targetPosition, new TeamHero(heroInfo, targetPosition, this));
-        }
+        SetTeamHero(targetPosition, new TeamHero(heroInfo, targetPosition, this));
     }
 
 

--
Gitblit v1.8.0