Exemple #1
0
 /*
  * change the level of the given attribute to 'value' for this instance
  */
 public void setAttributeTo(EAttributeGroup A, int value)
 {
     if (value < minLevel || value > maxLevel)
         throw new ArgumentOutOfRangeException("You attempted to set an attribute to high or to low! Value: " + value);
     else
         attributeGroups[A] = value; // update to new level
 }
Exemple #2
0
 /**
  * Given A, increase the level of A by 'by'
  * return TRUE, if the given attribute A can be raised by 'by' levels
  */
 public void increaseAttribute(EAttributeGroup A, int by = 1)
 {
     if (canLevelUp(A, by))
     {
         attributeGroups[A] += by;
     }
     else
         throw new InvalidAttributeLevelException("increaseAttribute");
 }
Exemple #3
0
 /**
  * return TRUE, if the given attribute A can be raised by 'by' levels
  */
 public bool canLevelUp(EAttributeGroup A, int by = 1)
 {
     return attributeGroups[A] + by <= maxLevel;
 }
Exemple #4
0
 /**
  * given A, return the current level of A
  */
 public int getAttributeLevel(EAttributeGroup A)
 {
     return attributeGroups[A];
 }
Exemple #5
0
 /**
  * ATTRIBUTE RELATED
  */
 public int getAttributeValue(EAttributeGroup A)
 {
     return attr.getAttributeLevel(A);
 }