Esempio n. 1
0
        /// <summary>
        /// Fetches and returns all the modifications to stats this equipment provides.
        /// </summary>
        /// <returns>Returns an array of <see cref="CharacterStat"/> representing the values.</returns>
        public CharacterStatCollection GetEquipmentModifierStats()
        {
            var stats = new CharacterStatCollection();

            stats[StatTypes.Strength].CurrentValue = ItemTemplate.Str;
            stats[StatTypes.Dexterity].CurrentValue = ItemTemplate.Dex;
            stats[StatTypes.Intelligence].CurrentValue = ItemTemplate.Int;
            stats[StatTypes.Hitpoints].CurrentValue = ItemTemplate.HitpointsModifier;
            stats[StatTypes.Luck].CurrentValue = ItemTemplate.Lck;
            stats[StatTypes.Vitality].CurrentValue = ItemTemplate.Vit;

            return stats;
        }
Esempio n. 2
0
        public Character(string sprite)
            : base(sprite)
        {
            //TODO: Be a bit more creative than this
            Speed = 130;

            CharacterStats = new CharacterStatCollection(this);

            // Allocate just enough room for equipment
            var numberOfEquipmentSlots = Enum.GetNames(typeof(EquipmentSlot)).Length;
            Equipment = new Equipment[numberOfEquipmentSlots];

            Skills = new List<Skill>();
        }
Esempio n. 3
0
        private CharacterStatCollection CombineStats(CharacterStatCollection first, CharacterStatCollection second)
        {
            var stats = new CharacterStatCollection();

            for (int index = 0; index < first.Length; index++)
            {
                var stat = first[index];
                var stat2 = second[index];

                stats[index].CurrentValue = stat.CurrentValue + stat2.CurrentValue;
                stats[index].MaximumValue = stat.MaximumValue + stat2.MaximumValue;
            }

            return stats;
        }
Esempio n. 4
0
        private CharacterStatCollection GetCharacterStats(Character character)
        {
            var statsWithEquipmentMods = new CharacterStatCollection();

            // Include character stats
            statsWithEquipmentMods = CombineStats(statsWithEquipmentMods, character.CharacterStats);

            // Get inclusive equipment stats
            foreach (var equip in character.Equipment)
            {
                if (equip != null)
                    statsWithEquipmentMods = CombineStats(equip.GetEquipmentModifierStats(), statsWithEquipmentMods);
            }

            return statsWithEquipmentMods;
        }
Esempio n. 5
0
        public Character(string sprite)
            : base(sprite)
        {
            //TODO: Be a bit more creative than this
            Speed = 130;

            CharacterStats = new CharacterStatCollection(this);

            // Allocate just enough room for equipment
            var numberOfEquipmentSlots = Enum.GetNames(typeof(EquipmentSlot)).Length;
            Equipment = new Equipment[numberOfEquipmentSlots];

            CharacterStats[StatTypes.Hitpoints].CurrentValueChanged += OnHitpointsChanged;

            Skills = new List<Skill>();
            ActiveStatusEffects = new StatusEffectCollection();
        }