From 1a7b1b9fa3b539fa57f54a5d69aa9c01b0e5b0e9 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期六, 11 十月 2025 16:48:55 +0800
Subject: [PATCH] 0312 增加引导路径配置错误警告

---
 Main/System/Battle/Skill/SkillBase.cs |  126 +++++++++++++++++++++++++++++++++---------
 1 files changed, 99 insertions(+), 27 deletions(-)

diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index 49f7c3c..f7009d0 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -36,6 +36,8 @@
 
     public int fromSkillId;
 
+	public bool isPlay = false;
+
     public SkillBase(BattleObject _caster, SkillConfig _skillCfg, HB427_tagSCUseSkill vNetData, List<GameNetPackBasic> _packList, BattleField _battleField = null)
 	{
 		caster = _caster;
@@ -48,13 +50,11 @@
 		battleField = _battleField;
 		packList = _packList;
 
-		
-
+		// Debug.LogError("start a skill id " + skillConfig.SkillID + " caster " + caster.teamHero.heroId + " pos " + caster.teamHero.positionNum + " camp " + caster.Camp);
 	}
 
 	public virtual void Run()
 	{
-
 		if (null != skillEffect)
 		{
 			if (skillEffect.IsFinished())
@@ -66,6 +66,7 @@
 			{
 				skillEffect.Run();
 			}
+			return;
 		}
 
 		if (otherSkillAction != null)
@@ -77,8 +78,12 @@
 			}
 			else
 			{
-				otherSkillAction.Run();
+				if (moveFinished)
+				{
+					otherSkillAction.Run();
+				}
 			}
+			return;
 		}
 	}
 
@@ -86,6 +91,7 @@
 	// 1路绉诲姩鍒拌窛绂婚樀瀹逛綅缃畁鐮佺殑璺濈锛堝2鍙蜂綅锛�5鍙蜂綅锛夐噴鏀撅紙鍗虫垬鍦轰腑澶绫伙級
 	public virtual void Cast()
 	{
+		// Debug.LogError("Cast skill " + skillConfig.SkillID + " cast position " + skillConfig.CastPosition + " cast mode " + skillConfig.castMode); 
 		string guid = battleField.guid;
 		TeamHero teamHero = caster.teamHero;
 		EventBroadcast.Instance.Broadcast<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, guid, skillConfig, teamHero);
@@ -159,6 +165,8 @@
 			_onComplete?.Invoke();
 		}, speed);
 		battleField.battleTweenMgr.OnPlayTween(tweener);
+
+		// Debug.LogError("move to tarrget " + target.name + " offset " + offset + " speed " + speed + " time " + tweener.Duration());
 	}
 
 	protected void TurnBack(Action _onComplete, float forward)
@@ -241,6 +249,16 @@
 	protected virtual void OnAllAttackMoveFinished()
 	{
 		moveFinished = true;
+		List<BattleObject> allList = battleField.battleObjMgr.allBattleObjDict.Values.ToList<BattleObject>();
+		for (int i = 0; i < allList.Count; i++)
+		{
+			BattleObject bo = allList[i];
+			bo.layerMgr.SetFront();
+			// bo.heroRectTrans.SetParent(battleField.GetTeamNode(bo.Camp, bo.teamHero.positionNum), true);
+			bo.heroInfoBar.SetActive(true);
+		}
+		battleField.battleRootNode.skillMaskNode.SetActive(false);
+		// Debug.LogError("OnAllAttackMoveFinished skill " + skillConfig.SkillID + " cast position " + skillConfig.CastPosition + " cast mode " + skillConfig.castMode); 
 	}
 
 	protected void CastToAllies()
@@ -289,12 +307,14 @@
 		// OnMiddleFrameEnd 涓憞缁撴潫
 		// OnFinalFrameStart 鍚庢憞寮�濮�
 		// OnFinalFrameEnd 鍚庢憞缁撴潫
+
 		return caster.motionBase.PlaySkillAnimation(skillConfig, this, onComplete);
 	}
 
 	//	鎶�鑳藉紑濮�
 	public void OnSkillStart()
 	{
+		HandleDead();
 		skillEffect = SkillEffectFactory.CreateSkillEffect(
 				caster,
 				skillConfig,
@@ -302,6 +322,8 @@
 			);
 
 		skillEffect.Play(OnHitTargets);
+		isPlay = true;
+
 	}
 
 	//	鎶�鑳藉墠鎽囧抚缁撴潫
@@ -339,7 +361,8 @@
 	{	
 		skillEffect.OnFinalFrameEnd();
 
-		HandleDead();
+		//	杞Щ鍒版浜″寘 battleobject.hurt 鏈�鍚庝竴鍑荤殑鏃跺�欐挱鏀�
+		
 	}
 
 
@@ -347,6 +370,8 @@
 
 	protected void HighLightAllTargets()
 	{
+		caster.layerMgr.SetSortingOrder(BattleConst.ActiveHeroActionSortingOrder);
+
 		if (skillConfig.FuncType != 2)
 			return;
 
@@ -359,6 +384,8 @@
 
 		caster.heroInfoBar.SetActive(false);
 
+		
+
 		for (int i = 0; i < allList.Count; i++)
 		{
 			BattleObject bo = allList[i];
@@ -366,12 +393,12 @@
 			{
 				bo.layerMgr.SetFront();
 				bo.heroInfoBar.SetActive(true);
-				bo.heroRectTrans.SetParent(battleField.battleRootNode.skillFrontNode, true);
+				// bo.heroRectTrans.SetParent(battleField.battleRootNode.skillFrontNode, true);
 			}
 			else
 			{
 				bo.layerMgr.SetBack();
-				bo.heroRectTrans.SetParent(battleField.battleRootNode.skillBackNode, true);
+				// bo.heroRectTrans.SetParent(battleField.battleRootNode.skillBackNode, true);
 			}
 
 			if (targetList.Contains(bo))
@@ -384,10 +411,9 @@
 			}
 		}
 
-		caster.layerMgr.SetSortingOrder(BattleConst.ActiveHeroActionSortingOrder);
 
 		battleField.battleRootNode.skillMaskNode.SetActive(true);
-
+		battleField.battleRootNode.SetSortingOrder();
 		// caster.battleField.skillMask
 		//	鎶婅繖浜汢O鍏ㄩ珮浜� 鎴栬�呰鎶婇櫎浜嗚繖浜涚殑閮芥斁鍦ㄩ伄缃╁悗闈�
 		//	YYL TODO
@@ -434,13 +460,21 @@
 
 
 		//	TODO YYL AttackTypes  瑕佽〃鐜版垚浠�涔堟牱鍛紵 鏀寔澶氱绫诲瀷骞跺瓨锛屽鏃犺闃插尽涓旀毚鍑诲悓鏃惰鏍兼尅锛屼簩杩涘埗鎴栬繍绠楁渶缁堝�硷紱0-澶辫触锛�1-鏅�氾紱2-鍥炶锛�5-鏍兼尅锛�6-鏃犺闃插尽锛�7-鏆村嚮锛�9-闂伩
-		target.Hurt(damageList, totalDamage, hurt, skillConfig);
+
+
+		int objID = (int)target.ObjID;
+		tempDropList.TryGetValue(objID, out BattleDrops battleDrops);
+		tempDeadPackList.TryGetValue(objID, out HB422_tagMCTurnFightObjDead deadPack);
+		target.Hurt(damageList, totalDamage, hurt, skillConfig, _hitIndex, battleDrops, deadPack);
 
 		//	TODO YYL 杩欓噷鏄鍋氱粺涓�璁$畻鍚庡啀hurt璺焥uckhp杩樻槸鎬庢牱
 		caster.SuckHp(hurt.SuckHP, skillConfig);//	鍚歌
 		caster.HurtByReflect(hurt.BounceHP, skillConfig);// 鍙嶅脊浼ゅ
 	}
 
+	private Dictionary<int, BattleDrops> tempDropList = new Dictionary<int, BattleDrops>();
+
+	private Dictionary<int, HB422_tagMCTurnFightObjDead> tempDeadPackList = new Dictionary<int, HB422_tagMCTurnFightObjDead>();
 
 	protected void HandleDead()
 	{
@@ -489,17 +523,17 @@
 				dropItemPackIndex = itemModelDropsIndexList,
 				expDrops = expAssign[i]
 			};
-			deadTarget.PushDropItems(battleDrops);
+
+			tempDropList.Add((int)deadPackList[i].ObjID, battleDrops);
+			// deadTarget.PushDropItems(battleDrops);
 		}
 
-		// 鍒嗗彂姝讳骸鍖�
-
-		battleField.OnObjsDead(new List<HB422_tagMCTurnFightObjDead>(deadPackList));
+		// battleField.OnObjsDead(new List<HB422_tagMCTurnFightObjDead>(deadPackList));
 		foreach (var deadPack in deadPackList)
 		{
+			tempDeadPackList.Add((int)deadPack.ObjID, deadPack);
 			packList.Remove(deadPack);
 		}
-		deadPackList.Clear();
 	}
 
 
@@ -604,11 +638,22 @@
 	}
 	public virtual bool IsFinished()
 	{
+		if (!isPlay)
+		{
+			return false;
+		}
+
 		if (skillEffect != null)
 		{
 			if (!skillEffect.IsFinished())
 			{
 				return false;
+			}
+			else
+			{
+				skillEffect = null;
+				OnSkillFinished();	
+				return false;		
 			}
 		}
 
@@ -618,19 +663,22 @@
 			{
 				return false;
 			}
+			else
+			{
+				otherSkillAction = null;
+				OnSkillFinished();
+				return false;
+			}
 		}
+
 
 		if (isFinished && moveFinished)
 		{
-			List<BattleObject> allList = battleField.battleObjMgr.allBattleObjDict.Values.ToList<BattleObject>();
-			for (int i = 0; i < allList.Count; i++)
+			if (packList.Count > 0)
 			{
-				BattleObject bo = allList[i];
-				bo.layerMgr.SetFront();
-				bo.heroRectTrans.SetParent(battleField.GetTeamNode(bo.Camp, bo.teamHero.positionNum), true);
-				bo.heroInfoBar.SetActive(true);
+				OnSkillFinished();
+				return false;
 			}
-			battleField.battleRootNode.skillMaskNode.SetActive(false);
 
 			return true;
 		}
@@ -643,8 +691,14 @@
 	public virtual void ForceFinished()
 	{
 		skillEffect?.ForceFinished();
+		if (otherSkillAction != null)
+		{
+			otherSkillAction.ForceFinish();
+			otherSkillAction = null;
+		}
 		isFinished = true;
 		moveFinished = true;
+		isPlay = true;
 
 		while (packList.Count > 0)
 		{
@@ -655,18 +709,16 @@
 			{
 				if (combinePack.startTag.Tag.StartsWith("Skill_"))
 				{
-					BattleDebug.LogError("other skill casting " + combinePack.startTag.Tag);
 					otherSkillAction = combinePack.CreateSkillAction();
-
+					otherSkillAction.fromSkillId = skillConfig.SkillID;
 					//	寮哄埗缁撴潫鍏朵粬鎶�鑳�
 					otherSkillAction.ForceFinish();
-					return;
+					continue;
 				}
 			}
 			else if (pack is CustomB421ActionPack actionPack)
 			{
 				actionPack.Distribute();
-				return;
 			}
 			PackageRegedit.Distribute(pack);
 		}
@@ -679,6 +731,25 @@
 			if (!skillEffect.IsFinished())
 			{
 				return;
+			}
+			else
+			{
+				skillEffect = null;
+				OnSkillFinished();
+			}
+			
+		}
+
+		if (otherSkillAction != null)
+		{
+			if (!otherSkillAction.IsFinished())
+			{
+				return;
+			}
+			else
+			{
+				otherSkillAction = null;
+				OnSkillFinished();
 			}
 		}
 
@@ -701,8 +772,9 @@
 			else if (pack is CustomB421ActionPack actionPack)
 			{
 				actionPack.Distribute();
-				return;
 			}
+
+			// Debug.LogError("Distribute pack " + pack.GetType().ToString());
 			PackageRegedit.Distribute(pack);
 		}
 

--
Gitblit v1.8.0