Beispiel #1
0
        public void RoundCalcerTestLossWithFighter()
        {
            MonsterLibrary monsters = new MonsterLibrary();

            RoundCalcer instance = new RoundCalcer();

            Weapon aSword = new Weapon("shortsword", "1d6", "slashing");
            Weapon aBow   = new Weapon("shortbow", "1d6", "piercing");

            aBow.setRanged(20, 60);

            // Add hostile
            instance.addCombatant(monsters.getMonster("Skeleton"), false);
            instance.addCombatant(monsters.getMonster("Skeleton"), false);
            instance.addCombatant(monsters.getMonster("Skeleton"), false);

            // Add Ally
            instance.addCombatant(new Fighter(16, 14, 15, 11, 12, 10, 30, aSword, aBow), true);
            instance.addCombatant(new Fighter(16, 14, 15, 11, 12, 10, 30, aSword, aBow), true);

            int returnVal = instance.damageCalculator(0, true);

            while (returnVal == 0)
            {
                returnVal = instance.damageCalculator(0, false);
            }


            Assert.IsTrue(returnVal < 0);
        }
Beispiel #2
0
        public void RoundCalcerAddCombatants()
        {
            MonsterLibrary monsters = new MonsterLibrary();

            RoundCalcer instance = new RoundCalcer();

            // Add hostile
            instance.addCombatant(monsters.getMonster("Skeleton"), false);
            // Add Ally
            instance.addCombatant(monsters.getMonster("Skeleton"), true);

            instance.damageCalculator(0, true);

            Assert.AreEqual(instance.Combatants.Count, 2);
            Assert.AreEqual(instance.listAllies.Count, 1);
            Assert.AreEqual(instance.listEnemies.Count, 1);
        }
Beispiel #3
0
        public void RoundCalcerTestVictory()
        {
            MonsterLibrary monsters = new MonsterLibrary();

            RoundCalcer instance = new RoundCalcer();

            // Add Ally
            instance.addCombatant(monsters.getMonster("Skeleton"), true);
            instance.addCombatant(monsters.getMonster("Skeleton"), true);
            instance.addCombatant(monsters.getMonster("Skeleton"), true);
            // Add Hostile
            instance.addCombatant(monsters.getMonster("Skeleton"), false);

            int returnVal = instance.damageCalculator(0, true);

            while (returnVal == 0)
            {
                returnVal = instance.damageCalculator(0, false);
            }


            Assert.IsTrue(returnVal > 0);
        }
Beispiel #4
0
        public void testGetMonsterFromLibrary()
        {
            MonsterLibrary monsters = new MonsterLibrary();

            Combatant c = monsters.getMonster("Skeleton");

            Assert.AreEqual(c.stats[0], 10);
            Assert.AreEqual(c.stats[1], 14);
            Assert.AreEqual(c.stats[2], 15);
            Assert.AreEqual(c.stats[3], 6);
            Assert.AreEqual(c.stats[4], 8);
            Assert.AreEqual(c.stats[5], 5);

            Assert.AreEqual(c.primaryWeapon.name, "shortsword");
            Assert.AreEqual(c.secondaryWeapon.name, "shortbow");

            Assert.AreEqual(c.hpmax, 13);
            Assert.AreEqual(c.curHp, 13);
        }
Beispiel #5
0
        public void RoundCalcerTest1000WinsWithFighter()
        {
            MonsterLibrary monsters = new MonsterLibrary();

            RoundCalcer instance = new RoundCalcer();

            Weapon aSword = new Weapon("shortsword", "1d6", "slashing");
            Weapon aBow   = new Weapon("shortbow", "1d6", "piercing");

            aBow.setRanged(20, 60);

            // Add hostile
            instance.addCombatant(monsters.getMonster("Skeleton"), false);

            // Add Ally
            instance.addCombatant(new Fighter(16, 14, 15, 11, 12, 10, 30, aSword, aBow), true);
            instance.addCombatant(new Fighter(16, 14, 15, 11, 12, 10, 30, aSword, aBow), true);

            double winrate = instance.roundSampler(1000);


            Assert.IsTrue(winrate >= 0.95 && winrate <= 1);
        }