private static Combatant combatantFromJsonObject(JObject combatantJson)
        {
            Combatant combatant = new Combatant((string)combatantJson["CName"], true);
            combatant.AB = (float)combatantJson["AB"];
            combatant.AbilityCHA = (int)combatantJson["AbilityCHA"];
            combatant.AbilityCON = (int)combatantJson["AbilityCON"];
            combatant.AbilityDEX = (int)combatantJson["AbilityDEX"];
            combatant.AbilityINT = (int)combatantJson["AbilityINT"];
            combatant.AbilitySTR = (int)combatantJson["AbilitySTR"];
            combatant.AbilityWIS = (int)combatantJson["AbilityWIS"];
            combatant.AC = (float)combatantJson["AC"];
            combatant.Fort = (float)combatantJson["Fort"];
            combatant.Gold = (float)combatantJson["Gold"];
            combatant.HP = (float)combatantJson["HP"];
            combatant.Initiative = (float)combatantJson["Initiative"];
            combatant.InitMod = (float)combatantJson["InitMod"];
            combatant.IsNPC = (bool)combatantJson["IsNPC"];
            combatant.MaxHP = (float)combatantJson["MaxHP"];
            combatant.Notes = (string)combatantJson["Notes"];
            combatant.PName = (string)combatantJson["PName"];
            combatant.Refl = (float)combatantJson["Refl"];
            combatant.Will = (float)combatantJson["Will"];
            combatant.XP = (float)combatantJson["XP"];

            combatant.Feats = JsonConvert.DeserializeObject<ObservableCollection<string>>(combatantJson["Feats"].ToString());
            combatant.Items = JsonConvert.DeserializeObject<ObservableCollection<Item>>(combatantJson["Items"].ToString());

            JArray skillsJson = (JArray)combatantJson["Skills"];
            for (int i = 0; i < (int)eSkills.Use_Rope + 1; i++)
            {
                Skill skill = JsonConvert.DeserializeObject<Skill>(skillsJson[i].ToString());
                combatant.setSkillRank((eSkills)i, skill.SkillRank);
            }
            return combatant;
        }
        private void AddNewCombatant(object sender, ExecutedRoutedEventArgs e)
        {
            Combatant newCombatant = new Combatant(textBlock15.Text, "", textBlock21.Text, textBlock22.Text,
                    textBlock19.Text, textBlock20.Text, textBlock21.Text, textBlock22.Text, textBlock23.Text,
                    textBlock26.Text, textBlock27.Text, textBlock28.Text, textBox1.Text, textBox2.Text, (bool)isNPC.IsChecked);

            if (combatant == null)
            {
                CommAddCombatant addComm = new CommAddCombatant(combatants, newCombatant);
                addComm.Execute();
            }
            else
            {
                int index = combatants.IndexOf(combatant);

                CommRemoveCombatant commRmv = new CommRemoveCombatant(combatants, combatant);
                commRmv.Execute();
                CommAddCombatant addComm = new CommAddCombatant(combatants, newCombatant);
                addComm.Execute();
                CommRepositionCombatant commRepos = new CommRepositionCombatant(combatants, newCombatant, index - combatants.Count);
                commRepos.Execute();
            }

            this.Close();
        }
 public NewCombatant( CombatTable combatants )
 {
     editing = false;
     this.combatants = combatants;
     InitializeComponent();
     textBlock15.Focus();
     combatant = null;
 }
 public static string jsonFileFromCombatant(Combatant combatant)
 {
     return JsonConvert.SerializeObject(combatant, Formatting.Indented);
 }
 public CommUpdateCombatant(Combatant combatant, CombatantAttributes attribute, object attributeNewValue)
 {
     this.combatant = combatant;
     this.attribute = attribute;
     this.attributeNewValue = attributeNewValue;
 }
 public CommRepositionCombatant(CombatTable combatTable, Combatant combatant, int shift)
 {
     this.combatant = combatant;
     this.combatTable = combatTable;
     combatantPreviousIndex = combatTable.IndexOf(combatant);
     combatantNewIndex = combatantPreviousIndex + shift;
 }
 public CommRemoveCombatant(CombatTable combatTable, Combatant combatant)
 {
     this.combatant = combatant;
     this.combatTable = combatTable;
 }
 public override void Execute()
 {
     currentCombatant = table.getCurrent();
     table.finishEncounter();
     base.Execute();
 }
 public CommAddCombatant(CombatTable combatTable,  Combatant combatant)
 {
     this.combatant = combatant;
     this.combatTable = combatTable;
 }
 public CompleteSheet(Combatant combatant)
 {
     InitializeComponent();
     this.combatant = combatant;
     grid1.DataContext = combatant;
 }