예제 #1
0
        public void TestSpellcastingAbilityModifier()
        {
            DieRollDetails rollDetails = DieRollDetails.From("1d4+SAM(health)", +3);

            Assert.AreEqual(1, rollDetails.Rolls.Count);
            Assert.AreEqual(3, rollDetails.Rolls[0].Offset);
            Assert.AreEqual(4, rollDetails.Rolls[0].Sides);
            Assert.AreEqual("(health)", rollDetails.Rolls[0].Descriptor);
            Assert.AreEqual("1d4+3(health)", rollDetails.ToString());
        }
예제 #2
0
        public void TestDieRollDetails()
        {
            Roll roll = DieRollDetails.From("3d12").Rolls[0];

            Assert.AreEqual("3d12", roll.ToString());
            roll.Offset = 4;
            Assert.AreEqual("3d12+4", roll.ToString());
            roll.Descriptor = "(necrotic)";
            Assert.AreEqual("3d12+4(necrotic)", roll.ToString());

            DieRollDetails rollDetails = DieRollDetails.From("1d4");

            Assert.AreEqual(1, rollDetails.Rolls.Count);
            Assert.AreEqual(0, rollDetails.Rolls[0].Offset);
            Assert.AreEqual(4, rollDetails.Rolls[0].Sides);
            Assert.AreEqual("", rollDetails.Rolls[0].Descriptor);
            Assert.AreEqual("1d4", rollDetails.ToString());

            rollDetails = DieRollDetails.From("3d8+3(cold)");
            Assert.AreEqual(1, rollDetails.Rolls.Count);
            Assert.AreEqual(3, rollDetails.Rolls[0].Count);
            Assert.AreEqual(3, rollDetails.Rolls[0].Offset);
            Assert.AreEqual(8, rollDetails.Rolls[0].Sides);
            Assert.AreEqual("(cold)", rollDetails.Rolls[0].Descriptor);
            Assert.AreEqual("3d8+3(cold)", rollDetails.ToString());


            rollDetails = DieRollDetails.From("2d10+3(cold),5d6(fire)");
            Assert.AreEqual(2, rollDetails.Rolls.Count);

            Assert.AreEqual(2, rollDetails.Rolls[0].Count);
            Assert.AreEqual(3, rollDetails.Rolls[0].Offset);
            Assert.AreEqual(10, rollDetails.Rolls[0].Sides);
            Assert.AreEqual("(cold)", rollDetails.Rolls[0].Descriptor);
            Assert.AreEqual("2d10+3(cold),5d6(fire)", rollDetails.ToString());

            Assert.AreEqual(5, rollDetails.Rolls[1].Count);
            Assert.AreEqual(0, rollDetails.Rolls[1].Offset);
            Assert.AreEqual(6, rollDetails.Rolls[1].Sides);
            Assert.AreEqual("(fire)", rollDetails.Rolls[1].Descriptor);
        }