public static Hero GetRoleHero(this Clan clan, SkillEffect.PerkRole role) { foreach (var hero in clan.Heroes) { var heroParty = hero.PartyBelongedTo; if (heroParty != null && heroParty.GetHeroPerkRole(hero) == role) { return(hero); } foreach (var partyBase in hero.OwnedParties) { var party = partyBase.MobileParty; if (party != null && party?.GetHeroPerkRole(hero) == role) { return(hero); } } } return(null); }
public static Hero GetClanRoleHero(this Hero hero, SkillEffect.PerkRole role) => GetRoleHero(hero.Clan, role);