예제 #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.");
            }
        }
예제 #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);
            }
        }
예제 #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.");
            }
        }
예제 #4
0
        public Skill CreateSkill(Player player)
        {
            List <Skill> playerSkills = player.ListOfSkills;
            Skill        known        = CheckContent(playerSkills);

            if (known == null)
            {
                DoubleSlash    s1  = new DoubleSlash();
                EnchantedSlash s2  = new EnchantedSlash();
                SwordThrust    s3  = new SwordThrust();
                List <Skill>   tmp = new List <Skill>();
                if (s1.MinimumLevel <= player.Level)
                {
                    tmp.Add(s1);
                }
                if (s2.MinimumLevel <= player.Level)
                {
                    tmp.Add(s2);
                }
                if (s3.MinimumLevel <= player.Level)
                {
                    tmp.Add(s3);
                }
                if (tmp.Count == 0)
                {
                    return(null);
                }
                return(tmp[Index.RNG(0, tmp.Count)]);
            }
            else if (known.decoratedSkill == null)
            {
                DoubleSlashDecorator    s1  = new DoubleSlashDecorator(known);
                EnchantedSlashDecorator s2  = new EnchantedSlashDecorator(known);
                SwordThrustDecorator    s3  = new SwordThrustDecorator(known);
                List <Skill>            tmp = new List <Skill>();
                if (s1.MinimumLevel <= player.Level)
                {
                    tmp.Add(s1);
                }
                if (s2.MinimumLevel <= player.Level)
                {
                    tmp.Add(s2);
                }
                if (s3.MinimumLevel <= player.Level)
                {
                    tmp.Add(s3);
                }
                if (tmp.Count == 0)
                {
                    return(null);
                }
                return(tmp[Index.RNG(0, tmp.Count)]);
            }
            else
            {
                return(null);
            }
        }
예제 #5
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.");
        }
예제 #6
0
파일: Brawler.cs 프로젝트: JonECG/Brogue
 public Brawler()
 {
     heroTexture = Engine.Engine.GetTexture("Hero/Brawler");
     Hero.loadSprite();
     heroRole            = Classes.Brawler;
     baseHealth          = 300;
     healthPerLevel      = 40;
     requiredBranchLevel = 30;
     resetLevel();
     resetHealth();
     Enemies.Enemy.UpdateTargets(this);
     Enemies.BossEnemy.UpdateBossTargets(this);
     abilities[0] = new Cleave();
     abilities[1] = new WhirlwindSlash();
     abilities[2] = new Slam();
     abilities[3] = new DoubleSlash();
     Engine.Engine.Log(health.ToString());
 }
예제 #7
0
 public Berserker()
 {
     heroTexture = Engine.Engine.GetTexture("Hero/Berserker");
     Hero.loadSprite();
     heroRole            = Classes.Berserker;
     baseHealth          = 500;
     healthPerLevel      = 40;
     requiredBranchLevel = int.MaxValue;
     resetLevel();
     resetHealth();
     abilities[0] = new Cleave();
     abilities[1] = new WhirlwindSlash();
     abilities[2] = new Slam();
     abilities[3] = new DoubleSlash();
     abilities[4] = new Rage();
     abilities[5] = new Execute();
     Enemies.Enemy.UpdateTargets(this);
     Enemies.BossEnemy.UpdateBossTargets(this);
 }