示例#1
0
        private void AddLegendary(object sender, EventArgs e)
        {
            AddLegendaryForm addLegendary = new AddLegendaryForm();

            addLegendary.Show();

            addLegendary.FormClosing += (senders, es) =>
            {
                addLegendary.SerializeTraits();
                if (addLegendary.LegendaryAbility != null)
                {
                    if (TraitsList.Items.Contains(addLegendary.LegendaryAbility.Title))
                    {
                        addLegendary.LegendaryAbility.Title += "_";
                    }
                    Monster._Legendaries.Add(addLegendary.LegendaryAbility);
                    TraitsList.Items.Add("Legendary: " + addLegendary.LegendaryAbility.Title);
                }
            };
        }
示例#2
0
        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;
                        }
                    }
                }
            }
        }                
示例#3
0
        private void AddLegendary(object sender, EventArgs e)
        {
            AddLegendaryForm addLegendary = new AddLegendaryForm();
            addLegendary.Show();

            addLegendary.FormClosing += (senders, es) =>
            {
                addLegendary.SerializeTraits();
                if (addLegendary.LegendaryAbility != null)
                {                    
                    if (TraitsList.Items.Contains(addLegendary.LegendaryAbility.Title)) { addLegendary.LegendaryAbility.Title += "_"; }
                    Monster._Legendaries.Add(addLegendary.LegendaryAbility);
                    TraitsList.Items.Add("Legendary: " + addLegendary.LegendaryAbility.Title);
                }
            };
        }       
示例#4
0
        /* Edits selected item in the TraitList. If it's an Ability/Attack,
        Open the appropriate window and load that data. */
        private void editTrait(object sender, MouseEventArgs e)
        {                        
            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();
                            int index = Monster._Legendaries.IndexOf(legendary);
                            Monster._Legendaries.RemoveAt(index);
                            Monster._Legendaries.Insert(index, loadLegendary.LegendaryAbility);

                            index = TraitsList.Items.IndexOf(TraitsList.SelectedItem);
                            TraitsList.Items.RemoveAt(index);
                            TraitsList.Items.Insert(index, "Legendary: " + loadLegendary.LegendaryAbility.Title);
                        };
                        return;
                    }
                }
            }

            if (TraitsList.SelectedItem.ToString().Split(':')[0].Trim() == "Action")
            {
                AddActionForm loadAttack = new AddActionForm();

                foreach (Ability attack in Monster._Actions)
                {
                    if (attack.isDamage)
                    {
                        if (attack.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim())
                        {
                            loadAttack.LoadAttack(attack);                                
                            loadAttack.Show();

                            loadAttack.FormClosing += (senderx, ex) =>
                            {
                                int index = Monster._Actions.IndexOf(attack);
                                Monster._Actions.RemoveAt(index);                                    
                                Monster._Actions.Insert(index, loadAttack.NewAttack);

                                index = TraitsList.Items.IndexOf(TraitsList.SelectedItem);
                                TraitsList.Items.RemoveAt(index);
                                TraitsList.Items.Insert(index, "Action: " + loadAttack.NewAttack.Title);
                            };
                            return;
                        }
                    }

                    if (!attack.isDamage)
                    {
                        if (attack.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim())
                        {
                            loadAttack.LoadAction((Ability)attack);
                            loadAttack.Show();

                            loadAttack.FormClosing += (senderx, ex) =>
                            {
                                int index = Monster._Actions.IndexOf(attack);
                                Monster._Actions.RemoveAt(index);
                                Monster._Actions.Insert(index, loadAttack.NewAbility);

                                index = TraitsList.Items.IndexOf(TraitsList.SelectedItem);
                                TraitsList.Items.RemoveAt(index);
                                TraitsList.Items.Insert(index, "Action: " + loadAttack.NewAbility.Title);
                            };
                            return;
                        }
                    }
                }
            }

            if (TraitsList.SelectedItem.ToString().Split(':')[0].Trim() == "Reaction")
            {
                AddActionForm loadReaction = new AddActionForm();

                foreach (Ability reaction in Monster._Reactions)
                {
                    if (reaction.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim())
                    {
                        loadReaction.LoadReaction(reaction);
                        loadReaction.Show();

                        loadReaction.FormClosing += (senderx, ex) =>
                        {
                            int index = Monster._Reactions.IndexOf(reaction);
                            Monster._Reactions.RemoveAt(index);
                            Monster._Reactions.Insert(index, loadReaction.NewReaction);

                            index = TraitsList.Items.IndexOf(TraitsList.SelectedItem);
                            TraitsList.Items.RemoveAt(index);
                            TraitsList.Items.Insert(index, "Reaction: " + loadReaction.NewReaction.Title);
                        };
                        return;
                    }                        
                }
            }

            if (TraitsList.SelectedItem.ToString().Split(':')[0].Trim() == "Ability")
            {
                AddAbilityForm loadAbility = new AddAbilityForm();

                foreach (Ability ability in Monster._Abilities)
                {
                    if (ability.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim())
                    {
                        if (ability.isSpell)
                        {
                            loadAbility.LoadSpell(ability);
                        }
                        else
                        {
                            loadAbility.LoadAbility(ability);
                        }
                        loadAbility.Show();

                        loadAbility.FormClosing += (senderx, ex) =>
                        {
                            int index = Monster._Abilities.IndexOf(ability);
                            Monster._Abilities.RemoveAt(index);
                            Monster._Abilities.Insert(index, loadAbility.NewAbility);

                            index = TraitsList.Items.IndexOf(TraitsList.SelectedItem);
                            TraitsList.Items.RemoveAt(index);
                            TraitsList.Items.Insert(index, "Ability: " + loadAbility.NewAbility.Title);
                        };
                        return;
                    }
                }
            }
        }                        
示例#5
0
        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;
                        }
                    }
                }
            }
        }
        // Adds a Legendary
        private void AddLegendary(object sender, EventArgs e)
        {
            AddLegendaryForm addLegendary = new AddLegendaryForm();
            addLegendary.Show();

            addLegendary.FormClosing += (senders, es) =>
            {
                addLegendary.SerializeTraits();
                if (addLegendary.LegendaryAbility != null)
                {                    
                    if (TraitsList.Items.Contains(addLegendary.LegendaryAbility.Title)) { addLegendary.LegendaryAbility.Title += "_"; }                    
                    Monster.AddLegendary(addLegendary.LegendaryAbility);
                    TraitsList.Items.Add("Legendary: " + addLegendary.LegendaryAbility.Title);
                    Settings.LegendaryActions = addLegendary.numberOfLegendaryActions.Value.ToString();
                }
            };
        }