private void addAttack(object sender, EventArgs e) { AddAttackForm addAttack = new AddAttackForm(ChallengeRatingDropDown.Text); addAttack.Show(); addAttack.FormClosing += (senders, es) => { if (addAttack.NewAttack != null) { if (TraitsList.Items.Contains(addAttack.NewAttack.Title)) { addAttack.NewAttack.Title += "_"; } Monster._Attacks.Add(addAttack.NewAttack); TraitsList.Items.Add("Attack: " + addAttack.NewAttack.Title); } if (addAttack.NewAbility != null) { if (TraitsList.Items.Contains(addAttack.NewAbility.Title)) { addAttack.NewAbility.Title += "_"; } Monster._Attacks.Add(addAttack.NewAbility); TraitsList.Items.Add("Attack: " + addAttack.NewAbility.Title); } }; }
private void editTrait(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { if (TraitsList.SelectedItem.ToString().Split(':')[0].Trim() == "Attack") { AddAttackForm loadAttack = new AddAttackForm(); foreach (Attack attack in Monster._Attacks) { if (attack.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim()) { loadAttack.LoadAttack(attack); loadAttack.Show(); loadAttack.FormClosing += (senderx, ex) => { Monster._Attacks.Remove(attack); Monster._Attacks.Add(loadAttack.NewAttack); TraitsList.Items.Remove(TraitsList.SelectedItem); TraitsList.Items.Add("Attack: " + loadAttack.NewAttack.Title); }; return; } } } if (TraitsList.SelectedItem.ToString().Split(':')[0].Trim() == "Ability") { AddAbilityForm loadAttack = new AddAbilityForm(); foreach (Ability ability in Monster._Abilities) { if (ability.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim()) { loadAttack.LoadAbility(ability); loadAttack.Show(); loadAttack.FormClosing += (senderx, ex) => { Monster._Abilities.Remove(ability); Monster._Abilities.Add(loadAttack.NewAbility); TraitsList.Items.Remove(TraitsList.SelectedItem); TraitsList.Items.Add("Ability: " + loadAttack.NewAbility.Title); }; return; } } } } }
private void addAttack(object sender, EventArgs e) { AddAttackForm addAttack = new AddAttackForm(); addAttack.Show(); addAttack.FormClosing += (senders, es) => { if (addAttack.NewAttack != null) { Monster._Attacks.Add(addAttack.NewAttack); TraitsList.Items.Add("Attack: " + addAttack.NewAttack.Title); } }; }
private void addAttack(object sender, EventArgs e) { AddAttackForm addAttack = new AddAttackForm(); addAttack.Show(); addAttack.FormClosing += (senders, es) => { if (addAttack.NewAttack != null) { Monster._Attacks.Add(addAttack.NewAttack); TraitsList.Items.Add("Attack: " + addAttack.NewAttack.Title); } if (addAttack.NewAbility != null) { Monster._Attacks.Add(addAttack.NewAbility); TraitsList.Items.Add("Attack: " + addAttack.NewAbility.Title); } }; }
private void editTrait(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { if (TraitsList.SelectedItem == null) return; if (TraitsList.SelectedItem.ToString().Split(':')[0].Trim() == "Legendary") { AddLegendaryForm loadLegendary = new AddLegendaryForm(); foreach (Legendary legendary in Monster._Legendaries) { if (legendary.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim()) { loadLegendary.LoadLegendary(legendary); loadLegendary.Show(); loadLegendary.FormClosing += (senderx, ex) => { loadLegendary.SerializeTraits(); Monster._Legendaries.Remove(legendary); Monster._Legendaries.Add(loadLegendary.LegendaryAbility); TraitsList.Items.Remove(TraitsList.SelectedItem); TraitsList.Items.Add("Legendary: " + loadLegendary.LegendaryAbility.Title); }; return; } } } if (TraitsList.SelectedItem.ToString().Split(':')[0].Trim() == "Attack") { AddAttackForm loadAttack = new AddAttackForm(); foreach (Ability attack in Monster._Attacks) { if (attack.isDamage) { if (attack.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim()) { loadAttack.LoadAttack((Attack)attack); loadAttack.Show(); loadAttack.FormClosing += (senderx, ex) => { Monster._Attacks.Remove(attack); Monster._Attacks.Add(loadAttack.NewAttack); TraitsList.Items.Remove(TraitsList.SelectedItem); TraitsList.Items.Add("Attack: " + loadAttack.NewAttack.Title); }; return; } } if (!attack.isDamage) { if (attack.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim()) { loadAttack.LoadAttack((Ability)attack); loadAttack.Show(); loadAttack.FormClosing += (senderx, ex) => { Monster._Attacks.Remove(attack); Monster._Attacks.Add(loadAttack.NewAttack); TraitsList.Items.Remove(TraitsList.SelectedItem); TraitsList.Items.Add("Attack: " + loadAttack.NewAbility.Title); }; return; } } } } if (TraitsList.SelectedItem.ToString().Split(':')[0].Trim() == "Ability") { AddAbilityForm loadAttack = new AddAbilityForm(); foreach (Ability ability in Monster._Abilities) { if (ability.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim()) { loadAttack.LoadAbility(ability); loadAttack.Show(); loadAttack.FormClosing += (senderx, ex) => { Monster._Abilities.Remove(ability); Monster._Abilities.Add(loadAttack.NewAbility); TraitsList.Items.Remove(TraitsList.SelectedItem); TraitsList.Items.Add("Ability: " + loadAttack.NewAbility.Title); }; return; } } } } }