예제 #1
0
        public bool RemovePlayer(Channel channel, string nick)
        {
            UnoPlayer player = GetPlayer(nick);

            if (player == null)
            {
                return(false);
            }

            if (current_player == player.name)
            {
                TurnNext();
            }

            if (is_active && player.cards.Count == 0)
            {
                int score = 0;
                foreach (UnoPlayer up in players)
                {
                    if (up != player)
                    {
                        score += up.GetCardsValue();
                    }
                }

                string log = player.name + " finishes the game and gains "
                             + score + " points";
                if (CheckMode(UnoMode.RANKED))
                {
                    player.Win(players, initial_player_count);

                    foreach (UnoPlayer up in players)
                    {
                        m_settings.Set(up.name, up);
                    }

                    log += ". Elo: " + player.ShowElo(false);
                }
                channel.Say(log);
            }
            else
            {
                channel.Say(player.name + " left this UNO game.");
            }

            players.Remove(player);
            if (!is_active)
            {
                initial_player_count = players.Count;
            }
            return(true);
        }
예제 #2
0
        void Cmd_Elo(string nick, string message)
        {
            Channel channel = p_manager.GetChannel();
            string  who     = Chatcommand.GetNext(ref message);

            if (who.Length == 0)
            {
                who = nick;
            }

            var player = new UnoPlayer(who, null);

            if (!m_settings.Get(who, ref player))
            {
                channel.Say("[UNO] " + who + ": No information available");
            }
            else
            {
                channel.Say("[UNO] " + who + ": " + player.ShowElo(true));
            }
        }