Exemplo n.º 1
0
        private void score_TextChanged(object sender, RoutedEventArgs e)
        {
            if (this.IsInitialized)
            {
                if (!String.IsNullOrEmpty(((TextBox)sender).Text))
                {
                    TextBox source            = (TextBox)sender;
                    MainMethods.StatEnum stat = getStatItem(source.Name);

                    int  value  = 9;
                    bool result = int.TryParse(source.Text, out value);
                    if (!result)
                    {
                        MessageBox.Show("A score must be a number!", "Error reading info");
                    }

                    if (value >= 3 && value <= 18)
                    {
                        setScore(value, false, 0, stat);
                    }
                    else
                    {
                        MessageBox.Show("Scores must be between 3 and 18", "Error reading info");
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void setScore(int value, bool check, int checknum, MainMethods.StatEnum stat)
        {
            if (!check)
            {
                rscores[(int)stat]            = value + chara.stats.rbonus[(int)stat];
                chara.stats.scores[(int)stat] = value;
            }
            else
            {
                rscores[(int)stat]            = chara.stats.scores[(int)stat] + checknum;
                chara.stats.rbonus[(int)stat] = checknum;
                bonustb[(int)stat].Text       = "+" + checknum.ToString();
            }

            adjustments[(int)stat]   = MainMethods.calcAdjustment(chara.stats.scores[(int)stat]);
            adjusttb[(int)stat].Text = adjustments[(int)stat].ToString();
            if (adjustments[(int)stat] >= 0)
            {
                adjusttb[(int)stat].Text = "+" + adjustments[(int)stat].ToString();
            }
            if (stat == MainMethods.StatEnum.INT)
            {
                chara.maxlanguages = 2 + adjustments[(int)stat];
                setLanguages(adjustments[(int)stat]);
            }
            if (stat == MainMethods.StatEnum.DEX)
            {
                tbArmorClass.Text = (baseac - adjustments[(int)stat]).ToString();
                tbRoll.Text       = (19 - (baseac - adjustments[(int)stat])).ToString();
            }
            if (stat == MainMethods.StatEnum.CON)
            {
                tbRHitPoints.Text = getSpecies().hpcalc(chara.stats.hp, adjustments[4], 1).ToString();
            }
        }
Exemplo n.º 3
0
        private void chkScore2_Unchecked(object sender, RoutedEventArgs e)
        {
            CheckBox source = (CheckBox)sender;

            MainMethods.StatEnum stat = getStatItem(source.Name);

            setScore(0, true, 1, stat);

            unlockChecks();
        }
Exemplo n.º 4
0
        private void chkScore2_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox source = (CheckBox)sender;

            MainMethods.StatEnum stat = getStatItem(source.Name);

            lockChecks();
            bonuschk[0, (int)stat].IsEnabled = false;

            setScore(0, true, 2, stat);
        }
Exemplo n.º 5
0
        private void chkScore1_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox source = (CheckBox)sender;

            MainMethods.StatEnum stat = getStatItem(source.Name);

            if (countChecks() == 2)
            {
                lockChecks();
            }
            else if (countChecks() == 1)
            {
                bonuschk[1, (int)stat].IsEnabled = true;
            }

            setScore(0, true, 1, stat);
        }