hch
2025-08-18 5c5a5cc66227439be7a7b61da5d1ff68cf187ac3
Main/System/Hero/HeroInfo.cs
@@ -9,7 +9,7 @@
    public int heroId;
    //  武将配置
    public HeroConfig heroConfig;
    public HeroConfig heroConfig { get; private set; }
    public ItemModel itemHero;  //引用背包里的 数据同步
    public HeroCountry heroCountry
@@ -20,7 +20,27 @@
        }
    }
    //  品质配置
    public HeroQualityConfig qualityConfig { get; private set; }
    public int Quality
    {
        get
        {
            return heroConfig.Quality;
        }
    }
    //  武将等级
    public int heroLevel
    {
        get
        {
            if (itemHero == null)
                return 0;
            return itemHero.GetUseDataFirstValue(70);
        }
    }
    // 优先功能提醒类型:1觉醒 2升级 3突破 4升星
    // 优先顺序:
    public int funcState
@@ -40,8 +60,8 @@
    }
    public List<HeroTalentInfo> talentList = new List<HeroTalentInfo>();
    //已学习的所有技能取最高级的技能
    Dictionary<int, int> allSkillTypeIDToID = new Dictionary<int, int>();  //技能类型ID:  最高技能ID
    public HeroInfo(ItemModel _itemHero)
@@ -49,17 +69,7 @@
        UpdateHero(_itemHero);
    }
#if UNITY_EDITOR
    public HeroInfo()
    {
        heroId = 520001; // 默认英雄ID
        heroConfig = HeroConfig.Get(heroId);
        qualityConfig = HeroQualityConfig.Get(Quality);
        qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, awakeLevel);
        CalculateProperties();
    }
#endif
    public void UpdateHero(ItemModel _itemHero)
@@ -68,28 +78,9 @@
        // HeroConfigUtility
        heroId = itemHero.config.ID;
        InitConfigs();
        // 71 # 英雄天赋ID列表
        // List<int> talentSkillList = itemHero.GetUseData(71);
        // // 73 # 英雄天赋ID等级列表,对应71天赋ID的等级
        // List<int> talentLvList = itemHero.GetUseData(73);
        // // 75 # 英雄天赋洗炼锁定索引列表,对应71天赋ID索引
        // List<int> talentLockList = itemHero.GetUseData(75);
        // if (talentLockList.Count != talentLvList.Count || talentLvList.Count != talentSkillList.Count)
        // {
        //     Debug.LogError("天赋ID列表及后续的数据数量没对上");
        // }
        // //  天赋
        // talentList.Clear();
        // for (int i = 0; i < talentSkillList.Count; i++)
        // {
        //     talentList.Add(new HeroTalentInfo(this, talentSkillList[i], talentLvList[i], talentLockList[i]));
        // }
        CalculateProperties();
        // //  羁绊
        // fetterInfoList.Clear();
        // for (int i = 0; i < heroConfig.FetterIDList.Length; i++)
@@ -97,8 +88,6 @@
        //     fetterInfoList.Add(new HeroFetterInfo(this, heroConfig.FetterIDList[i]));
        // }
        // 77 # 英雄天赋洗炼随机ID列表
        // 79 # 英雄觉醒时随机天赋选项ID列表
        // 80 # 主阵型上阵位置
    }
@@ -106,33 +95,34 @@
    {
        //  武将配置
        heroConfig = HeroConfig.Get(heroId);
        //  品质配置
        qualityConfig = HeroQualityConfig.Get(Quality);
        //  品质突破配置
        qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, breakLevel);
        breakConfig = HeroBreakConfig.GetHeroBreakConfig(heroId, breakLevel);
        awakeConfig = HeroAwakeConfig.GetHeroAwakeConfig(heroId, awakeLevel);
        qualityAwakeConfig = HeroQualityAwakeConfig.GetQualityAwakeConfig(Quality, awakeLevel);
    }
    public int GetInheritRate(HeroAttrType attrType)
    {
        return heroConfig.GetInheritPercent(attrType);
    }
    
    //是否上x阵 81 # 所在阵容信息列表 [阵容类型*10000+阵型类型*100+位置编号, ...]
    //是否上x阵 服务端队伍
    public bool IsInTeamByTeamType(TeamType teamType)
    {
        var list = itemHero.GetUseData(81);
        if (list != null && list.Count > 0)
        return TeamManager.Instance.GetTeam(teamType).HasHeroInServer(itemHero.guid);
    }
    public long GetSkillsFightPower()
        {
            var index = list.FindIndex((item) => item / 10000 == (int)teamType);
            if (index >= 0)
        long fightPower = 0;
        foreach (var skillID in allSkillTypeIDToID.Values)
            {
                return true;
            fightPower += SkillConfig.Get(skillID).FightPower;
            }
        return fightPower;
        }
        return false;
    }
}