Revert "Refactor Damage to use Protoypes (#4262)"

This reverts commit 20bf5739a9.
This commit is contained in:
Silver
2021-08-24 00:50:39 -06:00
committed by Silver
parent 20bf5739a9
commit e708091518
121 changed files with 711 additions and 10237 deletions

View File

@@ -1,4 +1,4 @@
using System.Threading.Tasks;
using System.Threading.Tasks;
using Content.Server.Destructible.Thresholds.Triggers;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
@@ -6,15 +6,14 @@ using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
namespace Content.IntegrationTests.Tests.Destructible
{
[TestFixture]
[TestOf(typeof(DamageGroupTrigger))]
[TestOf(typeof(DamageClassTrigger))]
[TestOf(typeof(AndTrigger))]
public class DestructibleDamageGroupTest : ContentIntegrationTest
public class DestructibleDamageClassTest : ContentIntegrationTest
{
[Test]
public async Task AndTest()
@@ -32,7 +31,6 @@ namespace Content.IntegrationTests.Tests.Destructible
var sEntityManager = server.ResolveDependency<IEntityManager>();
var sMapManager = server.ResolveDependency<IMapManager>();
var sPrototypeManager = server.ResolveDependency<IPrototypeManager>();
IEntity sDestructibleEntity;
IDamageableComponent sDamageableComponent = null;
@@ -44,7 +42,7 @@ namespace Content.IntegrationTests.Tests.Destructible
var coordinates = new MapCoordinates(0, 0, mapId);
sMapManager.CreateMap(mapId);
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageGroupEntityId, coordinates);
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageClassEntityId, coordinates);
sDamageableComponent = sDestructibleEntity.GetComponent<IDamageableComponent>();
sThresholdListenerComponent = sDestructibleEntity.GetComponent<TestThresholdListenerComponent>();
});
@@ -58,23 +56,20 @@ namespace Content.IntegrationTests.Tests.Destructible
await server.WaitAssertion(() =>
{
var bruteDamageGroup = sPrototypeManager.Index<DamageGroupPrototype>("TestBrute");
var burnDamageGroup = sPrototypeManager.Index<DamageGroupPrototype>("TestBurn");
// Raise brute damage to 5
Assert.True(sDamageableComponent.TryChangeDamage(bruteDamageGroup, 5, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 5, true));
// No thresholds reached yet, the earliest one is at 10 damage
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise brute damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(bruteDamageGroup, 5, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 5, true));
// No threshold reached, burn needs to be 10 as well
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise burn damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(burnDamageGroup, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, 10, true));
// One threshold reached, brute 10 + burn 10
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
@@ -91,52 +86,52 @@ namespace Content.IntegrationTests.Tests.Destructible
var trigger = (AndTrigger) threshold.Trigger;
Assert.IsInstanceOf<DamageGroupTrigger>(trigger.Triggers[0]);
Assert.IsInstanceOf<DamageGroupTrigger>(trigger.Triggers[1]);
Assert.IsInstanceOf<DamageClassTrigger>(trigger.Triggers[0]);
Assert.IsInstanceOf<DamageClassTrigger>(trigger.Triggers[1]);
sThresholdListenerComponent.ThresholdsReached.Clear();
// Raise brute damage to 20
Assert.True(sDamageableComponent.TryChangeDamage(bruteDamageGroup, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 10, true));
// No new thresholds reached
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise burn damage to 20
Assert.True(sDamageableComponent.TryChangeDamage(burnDamageGroup, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, 10, true));
// No new thresholds reached
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Lower brute damage to 0
Assert.True(sDamageableComponent.TryChangeDamage(bruteDamageGroup, -20, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, -20, true));
// No new thresholds reached, healing should not trigger it
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise brute damage back up to 10
Assert.True(sDamageableComponent.TryChangeDamage(bruteDamageGroup, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 10, true));
// 10 brute + 10 burn threshold reached, brute was healed and brought back to its threshold amount and burn stayed the same
// 10 brute + 10 burn threshold reached, brute was healed and brought back to its threshold amount and slash stayed the same
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
sThresholdListenerComponent.ThresholdsReached.Clear();
// Heal both classes of damage to 0
Assert.True(sDamageableComponent.TryChangeDamage(bruteDamageGroup, -10, true));
Assert.True(sDamageableComponent.TryChangeDamage(burnDamageGroup, -20, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, -10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, -20, true));
// No new thresholds reached, healing should not trigger it
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise brute damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(bruteDamageGroup, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 10, true));
// No new thresholds reached
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise burn damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(burnDamageGroup, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, 10, true));
// Both classes of damage were healed and then raised again, the threshold should have been reached as triggers once is default false
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
@@ -153,8 +148,8 @@ namespace Content.IntegrationTests.Tests.Destructible
trigger = (AndTrigger) threshold.Trigger;
Assert.IsInstanceOf<DamageGroupTrigger>(trigger.Triggers[0]);
Assert.IsInstanceOf<DamageGroupTrigger>(trigger.Triggers[1]);
Assert.IsInstanceOf<DamageClassTrigger>(trigger.Triggers[0]);
Assert.IsInstanceOf<DamageClassTrigger>(trigger.Triggers[1]);
sThresholdListenerComponent.ThresholdsReached.Clear();
@@ -162,20 +157,20 @@ namespace Content.IntegrationTests.Tests.Destructible
threshold.TriggersOnce = true;
// Heal brute and burn back to 0
Assert.True(sDamageableComponent.TryChangeDamage(bruteDamageGroup, -10, true));
Assert.True(sDamageableComponent.TryChangeDamage(burnDamageGroup, -10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, -10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, -10, true));
// No new thresholds reached from healing
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise brute damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(bruteDamageGroup, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 10, true));
// No new thresholds reached
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise burn damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(burnDamageGroup, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Burn, 10, true));
// No new thresholds reached as triggers once is set to true and it already triggered before
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);

View File

@@ -1,4 +1,4 @@
using System.Threading.Tasks;
using System.Threading.Tasks;
using Content.Server.Destructible.Thresholds.Triggers;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
@@ -6,7 +6,6 @@ using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
namespace Content.IntegrationTests.Tests.Destructible
@@ -57,23 +56,20 @@ namespace Content.IntegrationTests.Tests.Destructible
await server.WaitAssertion(() =>
{
var bluntDamageType = IoCManager.Resolve<IPrototypeManager>().Index<DamageTypePrototype>("TestBlunt");
var slashDamageType = IoCManager.Resolve<IPrototypeManager>().Index<DamageTypePrototype>("TestSlash");
// Raise blunt damage to 5
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, 5, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 5, true));
// No thresholds reached yet, the earliest one is at 10 damage
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise blunt damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, 5, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 5, true));
// No threshold reached, slash needs to be 10 as well
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise slash damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(slashDamageType, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, 10, true));
// One threshold reached, blunt 10 + slash 10
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
@@ -96,25 +92,25 @@ namespace Content.IntegrationTests.Tests.Destructible
sThresholdListenerComponent.ThresholdsReached.Clear();
// Raise blunt damage to 20
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
// No new thresholds reached
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise slash damage to 20
Assert.True(sDamageableComponent.TryChangeDamage(slashDamageType, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, 10, true));
// No new thresholds reached
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Lower blunt damage to 0
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, -20, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, -20, true));
// No new thresholds reached, healing should not trigger it
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise blunt damage back up to 10
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
// 10 blunt + 10 slash threshold reached, blunt was healed and brought back to its threshold amount and slash stayed the same
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
@@ -122,20 +118,20 @@ namespace Content.IntegrationTests.Tests.Destructible
sThresholdListenerComponent.ThresholdsReached.Clear();
// Heal both types of damage to 0
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, -10, true));
Assert.True(sDamageableComponent.TryChangeDamage(slashDamageType, -20, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, -10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, -20, true));
// No new thresholds reached, healing should not trigger it
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise blunt damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
// No new thresholds reached
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise slash damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(slashDamageType, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, 10, true));
// Both types of damage were healed and then raised again, the threshold should have been reached as triggers once is default false
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
@@ -161,20 +157,20 @@ namespace Content.IntegrationTests.Tests.Destructible
threshold.TriggersOnce = true;
// Heal blunt and slash back to 0
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, -10, true));
Assert.True(sDamageableComponent.TryChangeDamage(slashDamageType, -10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, -10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, -10, true));
// No new thresholds reached from healing
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise blunt damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
// No new thresholds reached
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Raise slash damage to 10
Assert.True(sDamageableComponent.TryChangeDamage(slashDamageType, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Slash, 10, true));
// No new thresholds reached as triggers once is set to true and it already triggered before
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);

View File

@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using System.Threading.Tasks;
using Content.Server.Destructible.Thresholds;
using Content.Server.Destructible.Thresholds.Behaviors;
@@ -8,7 +8,6 @@ using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
namespace Content.IntegrationTests.Tests.Destructible
@@ -31,7 +30,6 @@ namespace Content.IntegrationTests.Tests.Destructible
var sEntityManager = server.ResolveDependency<IEntityManager>();
var sMapManager = server.ResolveDependency<IMapManager>();
var sPrototypeManager = server.ResolveDependency<IPrototypeManager>();
IEntity sDestructibleEntity = null;
IDamageableComponent sDamageableComponent = null;
@@ -51,11 +49,10 @@ namespace Content.IntegrationTests.Tests.Destructible
await server.WaitAssertion(() =>
{
var coordinates = sDestructibleEntity.Transform.Coordinates;
var bruteDamageGroup = sPrototypeManager.Index<DamageGroupPrototype>("TestBrute");
Assert.DoesNotThrow(() =>
{
Assert.True(sDamageableComponent.TryChangeDamage(bruteDamageGroup, 50, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageClass.Brute, 50, true));
});
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));

View File

@@ -6,93 +6,9 @@ namespace Content.IntegrationTests.Tests.Destructible
public const string DestructibleEntityId = "DestructibleTestsDestructibleEntity";
public const string DestructibleDestructionEntityId = "DestructibleTestsDestructibleDestructionEntity";
public const string DestructibleDamageTypeEntityId = "DestructibleTestsDestructibleDamageTypeEntity";
public const string DestructibleDamageGroupEntityId = "DestructibleTestsDestructibleDamageGroupEntity";
public const string DestructibleDamageClassEntityId = "DestructibleTestsDestructibleDamageClassEntity";
public static readonly string Prototypes = $@"
- type: damageType
id: TestBlunt
- type: damageType
id: TestSlash
- type: damageType
id: TestPiercing
- type: damageType
id: TestHeat
- type: damageType
id: TestShock
- type: damageType
id: TestCold
- type: damageType
id: TestPoison
- type: damageType
id: TestRadiation
- type: damageType
id: TestAsphyxiation
- type: damageType
id: TestBloodloss
- type: damageType
id: TestCellular
- type: damageGroup
id: TestBrute
damageTypes:
- TestBlunt
- TestSlash
- TestPiercing
- type: damageGroup
id: TestBurn
damageTypes:
- TestHeat
- TestShock
- TestCold
- type: damageGroup
id: TestAirloss
damageTypes:
- TestAsphyxiation
- TestBloodloss
- type: damageGroup
id: TestToxin
damageTypes:
- TestPoison
- TestRadiation
- type: damageGroup
id: TestGenetic
damageTypes:
- TestCellular
- type: damageContainer
id: TestAllDamageContainer
supportAll: true
- type: damageContainer
id: TestBiologicalDamageContainer
supportedGroups:
- TestBrute
- TestBurn
- TestToxin
- TestAirloss
- TestGenetic
- type: damageContainer
id: TestMetallicDamageContainer
supportedGroups:
- TestBrute
- TestBurn
- type: entity
id: {SpawnedEntityId}
name: {SpawnedEntityId}
@@ -102,7 +18,6 @@ namespace Content.IntegrationTests.Tests.Destructible
name: {DestructibleEntityId}
components:
- type: Damageable
damageContainer: TestMetallicDamageContainer
- type: Destructible
thresholds:
- trigger:
@@ -131,7 +46,6 @@ namespace Content.IntegrationTests.Tests.Destructible
name: {DestructibleDestructionEntityId}
components:
- type: Damageable
damageContainer: TestMetallicDamageContainer
- type: Destructible
thresholds:
- trigger:
@@ -155,36 +69,34 @@ namespace Content.IntegrationTests.Tests.Destructible
name: {DestructibleDamageTypeEntityId}
components:
- type: Damageable
damageContainer: TestMetallicDamageContainer
- type: Destructible
thresholds:
- trigger:
!type:AndTrigger
triggers:
- !type:DamageTypeTrigger
damageType: TestBlunt
type: Blunt
damage: 10
- !type:DamageTypeTrigger
damageType: TestSlash
type: Slash
damage: 10
- type: TestThresholdListener
- type: entity
id: {DestructibleDamageGroupEntityId}
name: {DestructibleDamageGroupEntityId}
id: {DestructibleDamageClassEntityId}
name: {DestructibleDamageClassEntityId}
components:
- type: Damageable
damageContainer: TestMetallicDamageContainer
- type: Destructible
thresholds:
- trigger:
!type:AndTrigger
triggers:
- !type:DamageGroupTrigger
damageGroup: TestBrute
- !type:DamageClassTrigger
class: Brute
damage: 10
- !type:DamageGroupTrigger
damageGroup: TestBurn
- !type:DamageClassTrigger
class: Burn
damage: 10
- type: TestThresholdListener";
}

View File

@@ -10,7 +10,6 @@ using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
namespace Content.IntegrationTests.Tests.Destructible
@@ -36,7 +35,6 @@ namespace Content.IntegrationTests.Tests.Destructible
var sEntityManager = server.ResolveDependency<IEntityManager>();
var sMapManager = server.ResolveDependency<IMapManager>();
var sPrototypeManager = server.ResolveDependency<IPrototypeManager>();
IEntity sDestructibleEntity;
IDamageableComponent sDamageableComponent = null;
@@ -64,14 +62,12 @@ namespace Content.IntegrationTests.Tests.Destructible
await server.WaitAssertion(() =>
{
var bluntDamageType = sPrototypeManager.Index<DamageTypePrototype>("TestBlunt");
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
// No thresholds reached yet, the earliest one is at 20 damage
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, 10, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true));
// Only one threshold reached, 20
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
@@ -87,7 +83,7 @@ namespace Content.IntegrationTests.Tests.Destructible
sThresholdListenerComponent.ThresholdsReached.Clear();
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, 30, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 30, true));
// One threshold reached, 50, since 20 already triggered before and it has not been healed below that amount
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
@@ -116,16 +112,16 @@ namespace Content.IntegrationTests.Tests.Destructible
sThresholdListenerComponent.ThresholdsReached.Clear();
// Damage for 50 again, up to 100 now
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, 50, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 50, true));
// No thresholds reached as they weren't healed below the trigger amount
Assert.IsEmpty(sThresholdListenerComponent.ThresholdsReached);
// Set damage to 0
sDamageableComponent.TrySetAllDamage(0);
// Heal down to 0
sDamageableComponent.Heal();
// Damage for 100, up to 100
Assert.True(sDamageableComponent.TryChangeDamage(bluntDamageType, 100, true));
Assert.True(sDamageableComponent.ChangeDamage(DamageType.Blunt, 100, true));
// Two thresholds reached as damage increased past the previous, 20 and 50
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(2));
@@ -133,25 +129,25 @@ namespace Content.IntegrationTests.Tests.Destructible
sThresholdListenerComponent.ThresholdsReached.Clear();
// Heal the entity for 40 damage, down to 60
sDamageableComponent.TryChangeDamage(bluntDamageType, -40, true);
sDamageableComponent.ChangeDamage(DamageType.Blunt, -40, true);
// Thresholds don't work backwards
Assert.That(sThresholdListenerComponent.ThresholdsReached, Is.Empty);
// Damage for 10, up to 70
sDamageableComponent.TryChangeDamage(bluntDamageType, 10, true);
sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true);
// Not enough healing to de-trigger a threshold
Assert.That(sThresholdListenerComponent.ThresholdsReached, Is.Empty);
// Heal by 30, down to 40
sDamageableComponent.TryChangeDamage(bluntDamageType, -30, true);
sDamageableComponent.ChangeDamage(DamageType.Blunt, -30, true);
// Thresholds don't work backwards
Assert.That(sThresholdListenerComponent.ThresholdsReached, Is.Empty);
// Damage up to 50 again
sDamageableComponent.TryChangeDamage(bluntDamageType, 10, true);
sDamageableComponent.ChangeDamage(DamageType.Blunt, 10, true);
// The 50 threshold should have triggered again, after being healed
Assert.That(sThresholdListenerComponent.ThresholdsReached.Count, Is.EqualTo(1));
@@ -181,10 +177,10 @@ namespace Content.IntegrationTests.Tests.Destructible
sThresholdListenerComponent.ThresholdsReached.Clear();
// Heal all damage
sDamageableComponent.TrySetAllDamage(0);
sDamageableComponent.Heal();
// Damage up to 50
sDamageableComponent.TryChangeDamage(bluntDamageType, 50, true);
sDamageableComponent.ChangeDamage(DamageType.Blunt, 50, true);
// Check that the total damage matches
Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(50));
@@ -232,7 +228,7 @@ namespace Content.IntegrationTests.Tests.Destructible
sThresholdListenerComponent.ThresholdsReached.Clear();
// Heal the entity completely
sDamageableComponent.TrySetAllDamage(0);
sDamageableComponent.Heal();
// Check that the entity has 0 damage
Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(0));
@@ -245,7 +241,7 @@ namespace Content.IntegrationTests.Tests.Destructible
}
// Damage the entity up to 50 damage again
sDamageableComponent.TryChangeDamage(bluntDamageType, 50, true);
sDamageableComponent.ChangeDamage(DamageType.Blunt, 50, true);
// Check that the total damage matches
Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(50));