/** * Make a SectionDungeonGenerator with a LightRNG using a random seed, height 40, and width 40. */ public SectionDungeonGenerator() { rng = new StatefulRNG(); utility = new DungeonUtility(rng); rebuildSeed = rng.getState(); height = 40; width = 40; roomFX = new EnumMap<>(FillEffect.class); corridorFX = new EnumMap<>(FillEffect.class); caveFX = new EnumMap<>(FillEffect.class); }
@Override public String stringify(StatefulRNG item) { return StringKit.hex(item.getState()) + ':' + (item.getRandomness().getClass().getSimpleName()); }
/** * Copies all fields from copying and makes a new DungeonGenerator. * @param copying the DungeonGenerator to copy */ public SectionDungeonGenerator(SectionDungeonGenerator copying) { rng = new StatefulRNG(copying.rng.getState()); utility = new DungeonUtility(rng); rebuildSeed = rng.getState(); height = copying.height; width = copying.width; Coord.expandPoolTo(width, height); roomFX = new EnumMap<>(copying.roomFX); corridorFX = new EnumMap<>(copying.corridorFX); caveFX = new EnumMap<>(copying.caveFX); doorFX = copying.doorFX; lakeFX = copying.lakeFX; deepLakeGlyph = copying.deepLakeGlyph; shallowLakeGlyph = copying.shallowLakeGlyph; dungeon = copying.dungeon; }
/** * Make a SectionDungeonGenerator with the given height, width, and RNG. Use this if you want to seed the RNG. If * width or height is greater than 256, then this will expand the Coord pool from its 256x256 default so it stores a * reference to each Coord that might be used in the creation of the dungeon (if width and height are 300 and 300, * the Coord pool will be 300x300; if width and height are 500 and 100, the Coord pool will be 500x256 because it * won't shrink below the default size of 256x256). * @param width The width of the dungeon in cells * @param height The height of the dungeon in cells * @param rng The RNG to use for all purposes in this class; if it is a StatefulRNG, then it will be used as-is, * but if it is not a StatefulRNG, a new StatefulRNG will be used, randomly seeded by this parameter */ public SectionDungeonGenerator(int width, int height, IRNG rng) { Coord.expandPoolTo(width, height); this.rng = (rng instanceof StatefulRNG) ? (StatefulRNG) rng : new StatefulRNG(rng.nextLong()); utility = new DungeonUtility(this.rng); rebuildSeed = this.rng.getState(); this.height = height; this.width = width; roomFX = new EnumMap<>(FillEffect.class); corridorFX = new EnumMap<>(FillEffect.class); caveFX = new EnumMap<>(FillEffect.class); }
if(!seedFixed) rebuildSeed = rng.getState();
rebuildSeed = rng.getState();
rebuildSeed = rng.getState(); environmentType = kind.environment(); DungeonBoneGen gen = new DungeonBoneGen(rng);