v2.4.0: fixed createMobs discarding mobs it can't immediately place

This commit is contained in:
Evan Debenham
2024-05-07 11:26:43 -04:00
parent b9a301bba1
commit d45cc9cae4
@@ -236,8 +236,9 @@ public abstract class RegularLevel extends Level {
ShadowCaster.castShadow(c.x, c.y, width(), entranceFOV, losBlocking, 6);
PathFinder.buildDistanceMap(entrance(), BArray.not(solid, null), 8);
Mob mob = null;
while (mobsToSpawn > 0) {
Mob mob = createMob();
if (mob == null) mob = createMob();
Room roomToSpawn;
if (!stdRoomIter.hasNext()) {
@@ -261,6 +262,7 @@ public abstract class RegularLevel extends Level {
if (tries >= 0) {
mobsToSpawn--;
mobs.add(mob);
mob = null;
//chance to add a second mob to this room, except on floor 1
if (Dungeon.depth > 1 && mobsToSpawn > 0 && Random.Int(4) == 0){
@@ -282,6 +284,7 @@ public abstract class RegularLevel extends Level {
if (tries >= 0) {
mobsToSpawn--;
mobs.add(mob);
mob = null;
}
}
}