Compare commits

...

3 Commits

Author SHA1 Message Date
d119e71116 Only reseed the door at the beginning of the day/night
It's weird that people teleport when you open the menu twice in a row
2023-12-17 10:15:14 +01:00
b439246d6d Better constant and random management in door/summon
Using a local __choice like in map to avoid unnecessary inconstantness
This is same-behavior, but I would be in favor of reseeding only at the beginning of the day/night instead of every time the summon menu is opened (next commit)
2023-12-17 10:13:58 +01:00
ea138023c7 Simpler random reseeding
Constructing an entire new random object is not necessary, calling seed is enough
2023-12-17 10:13:14 +01:00
2 changed files with 71 additions and 60 deletions

View File

@ -86,7 +86,8 @@ label day_start:
# Randomisers # Randomisers
random_gold = renpy.random.randint(8, 40) random_gold = renpy.random.randint(8, 40)
map_randomobj = renpy.random.Random() map_randomobj.seed()
door_randomobj.seed()
# Send salary every 7th day # Send salary every 7th day
if game.day % 7 == 0: if game.day % 7 == 0:
@ -194,7 +195,8 @@ label night_start:
# Randomisers # Randomisers
random_gold = renpy.random.randint(8, 40) random_gold = renpy.random.randint(8, 40)
map_randomobj = renpy.random.Random() map_randomobj.seed()
door_randomobj.seed()
# Update map locations # Update map locations
call set_all_map_locations call set_all_map_locations

View File

@ -3,28 +3,29 @@
#################################### ####################################
default summon_show_busy = True default summon_show_busy = True
default door_randomobj = renpy.random.Random()
label summon: init python:
$ gui.in_context("summon_menu") def __choice(seq):
jump main_room_menu seed = door_randomobj.getstate()
rv = door_randomobj.choice(seq)
door_randomobj.setstate(seed)
return rv
label summon_menu(xx=723, yy=90): define map_transcript_loc = dict(
library = "Library",
$ renpy.dynamic( room_g = "Gryffindor Dormitory",
map_transcript_loc = { room_s = "Slytherin Dormitory",
"library": "Library", room_r = "Ravenclaw Dormitory",
"room_g": "Gryffindor Dormitory", room_h = "Hufflepuff Dormitory",
"room_s": "Slytherin Dormitory", great_hall = "Great Hall",
"room_r": "Ravenclaw Dormitory", courtyard = "Courtyard",
"room_h": "Hufflepuff Dormitory", forest = "Forest",
"great_hall": "Great Hall", greenhouse = "Greenhouse",
"courtyard": "Courtyard", defense = "D.A.D.A Classroom",
"forest": "Forest", training_grounds = "Training Grounds",
"greenhouse": "Greenhouse", Lake = "Lake",
"defense": "D.A.D.A Classroom", randomstudent = functools.partial(__choice, (
"training_grounds": "Training Grounds",
"Lake": "Lake",
"randomstudent": renpy.random.choice((
"Classroom", "Classroom",
"Bathroom", "Bathroom",
"Hagrid's Hut", "Hagrid's Hut",
@ -32,7 +33,7 @@ label summon_menu(xx=723, yy=90):
"Mafkin's Store", "Mafkin's Store",
"Broom Cupboard", "Broom Cupboard",
"Attic")), "Attic")),
"randomsnape": renpy.random.choice(( randomsnape = functools.partial(__choice, (
"Classroom", "Classroom",
"Boathouse", "Boathouse",
"Bathroom", "Bathroom",
@ -48,7 +49,7 @@ label summon_menu(xx=723, yy=90):
"Staircase", "Staircase",
"Behind your door", "Behind your door",
"Room of Doom")), "Room of Doom")),
"randomtonks": renpy.random.choice(( randomtonks = functools.partial(__choice, (
"Classroom", "Classroom",
"Bathroom", "Bathroom",
"Hall", "Hall",
@ -57,7 +58,7 @@ label summon_menu(xx=723, yy=90):
"Hufflepuff Dormitory", "Hufflepuff Dormitory",
"Ravenclaw Dormitory", "Ravenclaw Dormitory",
"Training Grounds", "Training Grounds",
"Tonks' Room", "Tonks's Room",
"Quidditch Pitch", "Quidditch Pitch",
"Infirmary", "Infirmary",
"Sex Dungeon", "Sex Dungeon",
@ -66,8 +67,15 @@ label summon_menu(xx=723, yy=90):
"Lake", "Lake",
"Greenhouse", "Greenhouse",
"Mafkin's Store")), "Mafkin's Store")),
}, )
label summon:
$ gui.in_context("summon_menu")
jump main_room_menu
label summon_menu(xx=723, yy=90):
$ renpy.dynamic(
# Door dictionary # Door dictionary
summon_dict = { summon_dict = {
# the order will be the one in the menu # the order will be the one in the menu
@ -179,7 +187,8 @@ screen summon_menu():
xysize (48, 48) xysize (48, 48)
add crop_image_zoom("interface/icons/head/"+char_dict["ico"]+".webp", 42, 42, char_dict["busy"]) align (0.5, 0.5) add crop_image_zoom("interface/icons/head/"+char_dict["ico"]+".webp", 42, 42, char_dict["busy"]) align (0.5, 0.5)
text map_transcript_loc[char_dict["loc"]] size 10 xcenter 0.6 yalign 0.9 $ loc = map_transcript_loc[char_dict["loc"]]
text (loc() if callable(loc) else loc) size 10 xcenter 0.6 yalign 0.9
if not states.sna.unlocked: if not states.sna.unlocked:
text "You don't know anyone" size 12 at truecenter text "You don't know anyone" size 12 at truecenter