Last active
February 3, 2021 05:38
-
-
Save PeyaPeyaPeyang/6d18d47a95218e2298baabc09a0b88bc to your computer and use it in GitHub Desktop.
PvPとかのLV管理用。EXPが次LVを超えた場合、その分もLvUp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Main { | |
public static void main(String[] args) throws Exception { | |
int current = 119; //Current LEVEL | |
int currentexp = 10; //Current EXP | |
int incoming = 40000; //Incoming EXP | |
int next = getnext(current + 1); | |
System.out.println("Next: " + next); | |
if (next - (currentexp + incoming) > 0) | |
{ | |
System.out.println("Not LevelUP"); | |
System.out.println("ADD EXP: " + incoming); | |
return; | |
} | |
System.out.println("LevelUP!!!"); | |
int levelUp = 1; | |
int ex = currentexp + incoming; | |
while (getnext(current + levelUp) <= ex) | |
{ | |
System.out.println("UP: " + levelUp + ", EXP: " + ex + ", REQ: " + getnext(current + levelUp)); | |
ex -= getnext(current + levelUp); | |
levelUp++; | |
if ((current + levelUp) > 120) | |
{ | |
System.out.println("!!!PRESTIGE!!!"); | |
ex = 0; | |
break; | |
} | |
} | |
System.out.println("Level UP: " + (levelUp - 1)); | |
System.out.println("ADD EXP: " + ex); | |
System.out.println("Next Require: " + getnext(current + levelUp)); | |
} | |
public static int getnext(int level) | |
{ | |
return 10 * level; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment