Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ex2;
- import java.util.Random;
- public class ExpSys {
- private Random ran;
- int Level = 1;
- int Exp_Base = 10;
- int Exp = 0;
- int Exp_Max = 0;
- public ExpSys() {
- this.ran = new Random();
- Exp_Max = (Exp_Base * Level) + (ran.nextInt((Level * 0.05)) + (Level * 0.01));
- }
- public void gainExp() {
- for (int i = 0; i <= 10; i++) {
- System.out.println("Nivel : " + Level + "Exp necesaria : " + Exp_Max + "nExp actual : " + Exp);
- int expObt = 1 + ran.nextInt((Level * 2)) + 1;
- Exp += expObt;
- System.out.println("============nGanaste: " + expObt + "============");
- Level += (Exp <= Exp_Max) ? LevelUp() : 0;
- }
- }
- private int LevelUp() {
- //growStats();
- System.out.println("Subiste al nivel: " + Level + 1);
- Exp_Max = (Exp_Base * Level) + (ran.nextInt((Level * 0.05)) + (Level * 0.01));
- return 1;
- }
- }
Add Comment
Please, Sign In to add comment