From 97f0bab5b8ad12b5c62e00de32b1eee30d5a4e6a Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Sat, 28 Jun 2025 14:12:36 -0400 Subject: [PATCH] Cleanup prototype instantiation in `DamageTest` (#38639) Cleanup prototype instantiation in DamageTest --- Content.Tests/Shared/DamageTest.cs | 35 ++++++++++-------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/Content.Tests/Shared/DamageTest.cs b/Content.Tests/Shared/DamageTest.cs index 88beca8841..58fa8fbde3 100644 --- a/Content.Tests/Shared/DamageTest.cs +++ b/Content.Tests/Shared/DamageTest.cs @@ -4,7 +4,6 @@ using NUnit.Framework; using Robust.Shared.IoC; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.Manager; -using System.Collections.Generic; using Content.Shared.FixedPoint; namespace Content.Tests.Shared @@ -16,23 +15,6 @@ namespace Content.Tests.Shared [TestOf(typeof(DamageGroupPrototype))] public sealed class DamageTest : ContentUnitTest { - - private static Dictionary _resistanceCoefficientDict = new() - { - // "missing" blunt entry - { "Piercing", -2 },// Turn Piercing into Healing - { "Slash", 3 }, - { "Radiation", 1.5f }, - }; - - private static Dictionary _resistanceReductionDict = new() - { - { "Blunt", - 5 }, - // "missing" piercing entry - { "Slash", 8 }, - { "Radiation", 0.5f }, // Fractional adjustment - }; - private IPrototypeManager _prototypeManager; private DamageSpecifier _damageSpec; @@ -139,11 +121,7 @@ namespace Content.Tests.Shared DamageSpecifier damageSpec = 10 * new DamageSpecifier(_damageSpec); // Create a modifier set - DamageModifierSetPrototype modifierSet = new() - { - Coefficients = _resistanceCoefficientDict, - FlatReduction = _resistanceReductionDict - }; + var modifierSet = _prototypeManager.Index("ModifierTestSet"); //damage is initially 20 / 20 / 10 / 30 //Each time we subtract -5 / 0 / 8 / 0.5 @@ -289,6 +267,17 @@ namespace Content.Tests.Shared flatReductions: Blunt: 5 +- type: damageModifierSet + id: ModifierTestSet + coefficients: + Piercing: -2 + Slash: 3 + Radiation: 1.5 + flatReductions: + Blunt: -5 + Slash: 8 + Radiation: 0.5 + - type: damageContainer id: Biological supportedGroups: -- 2.51.2