private void RemoveCombatant_Click(object sender, RoutedEventArgs e) { if (CombatantList.SelectedItem != null) { if (ActiveCombatant != null) { if (ActiveCombatant.Name.Equals((CombatantList.SelectedItem as DD4ECombatant).Name)) { var index = CombatantList.Items.IndexOf(ActiveCombatant); if (index >= CombatantList.Items.Count - 1) { ActiveCombatant = CombatantList.Items[0] as DD4ECombatant; } else { ActiveCombatant = CombatantList.Items[index + 1] as DD4ECombatant; } } } var removeIndex = CombatantList.SelectedIndex; CombatantList.SelectedIndex = -1; Combatants.RemoveAt(removeIndex); } }
public AddTemporaryHealthWindow(DD4ECombatant combatant) { InitializeComponent(); Combatant = combatant; PromptLabel.Content = String.Format("How much temp HP will {0} add?\nCurrent: {1}", Combatant.CombatName, Combatant.TemporaryHP); }
public HealCombatantWindow(DD4ECombatant combatant) { InitializeComponent(); Combatant = combatant; PromptLabel.Content = String.Format("How much is {0} healing?\nCurrent: {1}/{2}", Combatant.CombatName, Combatant.CurrentHP, Combatant.MaxHP); }
public SetFigurineWindow(DD4ECombatant combatant) { InitializeComponent(); Combatant = combatant; PromptLabel.Content = String.Format("Which figure is {0} using?", Combatant.CombatName); }
public TakeDamageWindow(DD4ECombatant combatant) { InitializeComponent(); Combatant = combatant; DamageTypeList.ItemsSource = DamageTypes; PromptLabel.Content = String.Format("How much damage is {0} taking?", Combatant); }
public AttackTargetWindow(ref DD4ECombatant target, DD4EDamageType damageType, IList <DD4EStatusEffect> statusEffects) { InitializeComponent(); Target = target; DamageType = damageType; StatusEffects = statusEffects; DefenderNameLabel.Content = Target.Name; }
public DD4eCombatTracker() { InitializeComponent(); // This is for testing for (int i = 0; i < 5; i++) { DD4ECombatant combatant = new DD4ECombatant("Goblin", 25, 15, 15, 16, 15, 3); var fireRes = new DD4EDamageModifier(DD4EStatusEffectType.Resistance, combatant.Name, DD4EDamageType.Fire, 5, DD4EStatusEffectDuration.EndOfEncounter); combatant.ApplyStatusEffect(fireRes); AddCombatant(combatant); } this.CombatantList.ItemsSource = Combatants; }
private void AddCombatant(DD4ECombatant combatant) { if (Combatants.Any(c => c.Name.Equals(combatant.Name) && c.IsPlayer == false)) { int id = Combatants.Count(c => c.Name.Equals(combatant.Name) && c.IsPlayer == false); combatant.ID = id; } else { if (Combatants.Any(c => c.Name.Equals(combatant.Name))) { MessageBox.Show("You cannot add the same player character twice.", "Warning"); return; } } Combatants.Add(combatant); }
private void NextTurn_Click(object sender, RoutedEventArgs e) { if (CombatActive) { var index = CombatantList.Items.IndexOf(ActiveCombatant); if (index != -1) { for (int i = 0; i < Combatants.Count; i++) { if (i == index) { Combatants[i].EndTurn(); } else { Combatants[i].OtherEndTurn(Combatants[index].CombatName); } } if (index >= CombatantList.Items.Count - 1) { ActiveCombatant = CombatantList.Items[0] as DD4ECombatant; } else { ActiveCombatant = CombatantList.Items[index + 1] as DD4ECombatant; } var startIndex = CombatantList.Items.IndexOf(activeCombatant); for (int i = 0; i < Combatants.Count; i++) { if (i == startIndex) { Combatants[i].StartTurn(); } else { Combatants[i].OtherStartTurn(Combatants[startIndex].CombatName); } } } } }
private void StartCombat_Click(object sender, RoutedEventArgs e) { if (Combatants.Count > 1) { for (int i = 0; i < Combatants.Count; i++) { if (!Combatants[i].IsPlayer) { Combatants[i].RollInitiative(); } else { SetCombatantInitiative(i); } } SortByInitiative(); ActiveCombatant = CombatantList.Items[0] as DD4ECombatant; CombatActive = true; } }
private void AddButton_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrWhiteSpace(NameTextBox.Text)) { MessageBox.Show("Please input a name for the character", "Warning"); return; } if (!MaxHPTextBox.Text.IsPositiveInteger()) { MaxHPTextBox.Text = ""; MessageBox.Show("Please put in a positive integer for health.", "Warning"); return; } if (!ArmorClassTextBox.Text.IsPositiveInteger()) { ArmorClassTextBox.Text = ""; MessageBox.Show("Please put in a positive integer for armor class.", "Warning"); return; } if (!FortitudeTextBox.Text.IsPositiveInteger()) { FortitudeTextBox.Text = ""; MessageBox.Show("Please put in a positive integer for fortitude.", "Warning"); return; } if (!ReflexTextBox.Text.IsPositiveInteger()) { ReflexTextBox.Text = ""; MessageBox.Show("Please put in a positive integer for relfex.", "Warning"); return; } if (!WillTextBox.Text.IsPositiveInteger()) { WillTextBox.Text = ""; MessageBox.Show("Please put in a positive integer for will.", "Warning"); return; } if (!InitiativeBonusTextBox.Text.IsPositiveInteger()) { InitiativeBonusTextBox.Text = ""; MessageBox.Show("Please put in a positive integer for intiative bonus.", "Warning"); return; } var combatant = new DD4ECombatant(NameTextBox.Text, Convert.ToInt32(MaxHPTextBox.Text), Convert.ToInt32(ArmorClassTextBox.Text), Convert.ToInt32(FortitudeTextBox.Text), Convert.ToInt32(ReflexTextBox.Text), Convert.ToInt32(WillTextBox.Text), Convert.ToInt32(InitiativeBonusTextBox.Text)); combatant.IsPlayer = (bool)IsPlayerCheckBox.IsChecked; if (!combatant.IsPlayer) { if (Combatants.Any(c => c.Name.Equals(combatant.Name) && c.IsPlayer == false)) { int id = Combatants.Count(c => c.Name.Equals(combatant.Name) && c.IsPlayer == false); combatant.ID = id; } } else { if (Combatants.Any(c => c.Name.Equals(combatant.Name))) { MessageBox.Show("You cannot add the same player character twice.", "Warning"); return; } } Combatants.Add(combatant); this.Close(); }
private void EndCombat_Click(object sender, RoutedEventArgs e) { CombatActive = false; ActiveCombatant = null; }