diff --git a/DungeonMapGenerator/DungeonMapConsolePrinter/Program.cs b/DungeonMapGenerator/DungeonMapConsolePrinter/Program.cs index ea38424..53a86e0 100644 --- a/DungeonMapGenerator/DungeonMapConsolePrinter/Program.cs +++ b/DungeonMapGenerator/DungeonMapConsolePrinter/Program.cs @@ -13,10 +13,15 @@ class Program var generator = new DungeonGenerator(); // Call the method you want to run - int width = 100; - int height = 50; + int width = 40; + int height = 28; DungeonMap map = generator.GenerateDungeon(width, height, 5); DungeonLockPopulator.PopulateLocksOfDungeon(map); + List potentialLootRooms = new List(); + potentialLootRooms.AddRange(map.GetNormalRooms()); + potentialLootRooms.AddRange(map.GetMonsterRooms()); + potentialLootRooms.Add(map.GetBossRoom()); + DungeonLootPopulator.GenerateLootInRooms(potentialLootRooms); DungeonMapSerializer.SerializeToFile(map, SAVED_DUNGEONS_PATH, $"{DUNGEON_NAME} {width}x{height}" ); // Print the map to the console (assuming it returns a string or something printable) diff --git a/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapConsolePrinter.dll b/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapConsolePrinter.dll index c8b935d..38a600c 100644 Binary files a/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapConsolePrinter.dll and b/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapConsolePrinter.dll differ diff --git a/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapConsolePrinter.exe b/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapConsolePrinter.exe index a71fa11..ac95f10 100644 Binary files a/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapConsolePrinter.exe and b/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapConsolePrinter.exe differ diff --git a/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapGenerator.dll b/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapGenerator.dll index c229425..a183538 100644 Binary files a/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapGenerator.dll and b/DungeonMapGenerator/DungeonMapConsolePrinter/bin/Debug/net9.0/DungeonMapGenerator.dll differ diff --git a/DungeonMapGenerator/DungeonMapGenerator/DungeonGenerator.cs b/DungeonMapGenerator/DungeonMapGenerator/DungeonGenerator.cs index 6df7f11..de4cff3 100644 --- a/DungeonMapGenerator/DungeonMapGenerator/DungeonGenerator.cs +++ b/DungeonMapGenerator/DungeonMapGenerator/DungeonGenerator.cs @@ -14,8 +14,8 @@ namespace DungeonMapGenerator private const int WIDTH_OF_BOSS = 10; private const int HEIGHT_OF_BOSS = 6; - private int _xLength = 40; - private int _yLength = 28; + private int _xLength; + private int _yLength; public DungeonMap GenerateDungeon(int xlength, int yLength, int numberOfMonsterRooms) { @@ -25,7 +25,7 @@ namespace DungeonMapGenerator Random random = new Random(); DungeonMap dungeonMap = new DungeonMap(_xLength, _yLength); - dungeonMap.AddRooms(GenerateEntranceRooms(_xLength, _yLength, random.Next(1,4))); + dungeonMap.AddRooms(GenerateEntranceRooms(_xLength, _yLength, random.Next(1,3))); dungeonMap.AddRoom(GenerateOnlyBossRoom(_xLength, _yLength, WIDTH_OF_BOSS, HEIGHT_OF_BOSS)); EvenDisperser disperser = new EvenDisperser(_xLength, _yLength, dungeonMap.GetUnoccupiedPoints()); //TODO calculate L and W from length @@ -43,7 +43,7 @@ namespace DungeonMapGenerator AddConnectionRooms(dungeonMap); ConnectAllAdjacentRooms(dungeonMap); AddAdjacentRoomsToEntranceRooms(dungeonMap); - + return dungeonMap; } diff --git a/DungeonMapGenerator/DungeonMapGenerator/DungeonLootPopulator.cs b/DungeonMapGenerator/DungeonMapGenerator/DungeonLootPopulator.cs new file mode 100644 index 0000000..6cd6ed9 --- /dev/null +++ b/DungeonMapGenerator/DungeonMapGenerator/DungeonLootPopulator.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using System.Linq; + +namespace DungeonMapGenerator +{ + public static class DungeonLootPopulator + { + private const int MONSTER_ROOM_DIAMONDS = 2; + private const int BOSS_ROOM_DIAMONDS = 6; + private const int BOSS_ROOM_DAMAGE = 2; + + public static void GenerateLootInRooms(List rooms) + { + foreach (Room room in rooms) + { + switch (room.TypeOfRoom) + { + case RoomType.Normal: + if (Lock.HardLocks.Any(l => l.GetLock() == room.Lock.GetLock())) + { + room.AddLoot(LootType.Chest); + } + else if (Lock.VeryHardLocks.Any(l => l.GetLock() == room.Lock.GetLock())) + { + room.AddLoot(LootType.Diamond); + } + break; + case RoomType.Monster: + for (int i = 0; i < MONSTER_ROOM_DIAMONDS; i++) + { + room.AddLoot(LootType.Diamond); + } + break; + case RoomType.Boss: + for (int i = 0; i < BOSS_ROOM_DIAMONDS; i++) + { + room.AddLoot(LootType.Diamond); + } + + for (int i = 0; i < BOSS_ROOM_DAMAGE; i++) + { + room.AddLoot(LootType.Diamond); + } + break; + } + + } + } + } +} \ No newline at end of file diff --git a/DungeonMapGenerator/DungeonMapGenerator/Room.cs b/DungeonMapGenerator/DungeonMapGenerator/Room.cs index 727fb76..9031140 100644 --- a/DungeonMapGenerator/DungeonMapGenerator/Room.cs +++ b/DungeonMapGenerator/DungeonMapGenerator/Room.cs @@ -21,6 +21,13 @@ namespace DungeonMapGenerator Monster, Boss } + + public enum LootType + { + Diamond, + Chest, + Damage + } public class Room { @@ -32,7 +39,8 @@ namespace DungeonMapGenerator public int Width { get; set; } public Point PositionOfTopLeft { get; set; } public int Id { get; set; } - + [JsonProperty("Loot")] + private List _loot = new List(); [JsonProperty("AdjacentRoomIds")] private HashSet _adjacentRoomIds = new HashSet(); private HashSet _adjacentRooms = new HashSet(); @@ -57,8 +65,12 @@ namespace DungeonMapGenerator _adjacentRooms.Add(room); _adjacentRoomIds.Add(room.Id); } - + public void AddLoot(LootType loot) + { + _loot.Add(loot); + } + public HashSet GetAdjacentRoomIds() { return new HashSet(_adjacentRoomIds); diff --git a/DungeonMapGenerator/DungeonMapGenerator/bin/Debug/netstandard2.0/DungeonMapGenerator.dll b/DungeonMapGenerator/DungeonMapGenerator/bin/Debug/netstandard2.0/DungeonMapGenerator.dll index c229425..a183538 100644 Binary files a/DungeonMapGenerator/DungeonMapGenerator/bin/Debug/netstandard2.0/DungeonMapGenerator.dll and b/DungeonMapGenerator/DungeonMapGenerator/bin/Debug/netstandard2.0/DungeonMapGenerator.dll differ