Exemple #1
0
 private void AddCombatant(Character c, int init)
 {
     c.Initiative = init;
     combat_Actors.Add(c);
     combat_Actors = combat_Actors.OrderByDescending(i => i.Initiative).Distinct().ToList();
 }
Exemple #2
0
        /// <summary>
        /// Saves the selected character. This is for adding a new character
        /// </summary>
        /// <param name="c">Selected Character</param>
        private Character SaveCharacter()
        {
            //Attributes are saved in creation
            Character c = new Character(txt_Name.Text, (int)txt_St.Value, (int)txt_Dx.Value, (int)txt_Cn.Value, (int)txt_In.Value, (int)txt_Wd.Value, (int)txt_Ch.Value);
            c.MaxHitPoints = int.Parse(txt_PlayerHP.Text);
            //Save characteristics
            c.setGender(combo_Gender.SelectedItem.ToString());
            c.setRace(combo_Race.SelectedItem.ToString());
            if (combo_SubRace.SelectedItem != null)
            {
                c.setSubRace(combo_SubRace.SelectedItem.ToString());
            }
            else
            {
                c.setSubRace("None");
            }
            c.setClass(combo_Class.SelectedItem.ToString());
            if (combo_Prestige.SelectedItem != null)
            {
                string prestigeclass = combo_Prestige.SelectedItem.ToString();
                c.setSubClass(prestigeclass, tempPrestigeType.ParseEnum<SubClassTypes>());
            }
            else
            {
                c.setSubClass("None", SubClassTypes.None);
            }
            c.setAllignment(combo_Allignment.SelectedItem.ToString());
            c.pBackground = txt_Background.Text;
            //Save skills
            foreach (Control s in grp_Skills.Controls)
            {
                CheckBox check = (CheckBox)s;
                //There is no check here to determine if the name is not spelled the same
                c.pSkills.First(k => k.SkillName != null && k.SkillName == check.Text).isProficient = check.Checked;

            }
            //Save Proficiencies
            c.Proficiencies = tempProficiencies;
            //Save Spells
            c.isSpellCaster = tempIsCaster;
            c.Spells = tempSpells;
            //Save Equipment
            c.Equipment = tempEquipment;
            return c;
        }
Exemple #3
0
 private void LoadSpells(ref List<Spell> spells, Character c)
 {
     if (spells != null)
     {
         spells.Clear();
     }
     else
     {
         spells = new List<Spell>();
     }
     foreach (Spell p in c.Spells)
     {
         spells.Add(p);
     }
 }
Exemple #4
0
 private void LoadProficiencies(ref List<Proficiencies> prof, Character c)
 {
     if (prof != null)
     {
         prof.Clear();
     }
     else
     {
         prof = new List<Proficiencies>();
     }
     foreach (Proficiencies p in c.Proficiencies)
     {
         prof.Add(p);
     }
 }
Exemple #5
0
 private void LoadEquipment(ref List<Equipment> equip, Character c)
 {
     if (equip != null)
     {
         equip.Clear();
     }
     else
     {
         equip = new List<Equipment>();
     }
     foreach (Equipment e in c.Equipment)
     {
         equip.Add(e);
     }
 }
Exemple #6
0
        /// <summary>
        /// Populates all of the fields to match the selected character.
        /// </summary>
        /// <param name="c"></param>
        private void LoadCharacter(Character c)
        {
            tempEquipment = null;
            tempProficiencies = null;
            tempSpells = null;
            //First the Character sheet
            txt_Name.Text = c.pName;
            combo_Gender.SelectedItem = c.Gender;
            combo_Race.SelectedItem = c.Race;
            combo_SubRace.SelectedItem = c.SubRace;
            combo_Class.SelectedItem = c.Class;
            combo_Prestige.SelectedItem = c.SubClass;
            combo_Allignment.SelectedItem = c.Allignment;
            txt_Background.Text = c.pBackground;
            txt_PlayerHP.Text = c.MaxHitPoints.ToString();
            //Use a generic method in Character to get the attributes
            txt_St.Value = c.getAttribute("Strength");
            txt_Dx.Value = c.getAttribute("Dexterity");
            txt_Cn.Value = c.getAttribute("Constitution");
            txt_In.Value = c.getAttribute("Intelligence");
            txt_Wd.Value = c.getAttribute("Wisdom");
            txt_Ch.Value = c.getAttribute("Charisma");

            //Set the Skills
            foreach (Control s in grp_Skills.Controls)
            {
                if (s is CheckBox)
                {
                    CheckBox check = (CheckBox)s;
                    foreach (Skill sk in c.pSkills)
                    {
                        if (sk.SkillName == check.Text)
                        {
                            check.Checked = sk.isProficient;
                        }
                    }
                }
            }

            //Set the Proficiencies
            LoadProficiencies(ref tempProficiencies, c);
            refreshProficiencies();

            //Spells
            tab_CharSpells.Enabled = c.isSpellCaster;
            tempIsCaster = c.isSpellCaster;
            LoadSpells(ref tempSpells, c);
            refreshSpells();

            //Equipment
            LoadEquipment(ref tempEquipment, c);
            refreshEquipment();
        }