public void AddImmunity_ShouldAddDamageTypeToList() { // Arrange var instance = new HitPoints(42); // Act instance.AddImmunity(DamageTypes.Fire); // Assert instance.Immunities.Should().HaveCount(1); instance.Immunities[0].Should().Be(DamageTypes.Fire); }
public void DealDamages_ShouldDoNoDamage_WhenImmunity() { // Arrange var instance = new HitPoints(42); instance.AddImmunity(DamageTypes.Fire); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 5 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(42); }
private void AddDamageModifiers(HitPoints hitPoints, IEnumerable <CreateDefense> defenses) { foreach (var defense in defenses) { switch (defense.Defense) { case DamageModifierTypes.Immunity: hitPoints.AddImmunity(defense.Type); break; case DamageModifierTypes.Resistance: hitPoints.AddResistance(defense.Type); break; case DamageModifierTypes.Vulnerability: hitPoints.AddVulnerability(defense.Type); break; } } }