AffectList.cs

src/Affects/AffectList.cs · 1.7 KB

From the archive Arthea-src-1.0.zip

Download the archive   « Back to the archive contents

#region Arthea License

/***********************************************************************
*  Arthea MUD by R. Jennings (2007)      http://arthea.googlecode.com/ *
*  By using this code you comply with the Artistic and GPLv2 Licenses. *
***********************************************************************/

#endregion

using System.Collections.Generic;

namespace Arthea.Affects
{
    /// <summary>
    /// Implementation of an affect list.
    /// </summary>
    public class AffectList : List<Affect>
    {
        #region [rgn] Methods (3)

        // [rgn] Public Methods (3)

        /// <summary>
        /// Adds the specified flags.
        /// </summary>
        /// <param name="affect">The affect.</param>
        public new void Add(Affect affect)
        {
            if (Contains(affect))
                return;

            Add(affect);
        }

        /// <summary>
        /// Adds the specified affects.
        /// </summary>
        /// <param name="affects">The affects.</param>
        /// <returns></returns>
        public void Add(AffectList affects)
        {
            if (affects == null)
                return;

            foreach (Affect aff in affects)
            {
                Add(aff);
            }
        }

        /// <summary>
        /// Removes the specified affects.
        /// </summary>
        /// <param name="affects">The affects.</param>
        public void Remove(AffectList affects)
        {
            foreach (Affect aff in affects)
            {
                if (Contains(aff))
                    Remove(aff);
            }
        }

        #endregion [rgn]
    }
}

Site Stats

Snippets: 1791
Codebases: 571