/
etc/
lib/
src/Abilities/
src/Abilities/Skills/
src/Abilities/Spells/
src/Abilities/Spells/Enums/
src/Affects/
src/ArtheaConsole/
src/ArtheaConsole/Properties/
src/ArtheaGUI/Properties/
src/Clans/Enums/
src/Commands/Communication/
src/Commands/ItemCommands/
src/Connections/
src/Connections/Colors/
src/Connections/Enums/
src/Connections/Players/
src/Connections/Players/Enums/
src/Continents/
src/Continents/Areas/
src/Continents/Areas/Characters/
src/Continents/Areas/Characters/Enums/
src/Continents/Areas/Items/
src/Continents/Areas/Items/Enums/
src/Continents/Areas/Rooms/
src/Continents/Areas/Rooms/Enums/
src/Continents/Areas/Rooms/Exits/
src/Creation/
src/Creation/Attributes/
src/Creation/Interfaces/
src/Database/
src/Database/Interfaces/
src/Environment/
src/Properties/
src/Scripts/Enums/
src/Scripts/Interfaces/
#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;
using Arthea.Classes;
using Arthea.Continents.Areas.Characters.Enums;

namespace Arthea.Abilities
{
    /// <summary>
    /// Implementation of a ability.
    /// </summary>
    public abstract class Ability
    {
        #region [rgn] Fields (7)

        private string damageNoun;
        private byte difficulty;
        private AbilityFlags flags;
        private ClassValues level;
        private Position minimumPosition;
        private string name;
        private byte waitTime;

        #endregion [rgn]

        #region [rgn] Constructors (2)

        /// <summary>
        /// Initializes a new instance of the <see cref="Ability"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="levels">The class levels.</param>
        /// <param name="pos">The position.</param>
        /// <param name="wait">The wait.</param>
        /// <param name="difficulty">The difficulty.</param>
        /// <param name="damage">The damage.</param>
        /// <param name="flags">The flags.</param>
        public Ability(string name, ClassValues levels, Position pos,
                       byte wait, byte difficulty, string damage, AbilityFlags flags)
        {
            this.name = name;
            level = levels;
            minimumPosition = pos;
            waitTime = wait;
            this.difficulty = difficulty;
            damageNoun = damage;
            this.flags = flags ?? new AbilityFlags();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Ability"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        public Ability(string name)
        {
            this.name = name;
            level = new ClassValues();
        }

        #endregion [rgn]

        #region [rgn] Properties (7)

        /// <summary>
        /// Gets or sets the damage noun.
        /// </summary>
        /// <value>The damage noun.</value>
        public string DamageNoun
        {
            get { return damageNoun; }
            set { damageNoun = value; }
        }

        /// <summary>
        /// Gets or sets the difficulty.
        /// </summary>
        /// <value>The difficulty.</value>
        public byte Difficulty
        {
            get { return difficulty; }
            set { difficulty = value; }
        }

        /// <summary>
        /// Gets or sets the flags.
        /// </summary>
        /// <value>The flags.</value>
        public AbilityFlags Flags
        {
            get { return flags; }
            set { flags = value; }
        }

        /// <summary>
        /// Gets or sets the level.
        /// </summary>
        /// <value>The level.</value>
        public ClassValues Level
        {
            get { return level; }
            set { level = value; }
        }

        /// <summary>
        /// Gets or sets the minimum position.
        /// </summary>
        /// <value>The minimum position.</value>
        public Position MinimumPosition
        {
            get { return minimumPosition; }
            set { minimumPosition = value; }
        }

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        /// <summary>
        /// Gets or sets the wait time.
        /// </summary>
        /// <value>The wait time.</value>
        public byte WaitTime
        {
            get { return waitTime; }
            set { waitTime = value; }
        }

        #endregion [rgn]

        #region [rgn] Methods (1)

        // [rgn] Public Methods (1)

        /// <summary>
        /// Creates class levels.
        /// </summary>
        /// <param name="levels">the list of class names and levels
        /// example - "warrior", 2, "thief", 3.</param>
        /// <returns>a classvalues object</returns>
        public static ClassValues CreateLevels(params object[] levels)
        {
            if (levels.Length%2 != 0)
                throw new ArgumentException();

            ClassValues foo = new ClassValues();

            int i = 0;

            while (i < levels.Length)
            {
                foo[levels[i++].ToString()] = Convert.ToByte(levels[i++]);
            }

            return foo;
        }

        #endregion [rgn]
    }

    /// <summary>
    /// Implementation of a ability flags.
    /// </summary>
    public class AbilityFlags : Flag
    {
        #region [rgn] Constructors (3)

        /// <summary>
        /// Initializes a new instance of the <see cref="AbilityFlags"/> class.
        /// </summary>
        /// <param name="flag">The bit array.</param>
        public AbilityFlags(Flag flag) : base(flag)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="AbilityFlags"/> class.
        /// </summary>
        /// <param name="mask">The mask.</param>
        public AbilityFlags(ulong mask) : base(mask)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="AbilityFlags"/> class.
        /// </summary>
        public AbilityFlags()
        {
        }

        #endregion [rgn]
    }
}