Ejemplo n.º 1
0
        public void NoDuplicateTraitRequirements()
        {
            Character c = new Character();

            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring"));
            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring"));
            Assert.AreEqual(2, CharacterCalc.LifepathRequiredTraits(c).Count);

            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Pilot", "Human_Seafaring"));
            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Pilot", "Human_Seafaring"));
            Assert.AreEqual(4, CharacterCalc.LifepathRequiredTraits(c).Count);

            List <string> requiredTraits = CharacterCalc.LifepathRequiredTraits(c);

            for (int i = 0; i < requiredTraits.Count; i++)
            {
                for (int j = 0; j < requiredTraits.Count; j++)
                {
                    if (i != j)
                    {
                        Assert.AreNotEqual(requiredTraits[i], requiredTraits[j]);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void CharacterCalcsLP_NoDuplicates()
        {
            Character c = new Character();

            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Born Peasant", "Human_Peasant"));
            Assert.AreEqual(CharacterCalc.LifepathLeadsCount(c), 0);
            Assert.AreEqual(0, CharacterCalc.LifepathRequiredSkills(c).Count);
            Assert.AreEqual(0, CharacterCalc.LifepathRequiredTraits(c).Count);
            Assert.AreEqual(8, CharacterCalc.LifepathYearsCount(c));

            //Ensure same setting doesn't lead
            Lifepath tmpLP = LifepathIndex.getLifepathByNameSetting("Born Peasant", "Human_Peasant");

            c.AddLifepath(tmpLP);
            Assert.AreEqual(2, c.LifepathList.Count);
            Assert.AreEqual(0, CharacterCalc.LifepathLeadsCount(c));
            c.DropLifepath(tmpLP);
            Assert.AreEqual(1, c.LifepathList.Count);

            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring"));
            Assert.AreEqual(1, CharacterCalc.LifepathBornCount(c));
            Assert.AreEqual(11, CharacterCalc.LifepathResourcePoints(c));
            Assert.AreEqual(1, CharacterCalc.LifepathLeadsCount(c));
            Assert.AreEqual(13, CharacterCalc.LifepathYearsCount(c)); //8 + 4 (+ 1 Leads)
            Assert.AreEqual(3, CharacterCalc.LifepathGeneralPoints(c));
            Assert.AreEqual(4, CharacterCalc.LifepathSkillPoints(c));
            Assert.AreEqual(3, CharacterCalc.LifepathTraitPoints(c));
            Assert.AreEqual(1, CharacterCalc.LifepathRequiredSkills(c).Count);
            Assert.AreEqual("Sailor-wise", CharacterCalc.LifepathRequiredSkills(c)[0], CharacterCalc.LifepathRequiredSkills(c)[0]);
            Assert.AreEqual(1, CharacterCalc.LifepathRequiredTraits(c).Count);
            Assert.AreEqual("Veneer of Obedience", CharacterCalc.LifepathRequiredTraits(c)[0]);

            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring"));
            Assert.AreEqual(17, CharacterCalc.LifepathYearsCount(c)); //8 + 4 + 4 (+ 1 Leads)
        }
Ejemplo n.º 3
0
        public void NoDuplicateSkillRequirements()
        {
            Character c = new Character();

            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring"));
            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring"));
            Assert.AreEqual(2, CharacterCalc.LifepathRequiredSkills(c).Count);

            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Pilot", "Human_Seafaring"));
            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Pilot", "Human_Seafaring"));
            Assert.AreEqual(4, CharacterCalc.LifepathRequiredSkills(c).Count);

            List <string> requiredSkills = CharacterCalc.LifepathRequiredSkills(c);

            for (int i = 0; i < requiredSkills.Count; i++)
            {
                for (int j = 0; j < requiredSkills.Count; j++)
                {
                    if (i != j)
                    {
                        Assert.AreNotEqual(requiredSkills[i], requiredSkills[j]);
                    }
                }
            }

            Assert.AreEqual(requiredSkills[0], "Sailor-wise");
            Assert.AreEqual(requiredSkills[1], "Ship-wise");
            Assert.AreEqual(requiredSkills[2], "Pilot");
            Assert.AreEqual(requiredSkills[3], "Observation");
        }
Ejemplo n.º 4
0
        public void LifepathIsNotReference() //To ensure we're not modifying the base values stored in Aggregator
        {
            List <Lifepath> listA = LifepathIndex.getLifepathByName("Born Peasant");
            List <Lifepath> listB = LifepathIndex.getLifepathByName("Born Peasant");

            Assert.AreNotSame(listA[0], listB[0]);
            listA[0].ResPoints = 23848;
            Assert.AreNotEqual(listA[0].ResPoints, listB[0].ResPoints);
        }
Ejemplo n.º 5
0
        public void LifepathEquivalenceValid()
        {
            Lifepath lpA = LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring");

            Assert.IsNotNull(lpA);
            Lifepath lpB = LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring");

            Assert.IsNotNull(lpB);

            Assert.IsTrue(LifepathIndex.AreEquivalent(lpA, lpB));
        }
Ejemplo n.º 6
0
        public void CharacterReceivesLP()
        {
            Character c           = new Character();
            Lifepath  BornPeasant = LifepathIndex.getLifepathByNameSetting("Born Peasant", "Human_Peasant");

            Assert.IsNotNull(BornPeasant);

            c.AddLifepath(BornPeasant);
            Assert.AreEqual(c.LifepathList.Count, 1);

            Assert.IsTrue(c.DropLifepath(BornPeasant));
            Assert.IsFalse(c.DropLifepath(BornPeasant));
        }
Ejemplo n.º 7
0
        public void LifepathFetchCorrectly()
        {
            List <Lifepath> list = LifepathIndex.getLifepathByName("Born Peasant");

            Assert.IsNotNull(list);
            Assert.AreEqual(list.Count, 1);
            Assert.AreEqual(list[0].Name, "Born Peasant");

            Lifepath lp = LifepathIndex.getLifepathByNameSetting("Born Peasant", "Human_Peasant");

            Assert.IsNotNull(lp);
            Assert.AreNotSame(list[0], lp);
        }
Ejemplo n.º 8
0
        public void BornLifepathsParseRace()
        {
            List <Lifepath> list = LifepathIndex.getBornLifepathList("Human");

            Assert.IsTrue(list.Count > 0);
            foreach (Lifepath lp in list)
            {
                Assert.IsTrue(lp.isBornLifepath);
            }

            List <Lifepath> list2 = LifepathIndex.getBornLifepathList("FfweEFJIJfjf");

            Assert.IsTrue(list2.Count == 0);
        }
Ejemplo n.º 9
0
        public void CharacterCalcsLP_WithDuplicates()
        {
            Character c = new Character();

            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring"));
            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring"));
            //Assertions for two the same
            Assert.AreEqual(2, CharacterCalc.LifepathRequiredTraits(c).Count);
            Assert.AreEqual(2, CharacterCalc.LifepathRequiredSkills(c).Count);
            Assert.AreEqual("Sailor-wise", CharacterCalc.LifepathRequiredSkills(c)[0]);
            Assert.AreEqual("Ship-wise", CharacterCalc.LifepathRequiredSkills(c)[1]);
            Assert.AreEqual("Veneer of Obedience", CharacterCalc.LifepathRequiredTraits(c)[0]);
            Assert.AreEqual("Curses like a Sailor", CharacterCalc.LifepathRequiredTraits(c)[1]);
            Assert.AreEqual(8, CharacterCalc.LifepathSkillPoints(c));
            Assert.AreEqual(2, CharacterCalc.LifepathTraitPoints(c));
            Assert.AreEqual(16, CharacterCalc.LifepathResourcePoints(c));

            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring"));
            //Assertions for three the same
            Assert.AreEqual(3, CharacterCalc.LifepathRequiredTraits(c).Count);
            Assert.AreEqual("Sprinter", CharacterCalc.LifepathRequiredTraits(c)[2]);
            Assert.AreEqual(3, CharacterCalc.LifepathRequiredSkills(c).Count);
            Assert.AreEqual("Captain-wise", CharacterCalc.LifepathRequiredSkills(c)[2]);
            Assert.AreEqual(10, CharacterCalc.LifepathSkillPoints(c));
            Assert.AreEqual(2, CharacterCalc.LifepathTraitPoints(c));
            Assert.AreEqual(20, CharacterCalc.LifepathResourcePoints(c));

            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Boy", "Human_Seafaring"));
            //Assertions for four the same
            Assert.AreEqual(3, CharacterCalc.LifepathRequiredTraits(c).Count);
            Assert.AreEqual(3, CharacterCalc.LifepathRequiredSkills(c).Count);
            Assert.AreEqual(10, CharacterCalc.LifepathSkillPoints(c));
            Assert.AreEqual(2, CharacterCalc.LifepathTraitPoints(c));
            Assert.AreEqual(24, CharacterCalc.LifepathResourcePoints(c));

            //Testing for second trait exception and general SPs
            c = new Character();
            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Born Peasant", "Human_Peasant"));
            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Born Peasant", "Human_Peasant"));
            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Born Peasant", "Human_Peasant"));
            c.AddLifepath(LifepathIndex.getLifepathByNameSetting("Born Peasant", "Human_Peasant"));
            Assert.AreEqual(4, c.LifepathList.Count);
            Assert.AreEqual(3, CharacterCalc.LifepathTraitPoints(c));
            Assert.AreEqual(7, CharacterCalc.LifepathGeneralPoints(c));
        }
Ejemplo n.º 10
0
        public void LifepathSearchByRace()
        {
            List <Lifepath> listA = LifepathIndex.getLifepathByRace("Human");
            List <Lifepath> listB = LifepathIndex.getLifepathByRace("Flimblejamble");

            Assert.AreNotEqual(0, listA.Count);
            Assert.AreEqual(0, listB.Count);
            foreach (Lifepath lp in listA)
            {
                Assert.IsTrue(lp.Setting.StartsWith("Human"));
            }

            Lifepath lpA = LifepathIndex.getLifepathByNameSetting("Born Peasant", "Human_Peasant");

            foreach (Lifepath lp in listA)
            {
                Assert.AreNotSame(lp, lpA);
            }
        }