Example #1
0
        [TestCase(9, "sausage", 4)]  //0.2: would be nice if this broke, to rule out typos.
        public void Default_resistance_when_type_has_no_match(int initial, string type, int expected)
        {
            var asys = new AttackSystem();
            List <AttackDamage> damages = new List <AttackDamage>
            {
                new AttackDamage(initial, type),
            };

            var out_dmgs = asys.ResistDamages(damages, ring_armor);  //  default for ring is 1/2 ..5

            Assert.That(out_dmgs.First().Current, Is.EqualTo(expected));
        }
Example #2
0
        public void Can_resist_a_set_of_AttackDamages()
        {
            var asys = new AttackSystem();
            List <AttackDamage> damages = new List <AttackDamage>
            {
                new AttackDamage(8, "physical.impact.blunt"),
                new AttackDamage(6, "physical.impact.edge"),
                new AttackDamage(6, "energetic.fire"),
            };

            Assert.That(damages[0].Initial, Is.EqualTo(8));
            Assert.That(damages[0].Current, Is.EqualTo(8), "initial and current begin equal");

            var out_dmgs = asys.ResistDamages(damages, leather_armor).ToList();

            Assert.That(out_dmgs[0].Initial, Is.EqualTo(8), "resistance doesn't alter initial value");

            Assert.That(out_dmgs[0].Current, Is.EqualTo(6), "leather resists blunt damage poorly");
            Assert.That(out_dmgs[1].Current, Is.EqualTo(3), "leather resists other physical damage better");
            Assert.That(out_dmgs[2].Current, Is.EqualTo(2), "leather resists energy damage well");
        }