Exemplo n.º 1
0
 /**
  * Gives levels to the player for all classes matching the experience source
  *
  * @param amount amount of levels to give
  * @param source source of the levels
  */
 public void giveLevels(int amount, ExpSource source) {
   for (PlayerClass playerClass : classes.values()) {
     RPGClass data = playerClass.getData();
     if (data.receivesExp(source)) {
       int exp = 0;
       int count = 0;
       int temp = amount;
       while (temp > 0) {
         temp--;
         exp += data.getRequiredExp(playerClass.getLevel() + count++);
       }
       playerClass.giveExp(exp, source);
     }
   }
   updateHealthAndMana(getPlayer());
 }
Exemplo n.º 2
0
 /**
  * Gives experience to the player from the given source
  *
  * @param amount amount of experience to give
  * @param source source of the experience
  */
 public void giveExp(double amount, ExpSource source) {
   for (PlayerClass playerClass : classes.values()) {
     playerClass.giveExp(amount, source);
   }
 }