//NoSkills cannot be refreshed like other status effects, as a move category cannot be disabled more than once
        //This serves to add new categories to disable and track how long they should be disabled
        public override void Refresh(StatusEffect newStatus)
        {
            //Convert the new status, then check if its category isn't already in the status' disabled dictionary
            NoSkillsStatus noSkills = (NoSkillsStatus)newStatus;

            if (CategoriesDisabled.ContainsKey(noSkills.CategoryDisabled) == false)
            {
                //Adjust the Duration to account for a new category disabled while the status is already active
                //The Duration will match the exact number of turns required for all disabled categories to finish
                //AdditionalDuration applies to all disabled MoveCategories and the status itself,
                //so this works with that regardless of its value
                int turnOverflow = TurnsPassed + newStatus.Duration;
                if (turnOverflow > Duration)
                {
                    Duration = turnOverflow;
                }

                //Get the total duration of the new status
                //The AdditionalDuration will be the same across all statuses of this type since it's based on the entity afflicted by it
                int totalDur = newStatus.Duration + AdditionalDuration;

                CategoriesDisabled.Add(noSkills.CategoryDisabled, totalDur);
                EntityAfflicted.EntityProperties.DisableMoveCategory(noSkills.CategoryDisabled);
            }
            else
            {
                //Display an error message if trying to disable a move category that NoSkills has already disabled
                Debug.LogError($"Moves cannot be disabled multiple times by NoSkills. Not refreshing {noSkills.CategoryDisabled} moves' disabled duration");
            }

            AfflictedMessage = GetMessageFromCategory(noSkills.CategoryDisabled);
            ShowAfflictedMessage();
        }
        //NoSkills cannot be refreshed like other status effects, as a move category cannot be disabled more than once
        //This serves to add new categories to disable and track how long they should be disabled
        public override void Refresh(StatusEffect newStatus)
        {
            //Convert the new status, then check if its category isn't already in the status' disabled dictionary
            /*As a failsafe, also check if the category isn't already disabled (see comments in OnAfflict())*/
            NoSkillsStatus noSkills = (NoSkillsStatus)newStatus;

            if (EntityAfflicted.EntityProperties.IsMoveCategoryDisabled(noSkills.CategoryDisabled) == true)
            {
                Debug.LogWarning($"{noSkills.CategoryDisabled} moves are already disabled for {EntityAfflicted.Name}. " +
                                 $"Not disabling in {nameof(NoSkillsStatus)} as they could've been disabled through other means");

                return;
            }

            if (CategoriesDisabled.ContainsKey(noSkills.CategoryDisabled) == false)
            {
                //Adjust the Duration to account for a new category disabled while the status is already active
                //The Duration will match the exact number of turns required for all disabled categories to finish
                //AdditionalDuration applies to all disabled MoveCategories and the status itself,
                //so this works with that regardless of its value
                int turnOverflow = TurnsPassed + newStatus.Duration;
                if (turnOverflow > Duration)
                {
                    Duration = turnOverflow;
                }

                //Get the total duration of the new status
                //The AdditionalDuration will be the same across all statuses of this type since it's based on the entity afflicted by it
                int totalDur = newStatus.Duration + AdditionalDuration;

                CategoriesDisabled.Add(noSkills.CategoryDisabled, totalDur);
                EntityAfflicted.EntityProperties.DisableMoveCategory(noSkills.CategoryDisabled);
            }
            else
            {
                Debug.LogError($"{noSkills.CategoryDisabled} moves are somehow ENABLED for {EntityAfflicted.Name} but " +
                               $"ALREADY in the {nameof(CategoryDisabled)} dictionary?! This must mean that this status was somehow Refreshed while Suspended. FIX IT!");
            }
        }
Exemple #3
0
        public static void DebugBattle()
        {
            //Default to Players - if holding 0, switch to Enemies
            Enumerations.EntityTypes entityType = Enumerations.EntityTypes.Player;
            if (Input.GetKey(Keys.D0, DebugKeyboard) == true)
            {
                entityType = Enumerations.EntityTypes.Enemy;
            }

            int turnCount = 3;

            StatusEffect status = null;

            //Inflict NoSkills
            if (Input.GetKey(Keys.N, DebugKeyboard) == true)
            {
                //Disable Jump
                if (Input.GetKeyDown(Keys.J, DebugKeyboard) == true)
                {
                    status = new NoSkillsStatus(Enumerations.MoveCategories.Jump, turnCount);
                }
                //Disable Hammer
                else if (Input.GetKeyDown(Keys.H, DebugKeyboard) == true)
                {
                    status = new NoSkillsStatus(Enumerations.MoveCategories.Hammer, turnCount);
                }
                //Disable Items
                else if (Input.GetKeyDown(Keys.I, DebugKeyboard) == true)
                {
                    status = new NoSkillsStatus(Enumerations.MoveCategories.Item, turnCount);
                }
                //Disable Tactics
                else if (Input.GetKeyDown(Keys.T, DebugKeyboard) == true)
                {
                    status = new NoSkillsStatus(Enumerations.MoveCategories.Tactics, turnCount);
                }
                //Disable Partner moves
                else if (Input.GetKeyDown(Keys.P, DebugKeyboard) == true)
                {
                    status = new NoSkillsStatus(Enumerations.MoveCategories.Partner, turnCount);
                }
                //Disable Special moves
                else if (Input.GetKeyDown(Keys.S, DebugKeyboard) == true)
                {
                    status = new NoSkillsStatus(Enumerations.MoveCategories.Special, turnCount);
                }

                if (status != null)
                {
                    DebugInflictStatus(status, entityType);
                }
            }
            //Inflict Poison, Payback, or Paralyzed
            else if (Input.GetKeyDown(Keys.P, DebugKeyboard) == true)
            {
                //Inflict Payback
                if (Input.GetKey(Keys.B, DebugKeyboard) == true)
                {
                    status = new PaybackStatus(turnCount);
                }
                //Inflict Paralyzed
                else if (Input.GetKey(Keys.Z, DebugKeyboard) == true)
                {
                    status = new ParalyzedStatus(turnCount);
                }
                else
                {
                    status = new PoisonStatus(turnCount);
                }

                DebugInflictStatus(status, entityType);
            }
            //Inflict Invisible or Injured
            else if (Input.GetKeyDown(Keys.I, DebugKeyboard) == true)
            {
                //Inflict Injured
                if (Input.GetKey(Keys.J, DebugKeyboard) == true)
                {
                    status = new InjuredStatus(turnCount);
                }
                else
                {
                    status = new InvisibleStatus(turnCount);
                }

                DebugInflictStatus(status, entityType);
            }
            //Inflict Electrified
            else if (Input.GetKeyDown(Keys.E, DebugKeyboard) == true)
            {
                DebugInflictStatus(new ElectrifiedStatus(turnCount), entityType);
            }
            //Inflict Fast, Frozen, FPRegen, or Fright
            else if (Input.GetKeyDown(Keys.F, DebugKeyboard) == true)
            {
                //Inflict Frozen
                if (Input.GetKey(Keys.R, DebugKeyboard) == true)
                {
                    status = new FrozenStatus(turnCount);
                }
                //Inflict FPRegen
                else if (Input.GetKey(Keys.P, DebugKeyboard) == true)
                {
                    status = new FPRegenStatus(2, turnCount);
                }
                else if (Input.GetKey(Keys.I, DebugKeyboard) == true)
                {
                    status = new FrightStatus();
                }
                else
                {
                    status = new FastStatus(turnCount);
                }

                DebugInflictStatus(status, entityType);
            }
            //Inflict Dizzy or Dodgy
            else if (Input.GetKeyDown(Keys.D, DebugKeyboard) == true)
            {
                //Inflict Dodgy
                if (Input.GetKey(Keys.O, DebugKeyboard) == true)
                {
                    status = new DodgyStatus(turnCount);
                }
                else
                {
                    status = new DizzyStatus(turnCount);
                }

                DebugInflictStatus(status, entityType);
            }
            //Inflict Sleep, Stone, Slow, or Stop
            else if (Input.GetKeyDown(Keys.S, DebugKeyboard) == true)
            {
                //Inflict Stone
                if (Input.GetKey(Keys.T, DebugKeyboard) == true)
                {
                    status = new StoneStatus(turnCount);
                }
                //Inflict Slow
                else if (Input.GetKey(Keys.L, DebugKeyboard) == true)
                {
                    status = new SlowStatus(turnCount);
                }
                //Inflict Stop
                else if (Input.GetKey(Keys.P, DebugKeyboard) == true)
                {
                    status = new StopStatus(turnCount);
                }
                else
                {
                    status = new SleepStatus(turnCount);
                }

                DebugInflictStatus(status, entityType);
            }
            //Inflict Confused or Charged
            else if (Input.GetKeyDown(Keys.C, DebugKeyboard) == true)
            {
                //Inflict Charged
                if (Input.GetKey(Keys.H, DebugKeyboard) == true)
                {
                    status = new ChargedStatus(1);
                }
                else
                {
                    status = new ConfusedStatus(turnCount);
                }

                DebugInflictStatus(status, entityType);
            }
            //Inflict Burn or Blown
            else if (Input.GetKeyDown(Keys.B, DebugKeyboard) == true)
            {
                if (Input.GetKey(Keys.L, DebugKeyboard) == true)
                {
                    status = new BlownStatus();
                }
                else
                {
                    status = new BurnStatus(turnCount);
                }

                DebugInflictStatus(status, entityType);
            }
            //Inflict Tiny
            else if (Input.GetKeyDown(Keys.T, DebugKeyboard) == true)
            {
                status = new TinyStatus(turnCount);
                DebugInflictStatus(status, entityType);
            }
            //Inflict Huge or HPRegen
            else if (Input.GetKeyDown(Keys.H, DebugKeyboard) == true)
            {
                //Inflict HPRegen
                if (Input.GetKey(Keys.P, DebugKeyboard) == true)
                {
                    status = new HPRegenStatus(2, turnCount);
                }
                //Inflict Hold Fast
                else if (Input.GetKey(Keys.O, DebugKeyboard) == true)
                {
                    status = new HoldFastStatus(turnCount);
                }
                else
                {
                    status = new HugeStatus(turnCount);
                }

                DebugInflictStatus(status, entityType);
            }
            //Inflict Allergic
            else if (Input.GetKeyDown(Keys.A, DebugKeyboard) == true)
            {
                status = new AllergicStatus(turnCount);
                DebugInflictStatus(status, entityType);
            }
        }