/// <summary>
        /// Calculate secondary attributes from primary attributes.
        /// i.e. How much critical strike chance does the characters agility provide?
        /// </summary>
        public override SecondaryAttributes CalculateSecondaryAttributes(PrimaryAttributes primaryAttributes)
        {
            // (Source: https://rankedboost.com/world-of-warcraft/classic-stats/)
            // 2 Melee Attack Power per 1 point of Strength.
            var meleeAttackPower = new MeleeAttackPower(primaryAttributes.Strength.Value * 2);
            // Block 1 Damage for every 20 points of Strength.
            var blockDamage = new BlockDamage(primaryAttributes.Strength.Value / 20);
            // 2 Armor for every 1 point of Agility.
            var armor = new ArmorAmount(primaryAttributes.Agility.Value / 2);
            // 1% Critical Strike Chance for every 20 points of Agility.
            var criticalStrike = new CriticalStrike(primaryAttributes.Agility.Value / 20);
            // 1 Ranged Attack Power per 1 point of Agility.
            var rangedAttackPower = new RangedAttackPower(primaryAttributes.Agility.Value);
            // 1% Dodge per 20 point of Agility.
            var dodge = new Dodge(primaryAttributes.Agility.Value / 20);
            // 5% base chance to Parry. (Source: https://worldofwarcraft.fandom.com/et/wiki/Parry)
            var parry = new Parry(5);
            // 10 Health for every 1 point of Stamina.
            var health = new Health((int)primaryAttributes.Stamina.Value / 10);

            var attributes = new SecondaryAttributes(
                health,
                criticalStrike,
                Hit.Zero,
                dodge,
                parry,
                Defense.Zero,
                blockDamage,
                meleeAttackPower,
                rangedAttackPower,
                armor,
                new WeaponSkills());

            return(attributes);
        }
 public CharacterAttributes(
     SecondaryAttributes classSecondaryAttributes,
     SecondaryAttributes equipmentSecondaryAttributes)
 {
     ClassSecondaryAttributes     = classSecondaryAttributes;
     EquipmentSecondaryAttributes = equipmentSecondaryAttributes;
 }
 protected Class(Race race, Level level)
 {
     Race                = race;
     Level               = level;
     PrimaryAttributes   = new PrimaryAttributes();
     SecondaryAttributes = new SecondaryAttributes();
 }
 public Item(
     string name,
     ItemIdentifier identifier,
     PrimaryAttributes primaryAttributes,
     SecondaryAttributes secondaryAttributes)
 {
     _identifier         = identifier;
     Name                = name;
     PrimaryAttributes   = primaryAttributes;
     SecondaryAttributes = secondaryAttributes;
 }
        public void LevelUp_LevelUpOfWarrior_SetsCorrectSecondaryAttributes()
        {
            // Arrange
            Warrior             warrior  = new("Warrior");
            SecondaryAttributes expected = new() { Health = 150, ArmorRating = 12, ElementalResistence = 2 };

            // Act
            warrior.LevelUp(1);
            SecondaryAttributes actual = warrior.BaseSecondaryAttributes;

            //Assert
            Assert.Equal(expected, actual);
        }

        #endregion
    }
 public Weapon(
     string name,
     ItemIdentifier identifier,
     PrimaryAttributes primaryAttributes,
     SecondaryAttributes secondaryAttributes,
     WeaponType type,
     DamageRange damageRange,
     double speed,
     WeaponProc proc)
     : base(
         name,
         identifier,
         primaryAttributes,
         secondaryAttributes)
 {
     Type        = type;
     DamageRange = damageRange;
     Speed       = speed;
     Proc        = proc;
 }
Exemple #7
0
        private SecondaryAttributes CalculateSecondaryAttributes(Dictionary <SlotType, Item> items)
        {
            var secondaryAttributes = new SecondaryAttributes();

            foreach (var(slot, item) in items)
            {
                secondaryAttributes.CriticalStrike.Add(item.SecondaryAttributes.CriticalStrike.Value);
                secondaryAttributes.Hit.Add(item.SecondaryAttributes.Hit.Value);
                secondaryAttributes.Dodge.Add(item.SecondaryAttributes.Dodge.Value);
                secondaryAttributes.Parry.Add(item.SecondaryAttributes.Parry.Value);
                secondaryAttributes.Defense.Add(item.SecondaryAttributes.Defense.Value);
                secondaryAttributes.MeleeAttackPower.Add(item.SecondaryAttributes.MeleeAttackPower.Value);
                secondaryAttributes.Armor.Add(item.SecondaryAttributes.Armor.Value);

                foreach (var weaponSkill in item.SecondaryAttributes.WeaponSkills)
                {
                    secondaryAttributes.WeaponSkills.Add(weaponSkill);
                }
            }

            return(secondaryAttributes);
        }
        /// <summary>
        /// Outputs stats to console.
        /// </summary>
        /// <param name="name">Name of hero</param>
        /// <param name="level">Level of hero</param>
        /// <param name="totalPrimaryAttributes">PrimaryAttributes of hero</param>
        /// <param name="baseSecondaryAttributes">SecondaryAttributes of hero</param>
        /// <param name="dps">Damage per second of hero</param>
        public void WriteStatsToConsole(string name, int level, PrimaryAttributes totalPrimaryAttributes, SecondaryAttributes baseSecondaryAttributes, double dps)
        {
            StringBuilder stats = new StringBuilder("\n-- Stats --\n");

            stats.AppendFormat($"Name: {name}\n");
            stats.AppendFormat($"Level: {level}\n");
            stats.AppendFormat($"Strength: {totalPrimaryAttributes.Strength}\n");
            stats.AppendFormat($"Dexterity: {totalPrimaryAttributes.Dexterity}\n");
            stats.AppendFormat($"Vitality: {totalPrimaryAttributes.Vitality}\n");
            stats.AppendFormat($"Intelligence: {totalPrimaryAttributes.Intelligence}\n");
            stats.AppendFormat($"Health: {baseSecondaryAttributes.Health}\n");
            stats.AppendFormat($"Armor Rating: {baseSecondaryAttributes.ArmorRating}\n");
            stats.AppendFormat($"Elemental Resistance: {baseSecondaryAttributes.ElementalResistence}\n");
            stats.AppendFormat($"DPS: {dps:0.##}");

            Console.WriteLine(stats.ToString());
        }
Exemple #9
0
 public Equipment(Dictionary <SlotType, Item> items)
 {
     _items              = items;
     PrimaryAttributes   = CalculatePrimaryAttributes(items);
     SecondaryAttributes = CalculateSecondaryAttributes(items);
 }