yyl
13 小时以前 5d3366f2e0f687995eb7ad2107c4379fe7acd4e8
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
using System;
using System.Collections.Generic;
 
public class HeroFetterInfo
{
    private HeroInfo heroInfo;
    private int fetterId;
 
    public HeroFetterConfig fetterConfig;
 
    protected bool isActive = false;
 
    public HeroFetterInfo(HeroInfo _heroInfo, int _fetterId)
    {
        heroInfo = _heroInfo;
        fetterId = _fetterId;
 
        fetterConfig = HeroFetterConfig.Get(fetterId);
    }
 
    //    是否激活了羁绊
    public bool IsActiveFetter()
    {
        return isActive;
    }
 
    public void SetIsActiveFetter(TeamBase teamBase)
    {
        int fetterHeroCount = fetterConfig.HeroIDList.Length;
 
        int count = 0;
 
        for (int i = 0; i < teamBase.teamHeros.Length; i++)
        {
            TeamHero teamHero = teamBase.teamHeros[i];
 
            if (null == teamHero)
                continue;
 
            if (Array.IndexOf(fetterConfig.HeroIDList, teamHero.heroInfo.heroId) >= 0)
            {
                count++;
            }
        }
 
        isActive = (count >= fetterHeroCount);
    }
 
    public int GetFetterAttr(HeroAttrType attrType)
    {
        if (!isActive)
            return 0;
        
        return fetterConfig.GetFetterAttr(attrType);
    }
}