WTS/game/scripts/interface/house_points.rpy
LoafyLemon 7069cc1294 Refactoring
* Refactored old house points references
* Updates set_points method to use a dict to work with multiple changes at once.
2024-04-27 15:24:14 +01:00

73 lines
2.8 KiB
Plaintext

### House-Points ###
init python:
def house_points_daily():
progress_factor = max(1, int(math.log(states.env.day) * 5))
# Bonuses based on Tonks and Snape friendship stat
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
}
leader = max(house_points.values())
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"]))
}
points = {
house: min(leader, round((progress_factor + bonus) * max_points / house_points[house]))
for house, (bonus, max_points) in factors.items()
}
for house, point in points.items():
points[house] = renpy.random.randint(point // 2, point) + house_points[house]
states.env.set_points(points)
screen house_points(gryffindor=None, slytherin=None, ravenclaw=None, hufflepuff=None, prefix="+", direction="up"):
tag house_points
layer "interface"
hbox:
spacing 15
align (0.5, 0.1)
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:
text "[prefix][slytherin]" outlines [(1, "#000000BF", 1, 0)] size 24 color "#3A734B"
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"
timer 4.0 action Hide("house_points")