zopiac

Levelup, etc.

Feb 6th, 2011
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.09 KB | None | 0 0
  1. //                0        1       2       3       4       5       6       7       8       9
  2. int[] lvlformula = {0000000,00000100,0000200,0000400,0000800,0001600,0003200,0006400,0012800,0025600
  3. //               10       11      12      13      14      15      16      17      19      20
  4.             0051200,01024000,0204800,0409600,0819200,1638600,3276800,6555200,0000000,0000000
  5.     };
  6. lvlformula=Math.pow(2, level+1);
  7. //Levelup checker
  8. if(exp*lvlforumula>level){
  9. OR
  10. if(exp>levels[level++]){
  11.     levelup(stats);
  12.     levelup=true;
  13. }
  14. if(levelup==true){
  15.     g.drawString("Levelup! Level "+level+" achieved.", 50, 100);
  16.     if(k!=0)levelup=false;
  17. }
  18.  
  19. battleStep=randInt.nextInt(15)+10;
  20.  
  21. package gameTest;
  22. public class Actions(){
  23.     //int oldhp, oldmaxhp;
  24.     //int hp, maxhp;
  25.     double hperc;
  26.     //int oldmp, oldmaxmp;
  27.     //int mp, maxmp;
  28.     double mperc;
  29.  
  30.     public static int[] levelup(int[] stats){
  31.         //level, skillPTS, maxhp, hp, maxmp, mp
  32.         //int[] stats = {0, 0, 0, 0, 0};
  33.         //level++;
  34.         stats[0]++;         //Update Level
  35.         //skillPTS+=5;
  36.         stats[1]+=5;            //Give five spendable skill points
  37.         //hperc=oldmaxhp/oldhp;
  38.         hperc=stats[2]/stats[3];    //Calculate HP %age
  39.         //mperc=oldmaxmp/oldmp;
  40.         mperc=stats[4]/stats[5];    //Calculate MP %age
  41.         //maxhp=(int)(1.2*maxhp);
  42.         stats[2]=(int)(1.2*stats[2]);   //Set new MaxHP
  43.         //maxmp=(int)(1.2*maxmp);
  44.         stats[4]=(int)(1.2*stats[4]);   //Set new MaxMP
  45.         //hp=(int)(maxhp*hperc);
  46.         stats[3]=(int)(1.2*hperc);  //Calculate new instantaneous HP
  47.         //mp=(int)(maxmp*mperc);
  48.         stats[5]=(int)(1.2*mperc);  //Calculate new instantaneous MP
  49.         return stats;
  50.     }
  51. }
  52.  
  53. package gameTest;
  54. public class Actions(){
  55.     double hperc, mperc;
  56.     public static int[] levelup(int[] stats){
  57.         stats[0]++;         //Update Level
  58.         stats[1]+=5;            //Give five spendable skill points
  59.         hperc=stats[2]/stats[3];    //Calculate HP %age
  60.         mperc=stats[4]/stats[5];    //Calculate MP %age
  61.         stats[2]=(int)(1.2*stats[2]);   //Set new MaxHP
  62.         stats[4]=(int)(1.2*stats[4]);   //Set new MaxMP
  63.         stats[3]=(int)(stats[]*hperc);  //Calculate new instantaneous HP
  64.         stats[5]=(int)(1.2*mperc);  //Calculate new instantaneous MP
  65.         return stats;
  66.     }
  67. }
Add Comment
Please, Sign In to add comment