Beispiel #1
0
        public void CheckProfession()
        {
            // create a footman
            Character Gilliam = new Character("Gilliam", new Footman("M"));

            // attach the "double slash" skill directly to the characters (not going through skillbar here)
            DoubleSlash knightSkill  = new DoubleSlash(Guinevere);
            DoubleSlash footmanSkill = new DoubleSlash(Gilliam);

            // "double slash" should be a Knight-restricted skill
            Assert.IsTrue(knightSkill.SkillProfessionReqs.Contains("Knight"), "Double Slash should be a Knight-only skill.");

            // have the knight use the skill on the footman
            try
            {
                knightSkill.Use(Gilliam);
                Assert.IsTrue(true, "Knight should use the skill successfully.");
            }
            catch (SkillReqsNotMetException)
            {
                Assert.IsFalse(true, "Knight should meet skill requirements.");
            }

            // have the footman try to use the skill on the knight
            try
            {
                footmanSkill.Use(Guinevere);
                Assert.IsFalse(true, "Footman should be unable to use the skill.");
            }
            catch (SkillReqsNotMetException)
            {
                Assert.IsTrue(true, "Footman should not meet the skill requirements.");
            }
        }
Beispiel #2
0
        public void UseAttackSkill()
        {
            // create a knight
            Character Guinevere = new Character("Guinevere", new Knight("F"));

            // attach the "double slash" skill directly to the character (not going through skillbar here)
            DoubleSlash knightSkill = new DoubleSlash();

            knightSkill.SetUser(Guinevere);
            Assert.IsTrue(knightSkill.SkillTags.Contains("Attack"), "Double Slash should be an Attack skill");

            // make a training dummy
            TrainingDummy dummy = new TrainingDummy(100, 10, 10);

            // knight uses skill to attack the dummy
            try
            {
                knightSkill.Use(dummy);
                Assert.IsTrue(true, "Attack skill should activate successfully.");
            }
            catch (Exception e)
            {
                Assert.IsFalse(true, e.Message);
            }
        }
Beispiel #3
0
        public void CheckStatReq()
        {
            // create another knight and make him too weak to meet the req
            Character Gilliam = new Character("Gilliam", new Knight("M"));

            Gilliam.Attributes.SetAttribute("STR", 1);

            // attach the "double slash" skill directly to the characters (not going through skillbar)
            DoubleSlash strongSkill = new DoubleSlash(Guinevere);
            DoubleSlash weakSkill   = new DoubleSlash(Gilliam);

            // strong knight should be able to use the skill
            try
            {
                strongSkill.Use(Gilliam);
                Assert.IsTrue(true, "Strong should use the skill successfully.");
            }
            catch (SkillReqsNotMetException)
            {
                Assert.IsFalse(true, "Strong should meet skill requirements.");
            }

            // weak knight should not be able to use the skill
            try
            {
                weakSkill.Use(Guinevere);
                Assert.IsFalse(true, "Weak should be unable to use the skill.");
            }
            catch (SkillReqsNotMetException)
            {
                Assert.IsTrue(true, "Weak should not meet the skill requirements.");
            }
        }
Beispiel #4
0
        public void AttackSkillDamage()
        {
            // create a knight
            Character Guinevere = new Character("Guinevere", new Knight("F"));

            // attach the "double slash" skill directly to the character (not going through skillbar here)
            DoubleSlash knightSkill = new DoubleSlash(Guinevere);

            // make a training dummy
            TrainingDummy dummy = new TrainingDummy(100, 10, 10);

            // attack the dummy
            knightSkill.Use(dummy);

            // dummy HP should be lower
            Assert.IsTrue(dummy.HP.Current < dummy.HP.Max, "Dummy should have lost health.");
        }