Example #1
0
        public override void CalcDamage()
        {
            PrimaryAttributes totalAttributes = CalcTotalAttributes();
            double            WeaponDps       = CalcWeaponDPS();

            Damage = WeaponDps * (1 + (totalAttributes.Dexterity / 100));
        }
Example #2
0
        /// <summary>
        /// Calculates the total attributes of the character.
        /// The calculation is based on the primaryattributes and the baseprimaryattributes.
        /// </summary>
        /// <returns>totalAttributes</returns>
        public PrimaryAttributes CalcTotalAttributes()
        {
            PrimaryAttributes primaryAttributes = CalcPrimaryAttributes();
            PrimaryAttributes totalAttributes   = BasePrimaryAttributes + primaryAttributes;

            return(totalAttributes);
        }
Example #3
0
        /// <summary>
        /// Calculates the secondary attributes of the character.
        /// The health is calculated by multiplying the characters totalvitality with 10.
        /// The armor is calculated by adding the totalstrength and totaldexterity of the character.
        /// The elemental resistance is equal to the intelligence of the character.
        /// </summary>
        public void CalcSecondaryAttributes()
        {
            PrimaryAttributes totalAttributes = CalcTotalAttributes();

            SecondaryAttributes.Health              = totalAttributes.Vitality * 10;
            SecondaryAttributes.ArmorRating         = totalAttributes.Strength + totalAttributes.Dexterity;
            SecondaryAttributes.ElementalResistance = totalAttributes.Intelligence;
        }
Example #4
0
        /// <summary>
        /// Calculates the primary attributes based on the equipped armor.
        /// If an item is equipped in a slot, proceed to add the armor attributes to the calculatedStats object.
        /// </summary>
        /// <returns>calculatedStats</returns>
        public PrimaryAttributes CalcPrimaryAttributes()
        {
            PrimaryAttributes calculatedStats = new PrimaryAttributes();
            List <Armor>      armors          = Equipment.Where(item => item.Key != ArmorSlots.WEAPON).Select(item => item.Value as Armor).ToList();

            foreach (Armor armor in armors)
            {
                if (armor != null)
                {
                    calculatedStats += armor.ArmorAttributes;
                }
            }

            return(calculatedStats);
        }
Example #5
0
        /// <summary>
        /// Prints the characters stats to the console.
        /// </summary>
        public static void PrintCharacterInfo(Character Character)
        {
            Character.CalcDamage();
            Character.CalcSecondaryAttributes();
            PrimaryAttributes totalAttributes = Character.CalcTotalAttributes();

            StringBuilder charInfo = new StringBuilder();

            charInfo.AppendLine("Character stats: ");
            charInfo.AppendLine("Name: " + Character.Name);
            charInfo.AppendLine("Level: " + Character.Level);
            charInfo.AppendLine("Vitality: " + totalAttributes.Vitality);
            charInfo.AppendLine("Strength: " + totalAttributes.Strength);
            charInfo.AppendLine("Dexterity: " + totalAttributes.Dexterity);
            charInfo.AppendLine("Intelligence: " + totalAttributes.Intelligence);
            charInfo.AppendLine("Health: " + Character.SecondaryAttributes.Health);
            charInfo.AppendLine("Armor Rating: " + Character.SecondaryAttributes.ArmorRating);
            charInfo.AppendLine("Elemental Resistance: " + Character.SecondaryAttributes.ElementalResistance);
            charInfo.AppendLine("DPS: " + Character.Damage);

            Console.WriteLine(charInfo);
        }