Esempio n. 1
0
        public void MoveToHospital()
        {
            InstanceGenerator.Cleaner(CharacteId1);
            CreateChar(CharacteId1, lobbyId, "Step1");
            CreateChar(CharacteId2, lobbyId, "Step2");
            Lobby newlobby = InstanceGenerator.GenerateTestingLobby(lobbyId);

            _lobbyRepository.Create(newlobby);

            bot.StateMachine(_characterRepository.Read(CharacteId1).State, "Влево", CharacteId1);
            newlobby = _lobbyRepository.Read(lobbyId);
            Assert.AreEqual(newlobby.Players[0].Health == LobbyRules.Test().PlayerMaxHealth, true);
        }
Esempio n. 2
0
        public void BombinVoid()
        {
            InstanceGenerator.Cleaner(CharacteId1);
            CreateChar(CharacteId1, lobbyId, "Step1");
            CreateChar(CharacteId2, lobbyId, "Step2");

            Lobby newlobby = InstanceGenerator.GenerateTestingLobby(lobbyId);

            _lobbyRepository.Create(newlobby);
            bot.BComm(CharacteId1, Direction.North);
            newlobby = _lobbyRepository.Read(lobbyId);
            Assert.AreEqual(newlobby.Maze[2, 1] == 0, true);
            Assert.AreEqual(newlobby.Players[0].Bombs == LobbyRules.Test().PlayerMaxBombs - 1, true);
        }
Esempio n. 3
0
        public void ShootInPlayer()
        {
            InstanceGenerator.Cleaner(CharacteId1);
            CreateChar(CharacteId1, lobbyId, "Step1");
            CreateChar(CharacteId2, lobbyId, "Step2");

            Lobby newlobby = InstanceGenerator.GenerateTestingLobby(lobbyId);

            _lobbyRepository.Create(newlobby);
            bot.SComm(CharacteId1, Direction.North);
            newlobby = _lobbyRepository.Read(lobbyId);
            Assert.AreEqual(newlobby.Players[1].Health == LobbyRules.Test().PlayerMaxHealth - 1, true);
            Assert.AreEqual(newlobby.Players[0].Guns == LobbyRules.Test().PlayerMaxGuns - 1, true);
        }
Esempio n. 4
0
        public void StabInPlayer()
        {
            InstanceGenerator.Cleaner(CharacteId1);
            CreateChar(CharacteId1, lobbyId, "Step1");
            CreateChar(CharacteId2, lobbyId, "Step2");

            Lobby newlobby = InstanceGenerator.GenerateTestingLobby(lobbyId);

            _lobbyRepository.Create(newlobby);
            bot.StateMachine(_characterRepository.Read(CharacteId1).State, "Пропуск хода", CharacteId1);
            bot.StateMachine(_characterRepository.Read(CharacteId2).State, "Вниз", CharacteId2);
            bot.StateMachine(_characterRepository.Read(CharacteId1).State, "Удар кинжалом", CharacteId1);
            newlobby = _lobbyRepository.Read(lobbyId);
            Assert.AreEqual(newlobby.Players[1].Health == LobbyRules.Test().PlayerMaxHealth - 1, true);
        }
Esempio n. 5
0
        public static int EmptyPlaceCount(int userId)
        {
            var players = _memberRepository.ReadLobbyAll();

            if (players.Count == 0)
            {
                return(LobbyRules.GenerateTemplateRules().PlayersCount);
            }
            else
            {
                Member lastuser = players.Last();
                var    users    = _memberRepository.ReadLobbyAll().Where(e => e.LobbyId == lastuser.LobbyId);
                return(LobbyRules.GenerateTemplateRules().PlayersCount - users.Count());
            }
        }