@Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); heroClass = HeroClass.restoreInBundle(bundle); subClass = HeroSubClass.restoreInBundle(bundle); attackSkill = bundle.getInt(ATTACK); defenseSkill = bundle.getInt(DEFENSE); STR = bundle.getInt(STRENGTH); updateAwareness(); lvl = bundle.getInt(LEVEL); exp = bundle.getInt(EXPERIENCE); belongings.restoreFromBundle(bundle); }
public void earnExp(int exp) { this.exp += exp; boolean levelUp = false; while (this.exp >= maxExp()) { this.exp -= maxExp(); lvl++; HT += 5; HP += 5; attackSkill++; defenseSkill++; if (lvl < 10) { updateAwareness(); } levelUp = true; } if (levelUp) { GLog.p(TXT_NEW_LEVEL, lvl); sprite.showStatus(CharSprite.POSITIVE, TXT_LEVEL_UP); Sample.INSTANCE.play(Assets.SND_LEVELUP); Badges.validateLevelReached(); } if (subClass == HeroSubClass.WARLOCK) { int value = Math.min(HT - HP, 1 + (Dungeon.depth - 1) / 5); if (value > 0) { HP += value; sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); } ((Hunger) buff(Hunger.class)).satisfy(10); } }