Пример #1
0
        public ChangePartnerSubMenu(BattleEntity user) : base(user)
        {
            Name     = "Change Partner";
            Position = new Vector2(230, 150);

            HeaderSize.X = 200f;

            BattlePartner[] partners = Inventory.Instance.partnerInventory.GetAllPartners();

            for (int i = 0; i < partners.Length; i++)
            {
                ChangePartnerAction partnerChange = new ChangePartnerAction(User, partners[i]);

                //If this Partner is the current one out in battle or is dead, disable the option to select it
                if (partners[i] == User.BManager.Partner || partners[i].IsDead == true)
                {
                    partnerChange.Disabled = true;
                    if (partners[i].IsDead == false)
                    {
                        partnerChange.DisabledString = $"{partners[i].Name} is already out!";
                    }
                    else
                    {
                        partnerChange.DisabledString = $"{partners[i].Name} is unable to battle!";
                    }
                }

                BattleActions.Add(partnerChange);
            }
        }
        public ItemDipSubMenu(BattleEntity user) : base(user)
        {
            Name     = "Items";
            Position = new Vector2(230, 150);

            int doubleDipCount = User.GetEquippedNPBadgeCount(BadgeGlobals.BadgeTypes.DoubleDip);
            int tripleDipCount = User.GetEquippedNPBadgeCount(BadgeGlobals.BadgeTypes.TripleDip);

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

            BattleActions.Add(new MenuAction(User, "Items", new CroppedTexture2D(battleTex, new Rectangle(216, 845, 22, 22)),
                                             "Select items to use in Battle.", new ItemSubMenu(User, 1, 0)));

            //Add Double Dip
            if (doubleDipCount > 0)
            {
                BattleActions.Add(new MenuAction(User, "Double Dip", new CroppedTexture2D(battleTex, new Rectangle(872, 107, 24, 21)),
                                                 "Lets you use 2 items in one turn.", 4, new ItemSubMenu(User, 2, 4)));
            }

            //Add Triple Dip
            if (doubleDipCount > 1 || tripleDipCount > 0)
            {
                BattleActions.Add(new MenuAction(User, "Triple Dip", new CroppedTexture2D(battleTex, new Rectangle(872, 137, 24, 21)),
                                                 "Lets you use 3 items in one turn.", 8, new ItemSubMenu(User, 3, 8)));
            }
        }
Пример #3
0
    //creates a button for a player to use an action and ass it to the action button list
    private void CreateActionButton(Vector3 position, string buttonName, BattleActions buttonAction, BaseChampion championSelected)
    {
        GameObject   newButtonObject = Instantiate(GameManager._prefabs.actionButtonPrefab, position, Quaternion.identity);
        ActionButton newButton       = newButtonObject.GetComponent <ActionButton>();

        newButton.Init(buttonName, buttonAction, championSelected);
        actionButtons.Add(newButton);
    }
Пример #4
0
        private void CounterBtn_Click(object sender, EventArgs e)
        {
            PBA = BattleActions.Counter;
            Enemy();
            Decision();

            MainTextBox.SelectionStart = MainTextBox.TextLength - 1;
            MainTextBox.ScrollToCaret();
        }
Пример #5
0
 //class constructor for creating a button
 public void Init(string _stringArg, BattleActions _actionArg, BaseChampion _championArg)
 {
     buttonInfo       = _stringArg;
     battleAction     = _actionArg;
     selectedChampion = _championArg;
     buttonCollider   = gameObject.GetComponent <BoxCollider2D>();
     buttonText       = gameObject.transform.GetChild(1).GetComponent <TextMeshPro>();
     buttonImage      = gameObject.transform.GetChild(0).GetComponent <Image>();
     buttonText.SetText(buttonInfo);
 }
Пример #6
0
 private void btnCounter_Click(object sender, RoutedEventArgs e)
 {
     if (!((Run)textBlock.Inlines.LastInline).Text.Contains("-") || ((Run)textBlock.Inlines.LastInline).Text.Contains("идея!"))
     {
         textBlock.Inlines.Clear();
     }
     PBA = BattleActions.Counter;
     Enemy();
     Decision();
 }
Пример #7
0
    //attempt an action for this champion
    public virtual void SelectAction(BattleActions action)
    {
        //returns function if it is not this champion's current turn
        if (!currentTurn)
        {
            return;
        }

        currentAction = action;
        StartCoroutine(action.AttemptAction(this));
    }
Пример #8
0
 /// <summary>
 /// Toggles a BattleCommand the Entity can perform
 /// </summary>
 /// <param name="battleAction">The BattleAction corresponding to the BattleCommand to disable</param>
 /// <param name="disabled">true to disable the Command, false to enable it</param>
 public void ToggleCommand(BattleActions battleAction, bool disabled)
 {
     if (KnownCommands.ContainsKey(battleAction))
     {
         KnownCommands[battleAction].Disabled = disabled;
     }
     else
     {
         Debug.Log($"{Name} doesn't have a usable command with the action: {battleAction}");
     }
 }
        public TacticsSubMenu()
        {
            Name     = "Tactics";
            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;

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

            //If no Partner is available (removed from battle or don't have one) then don't add the change partner action
            //Additionally, if only one partner is avaiable then don't add it either
            //This mimics TTYD behavior if you either have no Partner or if it's removed from battle via Gale Force or Fright
            bool addChangePartner = (BattleManager.Instance.GetPartner() != null && Inventory.Instance.partnerInventory.GetPartnerCount() > 1);

            if (addChangePartner == true)
            {
                Rectangle sourceRect = new Rectangle(30 + (((int)BattleManager.Instance.GetPartner().PartnerType - 1) * 32), 886, 32, 32);

                BattleActions.Add(new MenuAction("Change Partner", new CroppedTexture2D(battleTex, sourceRect),
                                                 "Change your current partner.", //costDisplayType,
                                                 new ChangePartnerSubMenu()));
            }

            #region Charge Menu

            //Charge action if the Charge or Charge P Badge is equipped
            int chargeCount = entity.GetEquippedNPBadgeCount(BadgeGlobals.BadgeTypes.Charge);
            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(new CroppedTexture2D(battleTex, new Rectangle(623, 807, 40, 40)),
                                                                              "Save up strength to power up\nyour 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());

            //Run away action
            BattleActions.Add(new RunAwayAction());
        }
        public HammerSubMenu()
        {
            Position         = new Vector2(230, 150);
            AutoSelectSingle = true;

            BattleActions.Add(new Hammer());
            if (BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.IceSmash) > 0)
            {
                BattleActions.Add(new IceSmash());
            }
            if (BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.HeadRattle) > 0)
            {
                BattleActions.Add(new HeadRattle());
            }
        }
        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());
        }
Пример #12
0
        /// <summary>
        /// Creates an ItemSubMenu.
        /// </summary>
        /// <param name="dipTurnCount">The number of item turns. This is used for Double/Triple Dip.</param>
        /// <param name="fpCost">The amount of FP it costs to use an item. This is used for Double/Triple Dip.</param>
        /// <param name="isRootMenu">Tells if the ItemSubMenu is the root menu. This is only true if Double/Triple Dip is used.</param>
        public ItemSubMenu(int dipTurnCount, int fpCost, bool isRootMenu = false)
        {
            Name     = "Items";
            Position = new Vector2(230, 150);

            DipTurnCount = dipTurnCount;
            FPCost       = fpCost;
            IsRootMenu   = isRootMenu;

            Item[] usableItems = Inventory.Instance.FindItems(Item.ItemCategories.Standard,
                                                              Item.ItemTypes.Healing | Item.ItemTypes.Damage | Item.ItemTypes.Status | Item.ItemTypes.Revival);
            for (int i = 0; i < usableItems.Length; i++)
            {
                //This cast fails if the Item doesn't derive from BattleItem
                //This can also happen if an Item that can't be used in battle had its ItemType set to the wrong value
                BattleItem item = (BattleItem)usableItems[i];

                //Set item properties
                ItemAction newItemAction = item.ActionAssociated;
                newItemAction.SetDipFPCost(FPCost);
                //Set the item turn count
                if (dipTurnCount > 1)
                {
                    newItemAction.SetOnItemUsed(SetEntityDipTurnCount);
                }

                BattleActions.Add(newItemAction);
            }

            if (BattleActions.Count == 0)
            {
                //Add the No Items action, which, when selected, brings up a battle message saying "You can't select that!"
                //and brings you back to the menu. This happens even with Double Dip and Triple Dip, essentially forcing you
                //to stop using items.

                MessageAction noItems = new MessageAction("No Items", null, "You have no items.",
                                                          (int)BattleGlobals.BattleEventPriorities.Message, "You can't select that!");
                BattleActions.Add(noItems);
            }

            //Initialize here if this is the root menu, as it won't be initialized like it normally is
            if (IsRootMenu == true)
            {
                MoveCategory = Enumerations.MoveCategories.Item;
                Initialize();
            }
        }
Пример #13
0
        public SpecialSubMenu()
        {
            Position = new Vector2(230, 150);

            BattleActions.Add(new Focus());
            BattleActions.Add(new Refresh());
            BattleActions.Add(new Lullaby());
            BattleActions.Add(new PowerLift());
            BattleActions.Add(new ArtAttack());

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

                BattleActions.Add(noSpecials);
            }
        }
        public JumpSubMenu()
        {
            Position         = new Vector2(230, 150);
            AutoSelectSingle = true;

            BattleActions.Add(new Jump());
            if (BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.PowerBounce) > 0)
            {
                BattleActions.Add(new PowerBounce());
            }
            if (BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.Multibounce) > 0)
            {
                BattleActions.Add(new Multibounce());
            }
            if (BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.TornadoJump) > 0)
            {
                BattleActions.Add(new TornadoJump());
            }
        }
Пример #15
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));
            }
        }
        public HammerSubMenu()
        {
            Name             = "Hammer";
            Position         = new Vector2(230, 150);
            AutoSelectSingle = true;

            BattleActions.Add(new Hammer());

            int powerSmashCount = BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.PowerSmash);

            if (powerSmashCount > 0)
            {
                BattleActions.Add(new PowerSmashAction(powerSmashCount));
            }
            if (BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.MegaSmash) > 0)
            {
                BattleActions.Add(new MegaSmashAction());
            }
            if (BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.PiercingBlow) > 0)
            {
                BattleActions.Add(new PiercingBlowAction());
            }
            if (BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.HeadRattle) > 0)
            {
                BattleActions.Add(new HeadRattle());
            }
            if (BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.IceSmash) > 0)
            {
                BattleActions.Add(new IceSmash());
            }
            if (BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.DDownPound) > 0)
            {
                BattleActions.Add(new DDownPoundAction());
            }

            int quakeCount = BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.QuakeHammer);

            if (quakeCount > 0)
            {
                BattleActions.Add(new QuakeHammerAction(quakeCount));
            }
        }
Пример #17
0
        public ChangePartnerSubMenu()
        {
            Position = new Vector2(230, 150);

            BattlePartner[] partners = Inventory.Instance.partnerInventory.GetAllPartners();

            for (int i = 0; i < partners.Length; i++)
            {
                ChangePartner partnerChange = new ChangePartner(partners[i]);

                //If this partner is the current one out in battle, disable the option
                if (partners[i] == BattleManager.Instance.GetPartner())
                {
                    partnerChange.Disabled       = true;
                    partnerChange.DisabledString = $"{partners[i].Name} is already out!";
                }

                BattleActions.Add(partnerChange);
            }
        }
Пример #18
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);
            }
        }
Пример #19
0
        public ItemDipSubMenu()
        {
            Position = new Vector2(230, 150);

            int doubleDipCount = BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.DoubleDip);
            int tripleDipCount = BattleManager.Instance.EntityTurn.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.TripleDip);

            BattleActions.Add(new MenuAction("Items", null, "Select items to use in Battle.", new ItemSubMenu(1, 0)));

            //Add Double Dip
            if (doubleDipCount > 0)
            {
                BattleActions.Add(new MenuAction("Double Dip", null, "Lets you use 2 items in one turn.", 4, new ItemSubMenu(2, 4)));
            }

            //Add Triple Dip
            if (doubleDipCount > 1 || tripleDipCount > 0)
            {
                BattleActions.Add(new MenuAction("Triple Dip", null, "Lets you use 3 items in one turn.", 8, new ItemSubMenu(3, 8)));
            }
        }
Пример #20
0
        public JumpSubMenu(BattleEntity user) : base(user)
        {
            Name             = "Jump";
            Position         = new Vector2(230, 150);
            AutoSelectSingle = true;

            BattleActions.Add(new JumpAction(User));
            if (User.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.PowerBounce) > 0)
            {
                BattleActions.Add(new PowerBounceAction(User));
            }
            if (User.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.Multibounce) > 0)
            {
                BattleActions.Add(new MultibounceAction(User));
            }
            if (User.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.TornadoJump) > 0)
            {
                BattleActions.Add(new TornadoJumpAction(User));
            }
            if (User.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.DDownJump) > 0)
            {
                BattleActions.Add(new DDownJumpAction(User));
            }
        }
Пример #21
0
    IEnumerator RunTurns(BattleActions playerAction)                                //Coroutine to manage the turns
    {
        state = BattleState.RunningTurn;                                            //switch the battle state

        if (playerAction == BattleActions.Move)                                     //If the move Action is selected
        {
            playerUnit.Pokemon.CurrentMove = playerUnit.Pokemon.Moves[currentMove]; //Store the move we'll select
            enemyUnit.Pokemon.CurrentMove  = enemyUnit.Pokemon.GetRandomMove();     //Store the move the enemy will use

            int playerMovePriority = playerUnit.Pokemon.CurrentMove.Base.Priority;  //Store in a var the priority of a move, for the player
            int enemyMovePriority  = enemyUnit.Pokemon.CurrentMove.Base.Priority;   //Store in a var the priority of a move, for the enemy

            //Before Check who goes first, we check the move Priority
            bool playerGoesFirst = true;
            if (enemyMovePriority > playerMovePriority) //If the enemy has a bigger priority, the player won't go fitrst
            {
                playerGoesFirst = false;
            }
            else if (enemyMovePriority == playerMovePriority)                          //If moves has the same priority, the speed will determine
            {
                playerGoesFirst = playerUnit.Pokemon.Speed >= enemyUnit.Pokemon.Speed; //True if the player's pokemon speed is higher
            }
            var firstUnit  = (playerGoesFirst) ? playerUnit : enemyUnit;               //If the bool is true, the player unit goes first, then the enemy
            var secondUnit = (playerGoesFirst) ? enemyUnit : playerUnit;               //Else, we reverse it

            var secondPokemon = secondUnit.Pokemon;                                    //This is in case the player switch as an action

            //We can now call the move in the order
            //First turn
            yield return(RunMove(firstUnit, secondUnit, firstUnit.Pokemon.CurrentMove));

            yield return(RunAfterTurn(firstUnit)); //Call the function happening after turn (poison damage, burn, etc..)

            if (state == BattleState.BattleOver)
            {
                yield break;                                  //If the battle is over, break the coroutine
            }
            if (secondPokemon.HP > 0)
            {
                //Second Turn
                yield return(RunMove(secondUnit, firstUnit, secondUnit.Pokemon.CurrentMove));

                yield return(RunAfterTurn(secondUnit)); //Call the function happening after turn (poison damage, burn, etc..)

                if (state == BattleState.BattleOver)
                {
                    yield break;                                  //If the battle is over, break the coroutine
                }
            }
        }
        else
        {
            if (playerAction == BattleActions.SwitchPokemon)               //If the player decided to switch
            {
                var selectedPokemon = playerParty.Pokemons[currentMember]; //check the selected pokemon
                state = BattleState.Busy;                                  //Set to busy
                yield return(SwitchPokemon(selectedPokemon));              //Call the coroutine
            }
            else if (playerAction == BattleActions.UseItem)
            {
                //For now just call the throw ball, later we'll just open the bag
                dialogBox.EnableActionSelector(false); //Disable action selector
                yield return(ThrowPokeball());         //Then trow the ball
            }
            else if (playerAction == BattleActions.Run)
            {
                yield return(TryToEscape()); //Call the coroutine
            }

            //Once the player switched, the enemy get the turn
            var enemyMove = enemyUnit.Pokemon.GetRandomMove();
            yield return(RunMove(enemyUnit, playerUnit, enemyMove));

            yield return(RunAfterTurn(enemyUnit)); //Call the function happening after turn (poison damage, burn, etc..)

            if (state == BattleState.BattleOver)
            {
                yield break;                                  //If the battle is over, break the coroutine
            }
        }

        if (state != BattleState.BattleOver)
        {
            ActionSelection();
        }
    }
Пример #22
0
        private void EvadeBtn_Click(object sender, EventArgs e)
        {
            PBA =BattleActions.Evade;
            Enemy();
            Decision();

            MainTextBox.SelectionStart = MainTextBox.TextLength - 1;
            MainTextBox.ScrollToCaret();
        }
Пример #23
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     if (!((Run)textBlock.Inlines.LastInline).Text.Contains("-") || ((Run)textBlock.Inlines.LastInline).Text.Contains("идея!"))
     {
         textBlock.Inlines.Clear();
     }
     PBA = BattleActions.Attack;
     Enemy();
     Decision();
 }
Пример #24
0
        private void _battleActionListBox_SelectionChanged(object sender, BattleActions action)
        {
            _battleActionListBox.ClearSelection();

            bool playerIsDefending   = false;
            var  playerCombatProfile = GameManager.Instance.State.GetPlayerCombatProfile();

            //TODO: Take equipped items into consideration

            switch (action)
            {
            case BattleActions.Attack:
                var result = CombatHelper.ResolveAttack(playerCombatProfile, _currentEnemy);
                switch (result.Result)
                {
                case AttackResultCode.Missed:
                    _outputBox.AddOutput($"Player attack missed enemy {_currentEnemy.Name}");
                    break;

                case AttackResultCode.ArmorBlocked:
                    _outputBox.AddOutput($"Enemy {_currentEnemy.Name}'s armor blocked the attack");
                    break;

                case AttackResultCode.DidDamage:
                    _outputBox.AddOutput($"Player did {result.DamageDone} damage to {_currentEnemy.Name}");

                    _currentEnemy.Health -= result.DamageDone;
                    SetHealth(_enemyHealth, Math.Max(0, _currentEnemy.Health), false);
                    break;
                }

                break;

            case BattleActions.Defend:
                playerIsDefending           = true;
                playerCombatProfile.Defense = Convert.ToInt32(playerCombatProfile.Defense * 1.3);
                playerCombatProfile.Armor   = Convert.ToInt32(playerCombatProfile.Armor * 1.2);

                _outputBox.AddOutput("Player is defending");

                break;

            case BattleActions.Run:
                if (!string.IsNullOrEmpty(_encounter.RunConditional))
                {
                    var conditionalResult = EmbeddedFunctionsHelper.Conditional(_encounter.RunConditional);

                    if (!string.IsNullOrEmpty(conditionalResult.Output))
                    {
                        _outputBox.AddOutput(conditionalResult.Output);
                    }

                    if (conditionalResult.Success)
                    {
                        TriggerContinue(EncounterState.RunAway);
                    }
                }
                else
                {
                    TriggerContinue(EncounterState.RunAway);
                }

                return;

            case BattleActions.Continue:
                switch (_encounterState)
                {
                case EncounterState.Default:
                    break;

                case EncounterState.RunAway:
                    EncounterManager.Instance.Exit();
                    break;

                case EncounterState.PlayerWon:
                    EncounterManager.Instance.PlayerWon(_encounter);
                    break;

                case EncounterState.PlayerDied:
                    EncounterManager.Instance.PlayerDied(_encounter);
                    break;
                }

                return;
            }

            if (_currentEnemy.Health > 0)
            {
                if (!_enemyIsStunned)
                {
                    var result = CombatHelper.ResolveAttack(_currentEnemy, playerCombatProfile);
                    switch (result.Result)
                    {
                    case AttackResultCode.Missed:
                        _outputBox.AddOutput($"{_currentEnemy.Name}'s attack missed player");
                        break;

                    case AttackResultCode.ArmorBlocked:
                        _outputBox.AddOutput($"Player's armor blocked the attack");
                        break;

                    case AttackResultCode.DidDamage:
                        _outputBox.AddOutput($"{_currentEnemy.Name} did {result.DamageDone} damage to player");

                        GameManager.Instance.State.Health -= result.DamageDone;
                        SetHealth(_playerHealth, GameManager.Instance.State.Health, false);
                        break;
                    }
                }
                {
                    _enemyIsStunned = false;
                    _outputBox.AddOutput($"{_currentEnemy.Name}'s was temporarily stunned");
                }


                if (playerIsDefending && DiceHelper.RollD6() >= 5)
                {
                    _enemyIsStunned = true;
                    _outputBox.AddOutput($"{_currentEnemy.Name}'s is stunned");
                }
            }
            else
            {
                _outputBox.AddOutput($"{_currentEnemy.Name} died!");

                if (_encounter.Enemies.Any())
                {
                    NextEnemy();
                    _outputBox.AddOutput($"New enemy {_currentEnemy.Name} appeared!");
                }
                else
                {
                    _outputBox.AddOutput($"Victory! Player successfully defeated encounter!");
                    TriggerContinue(EncounterState.PlayerWon);
                }
            }

            if (GameManager.Instance.State.Health <= 0)
            {
                GameManager.Instance.State.Health = 0;
                SetHealth(_playerHealth, GameManager.Instance.State.Health, false);

                _outputBox.AddOutput("Player died :'(");
                TriggerContinue(EncounterState.PlayerDied);
            }
        }