1
0
Fork 0

Complete section 4.13

This commit is contained in:
Timothy Warren 2021-12-14 14:16:18 -05:00
parent 99d5a78512
commit 9d97f3bd0d
2 changed files with 37 additions and 35 deletions

View File

@ -41,41 +41,43 @@ pub trait MapBuilder {
}
pub fn random_builder(new_depth: i32) -> Box<dyn MapBuilder> {
// let mut rng = rltk::RandomNumberGenerator::new();
// let mut result: Box<dyn MapBuilder> = match rng.roll_dice(1, 16) {
// 1 => Box::new(BspDungeonBuilder::new(new_depth)),
// 2 => Box::new(BspInteriorBuilder::new(new_depth)),
// 3 => Box::new(CellularAutomataBuilder::new(new_depth)),
// 4 => Box::new(DrunkardsWalkBuilder::open_area(new_depth)),
// 5 => Box::new(DrunkardsWalkBuilder::open_halls(new_depth)),
// 6 => Box::new(DrunkardsWalkBuilder::winding_passages(new_depth)),
// 7 => Box::new(DrunkardsWalkBuilder::fat_passages(new_depth)),
// 8 => Box::new(DrunkardsWalkBuilder::fearful_symmetry(new_depth)),
// 9 => Box::new(MazeBuilder::new(new_depth)),
// 10 => Box::new(DLABuilder::walk_inwards(new_depth)),
// 11 => Box::new(DLABuilder::walk_outwards(new_depth)),
// 12 => Box::new(DLABuilder::central_attractor(new_depth)),
// 13 => Box::new(DLABuilder::insectoid(new_depth)),
// 14 => Box::new(VoronoiCellBuilder::pythagoras(new_depth)),
// 15 => Box::new(VoronoiCellBuilder::manhattan(new_depth)),
// _ => Box::new(SimpleMapBuilder::new(new_depth)),
// };
//
// if rng.roll_dice(1, 3) == 1 {
// result = Box::new(WaveformCollapseBuilder::derived_map(new_depth, result));
// }
//
// result
let mut rng = rltk::RandomNumberGenerator::new();
let mut result: Box<dyn MapBuilder> = match rng.roll_dice(1, 17) {
1 => Box::new(BspDungeonBuilder::new(new_depth)),
2 => Box::new(BspInteriorBuilder::new(new_depth)),
3 => Box::new(CellularAutomataBuilder::new(new_depth)),
4 => Box::new(DrunkardsWalkBuilder::open_area(new_depth)),
5 => Box::new(DrunkardsWalkBuilder::open_halls(new_depth)),
6 => Box::new(DrunkardsWalkBuilder::winding_passages(new_depth)),
7 => Box::new(DrunkardsWalkBuilder::fat_passages(new_depth)),
8 => Box::new(DrunkardsWalkBuilder::fearful_symmetry(new_depth)),
9 => Box::new(MazeBuilder::new(new_depth)),
10 => Box::new(DLABuilder::walk_inwards(new_depth)),
11 => Box::new(DLABuilder::walk_outwards(new_depth)),
12 => Box::new(DLABuilder::central_attractor(new_depth)),
13 => Box::new(DLABuilder::insectoid(new_depth)),
14 => Box::new(VoronoiCellBuilder::pythagoras(new_depth)),
15 => Box::new(VoronoiCellBuilder::manhattan(new_depth)),
16 => Box::new(PrefabBuilder::constant(
new_depth,
prefab_builder::prefab_levels::WFC_POPULATED,
)),
_ => Box::new(SimpleMapBuilder::new(new_depth)),
};
Box::new(PrefabBuilder::vaults(
new_depth,
Box::new(PrefabBuilder::sectional(
if rng.roll_dice(1, 3) == 1 {
result = Box::new(WaveformCollapseBuilder::derived_map(new_depth, result));
}
if rng.roll_dice(1, 20) == 1 {
result = Box::new(PrefabBuilder::sectional(
new_depth,
prefab_builder::prefab_sections::UNDERGROUND_FORT,
Box::new(WaveformCollapseBuilder::derived_map(
new_depth,
Box::new(CellularAutomataBuilder::new(new_depth)),
)),
)),
))
result,
));
}
result = Box::new(PrefabBuilder::vaults(new_depth, result));
result
}

View File

@ -7,7 +7,7 @@ use std::collections::HashSet;
use rltk::RandomNumberGenerator;
use super::{remove_unreachable_areas_returning_most_distant, MapBuilder};
use crate::{spawner, Map, Position, TileType, SHOW_MAPGEN_VISUALIZER};
use crate::{Map, Position, TileType, SHOW_MAPGEN_VISUALIZER};
#[derive(PartialEq, Copy, Clone)]
#[allow(dead_code)]