mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-04 00:31:54 +00:00
Refactoring and Clue scrolls (#126)
* refactor treasure trails * tidy up random functions * tidy up treasure trails * refactor drops, consistant * add clue scroll drops * spread item rewards * update rewards * remove odd behaving items * always give 2 → 4 items (1 stackable)
This commit is contained in:
@@ -14,24 +14,9 @@ public class Misc {
|
||||
return (int) (java.lang.Math.random() * (range + 1));
|
||||
}
|
||||
|
||||
// return a random number from 0 → range - 1
|
||||
public static int randomMinusOne(int range) {
|
||||
int number = (int) (Math.random() * range);
|
||||
return number < 0 ? 0 : number;
|
||||
}
|
||||
|
||||
public static int random(int range1, int range2) { // 0 till range (range
|
||||
// INCLUDED)
|
||||
int keepGoing = 1;
|
||||
int compare1 = 0;
|
||||
while (keepGoing == 1) {
|
||||
compare1 = random(range2);
|
||||
if (compare1 >= range1) {
|
||||
keepGoing = 0;
|
||||
} else {
|
||||
keepGoing = 1;
|
||||
}
|
||||
}
|
||||
return compare1;
|
||||
return (int) Math.random() * range;
|
||||
}
|
||||
|
||||
public static boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
|
||||
@@ -152,8 +137,19 @@ public class Misc {
|
||||
return (int) (java.lang.Math.random() * range + 1);
|
||||
}
|
||||
|
||||
// return a random number from 0 → range (including range)
|
||||
public static int random(int range) {
|
||||
return (int) (java.lang.Math.random() * (range + 1));
|
||||
return (int) (java.lang.Math.random() * (++range));
|
||||
}
|
||||
|
||||
// return a random number between & including the min/max values
|
||||
public static int random(int min, int max) {
|
||||
++max;
|
||||
return (int) Math.floor(Math.random() * (max - min)) + min;
|
||||
}
|
||||
|
||||
public static int randomArrayItem(int[] arr) {
|
||||
return arr[(int) Math.floor(Math.random() * arr.length)];
|
||||
}
|
||||
|
||||
public static long playerNameToInt64(String s) {
|
||||
|
||||
Reference in New Issue
Block a user