コード例 #1
0
ファイル: Player.cs プロジェクト: exallium/DotNetHack
        /// <summary>
        /// Player
        /// </summary>
        /// <param name="aPlayerName"></param>
        /// <param name="aLocation"></param>
        public Player(string aPlayerName, Location3i aLocation)
            : base()
        {
            // Create the players key-chain
            KeyChain = new KeyChain();

            // Create the players wallet.
            Wallet = new Currency(0);

            G = '@';
            Name = aPlayerName;
            Location = aLocation;
            C = new Colour() { FG = ConsoleColor.Gray };
            Stats = new Stats()
            {
                Agility = 2,
                Charisma = 4,
                Endurance = 7,
                Intelligence = 7,
                Luck = 4,
                Perception = 2,
                Strength = 7,
            };

            Initialize();
        }
コード例 #2
0
ファイル: Actor.cs プロジェクト: exallium/DotNetHack
        /// <summary>
        /// Create a new instance of Actor.
        /// </summary>
        public Actor()
        {
            // Create inventory collection for this actor.
            Inventory = new ItemCollection();

            // Active effects on this actor.
            EffectStack = new List<Effect>();

            // The actors stats.
            Stats = new Stats();

            WieldedWeapons = new WeaponsWielded();
        }
コード例 #3
0
ファイル: Input.cs プロジェクト: exallium/DotNetHack
        /// <summary>
        /// ReadStats, read a full out stats object from standard-in.
        /// This is only for properties that *can* be read.
        /// </summary>
        /// <returns></returns>
        public static Stats ReadStats()
        {
            // Get all properties for a stats object and set them via user input.
            Stats retVal = new Stats();
            foreach (var p in typeof(Stats).GetProperties())
            {
                if (p.CanWrite)
                {
                    var pSet = p.GetSetMethod();
                    pSet.Invoke(retVal, new object[] { Input.GetInt(p.Name + ": ") });
                }

                UI.Graphics.CursorToLocation(1, 1);
                Console.Write("                   ");
            }

            return retVal;
        }