2022-05-16 23:48:22 +00:00
|
|
|
### House-Points ###
|
|
|
|
|
2024-04-27 14:24:14 +00:00
|
|
|
init python:
|
|
|
|
def house_points_daily():
|
2024-04-25 19:14:25 +00:00
|
|
|
progress_factor = max(1, int(math.log(states.env.day) * 5))
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
# Bonuses based on Tonks and Snape friendship stat
|
2024-04-27 14:24:14 +00:00
|
|
|
bonus_g = states.her.tier
|
|
|
|
bonus_h = int((states.ton.level / 100.0) * (progress_factor * 0.7))
|
|
|
|
bonus_s = int((states.sna.level / 100.0) * (progress_factor * 0.7))
|
|
|
|
bonus_r = states.cho.tier + states.lun.tier
|
|
|
|
|
|
|
|
house_points = {
|
|
|
|
"gryffindor": states.env.gryffindor,
|
|
|
|
"hufflepuff": states.env.hufflepuff,
|
|
|
|
"ravenclaw": states.env.ravenclaw,
|
|
|
|
"slytherin": states.env.slytherin
|
|
|
|
}
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2024-04-27 14:24:14 +00:00
|
|
|
leader = max(house_points.values())
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2024-04-27 14:24:14 +00:00
|
|
|
factors = {
|
|
|
|
"gryffindor": (bonus_g, max(house_points["hufflepuff"], house_points["ravenclaw"], house_points["slytherin"])),
|
|
|
|
"hufflepuff": (bonus_h, max(house_points["gryffindor"], house_points["ravenclaw"], house_points["slytherin"])),
|
|
|
|
"ravenclaw": (bonus_r, max(house_points["gryffindor"], house_points["hufflepuff"], house_points["slytherin"])),
|
|
|
|
"slytherin": (bonus_s, max(house_points["gryffindor"], house_points["hufflepuff"], house_points["ravenclaw"]))
|
|
|
|
}
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2024-04-27 14:24:14 +00:00
|
|
|
points = {
|
|
|
|
house: min(leader, round((progress_factor + bonus) * max_points / house_points[house]))
|
|
|
|
for house, (bonus, max_points) in factors.items()
|
|
|
|
}
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2024-04-27 14:24:14 +00:00
|
|
|
for house, point in points.items():
|
|
|
|
points[house] = renpy.random.randint(point // 2, point) + house_points[house]
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2024-04-27 14:24:14 +00:00
|
|
|
states.env.set_points(points)
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2024-04-27 14:24:14 +00:00
|
|
|
screen house_points(gryffindor=None, slytherin=None, ravenclaw=None, hufflepuff=None, prefix="+", direction="up"):
|
|
|
|
tag house_points
|
|
|
|
layer "interface"
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
hbox:
|
|
|
|
spacing 15
|
|
|
|
align (0.5, 0.1)
|
2024-04-27 00:54:41 +00:00
|
|
|
if direction == "up":
|
|
|
|
at transform:
|
|
|
|
on start:
|
|
|
|
alpha 0.0
|
|
|
|
on show:
|
|
|
|
alpha 1.0
|
|
|
|
yoffset 0
|
|
|
|
easein 4.0 yoffset -50 alpha 0.0
|
|
|
|
else:
|
|
|
|
at transform:
|
|
|
|
on start:
|
|
|
|
alpha 0.0
|
|
|
|
on show:
|
|
|
|
alpha 1.0
|
|
|
|
yoffset -50
|
|
|
|
easein 4.0 yoffset 0 alpha 0.0
|
|
|
|
|
|
|
|
if gryffindor:
|
|
|
|
text "[prefix][gryffindor]" outlines [(1, "#000000BF", 1, 0)] size 24 color "#A74D2A"
|
|
|
|
if slytherin:
|
2024-04-27 14:24:14 +00:00
|
|
|
text "[prefix][slytherin]" outlines [(1, "#000000BF", 1, 0)] size 24 color "#3A734B"
|
2024-04-27 00:54:41 +00:00
|
|
|
if ravenclaw:
|
|
|
|
text "[prefix][ravenclaw]" outlines [(1, "#000000BF", 1, 0)] size 24 color "#5974C2"
|
|
|
|
if hufflepuff:
|
|
|
|
text "[prefix][hufflepuff]" outlines [(1, "#000000BF", 1, 0)] size 24 color "#FBC60A"
|
|
|
|
|
2024-04-27 14:24:14 +00:00
|
|
|
timer 4.0 action Hide("house_points")
|