Beispiel #1
0
        /// <summary>
        /// Increments the number of turns the StatusEffect has been active and removes it from the entity afflicted when finished
        /// </summary>
        private void IncrementTurns()
        {
            //Handle problems with this method occurring after the status has ended
            if (Ended == true)
            {
                string entityName = EntityAfflicted?.Name ?? "N/A";

                Debug.LogError($"Attempting to increment turns for {StatusType} on {entityName} after it has ended!");

                //If the entity has already been cleared, return since there's no way to remove the status without the reference
                if (EntityAfflicted == null)
                {
                    return;
                }
            }

            //Print this message if we somehow reached this method when the StatusEffect was already done
            //Don't return because we still want to remove it
            if (IsFinished == true)
            {
                Debug.LogError($"Attempting to increment turns for {StatusType} on entity {EntityAfflicted.Name} when it's already finished!");
            }

            //Increment the number of turns passed, unless this StatusEffect doesn't go away
            if (IsInfinite == false)
            {
                TurnsPassed++;
            }

            //When the StatusEffect is finished, remove it
            if (IsFinished == true)
            {
                EntityAfflicted.RemoveStatus(StatusType, true, ShouldQueueEndEvent);
            }
        }
        protected override void OnAfflict()
        {
            //Remove the Frozen status if the entity was afflicted with Burn
            if (EntityAfflicted.EntityProperties.HasStatus(Enumerations.StatusTypes.Frozen) == true)
            {
                Debug.Log($"{StatusType} was inflicted on an entity afflicted with {Enumerations.StatusTypes.Frozen}, negating both effects!");
                EntityAfflicted.RemoveStatus(Enumerations.StatusTypes.Frozen, true, false);

                //Also remove Burn, as these two statuses negate each other
                EntityAfflicted.RemoveStatus(Enumerations.StatusTypes.Burn, true, false);
            }
        }