v3.3.0: rot garden rooms now have a minimum open size

This commit is contained in:
Evan Debenham
2025-10-08 14:40:16 -04:00
parent 8a5e05364a
commit 0c066595b6

View File

@@ -58,6 +58,7 @@ public class RotGardenRoom extends SpecialRoom {
ArrayList<Integer> candidates = new ArrayList<>();
boolean[] passable = new boolean[level.length()];
int entryPos = level.pointToCell(entrance());
int openCells;
do {
Painter.fill(level, this, 1, Terrain.HIGH_GRASS);
for (int i = 0; i < 12; i++) {
@@ -78,9 +79,11 @@ public class RotGardenRoom extends SpecialRoom {
//place the heart in a slightly random location sufficiently far from the entrance
PathFinder.buildDistanceMap(entryPos, passable);
candidates.clear();
openCells = 0;
for (Point p : getPoints()) {
int i = level.pointToCell(p);
if (PathFinder.distance[i] != Integer.MAX_VALUE) {
openCells++;
if (PathFinder.distance[i] >= 7) {
candidates.add(i);
}
@@ -102,7 +105,8 @@ public class RotGardenRoom extends SpecialRoom {
closestPos++;
}
} while (candidates.isEmpty());
//retry if there are no distanc candidates, or more than ~half the room is closed off
} while (candidates.isEmpty() || openCells < 35);
int heartPos = Random.element(candidates);
placePlant(level, heartPos, new RotHeart());