コード例 #1
0
ファイル: Equipment.cs プロジェクト: gitter-badger/OpenORPG
        /// <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;
        }
コード例 #2
0
ファイル: Character.cs プロジェクト: Erikai/OpenORPG
        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>();
        }
コード例 #3
0
ファイル: DamagePayload.cs プロジェクト: Erikai/OpenORPG
        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;
        }
コード例 #4
0
ファイル: DamagePayload.cs プロジェクト: Erikai/OpenORPG
        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;
        }
コード例 #5
0
ファイル: Character.cs プロジェクト: gitter-badger/OpenORPG
        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();
        }