hch
2026-01-26 aa84cb62bebb9c8a4e586bcc1ec28eb7a16a8860
Main/System/Battle/BattleObject/BattleObject.cs
@@ -72,6 +72,8 @@
    private List<HB405_tagMCAddExp> hB405_tagMCAddExps = new List<HB405_tagMCAddExp>();
    public BattleHeroInfoBar heroInfoBar;
    public bool isReborning = false;
    public BattleObject(BattleField _battleField)
    {
        battleField = _battleField;
@@ -177,13 +179,19 @@
        {
            case PlayerDataType.HP:
                long toHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
                heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp, false);
                if (!IsTianziBoss())
                {
                    heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp, false);
                }
                teamHero.curHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
                // Debug.LogError("OnObjInfoRefresh " + teamHero.curHp);
                break;
            case PlayerDataType.MaxHP:
                teamHero.maxHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
                heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false);
                if (!IsTianziBoss())
                {
                    heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false);
                }
                break;
            case PlayerDataType.XP:
                long toXp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
@@ -307,8 +315,9 @@
        return true;
    }
    public virtual void Hurt(BattleHurtParam battleHurtParam)
    public virtual DeathRecordAction Hurt(BattleHurtParam battleHurtParam, RecordAction _causingRecordAction = null)
    {
        DeathRecordAction recordAction = null;
        bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillConfig.DamageDivide.Length - 1;
        bool firstHit = battleHurtParam.hitIndex == 0;
        
@@ -327,6 +336,10 @@
            if (isLastHit)
            {
                DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this);
                // 【使用 BattleField.recordPlayer】
                // 原因:闪避完成动作是目标角色的独立行为,不是技能内部产生的
                // 虽然是在Hurt过程中触发,但是闪避动作本身是目标的反应,应该由主RecordPlayer管理
                // 使用InsertRecord可以插到队列最前面,保证闪避表现的优先级
                battleField.recordPlayer.InsertRecord(dodgeFinish);
            }
@@ -344,14 +357,14 @@
            {
                PushDropItems(battleHurtParam.battleDrops);
            }
            battleField.OnObjsDead(new List<HB422_tagMCTurnFightObjDead>() { battleHurtParam.deadPack });
            recordAction = battleField.OnObjsDead(new List<BattleDeadPack>() { battleHurtParam.deadPack }, _causingRecordAction);
        }
        else
        {
            if (dmgInfo.IsType(DamageType.Block))
            {
                battleField.battleEffectMgr.PlayEffect(this, BattleConst.BlockEffectID, heroRectTrans, Camp);
                battleField.battleEffectMgr.PlayEffect(this, BattleConst.BlockEffectID, heroRectTrans, Camp, teamHero.modelScale);
            }
            // else
            // {
@@ -359,13 +372,15 @@
            {
                if (!buffMgr.isControled[BattleConst.HardControlGroup])
                {
                    battleField.soundManager.PlayEffectSound(teamHero.heroConfig.HitSFX);
                    battleField.soundManager.PlayEffectSound(teamHero.heroConfig.HitSFX, false);
                    motionBase.PlayAnimation(MotionName.hit, false);
                }
            }
            // }
        }
        return recordAction;
    }
    /// <summary>
@@ -436,16 +451,29 @@
        battleField.battleTweenMgr.OnPlayTween(tween);
    }
    public virtual void OnDeath(Action _onDeathAnimationComplete)
    public virtual void OnDeath(Action _onDeathAnimationComplete, bool withoutAnime = false)
    {
        buffMgr.RemoveAllBuff();
        battleField.soundManager.PlayEffectSound(teamHero.heroConfig.DeathSFX);
        motionBase.PlayDeadAnimation(() =>
        battleField.soundManager.PlayEffectSound(teamHero.heroConfig.DeathSFX, false);
        if (withoutAnime)
        {
            teamHero.isDead = true;
            OnDeadAnimationComplete();
            SetDeath();
            _onDeathAnimationComplete?.Invoke();
        });
        }
        else
        {
            motionBase.PlayDeadAnimation(() =>
            {
                SetDeath();
                _onDeathAnimationComplete?.Invoke();
            });
        }
    }
    public void SetDeath()
    {
        teamHero.isDead = true;
        OnDeadAnimationComplete();
    }
    protected virtual void OnDeadAnimationComplete()
@@ -457,15 +485,35 @@
        buffMgr.RemoveAllBuff();
    }
    public void OnReborn(HB427_tagSCUseSkill.tagSCUseSkillHurt vNetData)
    //  释放者就是复活者时调用
    public void PreReborn(bool reviveSelf = false)
    {
        // 处理复活逻辑
        teamHero.curHp = GeneralDefine.GetFactValue(vNetData.CurHP, vNetData.CurHPEx);
        // Debug.LogError("OnReborn " + teamHero.curHp);
        teamHero.isDead = false;
        heroGo.SetActive(true);
        motionBase.ResetToIdleAnimation();
        motionBase.skeletonAnim.skeleton.A = 0f;
        motionBase.skeletonAnim.LateUpdate();
        heroRectTrans.anchoredPosition = Vector2.zero;
        motionBase.ResetForReborn(reviveSelf);
    }
    //  复活action
    public void OnReborn(HB427_tagSCUseSkill.tagSCUseSkillHurt vNetData, bool reviveSelf = false, RecordAction parentAction = null)
    {
        isReborning = true;
        heroGo.SetActive(true);
        motionBase.ResetForReborn(reviveSelf);
        heroRectTrans.anchoredPosition = Vector2.zero;
        motionBase.skeletonAnim.skeleton.A = 0f;
        motionBase.skeletonAnim.LateUpdate();
    }
    public void AfterReborn()
    {
        //  清空所有
        motionBase.ResetForReborn(false);
        isReborning = false;
    }
    // 伤害还要看 是否闪避 暴击 and so on 需要有一个DamageType 服务器应该会给
    protected virtual BattleDmgInfo PopDamage(BattleHurtParam battleHurtParam)
@@ -496,7 +544,7 @@
    protected virtual BattleDmgInfo PopDamageForCaster(BattleHurtParam battleHurtParam)
    {
        // 传入 isCasterView=true 表示这是施法者视角
        BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, battleHurtParam, isCasterView: true);
        BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, battleHurtParam, _isCasterView: true);
        
        BattleObject boss = battleField.FindBoss();
        if (boss != null && battleField.MapID == 30020 && boss.ObjID == this.ObjID)
@@ -535,8 +583,9 @@
        heroGo.SetActive(true);
        motionBase.HaveRest();
        heroRectTrans.anchoredPosition = Vector2.zero;
        heroInfoBar.HaveRest();
        isReborning = false;
        heroInfoBar.SetActive(false);
        SetFront();
    }
@@ -603,13 +652,20 @@
        {
            case PlayerDataType.HP:
                long toHp = GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx);
                heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp, true);
                bool isMinus = teamHero.curHp > toHp;
                if (!IsTianziBoss())
                {
                    heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp, false);
                }
                teamHero.curHp = newValue;
                // Debug.LogError("OnObjPropertyRefreshView " + teamHero.curHp);
                break;
            case PlayerDataType.MaxHP:
                teamHero.maxHp = newValue;
                heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, true);
                if (!IsTianziBoss())
                {
                    heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false);
                }
                break;
            case PlayerDataType.XP:
                long toXp = newValue;