예제 #1
0
 public void WaitBattle()
 {
     timeCanGo         = true;
     currentEventState = EventState.WaitBattle;
     time = 30;
     eventStateText.text = currentEventState.ToString();
 }
예제 #2
0
 private void ReadyBattle()
 {
     stageManager.ReadyNextStage();
     currentEventState = EventState.ReadyBattle;
     time = 5f;
     eventStateText.text = currentEventState.ToString();
 }
예제 #3
0
 private void StartBattle()
 {
     battleManager.StartBattle();
     currentEventState = EventState.StartBattle;
     time = 40f;
     eventStateText.text = currentEventState.ToString();
 }
예제 #4
0
        void cmdEventType(BasePlayer player, string command, string[] args)
        {
            if (player.net.connection.authLevel == 0 && !permission.UserHasPermission(player.userID.ToString(), PluginCommand))
            {
                return;
            }

            if (args.Length == 0)
            {
                player.ChatMessage(m_configData.Messages["server_state"].Replace("%state", m_state.ToString()));
                List <ulong>            players      = new List <ulong>();
                Dictionary <ulong, int> playerScores = new Dictionary <ulong, int>();
                foreach (ulong steamid in m_players.Keys)
                {
                    players.Add(steamid);
                    playerScores[steamid] = m_playersMurders[steamid];
                }
                for (int i = 0; i < players.Count - 1; i++)
                {
                    for (int j = i; j < players.Count; j++)
                    {
                        if (playerScores[players[i]] < playerScores[players[j]])
                        {
                            ulong buf = players[i];
                            players[i] = players[j];
                            players[j] = buf;
                        }
                    }
                }
                string scores = "";
                for (int i = 0; i < players.Count; i++)
                {
                    scores += (i + 1).ToString() + ") " + playerScore(players[i]);
                    if (i < players.Count - 1)
                    {
                        scores += ", ";
                    }
                }
                player.ChatMessage(scores);
            }
            else if (args.Length > 1)
            {
                if (args[0] == "set")
                {
                    EventState rState;
                    if (args[1] == EventState.Disabled.ToString())
                    {
                        rState = EventState.Disabled;
                    }
                    else if (args[1] == EventState.Deathmatch.ToString())
                    {
                        rState = EventState.Deathmatch;
                    }
                    else if (args[1] == EventState.TeamDeathmatch.ToString())
                    {
                        rState = EventState.TeamDeathmatch;
                    }
                    else
                    {
                        player.ChatMessage(m_configData.Messages["invalid_arguments"]);
                        return;
                    }

                    if ((rState == EventState.Deathmatch && m_state == EventState.TeamDeathmatch) ||
                        (rState == EventState.TeamDeathmatch && m_state == EventState.Deathmatch))
                    {
                        player.ChatMessage(m_configData.Messages["invalid_arguments"]);
                        return;
                    }

                    m_lootedPlayers.Clear();
                    m_players.Clear();
                    m_playersDeaths.Clear();
                    m_playersMurders.Clear();
                    m_state = rState;

                    if (m_state == EventState.Disabled)
                    {
                        player.ChatMessage(m_configData.Messages["event_was_disabled"]);
                    }
                    else
                    {
                        int frags = 0;
                        if (args.Length == 3)
                        {
                            if (!int.TryParse(args[2], out frags))
                            {
                                player.ChatMessage(m_configData.Messages["invalid_arguments"]);
                                return;
                            }
                        }
                        m_fragsMax = frags;
                        PrintToChat(m_configData.Messages["event_was_started"].Replace("%event_type", m_state.ToString()).Replace("%frags", m_fragsMax == 0 ? m_configData.Messages["endless"] : m_fragsMax.ToString()));
                    }
                }
                else
                {
                    player.ChatMessage(m_configData.Messages["invalid_arguments"]);
                    return;
                }
            }
            else
            {
                player.ChatMessage(m_configData.Messages["invalid_arguments"]);
                return;
            }
        }
예제 #5
0
        /// <summary>
        /// Calculate the probability for a state.
        /// </summary>
        /// <param name="state">The state to calculate.</param>
        /// <returns>The probability.</returns>
        private double CalculateProbability(EventState state)
        {

            int[] args = ObtainArgs(state.Event);

            foreach (TableLine line in state.Event.Table.Lines)
            {
                if (line.CompareArgs(args))
                {
                    if (Math.Abs(line.Result - state.Value) < EncogFramework.DefaultDoubleEqual)
                    {
                        return line.Probability;
                    }
                }
            }

            throw new BayesianError("Could not determine the probability for "
                    + state.ToString());
        }