Exemple #1
0
        public static UnitStatus CreateFromType(statusTypes type, float duration, float power)
        {
            UnitStatus tmp = null;

            switch (type)
            {
            case statusTypes.Stun:
                tmp = new StunStatus();
                break;

            case statusTypes.Root:
                tmp = new RootStatus();
                break;

            case statusTypes.Speed:
                tmp = new SpeedStatus();
                ((SpeedStatus)tmp).speedModifier = power;
                break;
            }
            if (tmp != null)
            {
                tmp.duration = duration;
            }
            return(tmp);
        }
Exemple #2
0
        private void wrapUp()
        {
            status = statusTypes.Stopped;
            String message = "Game over! You can continue this game with the same players with /xyzzy_extend \n\rScores are: ";
            foreach (mod_xyzzy_player p in players)
            {
                message += "\n\r" + p.name + " - " + p.wins.ToString() + " points";
            }

            TelegramAPI.SendMessage(chatID, message);
        }
Exemple #3
0
        internal void askQuestion()
        {
            mod_xyzzy_coredata localData = getLocalData();
            localData.clearExpectedReplies(chatID); //shouldnt be needed, but handy if we are forcing a question in debug.

            if (remainingQuestions.Count > 0)
            {

                mod_xyzzy_card question = localData.getQuestionCard(remainingQuestions[0]);
                int playerPos = lastPlayerAsked+1;
                if (playerPos >= players.Count) { playerPos = 0; }
                mod_xyzzy_player tzar = players[playerPos];

                //loop through each player and act accordingly
                foreach (mod_xyzzy_player player in players)
                {
                    //throw away old cards and select new ones.
                    player.selectedCards.Clear();
                    player.topUpCards(10, remainingAnswers);
                    if (player == tzar)
                    {
                        TelegramAPI.SendMessage(player.playerID, "Its your question! You ask:" + "\n\r" + question.text);
                    }
                    else
                    {
                        int questionMsg = TelegramAPI.GetReply(player.playerID, tzar.name + " asks: "
                            + "\n\r" + question.text, -1, true, player.getAnswerKeyboard(localData));
                        //we are expecting a reply to this:
                        localData.expectedReplies.Add(new mod_xyzzy_expectedReply(questionMsg, player.playerID, chatID, ""));
                    }
                }

                //todo - should this be winner stays on, or round-robbin?
                lastPlayerAsked = playerPos;
                currentQuestion = remainingQuestions[0];
                remainingQuestions.Remove(currentQuestion);
                status = mod_xyzzy_data.statusTypes.Question;
            }
            else
            {
                wrapUp();
            }
        }
Exemple #4
0
        internal void beginJudging()
        {
            status = statusTypes.Judging;
            mod_xyzzy_coredata localData = getLocalData();

            mod_xyzzy_card q = localData.getQuestionCard(currentQuestion);
            mod_xyzzy_player tzar = players[lastPlayerAsked];
            //get all the responses for the keyboard, and the chat message
            List<string> responses = new List<string>();
            string chatMsg = "All answers recieved! The honourable " + tzar.name + " presiding." + "\n\r" +
                "Question: " + q.text + "\n\r" + "\n\r";
            foreach (mod_xyzzy_player p in players)
            {
                if (p != tzar)
                {
                    //handle multiple answers for a question
                    string answer = "";
                    foreach (string cardUID in p.selectedCards)
                    {
                        mod_xyzzy_card card = localData.getAnswerCard(cardUID);
                        if (answer != "") { answer += " >> "; }
                        answer += card.text;
                    }
                    responses.Add(answer);

                }
            }
            responses.Sort(); //sort so that player order isnt same each time.

            foreach (string answer in responses) { chatMsg += "  - " + answer + "\n\r"; }

            string keyboard = TelegramAPI.createKeyboard(responses,1);
            int judgeMsg = TelegramAPI.GetReply(tzar.playerID, "Pick the best answer! \n\r" + q.text, -1, true, keyboard);
            localData.expectedReplies.Add(new mod_xyzzy_expectedReply(judgeMsg, tzar.playerID, chatID, ""));

            TelegramAPI.SendMessage(chatID, chatMsg);
        }
Exemple #5
0
 //internal mod_xyzzy_data() { }
 public void reset()
 {
     status = statusTypes.Stopped;
     players.Clear();
     remainingAnswers.Clear();
     remainingQuestions.Clear();
     lastPlayerAsked = -1;
 }