Add data privacy when computing house points

the dynamic variables are needed for the show screen call
This commit is contained in:
Gouvernathor 2023-11-17 02:47:17 +01:00
parent ebcfa4b78d
commit aefa88e4d2

View File

@ -2,7 +2,7 @@
label points_changes: # Gets called every day/night. label points_changes: # Gets called every day/night.
python: python hide:
progress_factor = max(1, int(math.log(game.day) * 5)) progress_factor = max(1, int(math.log(game.day) * 5))
# Bonuses based on Tonks and Snape friendship stat # Bonuses based on Tonks and Snape friendship stat
@ -19,15 +19,17 @@ label points_changes: # Gets called every day/night.
difference_factor_r = min(leader, round((progress_factor + bonus_r) * max(gryffindor, hufflepuff, slytherin)/float(ravenclaw))) difference_factor_r = min(leader, round((progress_factor + bonus_r) * max(gryffindor, hufflepuff, slytherin)/float(ravenclaw)))
difference_factor_s = min(leader, round((progress_factor + bonus_s) * max(hufflepuff, ravenclaw, gryffindor)/float(slytherin))) difference_factor_s = min(leader, round((progress_factor + bonus_s) * max(hufflepuff, ravenclaw, gryffindor)/float(slytherin)))
points_g = renpy.random.randint(difference_factor_g//2, difference_factor_g) renpy.dynamic(
points_h = renpy.random.randint(difference_factor_h//2, difference_factor_h) points_g = renpy.random.randint(difference_factor_g//2, difference_factor_g),
points_r = renpy.random.randint(difference_factor_r//2, difference_factor_r) points_h = renpy.random.randint(difference_factor_h//2, difference_factor_h),
points_s = renpy.random.randint(difference_factor_s//2, difference_factor_s) points_r = renpy.random.randint(difference_factor_r//2, difference_factor_r),
points_s = renpy.random.randint(difference_factor_s//2, difference_factor_s),
)
gryffindor += points_g store.gryffindor += points_g
hufflepuff += points_h store.hufflepuff += points_h
ravenclaw += points_r store.ravenclaw += points_r
slytherin += points_s store.slytherin += points_s
hide screen points_changes hide screen points_changes
show screen points_changes(points_s, points_g, points_r, points_h) show screen points_changes(points_s, points_g, points_r, points_h)
@ -42,7 +44,7 @@ screen points_changes(points_s, points_g, points_r, points_h):
align (0.5, 0.1) align (0.5, 0.1)
at transform: at transform:
on start: on start:
alpha 0.0 alpha 0.0
on show: on show:
yoffset 0 yoffset 0
alpha 1.0 alpha 1.0
@ -54,5 +56,3 @@ screen points_changes(points_s, points_g, points_r, points_h):
text "+[points_h]" outlines [(1, "#000000BF", 1, 0)] size 24 color "#FBC60A" text "+[points_h]" outlines [(1, "#000000BF", 1, 0)] size 24 color "#FBC60A"
timer 3.0 action Hide("points_changes") timer 3.0 action Hide("points_changes")