public sealed override int GetEquippedBadgeCount(BadgeGlobals.BadgeTypes badgeType) { BadgeGlobals.BadgeTypes newBadgeType = badgeType; //Find the Partner version of the Badge BadgeGlobals.BadgeTypes?tempBadgeType = BadgeGlobals.GetPartnerBadgeType(badgeType); if (tempBadgeType != null) { newBadgeType = tempBadgeType.Value; } else { //If there is no Partner version, get the Badge and check if it affects Partners Badge badge = Inventory.Instance.GetBadge(newBadgeType, BadgeGlobals.BadgeFilterType.Equipped); //If the Badge isn't equipped or doesn't affect Both or the Partner, none are equipped to this Partner if (badge == null || badge.AffectedType == BadgeGlobals.AffectedTypes.Self) { return(0); } } return(Inventory.Instance.GetActiveBadgeCount(newBadgeType)); }
/// <summary> /// Gets the number of Badges of a particular BadgeType, for both its Partner and Non-Partner versions, that a set of BattleEntities have equipped. /// </summary> /// <param name="battleEntity"></param> /// <param name="badgeType">The BadgeType to check for.</param> /// <returns>The total number of Badges of the Partner and Non-Partner versions of the BadgeType that a set of BattleEntities have equipped.</returns> public static int GetCombinedEquippedNPBadgeCount(IList <BattleEntity> party, BadgeGlobals.BadgeTypes badgeType) { if (party == null || party.Count == 0) { return(0); } BadgeGlobals.BadgeTypes?npBadgeType = BadgeGlobals.GetNonPartnerBadgeType(badgeType); BadgeGlobals.BadgeTypes?pBadgeType = BadgeGlobals.GetPartnerBadgeType(badgeType); int count = 0; if (npBadgeType != null) { count += GetCombinedEquippedBadgeCount(party, npBadgeType.Value); } if (pBadgeType != null) { count += GetCombinedEquippedBadgeCount(party, pBadgeType.Value); } return(count); }