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)); }
public override int GetEquippedBadgeCount(BadgeGlobals.BadgeTypes badgeType) { if (HeldCollectible?.CollectibleType == Enumerations.CollectibleTypes.Badge) { Badge heldBadge = (Badge)HeldCollectible; if (heldBadge.BadgeType == badgeType && (heldBadge.AffectedType == BadgeGlobals.AffectedTypes.Self || heldBadge.AffectedType == BadgeGlobals.AffectedTypes.Both)) { return(1); } } return(0); }
public TacticsSubMenu() { Position = new Vector2(230, 150); BattleEntity entity = BattleManager.Instance.EntityTurn; //int quickChangeCount = entity.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.QuickChange); //Enumerations.CostDisplayTypes costDisplayType = Enumerations.CostDisplayTypes.Shown; //if (quickChangeCount > 0) costDisplayType = Enumerations.CostDisplayTypes.Special; BattleActions.Add(new MenuAction("Change Partner", null, "Change your current partner.", //costDisplayType, new ChangePartnerSubMenu())); #region Charge Menu BadgeGlobals.BadgeTypes chargeBadgeType = BadgeGlobals.BadgeTypes.Charge; //Check for a Player; if the Player is a Partner, check the number of Charge P's instead if (entity.EntityType == Enumerations.EntityTypes.Player) { BattlePlayer player = (BattlePlayer)entity; if (player.PlayerType == Enumerations.PlayerTypes.Partner) { chargeBadgeType = BadgeGlobals.BadgeTypes.ChargeP; } } //Charge action if the Charge or Charge P Badge is equipped int chargeCount = entity.GetEquippedBadgeCount(chargeBadgeType); if (chargeCount > 0) { //Charge starts out at 2 then increases by 1 for each additional Badge int chargeAmount = 2 + (chargeCount - 1); BattleActions.Add(new MoveAction("Charge", new MoveActionData(null, "Save up strength to power up your next attack", Enumerations.MoveResourceTypes.FP, chargeCount, Enumerations.CostDisplayTypes.Shown, Enumerations.MoveAffectionTypes.None, TargetSelectionMenu.EntitySelectionType.Single, false, null), new ChargeSequence(null, chargeAmount))); } #endregion //Defend action BattleActions.Add(new Defend()); //Do nothing action BattleActions.Add(new NoAction()); }
/// <summary> /// Gets the number of Badges of a particular BadgeType 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 BadgeType that a set of BattleEntities have equipped.</returns> public static int GetCombinedEquippedBadgeCount(IList <BattleEntity> party, BadgeGlobals.BadgeTypes badgeType) { if (party == null || party.Count == 0) { return(0); } int count = 0; //Check the Badge count for each party for (int i = 0; i < party.Count; i++) { count += party[i].GetEquippedBadgeCount(badgeType); } return(count); }
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); }
/// <summary> /// Gets the number of Badges of a particular BadgeType that the BattleEntity has equipped. /// </summary> /// <param name="badgeType">The BadgeType to check for.</param> /// <returns>The number of Badges of the BadgeType that the BattleEntity has equipped.</returns> public abstract int GetEquippedBadgeCount(BadgeGlobals.BadgeTypes badgeType);