Example #1
0
  /**
   * Sets the professed class for the player for the corresponding group. This will not save any
   * skills, experience, or levels of the previous class if there was any. The new class will start
   * at level 1 with 0 experience.
   *
   * @param rpgClass class to assign to the player
   * @return the player-specific data for the new class
   */
  public PlayerClass setClass(RPGClass rpgClass) {
    PlayerClass c = classes.remove(rpgClass.getGroup());
    if (c != null) {
      for (Skill skill : c.getData().getSkills()) {
        skills.remove(skill.getName().toLowerCase());
        combos.removeSkill(skill);
      }
    }

    PlayerClass classData = new PlayerClass(this, rpgClass);
    classes.put(rpgClass.getGroup(), classData);

    // Add in missing skills
    for (Skill skill : rpgClass.getSkills()) {
      giveSkill(skill, classData);
    }

    updateHealthAndMana(getPlayer());
    updateScoreboard();
    return classes.get(rpgClass.getGroup());
  }
Example #2
0
 /**
  * Gives the player a skill outside of the normal class skills. This skill will not show up in a
  * skill tree.
  *
  * @param skill skill to give the player
  */
 public void giveSkill(Skill skill) {
   giveSkill(skill, null);
 }