Ejemplo n.º 1
0
 private void addAbilityButton_Click(object sender, EventArgs e)
 {
     AbilitiesForm d = new AbilitiesForm();
     if (d.ShowDialog() == DialogResult.OK)
     {
         Type abilityType = asm.GetType("Elena." + d.SelectedNode().Name);
         bool propertyGenerated;
         MonsterAbility ability;
         try
         {
             ability = (MonsterAbility)Activator.CreateInstance(abilityType);
             propertyGenerated = true;
         }
         catch
         {
             propertyGenerated = false;
             ability = new NullAbility();
         }
         if (propertyGenerated)
         {
             if (selectedAbility.IsNull)
             {
                 monster.AddAbility(ability);
             }
             else
             {
                 monster.AddAbility(ability, selectedAbility);
             }
             selectedAbility = new NullAbility();
         }
         this.UpdateData();
     }
 }
Ejemplo n.º 2
0
 private void delAbilButton_Click(object sender, EventArgs e)
 {
     if (!selectedAbility.IsNull)
     {
         if (selectedAbility.IsBaseAbility())
         {
             monster.Abilities.Remove(selectedAbility);
         }
         else
         {
             monster.RemoveModifier((AbilityModifier)selectedAbility);
         }
         selectedAbility = new NullAbility();
         this.UpdateData();
     }
 }
Ejemplo n.º 3
0
 private void abilsList_AfterSelect(object sender, TreeViewEventArgs e)
 {
     MonsterAbility a = FindAbilityInTree(abilsList.SelectedNode, abilsList.SelectedNode.Parent);
     if (a.IsNull != true)
     {
         selectedAbility = a;
         editAbilButton.Enabled = selectedAbility.IsEditable();
     }
     else
     {
         selectedAbility = new NullAbility();
         editAbilButton.Enabled = false;
     }
 }
Ejemplo n.º 4
0
 public void AddAbility(MonsterAbility ability)
 {
     if (ability.Prepare(this))
     {
         if (slotsUsed + ability.SlotCost() > slots)
         {
             ability.Complain(1);
         }
         else
         {
             //if it's an actual ability, it'll be inserted as a root node
             //otherwise, it'll be inserted as a child node of whatever
             //ability it's modifying
             if (ability.IsBaseAbility())
             {
                 abilities.Add(ability);
             }
             else
             {
                 MonsterAbility parent = ability.GetParent();
                 parent.AddModifier((AbilityModifier)ability);
             }
         }
     }
 }
Ejemplo n.º 5
0
 public void AddAbility(MonsterAbility ability, MonsterAbility parent)
 {
     bool validToAdd = true;
     if (validToAdd)
     {
         //catch case wherein a modifier is selected
         if (parent.IsBaseAbility() && !ability.IsBaseAbility())
         {
             ability.SetupParent(parent);
             if (ability.Prepare(this))
             {
                 if (slotsUsed + ability.SlotCost() > slots)
                 {
                     ability.Complain(1);
                 }
                 else
                 {
                     parent.AddModifier((AbilityModifier)ability);
                 }
             }
         }
         else
         {
             AddAbility(ability);
         }
     }
 }
Ejemplo n.º 6
0
		public override void SetupParent(MonsterAbility parent)
		{
			modifiedAbility = (AbstractAbility)parent;
		}
Ejemplo n.º 7
0
		public virtual void SetupParent(MonsterAbility parent) { }