Exemple #1
0
        public void DamageLevelTableReturnsValidData(int rowIndex, string label, int?strRef)
        {
            TwoDimArray <DamageLevelEntry> table = NwGameTables.DamageLevelTable;
            DamageLevelEntry row = table.GetRow(rowIndex);

            Assert.That(row.RowIndex, Is.EqualTo(rowIndex));
            Assert.That(row.Label, Is.EqualTo(label));
            Assert.That(row.StrRef?.Id, Is.EqualTo(strRef));
        }
Exemple #2
0
        public void SetDamageLevelOverrideChangesDamageLevel(int damageLevelIndex)
        {
            Location startLocation = NwModule.Instance.StartingLocation;

            NwCreature?creature = NwCreature.Create(StandardResRef.Creature.nw_bandit001, startLocation);

            Assert.That(creature, Is.Not.Null, "Creature was null after creation.");

            createdTestObjects.Add(creature !);

            Assert.That(creature !.DamageLevel.RowIndex, Is.EqualTo(NwGameTables.DamageLevelTable[0].RowIndex)); // Uninjured

            DamageLevelEntry damageLevel = NwGameTables.DamageLevelTable[damageLevelIndex];

            DamageLevelOverrideService.SetDamageLevelOverride(creature, damageLevel);

            Assert.That(DamageLevelOverrideService.GetDamageLevelOverride(creature)?.RowIndex, Is.EqualTo(damageLevel.RowIndex));
            Assert.That(creature.GetDamageLevelOverride()?.RowIndex, Is.EqualTo(damageLevel.RowIndex));
            Assert.That(creature.DamageLevel.RowIndex, Is.EqualTo(damageLevel.RowIndex));
        }
 /// <summary>
 /// Sets the override that is set for the creature's damage level.<br/>
 /// </summary>
 public void SetDamageLevelOverride(NwCreature creature, DamageLevelEntry damageLevel)
 {
     InternalVariables.DamageLevelOverride(creature).Value = damageLevel.RowIndex;
 }