Fix #689 - dungeon without stairs to boss floor

This commit is contained in:
Lippy13 2021-02-16 00:39:25 +00:00
parent 0da363e420
commit b64fc5e822
2 changed files with 6 additions and 4 deletions

View File

@ -61,6 +61,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
one of them active at the same time
- Made zooming work on wayland
- Fixed AI behavior so only humanoids will attempt to roll
- Fixed a bug where the stairs to the boss floor in dungeons would sometimes not spawn
## [0.8.0] - 2020-11-28

View File

@ -267,9 +267,10 @@ impl Floor {
level: i32,
difficulty: u32,
) -> (Self, Vec2<i32>) {
const MAX_WIDTH: u32 = 4;
let floors = 3 + difficulty / 2;
let final_level = level == floors as i32 - 1;
let width = (2 + difficulty / 2).min(4);
let width = (2 + difficulty / 2).min(MAX_WIDTH);
let height = (15 + difficulty * 3).min(30);
let new_stair_tile = if final_level {
@ -309,8 +310,6 @@ impl Floor {
pillars: None,
difficulty,
});
this.tiles
.set(stair_tile - tile_offset, Tile::UpStair(upstair_room));
if final_level {
// Boss room
this.create_room(Room {
@ -320,7 +319,7 @@ impl Floor {
miniboss: false,
boss: true,
area: Rect::from((
new_stair_tile - tile_offset - 4,
new_stair_tile - tile_offset - MAX_WIDTH as i32 - 1,
Extent2::broadcast(width as i32 * 2 + 1),
)),
height: height as i32,
@ -345,6 +344,8 @@ impl Floor {
Tile::DownStair(downstair_room),
);
}
this.tiles
.set(stair_tile - tile_offset, Tile::UpStair(upstair_room));
this.create_rooms(ctx, level, 7);
// Create routes between all rooms