Exemplo n.º 1
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)
                {
                }
            }
        }
Exemplo n.º 2
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)
                {
                }
            }
        }
Exemplo n.º 3
0
 public Form1()
 {
     InitializeComponent();
     InitiativeManager.Start(InitiativeListBox, PlayerTurnLabel);
     BattleManager.Start(BattleListBox, DamageListBox);
     GeneratorManager.Start(SurpriseCombatFirstPreference, SurpriseCombatSecondPreference, SurpriseCombatThirdPreference,
                            SurpriseNonCombatFirstPreference, SurpriseNonCombatSecondPreference, SurpriseNonCombatThirdPreference);
 }
Exemplo n.º 4
0
        //Steps to the very next item in the list.
        private void Step_Click(object sender, EventArgs e)
        {
            string tmpStep = InitiativeListBox.Items[0].ToString();

            InitiativeListBox.Items.RemoveAt(0);
            InitiativeListBox.Items.Insert(InitiativeListBox.Items.Count, tmpStep);

            PlayerTurnLabel.Text = InitiativeManager.UpdatePlayerTurnLabel(InitiativeListBox);
            undoRedoTracker      = InitiativeManager.UpdateUndoBox(InitiativeListBox, undoInitiativeListBox, undoRedoTracker);
        }
Exemplo n.º 5
0
        private void Redo_Click(object sender, EventArgs e)
        {
            if (undoRedoTracker < undoInitiativeListBox.Count)
            {
                undoRedoTracker++;
                InitiativeListBox.Items.Clear();
                InitiativeListBox.Items.AddRange(undoInitiativeListBox[undoRedoTracker - 1].Items);

                PlayerTurnLabel.Text = InitiativeManager.UpdatePlayerTurnLabel(InitiativeListBox);
            }
        }
Exemplo n.º 6
0
        //Finds the next turn of someone that isn't downed.
        private void Next_Click(object sender, EventArgs e)
        {
            do
            {
                string tmpNext = InitiativeListBox.Items[0].ToString();
                InitiativeListBox.Items.RemoveAt(0);
                InitiativeListBox.Items.Insert(InitiativeListBox.Items.Count, tmpNext);
            }while (InitiativeListBox.Items[0].ToString().EndsWith(InitiativeManager.DOWN));

            PlayerTurnLabel.Text = InitiativeManager.UpdatePlayerTurnLabel(InitiativeListBox);
            undoRedoTracker      = InitiativeManager.UpdateUndoBox(InitiativeListBox, undoInitiativeListBox, undoRedoTracker);
        }
Exemplo n.º 7
0
 private void Down_Click(object sender, EventArgs e)
 {
     if (!InitiativeListBox.Items[0].ToString().Contains(InitiativeManager.TOP_OF_ROUND))
     {
         if (InitiativeListBox.Items[0].ToString().EndsWith(InitiativeManager.DOWN))
         {
             string replace = InitiativeListBox.Items[0].ToString().Replace(InitiativeManager.DOWN, "");
             InitiativeListBox.Items.RemoveAt(0);
             InitiativeListBox.Items.Insert(0, replace);
         }
         else
         {
             string insert = InitiativeListBox.Items[0].ToString().Insert(InitiativeListBox.Items[0].ToString().Length, InitiativeManager.DOWN);
             InitiativeListBox.Items.RemoveAt(0);
             InitiativeListBox.Items.Insert(0, insert);
         }
     }
     undoRedoTracker = InitiativeManager.UpdateUndoBox(InitiativeListBox, undoInitiativeListBox, undoRedoTracker);
 }
Exemplo n.º 8
0
        //Moves the current item to another place in the list.
        //If it were the Rat's turn and I put 3 in movelist, it would move rat to index 3.
        private void MoveList_Click(object sender, EventArgs e)
        {
            if (InitiativeTextBox.Text != "")
            {
                string[] contents = InitiativeTextBox.Text.Split(' ');
                InitiativeTextBox.Text = "";
                try
                {
                    if (Convert.ToInt32(contents[1]) > InitiativeListBox.Items.Count)
                    {
                        contents[1] = Convert.ToString(InitiativeListBox.Items.Count);
                    }
                    for (int index = 0; index < InitiativeListBox.Items.Count; index++)
                    {
                        if (!InitiativeListBox.Items[index].ToString().Contains(InitiativeManager.TOP_OF_ROUND))
                        {
                            InitiativeListNode tmp = new InitiativeListNode(InitiativeListBox.Items[index].ToString());
                            if (tmp.Name.Contains(contents[0]))
                            {
                                string tmpStr = InitiativeListBox.Items[index].ToString();
                                InitiativeListBox.Items.Insert(Convert.ToInt32(contents[1]), tmpStr);
                                InitiativeListBox.Items.RemoveAt(index);
                            }
                        }
                    }

                    undoRedoTracker      = InitiativeManager.UpdateUndoBox(InitiativeListBox, undoInitiativeListBox, undoRedoTracker);
                    PlayerTurnLabel.Text = InitiativeManager.UpdatePlayerTurnLabel(InitiativeListBox);
                    InitiativeManager.UpdatePositions(InitiativeListBox);
                }
                catch (IndexOutOfRangeException)
                {
                }
                catch (FormatException)
                {
                }
            }
        }
Exemplo n.º 9
0
        //Clears out the listview.
        private void InitiativeClear_Click(object sender, EventArgs e)
        {
            InitiativeManager.Start(InitiativeListBox, PlayerTurnLabel);

            undoRedoTracker = InitiativeManager.UpdateUndoBox(InitiativeListBox, undoInitiativeListBox, undoRedoTracker);
        }