Beispiel #1
0
        //adds a number of creatures based on the count given.
        //Rat 3 would make 3 rats, roll their initiative and assign their place.
        private void AddCount_Click(object sender, EventArgs e)
        {
            if (InitiativeTextBox.Text != "")
            {
                string[] contents = InitiativeTextBox.Text.Split(' ');
                InitiativeTextBox.Text = "";
                try
                {
                    Dice roller = new Dice();
                    for (int count = 0; count < Convert.ToInt32(contents[1]); count++)
                    {
                        InitiativeManager.AddRollPlace(InitiativeListBox, contents[0] + Convert.ToString(count + 1), roller.Roll(6, 2));
                    }

                    undoRedoTracker      = InitiativeManager.UpdateUndoBox(InitiativeListBox, undoInitiativeListBox, undoRedoTracker);
                    PlayerTurnLabel.Text = InitiativeManager.UpdatePlayerTurnLabel(InitiativeListBox);
                }
                catch (IndexOutOfRangeException)
                {
                }
                catch (FormatException)
                {
                }
            }
        }
Beispiel #2
0
        //adds the result to the list and orders them by that.
        //Rat 3 would mean I rolled a total of 3 and it orders them by the roll result.
        private void AddRoll_Click(object sender, EventArgs e)
        {
            if (InitiativeTextBox.Text != "")
            {
                string[] contents = InitiativeTextBox.Text.Split(' ');
                InitiativeTextBox.Text = "";
                try
                {
                    if (contents.Length == 1)
                    {
                        InitiativeManager.AddRollPlace(InitiativeListBox, contents[0]);
                    }
                    else
                    {
                        InitiativeManager.AddRollPlace(InitiativeListBox, contents[0], Convert.ToInt32(contents[1]));
                    }

                    undoRedoTracker      = InitiativeManager.UpdateUndoBox(InitiativeListBox, undoInitiativeListBox, undoRedoTracker);
                    PlayerTurnLabel.Text = InitiativeManager.UpdatePlayerTurnLabel(InitiativeListBox);
                }
                catch (IndexOutOfRangeException)
                {
                }
                catch (FormatException)
                {
                }
            }
        }