yyl
3 天以前 9424aabcb70374223a621eab120e9098cc36edc9
125 战斗 反伤 飘血 掉落表现消失问题修复
6个文件已修改
117 ■■■■■ 已修改文件
Main/System/Battle/BattleHUDWin.cs 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/BattleObject/BattleObject.cs 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/Define/BattleDmgInfo.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/Skill/SkillBase.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/UIComp/BattleHeroInfoBar.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/UIComp/DamageContent.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/BattleHUDWin.cs
@@ -95,6 +95,59 @@
    private void OnDamageTaken(BattleDmgInfo damageInfo)
    {
        SetTargetDamage(damageInfo);
        SetSelfDamage(damageInfo);
    }
    private void SetSelfDamage(BattleDmgInfo damageInfo)
    {
        if (damageInfo.casterDamageList.Count > 0)
        {
            GameObject damageContent = damagePrefabPool.Request();
            DamageContent content = damageContent.GetComponent<DamageContent>();
            damageContent.transform.SetParent(damageNode, false);
            var heroRect = damageInfo.casterObj.heroRectTrans;
            if (heroRect == null)
            {
                damagePrefabPool.Release(damageContent);
                return;
            }
            var contentRect = content.GetComponent<RectTransform>();
            var contentParentRect = contentRect.parent as RectTransform;
            // 获取 heroRect 的世界坐标(锚点为中心)
            Vector3 worldTargetPos = heroRect.transform.TransformPoint(heroRect.rect.center);
            // 转换到 content 父节点下的 anchoredPosition
            Vector2 anchoredPos;
            RectTransformUtility.ScreenPointToLocalPointInRectangle(
                contentParentRect,
                RectTransformUtility.WorldToScreenPoint(null, worldTargetPos),
                null,
                out anchoredPos);
            // 设置动态位置(会覆盖配置中的位置)
            Vector2 beginPos = anchoredPos;
            Vector2 endPos = anchoredPos + new Vector2(0, 150);
            content.SetPosition(beginPos, endPos);
            // 设置速度比例
            if (battleField != null)
            {
                content.SetRatio(battleField.speedRatio, 1f);
            }
            content.SetDamage(damageInfo, damageInfo.casterDamageList, () => RemoveDamageContent(content));
            damageContentList.Add(content);
        }
    }
    private void SetTargetDamage(BattleDmgInfo damageInfo)
    {
        if (damageInfo.targetDamageList.Count > 0)
        {
        GameObject damageContent = damagePrefabPool.Request();
        DamageContent content = damageContent.GetComponent<DamageContent>();
        damageContent.transform.SetParent(damageNode, false);
@@ -131,10 +184,10 @@
            content.SetRatio(battleField.speedRatio, 1f);
        }
        // 设置伤害数据并开始播放
        content.SetDamage(damageInfo, () => RemoveDamageContent(content));
            content.SetDamage(damageInfo, damageInfo.targetDamageList, () => RemoveDamageContent(content));
        damageContentList.Add(content);
    }
    }
    public void SetBattleField(BattleField _battleField)
    {
Main/System/Battle/BattleObject/BattleObject.cs
@@ -48,7 +48,7 @@
        private set;
    }
    protected BattleDrops battleDrops;
    protected BattleDrops m_battleDrops;
    private RectTransform m_heroRectTrans;
@@ -319,9 +319,9 @@
        if (isFatalAttack)
        {
            if (null != battleDrops)
            if (null != battleHurtParam.battleDrops)
            {
                PushDropItems(battleDrops);
                PushDropItems(battleHurtParam.battleDrops);
            }
            battleField.OnObjsDead(new List<HB422_tagMCTurnFightObjDead>() { battleHurtParam.deadPack });
            
@@ -344,16 +344,6 @@
            }
        }
    }
    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);
    }
@@ -460,21 +450,21 @@
    public void PushDropItems(BattleDrops _battleDrops)
    {
        battleDrops = _battleDrops;
        m_battleDrops = _battleDrops;
    }
    public void PerformDrop()
    {
        if (null == battleDrops || battleDrops.dropItemPackIndex.Count == 0)
        if (null == m_battleDrops || m_battleDrops.dropItemPackIndex.Count == 0)
            return;
        EventBroadcast.Instance.Broadcast<string, BattleDrops, Action>(
            EventName.BATTLE_DROP_ITEMS, battleField.guid, battleDrops, OnPerformDropFinish);
            EventName.BATTLE_DROP_ITEMS, battleField.guid, m_battleDrops, OnPerformDropFinish);
    }
    protected void OnPerformDropFinish()
    {
        battleDrops = null;
        m_battleDrops = null;
    }
    public void SetBack()
Main/System/Battle/Define/BattleDmgInfo.cs
@@ -21,6 +21,8 @@
    public List<long> damageList { get { return battleHurtParam.damageList; } }
    public BattleObject hurtObj { get { return battleHurtParam.hurtObj; } }
    public BattleObject casterObj { get { return battleHurtParam.casterObj; } }
    public HB427_tagSCUseSkill.tagSCUseSkillHurt hurt { get { return battleHurtParam.hurt; } }
    public SkillConfig skillConfig { get { return battleHurtParam.skillConfig; } }
@@ -30,7 +32,9 @@
    public bool isLastHit = false;
    public List<BattleDmg> battleDamageList = new List<BattleDmg>();
    public List<BattleDmg> targetDamageList = new List<BattleDmg>();
    public List<BattleDmg> casterDamageList = new List<BattleDmg>();
    public BattleDmgInfo(string battleFieldGuid, BattleHurtParam battleHurtParam)
    {
@@ -72,7 +76,7 @@
                long reflectHp = battleHurtParam.reflectHpList[i];
                if (reflectHp > 0)
                {
                    battleDamageList.Add(new BattleDmg
                    casterDamageList.Add(new BattleDmg
                    { 
                        damage = reflectHp, 
                        attackType = (int)DamageType.Reflect 
@@ -86,7 +90,7 @@
                long suckHp = battleHurtParam.suckHpList[i];
                if (suckHp > 0)
                {
                    battleDamageList.Add(new BattleDmg
                    casterDamageList.Add(new BattleDmg
                    { 
                        damage = suckHp, 
                        attackType = (int)DamageType.SuckHP 
@@ -104,13 +108,13 @@
                // 计算格挡伤害
                long totalDamage = (long)(actualDamage / (1 - blockRatio));
                long blockDmg = totalDamage - actualDamage;
                battleDamageList.Add(new BattleDmg { damage = blockDmg, attackType = (int)DamageType.Block });
                targetDamageList.Add(new BattleDmg { damage = blockDmg, attackType = (int)DamageType.Block });
                // 真实伤害特殊处理
                if (IsRealdamage())
                {
                    int showAttackType = (int)DamageType.Realdamage + (IsCrit() ? (int)DamageType.Crit : 0);
                    battleDamageList.Add(new BattleDmg { damage = actualDamage, attackType = showAttackType });
                    targetDamageList.Add(new BattleDmg { damage = actualDamage, attackType = showAttackType });
                }
                else
                {
@@ -125,7 +129,7 @@
                        else
                            UnityEngine.Debug.LogError($"强制转换失败,该类型不是治疗也不是伤害 {attackType}");
                    }
                    battleDamageList.Add(new BattleDmg { damage = actualDamage, attackType = attackType });
                    targetDamageList.Add(new BattleDmg { damage = actualDamage, attackType = attackType });
                }
            }
            else
@@ -136,7 +140,7 @@
                if (IsRealdamage())
                {
                    int showAttackType = (int)DamageType.Realdamage + (IsCrit() ? (int)DamageType.Crit : 0);
                    battleDamageList.Add(new BattleDmg { damage = actualDamage, attackType = showAttackType });
                    targetDamageList.Add(new BattleDmg { damage = actualDamage, attackType = showAttackType });
                }
                else
                {
@@ -151,7 +155,7 @@
                        else
                            UnityEngine.Debug.LogError($"强制转换失败,该类型不是治疗也不是伤害 {attackType}");
                    }
                    battleDamageList.Add(new BattleDmg { damage = actualDamage, attackType = attackType });
                    targetDamageList.Add(new BattleDmg { damage = actualDamage, attackType = attackType });
                }
            }
        }
Main/System/Battle/Skill/SkillBase.cs
@@ -475,7 +475,7 @@
        List<long> suckHpList = BattleUtility.DivideDamageToList(skillConfig.DamageDivide, _hitIndex, suckHp);
        List<long> reflectHpList = BattleUtility.DivideDamageToList(skillConfig.DamageDivide, _hitIndex, hurt.BounceHP);
        List<long> reflectHpList = BattleUtility.DivideDamageToList(skillConfig.DamageDivide, _hitIndex, reflectHp);
        // long currentSuckHp = suckHp / tagUseSkillAttack.HurtCount;
        // 计算当前这一击的实际伤害(所有分段伤害之和)
@@ -497,7 +497,7 @@
            currentHitReflectHp += reflect;
        }
        long toHp = Math.Max(0, fromHp - currentHitDamage + currentHitSuckHp - currentHitReflectHp);
        long toHp = Math.Max(0, fromHp - currentHitDamage);
        // 更新目标血量
@@ -512,7 +512,8 @@
            $"伤害: {currentHitDamage} (总伤害: {totalDamage})\n" +
            $"吸血: {currentHitSuckHp}\n" +
            $"反伤: {currentHitReflectHp}\n" +
            $"血量变化: {fromHp} -> {toHp}"
            $"血量变化: {fromHp} -> {toHp}\n" +
            $"技能包里的血量是: {GeneralDefine.GetFactValue(hurt.CurHP, hurt.CurHPEx)}\n"
        );
#endif
Main/System/Battle/UIComp/BattleHeroInfoBar.cs
@@ -179,7 +179,7 @@
        if (tween)
        {
            // 同样的修复
            sliderXp.value = fromValue;  // ← 这行是关键!
            sliderXp.value = fromValue;
            xpTween = sliderXp.DOValue(targetValue, 0.2f).SetAutoKill(false);
            battleObject.battleField.battleTweenMgr.OnPlayTween(xpTween);
        }
Main/System/Battle/UIComp/DamageContent.cs
@@ -51,12 +51,9 @@
        controller?.SetRuntimePosition(beginPos, endPos);
    }
    public async void SetDamage(BattleDmgInfo _damageInfo, Action _onComplete)
    public async void SetDamage(BattleDmgInfo _battleDmgInfo, List<BattleDmg> damages, Action _onComplete)
    {
        battleDmgInfo = _damageInfo;
        var damages = battleDmgInfo.battleDamageList;
        battleDmgInfo = _battleDmgInfo;
        for (int i = damages.Count; i < damageLineList.Count; i++)
        {
            damageLineList[i].SetActive(false);