public sealed override int GetEquippedBadgeCount(BadgeGlobals.BadgeTypes badgeType)
        {
            //NOTE: This isn't entity-specific right now, so it technically doesn't work properly.
            //For example, if a Partner had Mario's Jump, it could use Power Bounce if Mario had
            //the Badge equipped even if the Partner didn't.

            //NOTE 2: The problem is that all Active Badges are in the same list, and it's impossible
            //to differentiate Badges that only affect Mario from ones that affect both Mario and his Partner
            //without finding the Badge first. I feel there needs to be a new approach to how this is handled.

            BadgeGlobals.BadgeTypes newBadgeType = badgeType;

            //Find the non-Partner version of the Badge
            BadgeGlobals.BadgeTypes?tempBadgeType = BadgeGlobals.GetNonPartnerBadgeType(badgeType);
            if (tempBadgeType != null)
            {
                newBadgeType = tempBadgeType.Value;
            }
            else
            {
                //If there is no non-Partner version, get the Badge and check if it affects Mario
                Badge badge = Inventory.Instance.GetBadge(newBadgeType, BadgeGlobals.BadgeFilterType.Equipped);
                //If the Badge isn't equipped or doesn't affect Both or Mario, none are equipped to Mario
                if (badge == null || badge.AffectedType == BadgeGlobals.AffectedTypes.Partner)
                {
                    return(0);
                }
            }

            return(Inventory.Instance.GetActiveBadgeCount(newBadgeType));
        }
예제 #2
0
        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));
        }
예제 #3
0
        /// <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);
        }