v3.1.0: improved logic for fairly placing enemies near entrances
This commit is contained in:
@@ -231,12 +231,24 @@ public abstract class RegularLevel extends Level {
|
||||
Random.shuffle(stdRooms);
|
||||
Iterator<Room> stdRoomIter = stdRooms.iterator();
|
||||
|
||||
//enemies cannot be within an 8-tile FOV of the entrance
|
||||
// or a 6-tile open space distance from the entrance
|
||||
//enemies cannot be within a 8-tile FOV or 8-tile open space walk from the entrance
|
||||
boolean[] entranceFOV = new boolean[length()];
|
||||
Point c = cellToPoint(entrance());
|
||||
ShadowCaster.castShadow(c.x, c.y, width(), entranceFOV, losBlocking, 6);
|
||||
PathFinder.buildDistanceMap(entrance(), BArray.not(solid, null), 8);
|
||||
ShadowCaster.castShadow(c.x, c.y, width(), entranceFOV, losBlocking, 8);
|
||||
|
||||
boolean[] entranceWalkable = BArray.not(solid, null);
|
||||
|
||||
//doors within the entrance room are ignored for this walk, but doors on the edge are not
|
||||
for (int y = roomEntrance.top+1; y < roomEntrance.bottom; y++){
|
||||
for (int x = roomEntrance.left+1; x < roomEntrance.right; x++){
|
||||
int cell = x + y*width();
|
||||
if (passable[cell]){
|
||||
entranceWalkable[cell] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PathFinder.buildDistanceMap(entrance(), entranceWalkable, 8);
|
||||
|
||||
Mob mob = null;
|
||||
while (mobsToSpawn > 0) {
|
||||
|
||||
@@ -104,6 +104,9 @@ public abstract class StandardRoom extends Room {
|
||||
}
|
||||
|
||||
public int mobSpawnWeight(){
|
||||
if (isEntrance()){
|
||||
return 1; //entrance rooms don't have higher mob spawns even if they're larger
|
||||
}
|
||||
return sizeFactor();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user