Пример #1
0
        public void ShouldCastMagicMissile()
        {
            //mock player
            var player = new MIMWebClient.Core.PlayerSetup.Player()
            {
                Name = "Liam"
            };
            //give spell to player
            var magicMissle = MagicMissile.MagicMissileAb();

            player.Skills.Add(magicMissle);

            //mock target
            var target = new MIMWebClient.Core.PlayerSetup.Player()
            {
                Name = "target"
            };

            //mock room
            var room = new Room();

            room.players = new List <MIMWebClient.Core.PlayerSetup.Player>();
            room.players.Add(player);
            room.players.Add(target);


            Assert.DoesNotThrow(() => MagicMissile.StartMagicMissile(player, room, ""));
        }
Пример #2
0
        public void Should_Confirm_Player_Does_Not_Have_Skill()
        {
            var player = new MIMWebClient.Core.PlayerSetup.Player()
            {
                Name = "Liam"
            };
            //give spell to player
            var magicMissle = MagicMissile.MagicMissileAb();

            var hasSkill = Skill.CheckPlayerHasSkill(player, magicMissle.Name);

            Assert.IsFalse(hasSkill);
        }
Пример #3
0
        public void StandShouldKeepStatusIfAlreadyStanding()
        {
            Mock <MIMWebClient.Core.IHubContext> context = new Mock <MIMWebClient.Core.IHubContext>();

            CorePlayer player = new CorePlayer
            {
                Status = CorePlayer.PlayerStatus.Standing
            };
            Room room = new Room();

            Status.StandPlayer(context.Object, player, room);

            Assert.That(player.Status, Is.EqualTo(CorePlayer.PlayerStatus.Standing));
            context.Verify(m => m.SendToClient("You are standing already.", player.HubGuid, null, false, false, false));
        }
Пример #4
0
        public void StatusShouldChangeToRest()
        {
            var context = new Mock <MIMWebClient.Core.IHubContext>();

            CorePlayer player = new CorePlayer
            {
                Status = CorePlayer.PlayerStatus.Standing
            };
            Room room = new Room();

            room.players = new List <CorePlayer>();

            Status.RestPlayer(context.Object, player, room);

            Assert.That(player.Status, Is.EqualTo(CorePlayer.PlayerStatus.Resting));
            context.Verify(m => m.SendToClient("You sit down and rest.", player.HubGuid, null, false, false, false)); //Mind blown, this is pure magic :)
        }
Пример #5
0
        public void Should_Find_Target_For_Skill()
        {
            var target = new MIMWebClient.Core.PlayerSetup.Player()
            {
                Name = "Liam"
            };

            var room = new Room()
            {
                players = new List <MIMWebClient.Core.PlayerSetup.Player>()
            };

            room.players.Add(target);

            var skillCommand = "magic liam"; //C magic Liam (command is not included)

            var findTarget = Skill.FindTarget(skillCommand, room);

            Assert.That(findTarget, Is.EqualTo(target));
        }
Пример #6
0
        public void TripShouldFailIfAsleep()
        {
            #region setup
            Mock <MIMWebClient.Core.IHubContext> context = new Mock <MIMWebClient.Core.IHubContext>();

            CorePlayer player = new CorePlayer
            {
                Name          = "Attacker",
                Status        = CorePlayer.PlayerStatus.Standing,
                SelectedClass = "Fighter",
                Skills        = new List <Skill>(),
            };

            player.Status = CorePlayer.PlayerStatus.Sleeping;

            CorePlayer target = new CorePlayer
            {
                Name          = "Defender",
                Status        = CorePlayer.PlayerStatus.Standing,
                SelectedClass = "Fighter",
                Skills        = new List <Skill>()
            };

            var skill = Trip.TripAb();
            skill.Proficiency = 100;
            player.Skills.Add(skill);

            Room room = new Room {
                players = new List <CorePlayer> {
                    player, target
                }
            };


            #endregion setup

            new Trip().StartTrip(context.Object, player, room, "trip defender");

            context.Verify(m => m.SendToClient("You can't do that while asleep.", player.HubGuid, null, false, false, false));
        }
Пример #7
0
        public void TripShouldFailIfNotLearned()
        {
            #region setup
            Mock <MIMWebClient.Core.IHubContext> context = new Mock <MIMWebClient.Core.IHubContext>();

            CorePlayer player = new CorePlayer
            {
                Name          = "Attacker",
                Status        = CorePlayer.PlayerStatus.Standing,
                SelectedClass = "Fighter",
                Skills        = new List <Skill>(),
            };



            CorePlayer target = new CorePlayer
            {
                Name          = "Defender",
                Status        = CorePlayer.PlayerStatus.Standing,
                SelectedClass = "Fighter",
                Skills        = new List <Skill>()
            };



            Room room = new Room();
            room.players = new List <CorePlayer>();

            room.players.Add(player);
            room.players.Add(target);

            #endregion setup

            new Trip().StartTrip(context.Object, player, room, "trip defender");

            context.Verify(m => m.SendToClient("You don't know that skill.", player.HubGuid, null, false, false, false));
        }