feat: add safe rooms and repeatable Bobka rations
This commit is contained in:
@@ -206,6 +206,13 @@ static func _assign_room_kinds(rng: DeterministicRng, rooms: Array[RoomState], e
|
||||
if UNIQUE_ROOM_KINDS.has(kind):
|
||||
used_unique[kind] = true
|
||||
|
||||
# Weighted room kinds can exhaust either safe kind because both are unique.
|
||||
# Reserve one deterministic non-entrance/non-exit candidate when that occurs.
|
||||
var has_safe_room := candidates.any(func(room_index: int) -> bool: return rooms[room_index].kind in [&"refuge", &"sanctuary"])
|
||||
if not has_safe_room and not candidates.is_empty():
|
||||
var safe_index := candidates[rng.next_int() % candidates.size()]
|
||||
rooms[safe_index].kind = &"refuge" if rng.next_int() % 2 == 0 else &"sanctuary"
|
||||
|
||||
static func _weighted_room_kind(rng: DeterministicRng, floor_number: int, used_unique: Dictionary[StringName, bool]) -> StringName:
|
||||
var available: Array[StringName] = []
|
||||
var total_weight := 0
|
||||
|
||||
Reference in New Issue
Block a user