Compare commits

..

No commits in common. "74831857cf76c7fe4f6e8842bcb27e18f1e274f3" and "b833b43c7c16050d385219ce7d9b19ab36ccc81f" have entirely different histories.

2 changed files with 6 additions and 6 deletions

View File

@ -29,13 +29,13 @@ pub const LEVEL_WIDTH: usize = 1 + ROOMS_VERTICAL * ROOM_WIDTH;
pub const LEVEL_HEIGHT: usize = 1 + ROOMS_HORIZONTAL * ROOM_HEIGHT;
pub fn get_monsters_per_level() -> Vec<HashMap<MonsterTypes, std::ops::RangeInclusive<u8>>> {
let tmp =[
let tmp = vec![
// level 1
vec![(MonsterTypes::Rat, 50), (MonsterTypes::Spider, 50)],
// level 2
vec![(MonsterTypes::Rat, 50), (MonsterTypes::Snake, 50)],
// level 3
vec![(MonsterTypes::Orc, 34), (MonsterTypes::Skeleton, 33), (MonsterTypes::Snake, 33)],
vec![(MonsterTypes::Orc, 33), (MonsterTypes::Skeleton, 33), (MonsterTypes::Snake, 33)],
];
if tmp.len() != LEVELS {
panic!("Only {} monster sets defined for {} levels!", tmp.len(), LEVELS);

View File

@ -24,7 +24,7 @@ enum RoomType {
StairUp,
StairDown,
BasicRoom,
ArtifactRoom,
TreasureRoom,
MonsterRoom,
EmptyRoom,
}
@ -105,13 +105,13 @@ impl LevelGenerator {
room_types.push(RoomType::StairDown);
}
room_types.push(RoomType::MonsterRoom);
room_types.push(RoomType::ArtifactRoom);
room_types.push(RoomType::TreasureRoom);
// generate a random set of rooms and shuffle them
for _ in room_types.len()..ROOMS_HORIZONTAL * ROOMS_VERTICAL {
match rng.gen_range(1..=100) {
// TODO tune room type distribution
1..=33 => room_types.push(RoomType::EmptyRoom),
34..=66 => room_types.push(RoomType::ArtifactRoom),
34..=66 => room_types.push(RoomType::TreasureRoom),
67..=90 => room_types.push(RoomType::MonsterRoom),
_ => room_types.push(RoomType::BasicRoom),
}
@ -298,7 +298,7 @@ impl LevelGenerator {
StructureElement::Floor;
}
}
if room.kind == RoomType::ArtifactRoom {
if room.kind == RoomType::TreasureRoom {
let t_x = left + room.offset_x + rng.gen_range(0..room.width);
let t_y = top + room.offset_y + rng.gen_range(0..room.height);
// TODO randomize artifacts