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);
|
}
|
}
|