示例#1
0
 private void setLevel(int level) {
   for (Subject subject : subjectList) {
     int mod = dice.nextInt(3) - 1;
     if (level + mod > 0) {
       subject.setLevel(level + mod);
     } else subject.setLevel(level);
   }
 }
  public void levelUp() {
    experience = experience - XPNextLevel(level) + XPNextLevel(level - 1);
    setLevel(level + 1);

    DisplayText.add("", String.format("%s er nå level %d!", this.getName(), level));

    owner.levelUp(this);

    DisplayText.add("", String.format("Du ble litt bedre i %s", this.getName()));

    if (this.experienceTotal >= XPNextLevel(level)) {
      levelUp();
    }
  }
 public Subject copy(int level, Entity owner) {
   Subject newSubject =
       new Subject(
           getImage(),
           world,
           name,
           level,
           hpMax,
           practicalOffence,
           theoreticalOffence,
           practicalDefence,
           theoreticalDefence,
           speed,
           accuracy,
           evasion,
           type.toString(),
           allAttacks,
           attackLevels);
   newSubject.setOwner(owner);
   newSubject.setLevel(level);
   newSubject.setExperienceTotal(XPNextLevel(level - 1));
   return newSubject;
 }