daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Random random = new Random();
  2.  
  3.     int plevel=0, mlevel=0, leveldif=0, mlevelchance=0;
  4.  
  5.     String lvl1="";
  6.     int lvl=0;
  7.  
  8.     BufferedReader playerlvl = new BufferedReader (new FileReader ("playerlvl.txt"));
  9.     while ((lvl1 = playerlvl.readLine())!=null)
  10.     {
  11.         int lvl2 = Integer.parseInt(lvl1);
  12.         lvl = lvl2;
  13.     }
  14.  
  15.     Set<Integer> generated = new LinkedHashSet<Integer>();
  16.  
  17.     mlevelchance = random.nextInt ((99)+1)+1;
  18.  
  19.     if (mlevelchance<=80)
  20.     {
  21.         while (leveldif<=0)
  22.         {
  23.             leveldif = random.nextInt (((lvl)-(lvl-2))+1)+(lvl-2);
  24.             mlevel = leveldif;
  25.             generated.add(leveldif);
  26.         }
  27.     }
  28.     if (mlevelchance>80 && mlevelchance<95)
  29.     {
  30.         while (leveldif<=0)
  31.         {
  32.             leveldif = random.nextInt (((lvl-3)-(lvl-5))+1)+(lvl-5);
  33.             mlevel = leveldif;  
  34.             generated.add(leveldif);
  35.         }
  36.     }
  37.     if (mlevelchance>=95){mlevel = lvl+1;}
  38.  
  39.     System.out.println("Spawn Chance: "+mlevelchance);
  40.     System.out.println("Player Level: "+lvl);
  41.     System.out.println("Monster Level: "+mlevel);
  42. }
RAW Paste Data
Top