Ejemplo n.º 1
0
    void GetInput()
    {
        if (activeCharacter == null || activeCharacter.rb == null)
        {
            return;
        }

        if (gameManager.inputManager.switchAction)
        {
            SetNextCharacterAsActive();
        }

        if (gameManager.inputManager.reloadScene)
        {
            gameManager.levelManager.Retry();
        }

        if (gameManager.inputManager.fusionAction)
        {
            CombineActiveWithNearestCharacter();
        }

        if (gameManager.inputManager.abilityAction)
        {
            activeCharacter.abilityIndex = 0;
            activeCharacter.ActivateAbility();
        }

        if (gameManager.inputManager.abilityAction2)
        {
            Depression depression = activeCharacter.GetComponent <Depression>();

            if (!depression)
            {
                return;
            }

            if (depression.jetpackActivated)
            {
                return;
            }

            activeCharacter.abilityIndex = 1;
            activeCharacter.ActivateAbility();
        }
    }
Ejemplo n.º 2
0
        private void ActionExecution()
        {
            character.Attacking    = actionArrows[0] == ">";
            character.Defending    = actionArrows[1] == ">";
            character.UsingAbility = actionArrows[2] == ">";
            character.UsingPotion  = actionArrows[3] == ">";

            character.CheckAbility(character, "Combat Game State");

            if (character.Attacking)
            {
                notifications = $"{character.nickname} used Attack!!";
            }
            else if (character.Defending)
            {
                notifications = $"{character.nickname} used Defend!!";
            }
            else if (character.UsingAbility)
            {
                if (character.abilityActive)
                {
                    error         = true;
                    notifications = $"{character.abilityName} cannot be used this round!!";
                }
                else
                {
                    character.ActivateAbility();
                    notifications = $"{character.nickname} used {character.abilityName}!!";
                }
            }
            else if (character.UsingPotion)
            {
                error = true;

                if (Program.potions.Count > 0)
                {
                    for (int potion = 0; potion < Program.potions.Count; potion++)
                    {
                        if (Program.potions[potion] != null)
                        {
                            switch (Program.potions[potion].stat)
                            {
                            case "Strength": strengthPotions += 1; break;

                            case "Toughness": toughnessPotions += 1; break;

                            case "Defence": defencePotions += 1; break;

                            case "Luck": luckPotions += 1; break;
                            }
                        }
                    }

                    potionNames[0] = $"Strength Potion x {strengthPotions}";
                    potionNames[1] = $"Toughness Potion x {toughnessPotions}";
                    potionNames[2] = $"Defence Potion x {defencePotions}";
                    potionNames[3] = $"Luck Potion x {luckPotions}";

                    character.UsingPotion = false;
                    potionAction          = true;
                }
                else
                {
                    notifications = "You do not have any potions!";
                    potionAction  = false;
                }
            }
            else
            {
                error         = true;
                notifications = "You cannot choose that option!";
            }

            if (!error)
            {
                if (character.hasFought)
                {
                    error         = true;
                    notifications = $"{character.nickname} has already fought!!";
                }
                else
                {
                    character.hasFought = true;
                }
            }

            if (!error)
            {
                bool miss = character.LuckRoll(15);

                if (miss)
                {
                    notifications = $"{enemy.creatureName} missed!";
                }

                enemy.Combat(character, round, miss);

                if (character.Crit && character.Attacking || character.CalcAttack == character.Strength * 1.5 && character.Attacking)
                {
                    notifications = $"{character.nickname} got a Critical Hit!";
                }

                character.PotionWearOff();
            }

            SetUpNextState();
        }