v0.8.0: adjusted Random to be more flexible, now uses a generator stack
This commit is contained in:
@@ -173,7 +173,7 @@ public class Dungeon {
|
||||
Actor.clear();
|
||||
Actor.resetNextID();
|
||||
|
||||
Random.seed( seed );
|
||||
Random.pushGenerator( seed );
|
||||
|
||||
Scroll.initLabels();
|
||||
Potion.initColors();
|
||||
@@ -182,7 +182,7 @@ public class Dungeon {
|
||||
SpecialRoom.initForRun();
|
||||
SecretRoom.initForRun();
|
||||
|
||||
Random.seed();
|
||||
Random.resetGenerators();
|
||||
|
||||
Statistics.reset();
|
||||
Notes.reset();
|
||||
@@ -313,11 +313,14 @@ public class Dungeon {
|
||||
}
|
||||
|
||||
public static long seedForDepth(int depth){
|
||||
Random.seed( seed );
|
||||
for (int i = 0; i < depth; i ++)
|
||||
Random.Long(); //we don't care about these values, just need to go through them
|
||||
long result = Random.Long();
|
||||
Random.seed();
|
||||
Random.pushGenerator( seed );
|
||||
|
||||
for (int i = 0; i < depth; i ++) {
|
||||
Random.Long(); //we don't care about these values, just need to go through them
|
||||
}
|
||||
long result = Random.Long();
|
||||
|
||||
Random.popGenerator();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ public abstract class Level implements Bundlable {
|
||||
|
||||
public void create() {
|
||||
|
||||
Random.seed( Dungeon.seedCurDepth() );
|
||||
Random.pushGenerator( Dungeon.seedCurDepth() );
|
||||
|
||||
if (!(Dungeon.bossLevel() || Dungeon.depth == 21) /*final shop floor*/) {
|
||||
|
||||
@@ -261,7 +261,7 @@ public abstract class Level implements Bundlable {
|
||||
createMobs();
|
||||
createItems();
|
||||
|
||||
Random.seed();
|
||||
Random.popGenerator();
|
||||
}
|
||||
|
||||
public void setSize(int w, int h){
|
||||
|
||||
@@ -392,11 +392,14 @@ public class DungeonTileSheet {
|
||||
public static byte[] tileVariance;
|
||||
|
||||
public static void setupVariance(int size, long seed){
|
||||
Random.seed( seed );
|
||||
tileVariance = new byte[size];
|
||||
for (int i = 0; i < tileVariance.length; i++)
|
||||
tileVariance[i] = (byte)Random.Int(100);
|
||||
Random.seed();
|
||||
Random.pushGenerator( seed );
|
||||
|
||||
tileVariance = new byte[size];
|
||||
for (int i = 0; i < tileVariance.length; i++) {
|
||||
tileVariance[i] = (byte) Random.Int(100);
|
||||
}
|
||||
|
||||
Random.popGenerator();
|
||||
}
|
||||
|
||||
//These alt visuals will trigger 50% of the time (45% of the time if a rare alt is also present)
|
||||
|
||||
Reference in New Issue
Block a user