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
 
 
 
using System.Collections.Generic;
using System.Linq;
 
public partial class HeroInfo
{
    //  羁绊配置
    public HeroFetterConfig fetterConfig;
 
 
    public List<int> GetActiveFetter(HeroConfig config, TeamBase teamBase)
    {
        List<int> list = new List<int>();
        if (config.FetterIDList.Length == 0)
            return list;
 
        foreach (var fetterID in config.FetterIDList)
        {
            HeroFetterConfig fetterConfig = HeroFetterConfig.Get(fetterID);
            int count = 0;
            for (int i = 0; i < teamBase.tempHeroes.Length; i++)
            {
                TeamHero teamHero = teamBase.tempHeroes[i];
 
                if (null == teamHero)
                    continue;
 
                if (fetterConfig.HeroIDList.Contains(teamHero.heroId))
                {
                    count++;
                }
                if (count >= fetterConfig.HeroIDList.Length)
                {
                    list.Add(fetterID);
                    break;
                }
            }
        }
 
        return list;
    }
}