protected Class(Race race, Level level) { Race = race; Level = level; PrimaryAttributes = new PrimaryAttributes(); SecondaryAttributes = new SecondaryAttributes(); }
/// <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 PrimaryAttributes Combine(PrimaryAttributes attributes) { return(new PrimaryAttributes( new Strength(Strength.Value + attributes.Strength.Value), new Agility(Agility.Value + attributes.Agility.Value), new Stamina(Stamina.Value + attributes.Stamina.Value), new Intellect(Intellect.Value + attributes.Intellect.Value), new Spirit(Spirit.Value + attributes.Spirit.Value) )); }
public void Constructor_InitOfWarrior_SetsCorrectPrimaryAttributes() { // Arrange Warrior warrior = new("Warrior"); PrimaryAttributes expected = new() { Vitality = 10, Strength = 5, Dexterity = 2, Intelligence = 1 }; // Act PrimaryAttributes actual = warrior.BasePrimaryAttributes; //Assert Assert.Equal(expected, actual); }
public void Constructor_InitOfRogue_SetsCorrectPrimaryAttributes() { // Arrange Rogue rogue = new("Rogue"); PrimaryAttributes expected = new() { Vitality = 8, Strength = 2, Dexterity = 6, Intelligence = 1 }; // Act PrimaryAttributes actual = rogue.BasePrimaryAttributes; //Assert Assert.Equal(expected, actual); }
public void Constructor_InitOfRanger_SetsCorrectPrimaryAttributes() { // Arrange Ranger ranger = new("Ranger"); PrimaryAttributes expected = new() { Vitality = 8, Strength = 1, Dexterity = 7, Intelligence = 1 }; // Act PrimaryAttributes actual = ranger.BasePrimaryAttributes; //Assert Assert.Equal(expected, actual); }
public void Constructor_InitOfMage_SetsCorrectPrimaryAttributes() { // Arrange Mage mage = new("Mage"); PrimaryAttributes expected = new() { Vitality = 5, Strength = 1, Dexterity = 1, Intelligence = 8 }; // Act PrimaryAttributes actual = mage.BasePrimaryAttributes; //Assert Assert.Equal(expected, actual); }
public Item( string name, ItemIdentifier identifier, PrimaryAttributes primaryAttributes, SecondaryAttributes secondaryAttributes) { _identifier = identifier; Name = name; PrimaryAttributes = primaryAttributes; SecondaryAttributes = secondaryAttributes; }
/// <summary> /// Initializes a hero. /// </summary> /// <param name="name">Name of hero</param> /// <param name="strength">Strength of hero</param> /// <param name="dexterity">Dexterity of hero</param> /// <param name="intelligence">Intelligence of hero</param> /// <param name="vitality">Vitality of hero</param> public Hero(string name, int strength, int dexterity, int intelligence, int vitality) { Name = name; Level = 1; Equipment = new Dictionary <Slot, Item>(); BasePrimaryAttributes = new PrimaryAttributes() { Strength = strength, Dexterity = dexterity, Intelligence = intelligence, Vitality = vitality }; CalculateTotalStats(); }
public static PrimaryAttributes operator +(PrimaryAttributes a, PrimaryAttributes b) { PrimaryAttributes primaryAttributes = new PrimaryAttributes { Strength = a.Strength + b.Strength, Dexterity = a.Dexterity + b.Dexterity, Intelligence = a.Intelligence + b.Intelligence, Vitality = a.Vitality + b.Vitality }; return(primaryAttributes); }
public void LevelUp_LevelUpOfRanger_SetsCorrectPrimaryAttributes() { // Arrange Ranger ranger = new("Ranger"); PrimaryAttributes expected = new() { Vitality = 10, Strength = 2, Dexterity = 12, Intelligence = 2 }; // Act ranger.LevelUp(1); PrimaryAttributes actual = ranger.BasePrimaryAttributes; //Assert Assert.Equal(expected, actual); }
public void LevelUp_LevelUpOfRogue_SetsCorrectPrimaryAttributes() { // Arrange Rogue rogue = new("Rogue"); PrimaryAttributes expected = new() { Vitality = 11, Strength = 3, Dexterity = 10, Intelligence = 2 }; // Act rogue.LevelUp(1); PrimaryAttributes actual = rogue.BasePrimaryAttributes; //Assert Assert.Equal(expected, actual); }
public void LevelUp_LevelUpOfWarrior_SetsCorrectPrimaryAttributes() { // Arrange Warrior warrior = new("Warrior"); PrimaryAttributes expected = new() { Vitality = 15, Strength = 8, Dexterity = 4, Intelligence = 2 }; // Act warrior.LevelUp(1); PrimaryAttributes actual = warrior.BasePrimaryAttributes; //Assert Assert.Equal(expected, actual); }
public void LevelUp_LevelUpOfMage_SetsCorrectPrimaryAttributes() { // Arrange Mage mage = new("Mage"); PrimaryAttributes expected = new() { Vitality = 8, Strength = 2, Dexterity = 2, Intelligence = 13 }; // Act mage.LevelUp(1); PrimaryAttributes actual = mage.BasePrimaryAttributes; //Assert Assert.Equal(expected, actual); }
private PrimaryAttributes GetPrimaryAttributesForLevel(double level) { var baseAttributes = new PrimaryAttributes(); var baseAttributesTable = new WarriorBaseAttributesTable(); for (var currentLevel = 1; currentLevel <= level; currentLevel++) { var attributesGained = baseAttributesTable[currentLevel]; baseAttributes = new PrimaryAttributes() .Combine(baseAttributes) .Combine(attributesGained); } return(baseAttributes); }
private PrimaryAttributes CalculatePrimaryAttributes(Dictionary <SlotType, Item> items) { var primaryAttributes = new PrimaryAttributes(); foreach (var(slot, item) in items) { primaryAttributes.Strength.Add(item.PrimaryAttributes.Strength.Value); primaryAttributes.Agility.Add(item.PrimaryAttributes.Agility.Value); primaryAttributes.Stamina.Add(item.PrimaryAttributes.Stamina.Value); primaryAttributes.Intellect.Add(item.PrimaryAttributes.Intellect.Value); primaryAttributes.Spirit.Add(item.PrimaryAttributes.Spirit.Value); } return(primaryAttributes); }
/// <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()); }
public void OperatorAddition_AddTwoPrimaryAttributes_ShouldReturnSumOfAttributes() { // Arrange PrimaryAttributes lhs = new() { Vitality = 3, Strength = 1, Dexterity = 1, Intelligence = 5 }; PrimaryAttributes rhs = new() { Vitality = 7, Strength = 9, Dexterity = 9, Intelligence = 5 }; PrimaryAttributes expected = new() { Vitality = 10, Strength = 10, Dexterity = 10, Intelligence = 10 }; // Act PrimaryAttributes actual = lhs + rhs; // Assert Assert.Equal(expected, actual); } #endregion #region CalculateDPS [Fact]
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; }
/// <summary> /// Calculates armor bonus /// </summary> /// <returns>New PrimaryAttributes</returns> public PrimaryAttributes CalculateArmorBonus() { PrimaryAttributes armorBonusValues = new() { Strength = 0, Dexterity = 0, Intelligence = 0, Vitality = 0 }; bool hasHeadArmor = Equipment.TryGetValue(Slot.SLOT_HEADER, out Item headArmor); bool hasBodyArmor = Equipment.TryGetValue(Slot.SLOT_BODY, out Item bodyArmor); bool hasLegsArmor = Equipment.TryGetValue(Slot.SLOT_LEGS, out Item legsArmor); if (hasHeadArmor) { Armor a = (Armor)headArmor; armorBonusValues += new PrimaryAttributes() { Strength = a.Attributes.Strength, Dexterity = a.Attributes.Dexterity, Intelligence = a.Attributes.Intelligence, Vitality = a.Attributes.Vitality }; } if (hasBodyArmor) { Armor a = (Armor)bodyArmor; armorBonusValues += new PrimaryAttributes() { Strength = a.Attributes.Strength, Dexterity = a.Attributes.Dexterity, Intelligence = a.Attributes.Intelligence, Vitality = a.Attributes.Vitality }; } if (hasLegsArmor) { Armor a = (Armor)legsArmor; armorBonusValues += new PrimaryAttributes() { Strength = a.Attributes.Strength, Dexterity = a.Attributes.Dexterity, Intelligence = a.Attributes.Intelligence, Vitality = a.Attributes.Vitality }; } return(BasePrimaryAttributes + armorBonusValues); }
public Armor(string ItemName, int ItemLevel, ArmorSlots ItemSlot, ArmorTypes ArmorType, PrimaryAttributes ArmorAttributes) : base(ItemName, ItemLevel, ItemSlot) { this.ArmorType = ArmorType; this.ArmorAttributes = ArmorAttributes; }
public abstract SecondaryAttributes CalculateSecondaryAttributes(PrimaryAttributes primaryAttributes);