From 3ff30a242d36c894ebea2540893ad77d265c5593 Mon Sep 17 00:00:00 2001 From: Matheus Date: Thu, 30 Oct 2025 17:40:29 -0300 Subject: Um pouquinho mais aleatório MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/Map/DungeonGenerator.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/Map/DungeonGenerator.cs b/scripts/Map/DungeonGenerator.cs index 2b24e8a..f7a3f4d 100644 --- a/scripts/Map/DungeonGenerator.cs +++ b/scripts/Map/DungeonGenerator.cs @@ -90,7 +90,9 @@ public partial class DungeonGenerator : Node // Coloca os corredores. TunnelDivisions(data, root); - Rect2I lastRoom = new(0, 0, 0, 0); + Vector2I lastRoom = new(0, 0); + + bool placedStair = false; // Cria as salas com base nas divisões geradas. foreach (MapDivision division in root.GetLeaves()) @@ -113,13 +115,19 @@ public partial class DungeonGenerator : Node first = false; player.GridPosition = room.GetCenter(); } + else if (!placedStair && rng.RandiRange(0, 100) > 25) + { + lastRoom = room.GetCenter(); + placedStair = true; + } else if (!placedStair) { + lastRoom = room.GetCenter(); + } + // Colocamos os inimigos na sala. PlaceEntities(data, room); - - lastRoom = room; } - data.DownstairsLocation = lastRoom!.GetCenter(); + data.DownstairsLocation = lastRoom; Tile downTile = data.GetTile(data.DownstairsLocation); downTile.Key = TileType.DOWN_STAIRS; -- cgit v1.2.3