Beispiel #1
0
        private void saveCombatGroupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog fdlg = new SaveFileDialog();

            fdlg.Filter = fileTypes;
            if (fdlg.ShowDialog() == DialogResult.OK)
            {
                TrackerUtils.WriteCSVFile(fdlg.FileName, combatants);
            }
        }
Beispiel #2
0
        /**
         * Rolls a number of dice based on the number passed in
         *
         * returns a dictionary with the number rolled as the key and
         * how many times it was rolled as the value.
         */
        private ConcurrentDictionary <int, int> rollDice(int skill)
        {
            ConcurrentDictionary <int, int> rolls = new ConcurrentDictionary <int, int>();

            // rolls dice
            for (int i = 0; i < skill; i++)
            {
                int roll = TrackerUtils.RandomNumber(0, 6) + 1;
                rolls.AddOrUpdate(roll, 1, (key, count) => count + 1);
            }

            return(rolls);
        }
Beispiel #3
0
        public int CalculateRoll(int skill, int perception, int will, int wound, bool isAssit, string name)
        {
            ConcurrentDictionary <int, int> rolls = null;
            int maxRoll = -1;

            if (skill > 0)
            {
                rolls   = rollDice(skill);
                maxRoll = rolls.Keys.Max();
            }
            else
            {
                rolls   = rollDice(2);
                maxRoll = rolls.Keys.Min();
            }

            // gives the roll if it was a 6
            if (maxRoll == 6)
            {
                logger.Info("{} rolled {} with {} perception and {} to wounds.", name, rolls, perception, wound);
                return(maxRoll + (rolls[maxRoll] - 1) + perception - wound);
            }
            else if (maxRoll == 1)
            {
                logger.Info("{} glitched with {}", name, rolls);
                //make a will check 4 or higher
                for (int i = 0; i < 2; i++)
                {
                    if ((TrackerUtils.RandomNumber(0, 6) + 1 + will - wound) >= 4)
                    {
                        logger.Info("{} saved their will check", name);
                        return(1);
                    }
                }
                // gitch and removes them from combat
                logger.Info("{} failed their will check.", name);
                return(0);
            }
            else
            {
                int finalRoll = maxRoll + perception - wound;
                if (finalRoll < 1)
                {
                    logger.Info("{} rolled and adjusted {}", name, 1);
                    return(1);
                }
                logger.Info("{} rolled {}", name, finalRoll);
                return(finalRoll);
            }
        }
Beispiel #4
0
        private void loadBatchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fdlg = new OpenFileDialog();

            fdlg.Filter = fileTypes;
            if (fdlg.ShowDialog() == DialogResult.OK)
            {
                TrackerUtils.ReadCSVFile(fdlg.FileName)
                .ForEach(c =>
                {
                    combatants.Add(c);
                    characterStagingPanel.Controls.Add(CreateCharacterPanel(c));
                });
            }
        }
Beispiel #5
0
        /**
         *
         */
        private void createCharacter_Click(object sender, EventArgs e)
        {
            Character newCharacter = new Character(
                TrackerUtils.getCharacterId(),
                names.nameValidation(CharName.Text),
                Convert.ToInt32(csInput.Text),
                Convert.ToInt32(cpxInput.Text),
                Convert.ToInt32(perInput.Text),
                Convert.ToInt32(willInput.Text));

            newCharacter.InCombat = false;
            combatants.Add(newCharacter);

            characterStagingPanel.Controls.Add(CreateCharacterPanel(newCharacter));
            characterSummaryPanel.Controls.Add(CreateCharacterSummaryPanel(newCharacter));
        }
Beispiel #6
0
        private void orderUp_Click(object sender, EventArgs e)
        {
            Button    up   = (Button)sender;
            Character temp = null;

            foreach (Character c in combatants.Where(c => c.InCombat))
            {
                if (up.Parent.Parent.Name == c.ID.ToString())
                {
                    temp = c;
                }
            }

            if (temp != null)
            {
                int index = combatants.IndexOf(temp);
                TrackerUtils.Swap(combatants, index, index - 1);
            }

            RedrawCharacterPanels();
        }
 private string generateRandomName()
 {
     return(RandomNameGenerator.NameGenerator.GenerateFirstName(TrackerUtils.RandomGender()));
 }