예제 #1
0
        //------------------------------------------------------------------------/
        // Methods
        //------------------------------------------------------------------------/
        /// <summary>
        /// Adds the status. If it is already present, it will follow whatever
        /// rules for stackability/diminishing returns it has.
        /// </summary>
        /// <param name="status">The instance of the status to be added.</param>
        public void Add(Status.Instance newStatus)
        {
            //Trace.Script("Adding" + newStatus.Name);

            // Apply its initial effect
            newStatus.Start();

            // Check whether an instance of the status is already present
            var presentStatus = Find(newStatus.status);

            if (presentStatus != null)
            {
                // Determine whether to stack it
                if (presentStatus.status.IsStackable)
                {
                    presentStatus.Stack();
                }
                // Determine whether to reset its duration
                presentStatus.Reset();
            }
            // If not present, add it
            else
            {
                statuses.Add(newStatus);
            }
        }