private void applyDamage(float damageAmount)
 {
     Combatant toBeDamagedCombatant = getSelectedCombatant();
     if (toBeDamagedCombatant == null)
         return;
     float previousHP = toBeDamagedCombatant.HP;
     CommUpdateCombatant commUpdt = new CommUpdateCombatant(toBeDamagedCombatant, CombatantAttributes.hp, previousHP + damageAmount);
     commUpdt.Execute();
 }
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     float newInititive = App.getFloatFromString(initiativeBox.Text);
     if (newInititive != 0)
     {
         Combatant newInitiativeCombatant = getSelectedCombatant();
         if (newInitiativeCombatant == null)
             return;
         float previousHP = newInitiativeCombatant.HP;
         CommUpdateCombatant commUpdt = new CommUpdateCombatant(newInitiativeCombatant, CombatantAttributes.initiative, newInititive);
         commUpdt.Execute();
     }
 }
        private void SetThisInitiative(object sender, ExecutedRoutedEventArgs e)
        {
            float initiative = App.getFloatFromString(initBox.Text);
            Combatant selectedCombatant = (Combatant)listBox1.SelectedItem;
            CommUpdateCombatant commUpdt = new CommUpdateCombatant(selectedCombatant, CombatantAttributes.initiative, initiative);
            commUpdt.Execute();

            int indexOfSelected = table.IndexOf(selectedCombatant);
            if (indexOfSelected < table.Count - 1)
            {
                listBox1.SelectedItem = table[indexOfSelected + 1];
                initBox.Text = "";
            }
            else
            {
                this.Close();
            }
        }
 private void XP_Click(object sender, RoutedEventArgs e)
 {
     float xpAmount = App.getFloatFromString(damageHealBox.Text);
     if (xpAmount != 0)
     {
         Combatant toBexpedCombatant = getSelectedCombatant();
         if (toBexpedCombatant == null)
             return;
         float previousxp = toBexpedCombatant.XP;
         CommUpdateCombatant commUpdt = new CommUpdateCombatant(toBexpedCombatant, CombatantAttributes.xp, previousxp + xpAmount);
         commUpdt.Execute();
     }
 }
 private void restoreSelectedHp_Click(object sender, RoutedEventArgs e)
 {
     Combatant toBeRestoredCombatant = getSelectedCombatant();
     if (toBeRestoredCombatant == null)
         return;
     float maxHP = toBeRestoredCombatant.MaxHP;
     CommUpdateCombatant commUpdt = new CommUpdateCombatant(toBeRestoredCombatant, CombatantAttributes.hp, maxHP);
     commUpdt.Execute();
 }
 private void restoreAllHP_Click(object sender, RoutedEventArgs e)
 {
     for (int i = 0; i < listi.Count; i++)
     {
         Combatant toBeRestoredCombatant = listi[i];
         float maxHP = toBeRestoredCombatant.MaxHP;
         CommUpdateCombatant commUpdt = new CommUpdateCombatant(toBeRestoredCombatant, CombatantAttributes.hp, maxHP);
         commUpdt.Execute();
     }
 }
 private void Gold_Click(object sender, RoutedEventArgs e)
 {
     float goldAmount = App.getFloatFromString(damageHealBox.Text);
     if (goldAmount != 0)
     {
         Combatant toBeGoldedCombatant = getSelectedCombatant();
         if (toBeGoldedCombatant == null)
             return;
         float previousGold = toBeGoldedCombatant.Gold;
         CommUpdateCombatant commUpdt = new CommUpdateCombatant(toBeGoldedCombatant, CombatantAttributes.gold, previousGold + goldAmount);
         commUpdt.Execute();
     }
 }
 private void damageHeal_Click(object sender, RoutedEventArgs e)
 {
     float lifeAmount = App.getFloatFromString(damageHealBox.Text);
     if (lifeAmount != 0)
     {
         Combatant toBeDamagedCombatant = getSelectedCombatant();
         if (toBeDamagedCombatant == null)
             return;
         float previousHP = toBeDamagedCombatant.HP;
         CommUpdateCombatant commUpdt = new CommUpdateCombatant(toBeDamagedCombatant, CombatantAttributes.hp, previousHP - lifeAmount);
         commUpdt.Execute();
     }
 }