예제 #1
0
        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;
                        }
                    }
                }
            }
        }
예제 #2
0
        private void addAbility(object sender, EventArgs e)
        {
            AddAbilityForm addAbility = new AddAbilityForm();
            addAbility.Show();

            addAbility.FormClosing += (senders, es) =>
            {
                if (addAbility.NewAbility != null)
                {
                    Monster._Abilities.Add(addAbility.NewAbility);
                    TraitsList.Items.Add("Ability: " + addAbility.NewAbility.Title);
                }
            };
        }
예제 #3
0
        private void addAbility(object sender, EventArgs e)
        {
            AddAbilityForm addAbility = new AddAbilityForm();

            addAbility.Show();

            addAbility.FormClosing += (senders, es) =>
            {
                if (addAbility.NewAbility != null)
                {
                    Monster._Abilities.Add(addAbility.NewAbility);
                    TraitsList.Items.Add("Ability: " + addAbility.NewAbility.Title);
                }
            };
        }
예제 #4
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;
                        }
                    }
                }
            }
        }                
예제 #5
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;
                    }
                }
            }
        }                        
예제 #6
0
        // Adds abilites to both the Monster._Abilities and TraitList
        private void addAbility(object sender, EventArgs e)
        {
            AddAbilityForm addAbility = new AddAbilityForm();
            addAbility.Show();

            addAbility.FormClosing += (senders, es) =>
            {
                if (addAbility.NewAbility != null)
                {                                                            
                    int increment = 0;
                    foreach (string item in TraitsList.Items)
                    {
                        if (item.Contains(addAbility.NewAbility.Title))
                        {
                            increment++;
                        }
                    }

                    if (increment > 0)
                    {
                        addAbility.NewAbility.Title += " " + increment;
                    }

                    Monster.AddAbility(addAbility.NewAbility);
                    TraitsList.Items.Add("Ability: " + addAbility.NewAbility.Title);
                }
                else
                {
                    TraitsList.Items.Add("Advanced Spellcasting");
                } 
            };
        }