public void DealDamages_ShouldSumAllDamage_WhenMultipleDamages() { // Arrange var instance = new HitPoints(42); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 1 }, new DealDamage { DamageType = DamageTypes.Cold, Hp = 2 }, new DealDamage { DamageType = DamageTypes.Necrotic, Hp = 3 }, new DealDamage { DamageType = DamageTypes.Psychic, Hp = 4 }, }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(32); }
public void DealDamages_ShouldSubtractHp() { // Arrange var instance = new HitPoints(42); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 5 }, }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(37); }
public void DealDamages_ShouldChangeStatusToDead_WhenRemainingDamageIsMaxOrMore() { // Arrange var instance = new HitPoints(42); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 84 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(0); instance.DeathSavingThrowFailures.Should().Be(0); instance.Status.Should().Be(LifeStatuses.Dead); }
public void DealDamages_ShouldNotHaveNegativeHP_WhenDamageIsMoreThanCurrent() { // Arrange var instance = new HitPoints(42); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 45 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(0); instance.DeathSavingThrowFailures.Should().Be(0); instance.Status.Should().Be(LifeStatuses.Dying); }
public void DealDamages_ShouldChangeStatusToDying_WhenStableAndDamageIsSameAsCurrent() { // Arrange var instance = new HitPoints(42); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 42 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(0); instance.DeathSavingThrowFailures.Should().Be(0); instance.Status.Should().Be(LifeStatuses.Dying); }
public void DealDamages_ShouldDoDoubleDamage_WhenVulnerability() { // Arrange var instance = new HitPoints(42); instance.AddVulnerability(DamageTypes.Fire); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 5 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(32); }
public void DealDamages_ShouldDoHalfDamageRoundedDown_WhenResitance() { // Arrange var instance = new HitPoints(42); instance.AddResistance(DamageTypes.Fire); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 5 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(40); }
public void DealDamages_ShouldUseTemporaryHPThenCurrentHP_WhenNotEnough() { // Arrange var instance = new HitPoints(42); instance.AddTemporaryHp(5); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 10 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(37); instance.TemporaryHp.Should().Be(0); }
public void DealDamages_ShouldProcessResistanceThenVulnerability_WhenBoth() { // Arrange var instance = new HitPoints(42); instance.AddResistance(DamageTypes.Fire); instance.AddVulnerability(DamageTypes.Fire); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 9 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(34); }
public void DealDamages_ShouldIncrememntFailures_WhenDying() { // Arrange var instance = new HitPoints(42); instance.CurrentHp = 0; instance.Status = LifeStatuses.Dying; var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 5 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(0); instance.DeathSavingThrowFailures.Should().Be(1); }
public void DealDamages_ShouldOnlyDoHalfDamage_WhenMultipleResistances() { // Arrange var instance = new HitPoints(42); instance.AddResistance(DamageTypes.Fire); instance.AddResistance(DamageTypes.Fire); instance.AddResistance(DamageTypes.Fire); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 8 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(38); }