hch
7 天以前 45ecc7fb322b2555d5660b7b0c516cb0bbf29e24
0312 修复武将最后一个潜能没有计算的问题
2个文件已修改
49 ■■■■■ 已修改文件
Main/System/Hero/HeroInfo.Break.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Main/FightPowerManager.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Hero/HeroInfo.Break.cs
@@ -27,7 +27,7 @@
    public void RefreshBreakAttr()
    {
        breakAttrs.Clear();
        for (int i = 0; i < breakLevel; i++)
        for (int i = 0; i <= breakLevel; i++)
        {
            var tmpBreakConfig = HeroBreakConfig.GetHeroBreakConfig(heroId, i);
            if (tmpBreakConfig == null)
Main/System/Main/FightPowerManager.cs
@@ -122,12 +122,15 @@
    /// <param name="ispreview">预览阵容战力</param>
    public void InitFightPowerParam(TeamType teamType = TeamType.Story, int dropindex = -1, bool ispreview = false)
    {
#if !UNITY_EDITOR
        openLog = false;
#endif
        teamTypeCalc = teamType;
        isPreviewTeamPower = ispreview;
        dropIndexCalc = dropindex;
#if UNITY_EDITOR
        // Debug.Log("战力:初始化参数 dropIndex:" + dropIndexCalc + " 阵型:" + teamTypeCalc + " ispreview:" + ispreview);
        FightPowerDebug("战力:初始化参数 dropIndex:" + dropIndexCalc + " 阵型:" + teamTypeCalc + " ispreview:" + ispreview);
#endif
    }
    #endregion
@@ -157,7 +160,7 @@
            lvAttrs[attrType] = GetPlayerLVValue(playerLVConfig, attrType);
        }
#if UNITY_EDITOR
        // Debug.Log("战力:等级属性 " + JsonMapper.ToJson(lvAttrs));
        FightPowerDebug("战力:等级属性 " + JsonMapper.ToJson(lvAttrs));
#endif
    }
@@ -191,7 +194,7 @@
            officialAttrs[id] = config.AddAttrNum[i];
        }
#if UNITY_EDITOR
        // Debug.Log("战力:官职属性 " + JsonMapper.ToJson(officialAttrs));
        FightPowerDebug("战力:官职属性 " + JsonMapper.ToJson(officialAttrs));
#endif
    }
@@ -251,7 +254,7 @@
        }
#if UNITY_EDITOR
        // Debug.Log("战力:装备属性 " + JsonMapper.ToJson(equipAttrs));
        FightPowerDebug("战力:装备属性 " + JsonMapper.ToJson(equipAttrs));
#endif
    }
@@ -268,7 +271,7 @@
        // 阵容:国家(光环)属性
        countryAttrs = HeroUIManager.Instance.GetCountryAttrs(teamTypeCalc, isPreviewTeamPower);
#if UNITY_EDITOR
        // Debug.Log("战力:国家(光环)属性 " + JsonMapper.ToJson(countryAttrs));
        FightPowerDebug("战力:国家(光环)属性 " + JsonMapper.ToJson(countryAttrs));
#endif
    }
@@ -346,9 +349,9 @@
        propertyVariables[HERO_LV_PER] = hero.GetHeroLVPer(attrType) / 10000.0f;
#if UNITY_EDITOR
        //排除值为0的属性输出
        // var tmpPropertyVariables = propertyVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value);
        // if (!tmpPropertyVariables.IsNullOrEmpty())
        //     propertyStrForDebug += $"属性ID {attrType} - {JsonMapper.ToJson(tmpPropertyVariables)}";
        var tmpPropertyVariables = propertyVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value);
        if (!tmpPropertyVariables.IsNullOrEmpty())
            propertyStrForDebug += $"属性ID {attrType} - {JsonMapper.ToJson(tmpPropertyVariables)}";
#endif
        if (type == 0)
            return FightPowerFormula.GetBaseAttr(propertyVariables);
@@ -413,7 +416,7 @@
    public long CalculatePower()
    {
#if UNITY_EDITOR
        // Debug.Log("战力:开始计算");
        FightPowerDebug("战力:开始计算");
#endif
        // --- 先计算所有功能的汇总属性 ---
        RefreshLVAttrs();
@@ -446,7 +449,7 @@
        }
// #if UNITY_EDITOR
//         Debug.Log("战力:计算完毕 " + fightPower);
         FightPowerDebug("战力:计算完毕 " + fightPower);
// #endif
        return fightPower;
    }
@@ -482,7 +485,7 @@
        }
#if UNITY_EDITOR
        // Debug.Log($"战力:武将ID {hero.heroId} 属性信息 {propertyStrForDebug}");
        FightPowerDebug($"战力:武将ID {hero.heroId} 属性信息 {propertyStrForDebug}");
#endif
        //属性系数根据官职等级的加成
@@ -535,9 +538,9 @@
        long fightPower = (long)FightPowerFormula.GetFightPower(fightPowerVariables);
#if UNITY_EDITOR
            //排除值为0的属性输出
            // var tmpFightPowerVariables = fightPowerVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value);
            // if (!tmpFightPowerVariables.IsNullOrEmpty())
            //     Debug.Log($"战力:武将ID {hero.heroId} 属性战力 {fightPower} 属性战力参数 {JsonMapper.ToJson(tmpFightPowerVariables)}");
            var tmpFightPowerVariables = fightPowerVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value);
            if (!tmpFightPowerVariables.IsNullOrEmpty())
                FightPowerDebug($"战力:武将ID {hero.heroId} 属性战力 {fightPower} 属性战力参数 {JsonMapper.ToJson(tmpFightPowerVariables)}");
#endif
        //加上技能战力
@@ -549,9 +552,9 @@
        long skillPower = (long)FightPowerFormula.GetSkillsFightPower(fightPowerVariables);
#if UNITY_EDITOR
            // Debug.Log($"战力:武将ID {hero.heroId} 技能战力 {skillPower} 技能参数 {JsonMapper.ToJson(fightPowerVariables)}");
            FightPowerDebug($"战力:武将ID {hero.heroId} 技能战力 {skillPower} 技能参数 {JsonMapper.ToJson(fightPowerVariables)}");
            // Debug.Log($"战力:武将ID {hero.heroId} 总战力 {fightPower + skillPower}");
            FightPowerDebug($"战力:武将ID {hero.heroId} 总战力 {fightPower + skillPower}");
#endif
            return fightPower + skillPower;
@@ -648,10 +651,20 @@
            }
        }
#if UNITY_EDITOR
        // Debug.Log($"战力:武将ID {hero.heroId} 属性信息 {propertyStrForDebug}");
        FightPowerDebug($"战力:武将ID {hero.heroId} 属性信息 {propertyStrForDebug}");
#endif
        return tmpAttrs;
    }
    bool openLog = true;
    void FightPowerDebug(string msg)
    {
#if UNITY_EDITOR
        if (!openLog) return;
        Debug.Log(msg);
        #endif
    }
}