Complete section 4.14

This commit is contained in:
Timothy Warren 2021-12-15 12:08:44 -05:00
parent ee5e690180
commit 8249622a3e

View File

@ -149,19 +149,60 @@ pub trait MetaMapBuilder {
fn build_map(&mut self, rng: &mut RandomNumberGenerator, build_data: &mut BuilderMap); fn build_map(&mut self, rng: &mut RandomNumberGenerator, build_data: &mut BuilderMap);
} }
fn random_initial_builder(rng: &mut RandomNumberGenerator) -> (Box<dyn InitialMapBuilder>, bool) {
match rng.roll_dice(1, 17) {
1 => (BspDungeonBuilder::new(), true),
2 => (BspInteriorBuilder::new(), true),
3 => (CellularAutomataBuilder::new(), false),
4 => (DrunkardsWalkBuilder::open_area(), false),
5 => (DrunkardsWalkBuilder::open_halls(), false),
6 => (DrunkardsWalkBuilder::winding_passages(), false),
7 => (DrunkardsWalkBuilder::fat_passages(), false),
8 => (DrunkardsWalkBuilder::fearful_symmetry(), false),
9 => (MazeBuilder::new(), false),
10 => (DLABuilder::walk_inwards(), false),
11 => (DLABuilder::walk_outwards(), false),
12 => (DLABuilder::central_attractor(), false),
13 => (DLABuilder::insectoid(), false),
14 => (VoronoiCellBuilder::pythagoras(), false),
15 => (VoronoiCellBuilder::manhattan(), false),
16 => (
PrefabBuilder::constant(prefab_builder::prefab_levels::WFC_POPULATED),
false,
),
_ => (SimpleMapBuilder::new(), true),
}
}
pub fn random_builder(new_depth: i32, rng: &mut RandomNumberGenerator) -> BuilderChain { pub fn random_builder(new_depth: i32, rng: &mut RandomNumberGenerator) -> BuilderChain {
let mut builder = BuilderChain::new(new_depth); let mut builder = BuilderChain::new(new_depth);
let (random_starter, has_rooms) = random_initial_builder(rng);
builder.start_with(random_starter);
if has_rooms {
builder
.with(RoomBasedSpawner::new())
.with(RoomBasedStairs::new())
.with(RoomBasedStartingPosition::new());
} else {
builder builder
.start_with(VoronoiCellBuilder::pythagoras())
.with(WaveformCollapseBuilder::new())
.with(PrefabBuilder::vaults())
.with(AreaStartingPosition::new(XStart::Center, YStart::Center)) .with(AreaStartingPosition::new(XStart::Center, YStart::Center))
.with(CullUnreachable::new()) .with(CullUnreachable::new())
.with(VoronoiSpawning::new()) .with(VoronoiSpawning::new())
.with(PrefabBuilder::sectional(
prefab_builder::prefab_sections::UNDERGROUND_FORT,
))
.with(DistantExit::new()); .with(DistantExit::new());
}
if rng.roll_dice(1, 3) == 1 {
builder.with(WaveformCollapseBuilder::new());
}
if rng.roll_dice(1, 20) == 1 {
builder.with(PrefabBuilder::sectional(
prefab_builder::prefab_sections::UNDERGROUND_FORT,
));
}
builder.with(PrefabBuilder::vaults());
builder builder
} }