From 9a3fe1df6538977ac4f44122b64574138422f119 Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Thu, 16 Nov 2023 00:13:42 +0100 Subject: [PATCH] Reform random map locations the locations of the different characters aren't independant, but they weren't in the first place --- game/scripts/events/DayNight.rpy | 5 +- game/scripts/interface/map.rpy | 85 ++++++++++++-------------------- 2 files changed, 34 insertions(+), 56 deletions(-) diff --git a/game/scripts/events/DayNight.rpy b/game/scripts/events/DayNight.rpy index 9fe565bb..e07b7007 100644 --- a/game/scripts/events/DayNight.rpy +++ b/game/scripts/events/DayNight.rpy @@ -1,4 +1,3 @@ - label day_start: show screen blkfade hide snape_main @@ -87,7 +86,7 @@ label day_start: # Randomisers random_gold = renpy.random.randint(8, 40) - random_map_loc = renpy.random.randint(1, 5) + map_randomobj = renpy.random.Random() # Send salary every 7th day if game.day % 7 == 0: @@ -201,7 +200,7 @@ label night_start: # Randomisers random_gold = renpy.random.randint(8, 40) - random_map_loc = renpy.random.randint(1, 5) + map_randomobj = renpy.random.Random() # Update map locations call set_her_map_location() diff --git a/game/scripts/interface/map.rpy b/game/scripts/interface/map.rpy index 4b150b9f..28c9218d 100644 --- a/game/scripts/interface/map.rpy +++ b/game/scripts/interface/map.rpy @@ -6,6 +6,14 @@ default map_animated = "once" define map_scale = 0.35 define map_ani_time = 1.5 +default map_randomobj = renpy.random.Random() +init python: + def __choice(seq): + seed = map_randomobj.getstate() + rv = map_randomobj.choice(seq) + map_randomobj.setstate(seed) + return rv + transform map_fadein: alpha 0 pause (map_ani_time) @@ -216,30 +224,15 @@ label set_her_map_location(location=""): else: #Random if states.her.level < 11: - if random_map_loc in [1,2]: #Library - $ states.her.map_location = "library" - elif random_map_loc in [3]: #Great Hall - $ states.her.map_location = "great_hall" - else: #Gryff Room - $ states.her.map_location = "room_g" + $ states.her.map_location = __choice(("library", "library", "great_hall", "room_g", "room_g")) else: - if states.her.public_level < 12: - if random_map_loc == 1: #Great Hall - $ states.her.map_location = "great_hall" - elif random_map_loc == 2: #Courtyard - $ states.her.map_location = "courtyard" - else: #Gryff Room - $ states.her.map_location = "room_g" - else: - if random_map_loc == 1: #Slytherin Room - $ states.her.map_location = "room_s" - elif random_map_loc == 2: #Courtyard - $ states.her.map_location = "courtyard" - else: #Gryff Room - $ states.her.map_location = "room_g" - if states.her.status.blowjob == True and game.weather in ("clear", "cloudy") and not game.daytime and not states.her.busy: - $ states.her.map_location = "forest" + $ states.her.map_location = "forest" + + elif states.her.public_level < 12: + $ states.her.map_location = __choice(("great_hall", "courtyard", "room_g", "room_g", "room_g")) + else: + $ states.her.map_location = __choice(("room_s", "courtyard", "room_g", "room_g", "room_g")) call update_character_map_locations @@ -256,12 +249,7 @@ label set_lun_map_location(location = ""): $ states.lun.map_location = "room_r" else: #Random - if random_map_loc in [1]: - $ states.lun.map_location = "greenhouse" - elif random_map_loc in [2,3]: - $ states.lun.map_location = "forest" - else: #Ravenclaw Room - $ states.lun.map_location = "room_r" + $ states.lun.map_location = __choice(("greenhouse", "forest", "forest", "room_r", "room_r")) call update_character_map_locations @@ -277,10 +265,7 @@ label set_ast_map_location(location = ""): $ states.ast.map_location = "defense" else: #Random - if random_map_loc in [1,2]: - $ states.ast.map_location = "courtyard" - else: #Slytherin Room - $ states.ast.map_location = "room_s" + $ states.ast.map_location = __choice(("courtyard", "courtyard", "room_s", "room_s", "room_s")) call update_character_map_locations @@ -294,10 +279,7 @@ label set_sus_map_location(location = ""): $ states.sus.map_location = "room_r" else: #Random - if random_map_loc in [1,2]: - $ states.sus.map_location = "great_hall" - else: #Hufflepuff Room - $ states.sus.map_location = "room_h" + $ states.sus.map_location = __choice(("great_hall", "great_hall", "room_h", "room_h", "room_h")) call update_character_map_locations @@ -311,32 +293,29 @@ label set_cho_map_location(location = ""): $ states.cho.map_location = "room_r" else: #Random - if random_map_loc in [1,2]: - $ states.cho.map_location = "training_grounds" - else: #Ravenclaw Room - $ states.cho.map_location = "room_r" + $ states.cho.map_location = __choice(("training_grounds", "training_grounds", "room_r", "room_r", "room_r")) call update_character_map_locations return label update_character_map_locations: - if states.her.map_location == "library": + if states.her.map_location == "library": $ her_map_xpos = 685 $ her_map_ypos = 94 - if states.her.map_location == "room_g": + elif states.her.map_location == "room_g": $ her_map_xpos = 340 $ her_map_ypos = 212 - if states.her.map_location == "room_s": + elif states.her.map_location == "room_s": $ her_map_xpos = 440 $ her_map_ypos = 184 - if states.her.map_location == "great_hall": + elif states.her.map_location == "great_hall": $ her_map_xpos = 300 $ her_map_ypos = 240 - if states.her.map_location == "courtyard": + elif states.her.map_location == "courtyard": $ her_map_xpos = 674 $ her_map_ypos = 216 - if states.her.map_location == "forest": + elif states.her.map_location == "forest": $ her_map_xpos = 290 $ her_map_ypos = 40 @@ -344,10 +323,10 @@ label update_character_map_locations: if states.lun.map_location == "room_r": $ lun_map_xpos = 536 $ lun_map_ypos = 242 - if states.lun.map_location == "forest": + elif states.lun.map_location == "forest": $ lun_map_xpos = 430 $ lun_map_ypos = 50 - if states.lun.map_location == "greenhouse": + elif states.lun.map_location == "greenhouse": $ lun_map_xpos = 680 $ lun_map_ypos = 320 @@ -355,10 +334,10 @@ label update_character_map_locations: if states.ast.map_location == "room_s": $ ast_map_xpos = 476 $ ast_map_ypos = 118 - if states.ast.map_location == "courtyard": + elif states.ast.map_location == "courtyard": $ ast_map_xpos = 634 $ ast_map_ypos = 254 - if states.ast.map_location == "defense": #Event + elif states.ast.map_location == "defense": #Event $ ast_map_xpos = 530 $ ast_map_ypos = 190 @@ -366,7 +345,7 @@ label update_character_map_locations: if states.sus.map_location == "room_h": $ sus_map_xpos = 360 $ sus_map_ypos = 320 - if states.sus.map_location == "great_hall": + elif states.sus.map_location == "great_hall": $ sus_map_xpos = 300 $ sus_map_ypos = 280 @@ -374,7 +353,7 @@ label update_character_map_locations: if states.cho.map_location == "room_r": $ cho_map_xpos = 494 $ cho_map_ypos = 276 - if states.cho.map_location == "training_grounds": + elif states.cho.map_location == "training_grounds": $ cho_map_xpos = 750 $ cho_map_ypos = 50 @@ -400,7 +379,7 @@ screen map_screen_characters(): #Hermione if states.her.unlocked: - if states.her.map_location == "forest": # Mark forest event. + if states.her.map_location == "forest": # Mark forest event. add "interface/achievements/glow.webp" pos (UI_xpos_offset+her_map_xpos, UI_ypos_offset+her_map_ypos) align (0.5, 0.5) zoom 0.15 alpha 0.5 at rotate_circular imagebutton: xpos +UI_xpos_offset +her_map_xpos