public virtual void HandleFlipped()
        {
            if (Flipped == false)
            {
                Entity.AddIntAdditionalProperty(Enumerations.AdditionalProperty.Immobile, 1);

                //Flipped Koopas are immune to Fright
                Entity.AddRemoveStatusImmunity(Enumerations.StatusTypes.Fright, true);

                //Lower defense by an amount when flipped
                Entity.LowerDefense(DefenseLoss);
            }

            Flipped = true;

            //Don't play this animation if dead
            if (Entity.IsDead == false)
            {
                Entity.BManager.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.Damage - 2,
                                                                    new BattleGlobals.BattleState[] { BattleGlobals.BattleState.Turn, BattleGlobals.BattleState.TurnEnd },
                                                                    new PlayAnimBattleEvent(Entity, Entity.GetIdleAnim(), false));
            }

            //Getting hit again while flipped refreshes the flip timer
            ElapsedFlippedTurns = 0;

            //Handle being flipped
            Entity.TurnStartEvent -= OnFlippedTurnStart;
            Entity.TurnStartEvent += OnFlippedTurnStart;
        }
        protected override void OnEnd()
        {
            base.OnEnd();

            //Get revival data from the item
            IRevivalItem revivalData = RevivalItem as IRevivalItem;

            if (revivalData != null && revivalData.RevivalHPRestored > 0)
            {
                RevivedEntity.HealHP(revivalData.RevivalHPRestored);

                //Play the idle animation
                RevivedEntity.AnimManager.PlayAnimation(RevivedEntity.GetIdleAnim());

                //Remove the item
                //NOTE: For now just handle players and remove from the inventory - enemies will need to remove their held items
                Inventory.Instance.RemoveItem(RevivalItem);
            }
            else
            {
                Debug.LogError($"{RevivalItem.Name} does not implement {nameof(IRevivalItem)} or heals 0 or less HP, so the BattleEntity can't be revived!");
            }

            //Clear references
            RevivedEntity = null;
            RevivalItem   = null;
        }
        protected override void OnEnd()
        {
            base.OnEnd();

            if (PlayIdleOnEnd == true)
            {
                Entity.AnimManager.PlayAnimation(Entity.GetIdleAnim());
            }
        }
Пример #4
0
        protected override void OnStart()
        {
            if (Entity != null)
            {
                StartPos = Entity.Position;
                EndPos   = StartPos + RelativeMove;

                Entity.AnimManager.PlayAnimation(Entity.GetIdleAnim());
            }

            ElapsedTime = 0d;
            MovedUp     = false;
        }
        protected override void OnEnd()
        {
            base.OnEnd();

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

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

            ElapsedTime = 0f;
            StartPos    = GroundedPos = Vector2.Zero;
            HurtAnim    = null;
            Entity      = null;
        }
Пример #6
0
        protected override void OnEnd()
        {
            BattleUIManager.Instance.UnsuppressMenus();

            FirstEntity.Position  = FirstEndPos;
            SecondEntity.Position = SecondEndPos;

            //Play idle animations again
            //NOTE: Get the correct idle (Ex. Danger/Peril and various Status Effects cause entities to have different idle animations)
            if (FirstEntity.IsDead == false)
            {
                FirstEntity.AnimManager.PlayAnimation(FirstEntity.GetIdleAnim());
            }
            if (SecondEntity.IsDead == false)
            {
                SecondEntity.AnimManager.PlayAnimation(SecondEntity.GetIdleAnim());
            }

            ElapsedTime = 0f;
        }
        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;
            }
        }
Пример #8
0
        protected override void OnEnd()
        {
            base.OnEnd();

            //Remove the item over the BattleEntity's head
            if (RevivalItemShown != null)
            {
                RevivedEntity.BManager.battleUIManager.RemoveUIElement(RevivalItemShown);
                RevivalItemShown = null;
            }

            //Revive the BattleEntity only if it's currently in battle
            if (RevivedEntity.IsInBattle == true)
            {
                //Get revival data from the item
                IRevivalItem revivalData = RevivalItem as IRevivalItem;
                if (revivalData != null)
                {
                    //If the revival item heals 0 or fewer HP, log a warning
                    if (revivalData.RevivalHPRestored <= 0)
                    {
                        Debug.LogWarning($"{RevivalItem.Name} heals 0 or fewer HP, so {RevivedEntity.Name} won't actually be revived!");
                    }

                    //Heal HP
                    RevivedEntity.HealHP(revivalData.RevivalHPRestored);

                    //Play the idle animation
                    RevivedEntity.AnimManager.PlayAnimation(RevivedEntity.GetIdleAnim());

                    //Remove the item
                    //For players, remove it from the inventory
                    if (RevivedEntity.EntityType == Enumerations.EntityTypes.Player)
                    {
                        Inventory.Instance.RemoveItem(RevivalItem);
                    }
                    //It has to be an enemy, so remove its held item
                    else
                    {
                        BattleEnemy revivedEnemy = (BattleEnemy)RevivedEntity;
                        revivedEnemy.SetHeldCollectible(null);
                    }
                }
                else
                {
                    Debug.LogError($"{RevivalItem.Name} does not implement {nameof(IRevivalItem)}, so {RevivedEntity.Name} can't be revived!");
                }

                //Failsafe; handle a dead BattleEntity in the event the RevivalItem doesn't actually revive or heal
                if (RevivedEntity.IsDead == true)
                {
                    RevivedEntity.BManager.HandleEntityDeath(RevivedEntity);
                }
            }
            else
            {
                Debug.LogWarning($"{RevivedEntity.Name} isn't in battle and thus won't be revived!");
            }

            //Clear references
            RevivedEntity = null;
            RevivalItem   = null;
        }