From 2d49ec4f87de5fdedcac25a2bd45c97a0c332a04 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 28 十月 2025 11:47:35 +0800
Subject: [PATCH] 0312 输出战斗日志,分析自动战斗不能攻击的问题

---
 Main/System/Battle/BattleObject/BattleObject.cs |   92 ++++++++++++++++++++++++++++++++++++----------
 1 files changed, 72 insertions(+), 20 deletions(-)

diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index c686fea..5b1aa1f 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -83,7 +83,7 @@
         teamHero = _teamHero;
         Camp = _camp;
         motionBase = new MotionBase();
-        motionBase.Init(heroGo.GetComponentInChildren<SkeletonGraphic>(true));
+        motionBase.Init(heroGo.GetComponentInChildren<SkeletonAnimation>(true));
         buffMgr = new BattleObjectBuffMgr();
         buffMgr.Init(this);
 
@@ -127,6 +127,8 @@
 
         motionBase.Release();
         motionBase = null;
+        buffMgr.Release();
+        buffMgr = null;
         teamHero = null;
         ObjID = 0;
 
@@ -268,33 +270,87 @@
         return true;
     }
 
-    public virtual void Hurt(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig)
+    public virtual void Hurt(List<long> damageValues, long _totalDamage,
+        HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig, int hitIndex,
+        BattleDrops battleDrops, HB422_tagMCTurnFightObjDead deadPack)
     {
-        BattleDmgInfo dmgInfo = PopDamage(damageValues, _totalDamage, hurt, skillConfig);
+        bool isLastHit = hitIndex >= skillConfig.DamageDivide.Length - 1;
+        bool firstHit = hitIndex == 0;
+        BattleDmgInfo dmgInfo = PopDamage(damageValues, _totalDamage, hurt, skillConfig, isLastHit);
 
-        if (dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsRealdamage())
+
+        //  杩欓噷
+        if (dmgInfo.IsType(DamageType.Dodge))
         {
-            motionBase.PlayAnimation(MotionName.hit, false);
+            if (isLastHit)
+            {
+                DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this);
+                battleField.recordPlayer.InsertRecord(dodgeFinish);
+            }
+
+            if (firstHit)
+            {
+                OnDodgeBegin();
+            }
         }
+
+
+
+        bool isFatalAttack = (null != deadPack) && isLastHit;
+
+        if (isFatalAttack)
+        {
+            if (null != battleDrops)
+            {
+                PushDropItems(battleDrops);
+            }
+            battleField.OnObjsDead(new List<HB422_tagMCTurnFightObjDead>() { deadPack });
+            
+        }
+        else
+        {
+            if (dmgInfo.IsType(DamageType.Block))
+            {
+                battleField.battleEffectMgr.PlayEffect(this, 19999, heroRectTrans, Camp);
+            }
+            else
+            {
+                if ((dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsRealdamage()))
+                {
+                    motionBase.PlayAnimation(MotionName.hit, false);
+                }
+            }
+
+        }
+
+
     }
 
     public void SuckHp(uint suckHP, SkillConfig skillConfig)
     {
-
+        teamHero.curHp = Math.Min(teamHero.maxHp, teamHero.curHp + (int)suckHP);
     }
 
     public void HurtByReflect(uint bounceHP, SkillConfig skillConfig)
     {
-
+        teamHero.curHp = Math.Max(0, teamHero.curHp - (int)bounceHP);
     }
 
+
+    const float pingpongTime = 0.4f;
     //  闂伩寮�濮�
     public virtual void OnDodgeBegin()
     {
-        float pingpongTime = 0.2f;
         RectTransform rectTrans = heroRectTrans;
         var tween = rectTrans.DOAnchorPos(new Vector3(-30, 0, 0), pingpongTime)
             .SetEase(Ease.OutCubic);
+
+        motionBase.ShowIllusionShadow(true);
+
+        tween.onComplete += () =>
+        {
+            motionBase.ShowIllusionShadow(false);
+        };
 
         battleField.battleTweenMgr.OnPlayTween(tween);
     }
@@ -302,7 +358,6 @@
     //  闂伩缁撴潫
     public virtual void OnDodgeEnd(Action _complete = null)
     {
-        float pingpongTime = 0.2f;
         RectTransform rectTrans = heroRectTrans;
 
         var tween = rectTrans.DOAnchorPos(Vector3.zero, pingpongTime)
@@ -343,16 +398,9 @@
     }
 
     // 浼ゅ杩樿鐪� 鏄惁闂伩 鏆村嚮 and so on 闇�瑕佹湁涓�涓狣amageType 鏈嶅姟鍣ㄥ簲璇ヤ細缁�
-    protected virtual BattleDmgInfo PopDamage(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig)
+    protected virtual BattleDmgInfo PopDamage(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig, bool isLastHit)
     {
-        BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, hurt, skillConfig);
-
-        if (battleDmgInfo.IsType(DamageType.Dodge))
-        {
-            OnDodgeBegin();
-            DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this);
-            battleField.recordPlayer.InsertRecord(dodgeFinish);
-        }
+        BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, hurt, skillConfig, isLastHit);
 
         int currentHurtHp = 0;
         for (int i = 0; i < damageValues.Count; i++)
@@ -360,8 +408,12 @@
             currentHurtHp += (int)damageValues[i];
         }
 
-        heroInfoBar.UpdateHP(teamHero.curHp, Math.Max(0, teamHero.curHp - currentHurtHp), teamHero.maxHp);
-        teamHero.curHp = Math.Max(0, teamHero.curHp - currentHurtHp);
+        bool isRecovery = battleDmgInfo.IsType(DamageType.Recovery);
+
+        long toHp = Math.Max(0, teamHero.curHp + (isRecovery ? currentHurtHp : -currentHurtHp));
+
+        heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp);
+        teamHero.curHp = toHp;
 
         // YYL TODO 鏄惁闇�瑕佹寕鍦ㄥ湪鑷韩鐨刦ollow鐐逛笂
         EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);

--
Gitblit v1.8.0