Example #1
0
        private void ChangeToGroundedEntity()
        {
            //Check if the winged entity and its grounded version have entries in the Tattle database
            bool wingedInTattle   = TattleDatabase.HasTattleDescription(Name);
            bool groundedInTattle = TattleDatabase.HasTattleDescription(GroundedEntity.Name);

            //If the winged entity has an entry and the grounded version doesn't, remove its ShowHP property
            if (wingedInTattle == true && groundedInTattle == false)
            {
                this.SubtractShowHPProperty();
            }
            //If the winged entity doesn't have an entry and the grounded version does, add its ShowHP property
            else if (wingedInTattle == false && groundedInTattle == true)
            {
                this.AddShowHPProperty();
            }

            Name = GroundedEntity.Name;

            //Set the vulnerability to the same as the grounded entity. The grounded entity shouldn't have a winged vulnerabilty
            EntityProperties.SetVulnerableDamageEffects(GroundedEntity.EntityProperties.GetVulnerableDamageEffects());

            //Change HeightState
            ChangeHeightState(Enumerations.HeightStates.Grounded);
        }
        public override void OnBattleStart()
        {
            base.OnBattleStart();

            //Set battle position
            Vector2 battlepos = BattleManager.Instance.EnemyStartPos + new Vector2(BattleManager.Instance.PositionXDiff * BattleIndex, 0);

            if (HeightState == Enumerations.HeightStates.Airborne)
            {
                battlepos.Y -= BattleManager.Instance.AirborneY;
            }
            else if (HeightState == Enumerations.HeightStates.Ceiling)
            {
                battlepos.Y -= BattleManager.Instance.CeilingY;
            }

            SetBattlePosition(battlepos);
            Position = BattlePosition;

            //Equip the held Badge, if one is held
            if (HeldCollectible?.CollectibleType == Enumerations.CollectibleTypes.Badge)
            {
                Badge heldBadge = (Badge)HeldCollectible;
                heldBadge.Equip(this);
            }

            //Check if the enemy has an entry in the Tattle table
            //If so, mark it to show its HP
            if (TattleDatabase.HasTattleDescription(Name) == true)
            {
                this.AddShowHPProperty();
            }
        }
        public virtual void HandleGrounded()
        {
            //Return if already grounded
            if (Grounded == true)
            {
                return;
            }

            Grounded = true;

            //Check if the winged entity and its grounded version have entries in the Tattle database
            bool wingedInTattle   = TattleDatabase.HasTattleDescription(Entity.Name);
            bool groundedInTattle = TattleDatabase.HasTattleDescription(GroundedEntity?.Name);

            //If the winged entity has an entry and the grounded version doesn't, remove its ShowHP property
            if (wingedInTattle == true && groundedInTattle == false)
            {
                Entity.SubtractShowHPProperty();
            }
            //If the winged entity doesn't have an entry and the grounded version does, add its ShowHP property
            else if (wingedInTattle == false && groundedInTattle == true)
            {
                Entity.AddShowHPProperty();
            }

            if (GroundedEntity != null)
            {
                Entity.Name = GroundedEntity.Name;

                //Set the vulnerability to the same as the grounded entity. The grounded entity shouldn't have a winged vulnerabilty
                Entity.EntityProperties.SetVulnerableDamageEffects(GroundedEntity.EntityProperties.GetVulnerableDamageEffects());
            }

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

            //Queue the BattleEvent to move the entity down
            BattleManager.Instance.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.Damage - 1,
                                                                       new BattleManager.BattleState[] { BattleManager.BattleState.Turn, BattleManager.BattleState.TurnEnd },
                                                                       new GroundedBattleEvent(Entity, new Vector2(Entity.BattlePosition.X, BattleManager.Instance.EnemyStartPos.Y)));

            //Queue the BattleEvent to remove the wings
            BattleManager.Instance.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.Damage - 1,
                                                                       new BattleManager.BattleState[] { BattleManager.BattleState.Turn, BattleManager.BattleState.TurnEnd },
                                                                       new RemoveWingsBattleEvent(this, Entity));

            //Remove the damage event, since we don't need it anymore
            Entity.DamageTakenEvent -= OnDamageTaken;
        }
Example #4
0
        protected override void SequenceSuccessBranch()
        {
            switch (SequenceStep)
            {
            case 0:
                string entityName = EntitiesAffected[0].Name;

                //Check if the enemy is in the Tattle database
                bool inDatabase = TattleDatabase.HasTattleDescription(entityName);

                //Add the Tattle information to the player's Tattles if the enemy isn't in the database
                if (inDatabase == false)
                {
                    TattleDatabase.AddTattleLogEntry(entityName, TattledEntity.GetTattleLogEntry());
                    TattleDatabase.AddTattleDescriptionEntry(entityName, TattledEntity.GetTattleDescription());

                    //Mark the enemies to show their HP
                    BattleEntity[] entities = BattleManager.Instance.GetEntities(Enumerations.EntityTypes.Enemy, null);
                    for (int i = 0; i < entities.Length; i++)
                    {
                        if (entities[i].Name == entityName)
                        {
                            entities[i].AddShowHPProperty();
                        }
                    }
                }

                //NOTE: Show dialogue bubble coming from Goombario/Goombella along with the enemy's Tattle log entry (with image and stats)
                string[] tattleDescriptions = TattledEntity.GetTattleDescription();

                string tattle = "Tattle Description:";

                //For now log it in the console
                for (int i = 0; i < tattleDescriptions.Length; i++)
                {
                    tattle += $"\n{tattleDescriptions[i]}";
                }

                Console.WriteLine(tattle);

                ChangeSequenceBranch(SequenceBranch.End);
                break;

            default:
                PrintInvalidSequence();
                break;
            }
        }
Example #5
0
        public override void OnEnteredBattle()
        {
            //The Mini-Yux's BattlePosition is set by the Yux, so do everything aside from that

            //Equip the held Badge, if one is held
            if (HeldCollectible?.CollectibleType == Enumerations.CollectibleTypes.Badge)
            {
                Badge heldBadge = (Badge)HeldCollectible;
                heldBadge.Equip(this);
            }

            //Check if the enemy has an entry in the Tattle table
            //If so, mark it to show its HP
            if (TattleDatabase.HasTattleDescription(Name) == true)
            {
                this.AddShowHPProperty();
            }
        }
        public override void OnBattleStart()
        {
            base.OnBattleStart();

            //Equip the held Badge, if one is held
            if (HeldCollectible?.CollectibleType == Enumerations.CollectibleTypes.Badge)
            {
                Badge heldBadge = (Badge)HeldCollectible;
                if (heldBadge.AffectedType == BadgeGlobals.AffectedTypes.Self || heldBadge.AffectedType == BadgeGlobals.AffectedTypes.Both)
                {
                    heldBadge.Equip(this);
                }
            }

            //Check if the enemy has an entry in the Tattle table
            //If so, mark it to show its HP
            if (TattleDatabase.HasTattleDescription(Name) == true)
            {
                this.AddShowHPProperty();
            }
        }
        protected override void SequenceSuccessBranch()
        {
            switch (SequenceStep)
            {
            case 0:
                if (CommandEnabled == true)
                {
                    ShowCommandRankVFX(HighestCommandRank, EntitiesAffected[0].Position);
                }

                //Create the tattle box and add it so it updates
                TattleBox = new TattleRenderObj(Camera.Instance.SpriteToUIPos(EntitiesAffected[0].Position));
                User.BManager.battleObjManager.AddBattleObject(TattleBox);

                string entityName = EntitiesAffected[0].Name;

                //Check if the enemy is in the Tattle database
                bool inDatabase = TattleDatabase.HasTattleDescription(entityName);

                //Add the Tattle information to the player's Tattles if the enemy isn't in the database
                if (inDatabase == false)
                {
                    TattleDatabase.AddTattleLogEntry(entityName, TattledEntity.GetTattleLogEntry());
                    TattleDatabase.AddTattleDescriptionEntry(entityName, TattledEntity.GetTattleDescription());

                    //Mark the enemies to show their HP
                    BattleEntity[] entities = User.BManager.GetEntities(Enumerations.EntityTypes.Enemy, null);
                    for (int i = 0; i < entities.Length; i++)
                    {
                        if (entities[i].Name == entityName)
                        {
                            entities[i].AddShowHPProperty();
                        }
                    }
                }

                //Start moving the tattle box down
                TattleBox.Start(WindowMoveTime);

                CurSequenceAction = new WaitSeqAction(WindowMoveTime);

                break;

            case 1:
                //Open the tattle box to show the BattleEntity tattled
                TattleBox.Open(WindowOpenCloseTime);

                CurSequenceAction = new WaitSeqAction(WindowOpenCloseTime);
                break;

            case 2:
                //NOTE: Show dialogue bubble coming from Goombario/Goombella along with the enemy's Tattle log entry (with image and stats)
                string tattleDescription = TattledEntity.GetTattleDescription();

                string tattle = "Tattle Description:\n" + tattleDescription;

                //Log it
                Debug.Log(tattle);

                //Create the dialogue bubble
                DialogueManager.Instance.CreateBubble(tattleDescription, User);
                CurSequenceAction = new WaitForDialogueSeqAction(DialogueManager.Instance.CurDialogueBubble);
                break;

            case 3:
                //Close the tattle box
                TattleBox.Close(WindowOpenCloseTime);

                CurSequenceAction = new WaitSeqAction(WindowOpenCloseTime);
                break;

            case 4:
                //Move the tattle box offscreen
                TattleBox.End(WindowMoveTime);

                CurSequenceAction = new WaitSeqAction(WindowMoveTime);
                break;

            case 5:
                //Remove the tattle box
                User.BManager.battleObjManager.RemoveBattleObject(TattleBox);
                TattleBox = null;

                CurSequenceAction = new WaitSeqAction(0d);
                ChangeSequenceBranch(SequenceBranch.End);
                break;

            default:
                PrintInvalidSequence();
                break;
            }
        }