yyl
2025-08-29 dbb4ea01211573e782666e45eb859c96859b2cd6
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
using System;
using System.Collections.Generic;
using System.Linq;
 
//武将天赋:升星获得天赋,可洗练
public partial class HeroInfo
{
 
    public int heroStar
    {
        get
        {
            if (itemHero == null)
                return 0;
            return itemHero.GetUseDataFirstValue(72);
        }
    }
    
    public List<HeroTalentInfo> talentList = new List<HeroTalentInfo>();
 
 
    Dictionary<int, int> talentAttrDic = new Dictionary<int, int>();   //属性ID : 天赋属性值
                                                                       // 71 # 英雄天赋ID列表
                                                                       // 73 # 英雄天赋ID等级列表,对应71天赋ID的等级
                                                                       // 75 # 英雄天赋洗炼锁定索引列表,对应71天赋ID索引
                                                                       // 77 # 英雄天赋洗炼随机ID列表
                                                                       // 79 # 英雄觉醒时随机天赋选项ID列表
    protected void RefreshTalentAttr()
    {
        // 71 # 英雄天赋ID列表
        List<int> talentIDList = itemHero.GetUseData(71);
        // // 73 # 英雄天赋ID等级列表,对应71天赋ID的等级
        List<int> talentLvList = itemHero.GetUseData(73);
        talentAttrDic.Clear();
 
        for (int i = 0; i < talentIDList.Count; i++)
        {
            if (talentIDList[i] == 0)
            {
                continue;
            }
            var config = HeroTalentConfig.Get(talentIDList[i]);
            if (!talentAttrDic.ContainsKey(config.AttrID))
            {
                //天赋属性,值*天赋等级
                talentAttrDic[config.AttrID] = config.AttrValue * talentLvList[i];
            }
            else
            { 
                talentAttrDic[config.AttrID] += config.AttrValue * talentLvList[i];
            }
        }
 
    }
 
    public int GetTalentAttrValue(int attrType)
    {
        int value = 0;
        talentAttrDic.TryGetValue(attrType, out value);
        return value;
    }
 
    public int GetTalentAttrPer(int attrType)
    { 
        if (PlayerPropertyConfig.baseAttr2perDict.ContainsKey(attrType))
        {
            var pertype = PlayerPropertyConfig.baseAttr2perDict[attrType];
            return talentAttrDic.ContainsKey(pertype) ? talentAttrDic[pertype] : 0;
        }
        return 0;
    }
 
}