|
@@ -111,17 +111,37 @@ class RegionRandom extends Region {
|
|
placedRooms.forEach((room : RoomRandom) => {
|
|
placedRooms.forEach((room : RoomRandom) => {
|
|
let myCoordinates = region.map.getCoordinates(room);
|
|
let myCoordinates = region.map.getCoordinates(room);
|
|
let directionShuffler = new Shuffler<number>(room.connectableOn.slice(0), RegionRandom.rng);
|
|
let directionShuffler = new Shuffler<number>(room.connectableOn.slice(0), RegionRandom.rng);
|
|
- for (let direction = directionShuffler.getOne(); direction != undefined && (RegionRandom.rng() * 100) <= room.extraConnectionChance; direction = directionShuffler.getOne()) {
|
|
|
|
|
|
+ // use greater connection chance
|
|
|
|
+ for (let direction = directionShuffler.getOne(); direction != undefined; direction = directionShuffler.getOne()) {
|
|
|
|
+ let chance1 = room.extraConnectionChance;
|
|
if (room.connections[direction] == undefined) {
|
|
if (room.connections[direction] == undefined) {
|
|
let otherCoordinates = Room.shift(myCoordinates, direction);
|
|
let otherCoordinates = Room.shift(myCoordinates, direction);
|
|
let otherRoom = region.map.getRoom(otherCoordinates[0], otherCoordinates[1]);
|
|
let otherRoom = region.map.getRoom(otherCoordinates[0], otherCoordinates[1]);
|
|
if (otherRoom != undefined && otherRoom.randomizable
|
|
if (otherRoom != undefined && otherRoom.randomizable
|
|
&& otherRoom.isConnectableOn(OppositeDirection[Direction[direction]])
|
|
&& otherRoom.isConnectableOn(OppositeDirection[Direction[direction]])
|
|
- && (RegionRandom.rng() * 100) <= otherRoom.extraConnectionChance) {
|
|
|
|
- room.mapRoom(otherRoom, direction);
|
|
|
|
|
|
+ ) {
|
|
|
|
+ let chance2 = otherRoom.extraConnectionChance;
|
|
|
|
+ let chance = (chance1 == 0 || chance2 == 0) ? 0 : Math.max(chance1, chance2);
|
|
|
|
+ console.log(chance);
|
|
|
|
+ if ((RegionRandom.rng() * 100) <= chance) {
|
|
|
|
+ room.mapRoom(otherRoom, direction);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // for (let direction = directionShuffler.getOne(); direction != undefined && (RegionRandom.rng() * 100) <= room.extraConnectionChance; direction = directionShuffler.getOne()) {
|
|
|
|
+ // if (room.connections[direction] == undefined) {
|
|
|
|
+ // let otherCoordinates = Room.shift(myCoordinates, direction);
|
|
|
|
+ // let otherRoom = region.map.getRoom(otherCoordinates[0], otherCoordinates[1]);
|
|
|
|
+ // if (otherRoom != undefined && otherRoom.randomizable
|
|
|
|
+ // && otherRoom.isConnectableOn(OppositeDirection[Direction[direction]])
|
|
|
|
+ // && (RegionRandom.rng() * 100) <= otherRoom.extraConnectionChance) {
|
|
|
|
+ // room.mapRoom(otherRoom, direction);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|