From dc348a729a8dddaadb7c8039b07f379402016723 Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Fri, 9 Aug 2024 15:49:21 +0100 Subject: [PATCH] Allow random CDS to return None, and fix weights. --- game/scripts/cds.rpy | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/game/scripts/cds.rpy b/game/scripts/cds.rpy index 76c09dc4..1a3ab850 100644 --- a/game/scripts/cds.rpy +++ b/game/scripts/cds.rpy @@ -149,8 +149,9 @@ python early hide: for block, weight in blocks: if n <= weight: - break - else: - n -= weight + return block + n -= weight - return block + # In the rare event where weights are incorrectly assigned, + # return a random available block, and in any other case None. + return renpy.random.choice(blocks)[0] if blocks else None