protected override void OnStart()
        {
            base.OnStart();

            //Check if there is a BattleEntity behind the one eaten and if it can be hit by this move
            List <BattleEntity> behindEntities = new List <BattleEntity>();

            BattleManager.Instance.GetEntitiesBehind(behindEntities, EntitiesAffected[0]);
            BattleManager.Instance.FilterEntitiesByHeights(behindEntities, Action.MoveProperties.HeightsAffected);

            //Store the reference to the behind entity and tell it it's being targeted
            if (behindEntities.Count > 0)
            {
                BehindEntity = behindEntities[0];
                BehindEntity.TargetForMove(User);
            }
        }
        public RallyWinkAction(BattleEntity user) : base(user)
        {
            Name = "Rally Wink";

            MoveInfo = new MoveActionData(new CroppedTexture2D(AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"), new Rectangle(874, 75, 22, 22)),
                                          "Wink at Mario to give him the\ncourage for an extra attack.", MoveResourceTypes.FP, 4, CostDisplayTypes.Shown, MoveAffectionTypes.Ally,
                                          Enumerations.EntitySelectionType.Single, false, null, null);

            //Rally Wink has damage data for a failed Action Command
            //It's used to show the move is ineffective
            DamageInfo = new DamageData(0, Elements.Normal, false, ContactTypes.None, ContactProperties.Ranged, null, true, false,
                                        DefensiveActionTypes.Guard | DefensiveActionTypes.Superguard, DamageEffects.None);

            SetMoveSequence(new RallyWinkSequence(this));
            actionCommand = new RallyWinkCommand(MoveSequence, new Keys[] { Keys.Z, Keys.X }, 100d, 4000d, 1000d, 10d, .2d, new Vector2(200f, 1f),
                                                 new ActionCommandGlobals.BarRangeData(66f, 101f, 1, ActionCommand.CommandRank.Nice, Color.AliceBlue));
        }
        public QuakeHammerAction(BattleEntity user, int numBadges) : base(user)
        {
            Name = "Quake Hammer";

            MoveInfo = new MoveActionData(new CroppedTexture2D(AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"), new Rectangle(907, 102, 23, 24)),
                                          "Slightly damage all ground\nenemies.", MoveResourceTypes.FP, 3 /*2 FP in PM*/, CostDisplayTypes.Shown,
                                          MoveAffectionTypes.Other, Enumerations.EntitySelectionType.All, true,
                                          new HeightStates[] { HeightStates.Grounded, HeightStates.Ceiling }, User.GetOpposingEntityType());

            //Scale by the number of badges the move has
            int damage = BaseDamage + (DamageScalePerBadge * (numBadges - 1));

            DamageInfo = new DamageData(damage, Elements.Normal, true, ContactTypes.None, ContactProperties.Ranged, null, DamageEffects.FlipsShelled | DamageEffects.FlipsClefts);

            SetMoveSequence(new QuakeHammerSequence(this));
            actionCommand = new HammerCommand(MoveSequence, 4, 500d);
        }
        public GulpAction(BattleEntity user) : base(user)
        {
            Name = "Gulp";

            MoveInfo = new MoveActionData(new CroppedTexture2D(AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"), new Rectangle(874, 14, 22, 22)),
                                          string.Empty, Enumerations.MoveResourceTypes.FP, 4, Enumerations.CostDisplayTypes.Shown,
                                          Enumerations.MoveAffectionTypes.Other, Enumerations.EntitySelectionType.First, true,
                                          new Enumerations.HeightStates[] { Enumerations.HeightStates.Grounded, Enumerations.HeightStates.Hovering }, User.GetOpposingEntityType());

            DamageInfo = new DamageData(4, Enumerations.Elements.Gulp, true, Enumerations.ContactTypes.SideDirect, Enumerations.ContactProperties.WeaponDirect, null,
                                        Enumerations.DamageEffects.None);

            GulpSequence gulpSequence = new GulpSequence(this);

            SetMoveSequence(gulpSequence);
            actionCommand = new GulpCommand(MoveSequence, gulpSequence.WalkDuration / 2f, 500f, 1f, Microsoft.Xna.Framework.Input.Keys.Z);
        }
Beispiel #5
0
        protected override void EntityAdded(BattleEntity entity)
        {
            //If the entity is a light source, add it and re-handle the targets
            if (IsLightSource(entity) == true)
            {
                LightSources.Add(new LightSourceHolder(entity, GetLightRadius(entity)));

                RecalculateTargets();
            }
            //Otherwise, add it and re-handle the targets
            else
            {
                NonLightSources.Add(entity);

                RecalculateTargets();
            }
        }
Beispiel #6
0
 public InteractionParamHolder(BattleEntity attacker, BattleEntity victim, int damage, Enumerations.Elements element,
                               bool piercing, Enumerations.ContactTypes contactType, Enumerations.ContactProperties contactProperty,
                               StatusChanceHolder[] statuses, Enumerations.DamageEffects damageEffect, bool cantMiss,
                               Enumerations.DefensiveActionTypes defensiveOverride)
 {
     Attacker          = attacker;
     Victim            = victim;
     Damage            = damage;
     DamagingElement   = element;
     Piercing          = piercing;
     ContactType       = contactType;
     ContactProperty   = contactProperty;
     Statuses          = statuses;
     DamageEffect      = damageEffect;
     CantMiss          = cantMiss;
     DefensiveOverride = defensiveOverride;
 }
        public BombSquadAction(BattleEntity user, int bombCount, int bombDamage) : base(user)
        {
            Name = "Bomb Squad";

            BombCount  = bombCount;
            BombDamage = bombDamage;

            MoveInfo = new MoveActionData(new CroppedTexture2D(AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"), new Rectangle(874, 14, 22, 22)),
                                          "Throw three bombs that\nwill explode one turn later.", MoveResourceTypes.FP, 3,
                                          CostDisplayTypes.Shown, MoveAffectionTypes.Other, Enumerations.EntitySelectionType.All, false,
                                          new HeightStates[] { HeightStates.Grounded, HeightStates.Hovering, HeightStates.Airborne }, User.GetOpposingEntityType());

            DamageInfo = new DamageData(BombDamage, Elements.Explosion, false, ContactTypes.None, ContactProperties.Ranged, null, DamageEffects.None);

            SetMoveSequence(new BombSquadSequence(this, BombCount));

            actionCommand = new BombSquadCommand(MoveSequence, BombCount);
        }
        /// <summary>
        /// Gets a Partner's Danger status value based on its current HealthState.
        /// </summary>
        /// <param name="entity">A BattleEntity representing Mario's Partner.</param>
        /// <returns>A float of the Partner's Danger status value.</returns>
        private static float GetPartnerDangerStatusValue(BattleEntity entity)
        {
            Enumerations.HealthStates?partnerHealthState = entity?.HealthState;

            switch (partnerHealthState)
            {
            case Enumerations.HealthStates.Danger:
                return(PartnerDangerMod);

            case Enumerations.HealthStates.Peril:
            case Enumerations.HealthStates.Dead:
                return(PartnerPerilMod);

            case Enumerations.HealthStates.Normal:
            default:
                return(NormalMod);
            }
        }
        /// <summary>
        /// Gets Mario's Danger status value based on his current HealthState.
        /// </summary>
        /// <param name="entity">A BattleEntity representing Mario.</param>
        /// <returns>A float of Mario's Danger status value.</returns>
        private static float GetMarioDangerStatusValue(BattleEntity entity)
        {
            Enumerations.HealthStates?marioHealthState = entity?.HealthState;

            switch (marioHealthState)
            {
            case Enumerations.HealthStates.Danger:
                return(MarioDangerMod);

            case Enumerations.HealthStates.Peril:
            case Enumerations.HealthStates.Dead:
                return(MarioPerilMod);

            case Enumerations.HealthStates.Normal:
            default:
                return(NormalMod);
            }
        }
Beispiel #10
0
        public TattleAction(BattleEntity user, bool isGoombella) : base(user)
        {
            Name = "Tattle";

            MoveInfo = new MoveActionData(new CroppedTexture2D(AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"), new Rectangle(874, 14, 22, 22)),
                                          "View enemies' descriptions\nand see their HP in battle.", MoveResourceTypes.FP, 0,
                                          CostDisplayTypes.Hidden, Enumerations.MoveAffectionTypes.Custom, Enumerations.EntitySelectionType.Single, false,
                                          null, User.GetOpposingEntityType(), EntityTypes.Neutral);

            SetMoveSequence(new TattleSequence(this));

            //Default to no Action Command
            //If this is Goombella, then set the Action Command
            actionCommand = null;
            if (isGoombella == true)
            {
                actionCommand = new TattleCommand(MoveSequence, 2f);
            }
        }
        public MarioBattleMenu(BattleEntity user) : base(user)
        {
            Texture2D tex = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png");

            //Get Jump and Hammer battle textures based on Mario's equipment
            CroppedTexture2D jump   = new CroppedTexture2D(tex, GetTexRectForBootLevel(User.BManager.Mario.MStats.BootLevel));
            CroppedTexture2D hammer = new CroppedTexture2D(tex, GetTexRectForHammerLevel(User.BManager.Mario.MStats.HammerLevel));

            CroppedTexture2D starPower = new CroppedTexture2D(tex, new Rectangle(182, 812, 24, 24));

            ActionButtons.Add(new ActionButton("Jump", jump,
                                               Enumerations.MoveCategories.Jump, new JumpSubMenu(user)));
            ActionButtons.Add(new ActionButton("Hammer", hammer,
                                               Enumerations.MoveCategories.Hammer, new HammerSubMenu(user)));
            ActionButtons.Add(new ActionButton("Special", starPower,
                                               Enumerations.MoveCategories.Special, new SpecialSubMenu(user)));

            Initialize(2);
        }
        /// <summary>
        /// Calculates the result of elemental damage on a BattleEntity, based on its weaknesses and resistances to that Element.
        /// </summary>
        /// <param name="victim">The BattleEntity being damaged.</param>
        /// <param name="element">The element the entity is attacked with.</param>
        /// <param name="damage">The initial damage of the attack.</param>
        /// <returns>An ElementDamageHolder stating the result and final damage dealt to this entity.</returns>
        private static ElementDamageResultHolder GetElementalDamage(BattleEntity victim, Elements element, int damage)
        {
            ElementDamageResultHolder elementDamageResult = new ElementDamageResultHolder(ElementInteractionResult.Damage, damage);

            //NOTE: If an entity is both resistant and weak to a particular element, they cancel out.
            //I decided to go with this approach because it's the simplest for this situation, which
            //doesn't seem desirable to begin with but could be interesting in its application
            WeaknessHolder   weakness   = victim.EntityProperties.GetWeakness(element);
            ResistanceHolder resistance = victim.EntityProperties.GetResistance(element);

            //If there's both a weakness and resistance, return
            if (weakness.WeaknessType != WeaknessTypes.None && resistance.ResistanceType != ResistanceTypes.None)
            {
                return(elementDamageResult);
            }

            //Handle weaknesses
            if (weakness.WeaknessType == WeaknessTypes.PlusDamage)
            {
                elementDamageResult.Damage += weakness.Value;
            }
            else if (weakness.WeaknessType == WeaknessTypes.KO)
            {
                elementDamageResult.InteractionResult = ElementInteractionResult.KO;
            }

            //Handle resistances
            if (resistance.ResistanceType == ResistanceTypes.MinusDamage)
            {
                elementDamageResult.Damage -= resistance.Value;
            }
            else if (resistance.ResistanceType == ResistanceTypes.NoDamage)
            {
                elementDamageResult.Damage = BattleGlobals.MinDamage;
            }
            else if (resistance.ResistanceType == ResistanceTypes.Heal)
            {
                elementDamageResult.InteractionResult = ElementInteractionResult.Heal;
            }

            return(elementDamageResult);
        }
Beispiel #13
0
        public HammerSubMenu(BattleEntity user) : base(user)
        {
            Name             = "Hammer";
            Position         = new Vector2(230, 150);
            AutoSelectSingle = true;

            BattleActions.Add(new HammerAction(User));

            int powerSmashCount = User.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.PowerSmash);

            if (powerSmashCount > 0)
            {
                BattleActions.Add(new PowerSmashAction(User, powerSmashCount));
            }
            if (User.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.MegaSmash) > 0)
            {
                BattleActions.Add(new MegaSmashAction(User));
            }
            if (User.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.PiercingBlow) > 0)
            {
                BattleActions.Add(new PiercingBlowAction(User));
            }
            if (User.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.HeadRattle) > 0)
            {
                BattleActions.Add(new HeadRattleAction(User));
            }
            if (User.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.IceSmash) > 0)
            {
                BattleActions.Add(new IceSmashAction(User));
            }
            if (User.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.DDownPound) > 0)
            {
                BattleActions.Add(new DDownPoundAction(User));
            }

            int quakeCount = User.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.QuakeHammer);

            if (quakeCount > 0)
            {
                BattleActions.Add(new QuakeHammerAction(User, quakeCount));
            }
        }
Beispiel #14
0
        public InteractionHolder(BattleEntity entity, int totalDamage, Enumerations.Elements damageElement, ElementInteractionResult elementResult,
                                 Enumerations.ContactTypes contactType, Enumerations.ContactProperties contactProperty, bool piercing, StatusChanceHolder[] statusesInflicted, bool hit, Enumerations.DamageEffects damageEffect)
        {
            Entity            = entity;
            TotalDamage       = totalDamage;
            DamageElement     = damageElement;
            ElementResult     = elementResult;
            ContactType       = contactType;
            ContactProperty   = contactProperty;
            Piercing          = piercing;
            StatusesInflicted = statusesInflicted;
            Hit          = hit;
            DamageEffect = damageEffect;

            DefensiveActionsPerformed = Enumerations.DefensiveActionTypes.None;

            IsPaybackDamage = false;

            DontDamageEntity = false;
        }
        /// <summary>
        /// Filters a set of entities by specified height states. This method is called internally by the BattleManager.
        /// </summary>
        /// <param name="entities">The list of entities to filter. This list is modified directly.</param>
        /// <param name="heightStates">The height states to filter entities by. Entities with any of the state will be included.
        /// If null or empty, will return the entities passed in</param>
        private void FilterEntitiesByHeights(List <BattleEntity> entities, params HeightStates[] heightStates)
        {
            //Return immediately if either input is null
            if (entities == null || heightStates == null || heightStates.Length == 0)
            {
                return;
            }

            for (int i = 0; i < entities.Count; i++)
            {
                BattleEntity entity = entities[i];

                //Remove the entity if it wasn't in any of the height states passed in
                if (heightStates.Contains(entity.HeightState) == false)
                {
                    entities.RemoveAt(i);
                    i--;
                }
            }
        }
Beispiel #16
0
        protected override void OnEnd()
        {
            base.OnEnd();

            Entity.SetBattlePosition(GroundedPos);
            Entity.Position = GroundedPos;

            //Change HeightState
            Entity.ChangeHeightState(Enumerations.HeightStates.Grounded);

            if (Entity.IsDead == false)
            {
                Entity.AnimManager.PlayAnimation(Entity.GetIdleAnim());
            }

            ElapsedTime = 0f;
            StartPos    = GroundedPos = Vector2.Zero;
            HurtAnim    = null;
            Entity      = null;
        }
Beispiel #17
0
        public SpecialSubMenu(BattleEntity user) : base(user)
        {
            Name     = "Special";
            Position = new Vector2(230, 150);

            BattleActions.Add(new FocusAction(User));
            BattleActions.Add(new SweetTreatAction(User));
            BattleActions.Add(new RefreshAction(User));
            BattleActions.Add(new LullabyAction(User));
            BattleActions.Add(new PowerLiftAction(User));
            BattleActions.Add(new ArtAttackAction(User));

            if (BattleActions.Count == 0)
            {
                MessageAction noSpecials = new MessageAction(User, "No Specials", null, "No Special Moves are available.",
                                                             (int)BattleGlobals.BattleEventPriorities.Message, "You can't select that!");

                BattleActions.Add(noSpecials);
            }
        }
        protected ActionSubMenu(BattleEntity user) : base(MenuTypes.Vertical)
        {
            User       = user;
            WrapCursor = true;

            BoxMenu = new TextBox(new Vector2(SpriteRenderer.Instance.WindowCenter.X, SpriteRenderer.Instance.WindowCenter.Y + 220f), new Vector2(320f, 80f), null);
            BoxMenu.SetText(string.Empty);

            Texture2D battleGFX = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png");

            Rectangle rect = new Rectangle(743, 59, 15, 12);

            SelectionCursor = new LoopAnimation(battleGFX,
                                                AnimationGlobals.InfiniteLoop, true,
                                                new Animation.Frame(rect, 200d),
                                                new Animation.Frame(rect, 200d, new Vector2(1, 0)));

            HeaderImage = new NineSlicedTexture2D(battleGFX, new Rectangle(457, 812, 32, 16), 7, 6, 7, 9);
            MenuBG      = new NineSlicedTexture2D(battleGFX, new Rectangle(485, 846, 16, 16), 8, 8, 8, 8);
        }
Beispiel #19
0
        private void RenderStatusInfo(IList <BattleEntity> allEntities)
        {
            //Ignore if we shouldn't show this UI
            if (battleManager.ShouldShowPlayerTurnUI() == true && UtilityGlobals.IListIsNullOrEmpty(allEntities) == false)
            {
                List <StatusEffect> statuses = (allEntities.Count == 0) ? null : new List <StatusEffect>();

                for (int i = 0; i < allEntities.Count; i++)
                {
                    BattleEntity entity = allEntities[i];

                    Vector2 statusIconPos = new Vector2(entity.Position.X + 10, entity.Position.Y - 40);
                    entity.EntityProperties.GetStatuses(statuses);
                    int index = 0;

                    for (int j = 0; j < statuses.Count; j++)
                    {
                        StatusEffect     status  = statuses[j];
                        CroppedTexture2D texture = status.StatusIcon;

                        //Don't draw the status if it doesn't have an icon or if it's Icon suppressed
                        if (texture == null || texture.Tex == null || status.IsSuppressed(Enumerations.StatusSuppressionTypes.Icon) == true)
                        {
                            continue;
                        }

                        float   yOffset = ((index + 1) * StatusGlobals.IconYOffset);
                        Vector2 iconPos = Camera.Instance.SpriteToUIPos(new Vector2(statusIconPos.X, statusIconPos.Y - yOffset));

                        float depth           = .35f - (index * .01f);
                        float turnStringDepth = depth + .0001f;

                        status.DrawStatusInfo(iconPos, depth, turnStringDepth);

                        index++;
                    }

                    statuses.Clear();
                }
            }
        }
Beispiel #20
0
        /// <summary>
        /// Handles resolving the sorting of BattleEntities if their BattleIndices are the same.
        /// </summary>
        /// <param name="entity1">The first BattleEntity to compare.</param>
        /// <param name="entity2">The second BattleEntity to compare.</param>
        /// <returns>-1 if entity1 has a lower X position, 1 if entity2 has a lower X position. If players, higher X positions are favored instead.
        /// If X positions are equal, -1 if entity1 has a lower Y position and 1 if entity2 has a lower Y position.
        /// If X and Y positions are equal, 0.</returns>
        private static int ResolveSameBattleIndex(BattleEntity entity1, BattleEntity entity2)
        {
            //Check if they have the same X position
            //If so, compare the Y - lower Y values are favored
            if (entity1.BattlePosition.X == entity2.BattlePosition.X)
            {
                if (entity1.BattlePosition.Y < entity2.BattlePosition.Y)
                {
                    return(-1);
                }
                else if (entity1.BattlePosition.Y < entity2.BattlePosition.Y)
                {
                    return(1);
                }
            }
            //If not, compare X positions
            else
            {
                //Sorting occurs between same BattleEntities with the same EntityType
                BattleEntity leftEntity  = entity1;
                BattleEntity rightEntity = entity2;

                //Swap if they're players, as Players go from right to left
                if (entity1.EntityType == Enumerations.EntityTypes.Player)
                {
                    UtilityGlobals.Swap(ref leftEntity, ref rightEntity);
                }

                //Compare X position; favor the lower for enemies and the higher for players
                if (leftEntity.BattlePosition.X < rightEntity.BattlePosition.X)
                {
                    return(-1);
                }
                else if (leftEntity.BattlePosition.X > rightEntity.BattlePosition.X)
                {
                    return(1);
                }
            }

            return(0);
        }
Beispiel #21
0
        private void OnEntityEnteredBattle(BattleEntity entity)
        {
            //Check if the BattleEntity this Badge is equipped to is added to battle
            //If so, grant it one of the Status Effects
            if (EntityEquipped == entity)
            {
                BattleManager.Instance.EntityAddedEvent -= OnEntityEnteredBattle;

                //Get the statuses and choose a random one
                StatusEffect[] statuses   = GetPossibleGrantedStatuses();
                int            randStatus = GeneralGlobals.Randomizer.Next(0, statuses.Length);

                //Despite the badge's effects, the Status Effect isn't guaranteed to be inflicted
                //If you have Feeling Fine equipped in TTYD and get Electrified with Lucky Start,
                //it's not inflicted yet the "LUCKY" text is displayed and the sound plays
                if (EntityEquipped.EntityProperties.TryAfflictStatus(100d, statuses[randStatus]) == true)
                {
                    EntityEquipped.AfflictStatus(statuses[randStatus], true);
                }
            }
        }
Beispiel #22
0
        private void EntityRemoved(BattleEntity entityRemoved)
        {
            //Remove the BattleEntity the Shell is defending if that BattleEntity or the Shell is removed from battle
            //Kill off the Shell since it won't be defending anyone
            if (entityRemoved == this || (EntityDefending != null && entityRemoved == EntityDefending))
            {
                RemoveEntityDefending();

                //Unsubscribe from this event
                if (BManager != null)
                {
                    BManager.EntityRemovedEvent -= EntityRemoved;
                }

                //Kill the Shell if it's not already dead
                if (IsDead == false)
                {
                    Die();
                }
            }
        }
Beispiel #23
0
        public ShellTossAction(BattleEntity user) : base(user)
        {
            Name = "Shell Toss";

            MoveInfo = new MoveActionData(new CroppedTexture2D(AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"), new Rectangle(216, 845, 22, 22)),
                                          "Shoot yourself at an enemy.", MoveResourceTypes.FP, 0, CostDisplayTypes.Shown,
                                          MoveAffectionTypes.Other, Enumerations.EntitySelectionType.First, true,
                                          new HeightStates[] { HeightStates.Grounded, HeightStates.Hovering }, User.GetOpposingEntityType(), EntityTypes.Neutral);

            DamageInfo = new DamageData(1, Elements.Normal, false, ContactTypes.SideDirect, ContactProperties.Protected, null, DamageEffects.RemovesSegment);

            //If a partner (Kooper or Koops) is using this move, the base damage is the Partner rank
            PartnerStats partnerStats = User.BattleStats as PartnerStats;

            if (partnerStats != null)
            {
                DamageInfo.Damage = (int)partnerStats.PartnerRank;
            }

            SetMoveSequence(new ShellTossSequence(this));
            actionCommand = new HammerCommand(MoveSequence, 4, 500d);
        }
        protected override void SequenceStartBranch()
        {
            switch (SequenceStep)
            {
            case 0:
                //Remove the evasion mod and turn transparency back to normal
                //NOTE: Find a way to get the original transparency (Ex. Invisible causes additional transparency)
                BattleEntity allyAffected = EntitiesAffected[0];
                User.RemoveEvasionMod(0d);
                allyAffected.RemoveEvasionMod(0d);

                //Turn transparency back
                Color entityColor = User.TintColor;
                Color allyColor   = allyAffected.TintColor;

                double colorDiff = (1 / (double)AlphaVal);

                User.TintColor         = new Color((int)Math.Ceiling(entityColor.R * colorDiff), (int)Math.Ceiling(entityColor.G * colorDiff), (int)Math.Ceiling(entityColor.B * colorDiff), (int)Math.Ceiling(entityColor.A * colorDiff));
                allyAffected.TintColor = new Color((int)Math.Ceiling(allyColor.R * colorDiff), (int)Math.Ceiling(allyColor.G * colorDiff), (int)Math.Ceiling(allyColor.B * colorDiff), (int)Math.Ceiling(allyColor.A * colorDiff));

                User.EntityProperties.UnsuppressStatuses(Enumerations.StatusSuppressionTypes.Effects, Enumerations.StatusTypes.Poison, Enumerations.StatusTypes.Burn, Enumerations.StatusTypes.Frozen);
                allyAffected.EntityProperties.UnsuppressStatuses(Enumerations.StatusSuppressionTypes.Effects, Enumerations.StatusTypes.Poison, Enumerations.StatusTypes.Burn, Enumerations.StatusTypes.Frozen);
                User.EntityProperties.UnsuppressStatuses(Enumerations.StatusSuppressionTypes.TurnCount, Enumerations.StatusTypes.Invisible);
                allyAffected.EntityProperties.UnsuppressStatuses(Enumerations.StatusSuppressionTypes.TurnCount, Enumerations.StatusTypes.Invisible);

                //Make the ally play its idle animation
                allyAffected.AnimManager.PlayAnimation(allyAffected.GetIdleAnim());

                CurSequenceAction = new WaitSeqAction(0d);

                ChangeSequenceBranch(SequenceBranch.Main);
                break;

            default:
                PrintInvalidSequence();
                break;
            }
        }
            protected override void OnCalculate(InteractionParamHolder damageInfo, InteractionResult curResult, ContactResultInfo curContactResult)
            {
                Elements     element = StepResult.VictimResult.DamageElement;
                BattleEntity victim  = StepResult.VictimResult.Entity;

                //Retrieve an overridden type of Elemental damage to inflict based on the Victim's PhysicalAttributes
                //(Ex. The Ice Power Badge only deals Ice damage to Fiery entities)
                ElementOverrideHolder newElement = StepResult.AttackerResult.Entity.EntityProperties.GetTotalElementOverride(victim);

                if (newElement.Element != Elements.Invalid)
                {
                    /*NOTE: Idea for stacking weaknesses
                     * (Ex. 1 Ice Power is 1 weakness, Ice Power + Ice Smash = 2 weaknesses)
                     *
                     * Ex. damage = 2
                     * player inflicts ice 2 times: ice power & ice smash
                     *
                     * ice_inflicted_times = 2
                     * if (enemy weak to ice)
                     *  damage += ice_inflicted_times
                     * end
                     *
                     #damage = 4
                     */

                    //Add the number of element overrides to the damage if the element used already exists as an override and the victim has a Weakness
                    //to the Element. This allows Badges such as Ice Power to deal more damage if used in conjunction with attacks
                    //that deal the same type of damage (Ex. Ice Power and Ice Smash deal 2 additional damage total rather than 1).
                    //If any new knowledge is discovered to improve this, this will be changed
                    //Ice Power is the only Badge of its kind across the first two PM games that does anything like this
                    if (element == newElement.Element && victim.EntityProperties.HasWeakness(element) == true)
                    {
                        StepResult.VictimResult.TotalDamage += newElement.OverrideCount;
                    }

                    StepResult.VictimResult.DamageElement = newElement.Element;
                }
            }
Beispiel #26
0
        public TornadoJumpAction(BattleEntity user) : base(user)
        {
            Name = "Tornado Jump";

            MoveInfo = new MoveActionData(new CroppedTexture2D(AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"), new Rectangle(939, 390, 38, 34)),
                                          "Execute superbly to damage\nall midair enemies.", MoveResourceTypes.FP, 3,
                                          CostDisplayTypes.Shown, MoveAffectionTypes.Other,
                                          Enumerations.EntitySelectionType.Single, false,
                                          new HeightStates[] { HeightStates.Grounded, HeightStates.Hovering, HeightStates.Airborne }, User.GetOpposingEntityType(), EntityTypes.Neutral);

            //The base damage is Mario's current Boot level
            //If Mario isn't the one using this move, it defaults to 1
            int        baseDamage = 1;
            MarioStats marioStats = User.BattleStats as MarioStats;

            if (marioStats != null)
            {
                baseDamage = (int)marioStats.BootLevel;
            }

            DamageInfo = new DamageData(baseDamage, Elements.Normal, false, ContactTypes.TopDirect, ContactProperties.None, null,
                                        DamageEffects.FlipsShelled | DamageEffects.RemovesWings);

            //Second part
            //The second part's damage is Piercing, starts as 2, and cannot be increased with Power Plus, All Or Nothing, or P-Up, D-Down
            //Equipping a 2nd badge increases the FP cost from 3 to 6 and increases the damage of the Jump by 1 and the air attack by 2
            TornadoJumpSecondPart = new MoveAction(User, string.Empty, new MoveActionData(null, string.Empty, MoveResourceTypes.FP, 0f, CostDisplayTypes.Shown,
                                                                                          MoveAffectionTypes.Other, Enumerations.EntitySelectionType.All, false, new HeightStates[] { HeightStates.Hovering, HeightStates.Airborne },
                                                                                          new EntityTypes[] { EntityTypes.Enemy }), new NoSequence(TornadoJumpSecondPart),
                                                   new DamageData(2, Elements.Normal, true, ContactTypes.None, ContactProperties.Ranged, null, DamageEffects.None));

            TornadoJumpSequence tornadoJumpSequence = new TornadoJumpSequence(this, TornadoJumpSecondPart);

            SetMoveSequence(tornadoJumpSequence);

            actionCommand = new TornadoJumpCommand(MoveSequence, tornadoJumpSequence.JumpDuration,
                                                   (int)(tornadoJumpSequence.JumpDuration / 2f), 10000d);
        }
        public ElectroDashAction(BattleEntity user) : base(user)
        {
            Name = "Electro Dash";

            MoveInfo = new MoveActionData(new CroppedTexture2D(AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"), new Rectangle(216, 845, 22, 22)),
                                          "Pierce enemy defense, dealing 5 damage.", MoveResourceTypes.FP, 0, CostDisplayTypes.Shown, MoveAffectionTypes.Other,
                                          Enumerations.EntitySelectionType.Single, true, null, new EntityTypes[] { User.GetOpposingEntityType() });

            DamageInfo = new DamageData(3, Elements.Electric, true, ContactTypes.SideDirect, ContactProperties.None, null, DamageEffects.None);

            //If a Partner (Watt) is using this move, the base damage is increased by 1 per Partner rank above Normal
            PartnerStats partnerStats = User.BattleStats as PartnerStats;

            if (partnerStats != null)
            {
                DamageInfo.Damage += ((int)partnerStats.PartnerRank - 1);
            }

            ElectroDashSequence electroDashSequence = new ElectroDashSequence(this);

            SetMoveSequence(electroDashSequence);
            actionCommand = new GulpCommand(MoveSequence, electroDashSequence.CommandDur, 500d, 1d, Microsoft.Xna.Framework.Input.Keys.Z);
        }
        /// <summary>
        /// Filters out BattleEntities marked as Untargetable from a set of BattleEntities.
        /// </summary>
        /// <typeparam name="T">A BattleEntity or derived type.</typeparam>
        /// <param name="entities">The list of BattleEntities to filter. The list is modified directly.</param>
        public static void FilterEntitiesByTargetable <T>(List <T> entities) where T : BattleEntity
        {
            //Return if the list is null
            if (entities == null)
            {
                return;
            }

            for (int i = 0; i < entities.Count; i++)
            {
                BattleEntity entity = entities[i];

                //Check if the entity has the Untargetable additional property
                bool untargetable = entity.EntityProperties.HasAdditionalProperty(AdditionalProperty.Untargetable);

                //If it's untargetable, remove it
                if (untargetable == true)
                {
                    entities.RemoveAt(i);
                    i--;
                }
            }
        }
        protected override void OnStart()
        {
            base.OnStart();

            //Check if there is a BattleEntity behind the one eaten and if it can be hit by this move
            List <BattleEntity> behindEntities = new List <BattleEntity>();

            User.BManager.GetEntitiesBehind(behindEntities, EntitiesAffected[0]);
            BattleManagerUtils.FilterEntitiesByHeights(behindEntities, Action.MoveProperties.HeightsAffected);

            //Store the reference to the behind entity and tell it it's being targeted
            if (behindEntities.Count > 0)
            {
                BehindEntity = behindEntities[0];
                BehindEntity.TargetForMove(User);
            }

            if (Action.CommandEnabled == true && Action.DrawActionCommandInfo == true)
            {
                GulpUI = new GulpActionCommandUI(actionCommand as GulpCommand);
                User.BManager.battleUIManager.AddUIElement(GulpUI);
            }
        }
Beispiel #30
0
        //public override void Draw()
        //{
        //    SpriteRenderer.Instance.EndDrawing(SpriteRenderer.Instance.spriteBatch);
        //
        //    Effect chargeEffect = new EffectMaterial(AssetManager.Instance.LoadAsset<Effect>($"{ContentGlobals.ShaderRoot}Charge"));
        //
        //    Texture2D tex = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.ShaderTextureRoot}ChargeShaderTex.png");
        //    Texture2D spriteSheet = AnimManager.SpriteSheet;
        //
        //    Vector2 dimensionRatio = new Vector2(tex.Width, tex.Height) / new Vector2(spriteSheet.Width, spriteSheet.Height);
        //
        //    chargeEffect.Parameters["chargeTex"].SetValue(tex);
        //    chargeEffect.Parameters["chargeAlpha"].SetValue((float)(UtilityGlobals.PingPong(Time.ActiveMilliseconds / 1000f, .9f)));
        //    chargeEffect.Parameters["objColor"].SetValue(TintColor.ToVector4());
        //    chargeEffect.Parameters["chargeOffset"].SetValue(new Vector2(0f, ((float)Time.ActiveMilliseconds % 1000f) / 1000f));
        //    chargeEffect.Parameters["chargeTexRatio"].SetValue(dimensionRatio.Y);
        //    chargeEffect.Parameters["objFrameOffset"].SetValue(spriteSheet.GetTexCoordsAt(AnimManager.CurrentAnim.CurFrame.DrawRegion));
        //
        //    SpriteRenderer.Instance.BeginDrawing(SpriteRenderer.Instance.spriteBatch, BlendState.AlphaBlend, null, chargeEffect, Camera.Instance.Transform);
        //
        //    base.Draw();
        //
        //    SpriteRenderer.Instance.EndDrawing(SpriteRenderer.Instance.spriteBatch);
        //
        //    SpriteRenderer.Instance.BeginDrawing(SpriteRenderer.Instance.spriteBatch, BlendState.AlphaBlend, null, null, Camera.Instance.Transform);
        //}

        #region Event Handlers

        private void OnMiniYuxDamageTaken(InteractionHolder damageInfo)
        {
            //NOTE: This should happen after the Mini-Yuxes finish their death animations so the shield stays up until they're gone

            //If the Mini-Yux is dead, remove it
            if (damageInfo.Entity.IsDead == true)
            {
                BattleEntity miniYux = damageInfo.Entity;

                //Remove the Mini-Yux from the list and unsubscribe from its event
                MiniYuxes.Remove(miniYux);
                miniYux.DamageTakenEvent -= OnMiniYuxDamageTaken;

                //Remove the Helper AdditionalProperty since the Mini-Yux is out of battle
                miniYux.EntityProperties.RemoveAdditionalProperty(AdditionalProperty.HelperEntity);

                //Remove the shield if there are no more Mini-Yuxes
                if (NumMiniYuxes == 0 && HasShield == true)
                {
                    AddRemoveShield(false);
                }
            }
        }