hch
2025-07-23 2336d5e71a6ed9c00f9a86c29d7aa33b9a1e38d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
using System.Collections.Generic;
using UnityEngine;
using LitJson;
 
//  武将信息:实际获得的武将,不包含图鉴数据
public partial class HeroInfo
{
    //  武将配置表ID
    public int heroId;
 
    //  武将配置
    public HeroConfig heroConfig;
    public ItemModel itemHero;  //引用背包里的 数据同步
 
    public HeroCountry heroCountry
    {
        get
        {
            return (HeroCountry)heroConfig.Country;
        }
    }
 
 
    //是否主线上阵 81 # 所在阵容信息列表 [阵容类型*10000+阵型类型*100+位置编号, ...]
    public bool isInMainBattle
    {
        get
        {
            //从列表中找到 阵容为1的 主线阵容
            var list = itemHero.GetUseData(81);
            if (list != null && list.Count > 0)
            {
                var index = list.FindIndex((item) => item / 10000 == 1);
                if (index >= 0)
                {
                    return true;
                }
            }
            return false;
        }
    }
 
    // 优先功能提醒类型:1觉醒 2升级 3突破 4升星
    // 优先顺序:
    public int funcState
    {
        get
        {
            return 0;
        }
    }
 
    public bool isLock
    { 
        get
        {
            return itemHero.itemInfo.isLock;
        }
    }
 
 
 
    public List<HeroFetterInfo> fetterInfoList = new List<HeroFetterInfo>();
    public List<HeroTalentInfo> talentList = new List<HeroTalentInfo>();
 
 
    public HeroInfo(ItemModel _itemHero)
    {
        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)
    {
        itemHero = _itemHero;
        // 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]));
        // }
 
        // //  羁绊
        // fetterInfoList.Clear();
        // for (int i = 0; i < heroConfig.FetterIDList.Length; i++)
        // {
        //     fetterInfoList.Add(new HeroFetterInfo(this, heroConfig.FetterIDList[i]));
        // }
 
        // 77 # 英雄天赋洗炼随机ID列表
        // 79 # 英雄觉醒时随机天赋选项ID列表
        // 80 # 主阵型上阵位置
    }
 
    protected void InitConfigs()
    {
        //  武将配置
        heroConfig = HeroConfig.Get(heroId);
 
 
        //  品质配置
        qualityConfig = HeroQualityConfig.Get(Quality);
 
        //  品质突破配置
        qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, awakeLevel);
 
    }
 
    public int GetInheritRate(HeroAttrType attrType)
    {
        return heroConfig.GetInheritPercent(attrType);
    }
}