Exemple #1
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);
             }
         }
     }
 }
Exemple #2
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);
         }
     }
 }