Refactoring day checks

This commit is contained in:
LoafyLemon 2024-04-25 20:14:25 +01:00
parent ec991ccd22
commit 333fdfed51
28 changed files with 84 additions and 84 deletions

View File

@ -81,7 +81,7 @@ label cc_pf_strip_T2_intro_E1:
$ cho.set_pose("default")
$ cho.animation = None
$ states.env.gold = 1984
$ game.day = 123
$ states.env.day = 123
call room("main_room")
call cho_chibi("stand", "desk", "base", flip=False)

View File

@ -58,7 +58,7 @@ label cc_pf_blowjob_T3_intro_E1:
$ cho.set_pose("default")
$ cho.animation = None
$ states.env.gold = 1984
$ game.day = 124
$ states.env.day = 124
call room("main_room")
call cho_chibi("stand", "desk", "base", flip=False)

View File

@ -125,7 +125,7 @@ label gryffindor_match:
with d5
$ states.env.gold = 1984
$ game.day = 665
$ states.env.day = 665
$ states.env.daytime = True
$ game.weather = "clear"
call room("main_room")
@ -587,7 +587,7 @@ label gryffindor_match:
$ cho.equip(cho_outfit_quidditch_gryffindor)
$ states.env.gold = 1984
$ game.day = 667
$ states.env.day = 667
$ states.env.daytime = True
$ game.weather = "clear"
$ snape_chibi.zorder = 3
@ -729,7 +729,7 @@ label gryffindor_match:
$ cho.equip(cho_outfit_quidditch_gryffindor)
$ states.env.gold = 1984
$ game.day = 667
$ states.env.day = 667
$ states.env.daytime = True
$ game.weather = "clear"
$ snape_chibi.zorder = 3
@ -935,7 +935,7 @@ label gryffindor_match:
$ cho.set_pose("broom")
$ cho.animation = sprite_fly_idle
$ states.env.gold = 1984
$ game.day = 667
$ states.env.day = 667
call room("quidditch_stands2")
call quidditch_stands2(weather="sun_low", crowd=crowd_full)
call lun_chibi(xpos=620, ypos=400)
@ -959,7 +959,7 @@ label gryffindor_match:
$ cho.set_pose("broom")
$ cho.animation = sprite_fly_idle
$ states.env.gold = 1984
$ game.day = 667
$ states.env.day = 667
call room("quidditch_stands2")
call quidditch_stands2(weather="sun_low", crowd=crowd_full)
call lun_chibi(xpos=620, ypos=400)

View File

@ -103,7 +103,7 @@ label cc_gt_return:
$ cho.equip(cho_outfit_quidditch_gryffindor)
$ states.env.gold = 1984
$ game.day = 665
$ states.env.day = 665
$ states.env.daytime = False
$ game.weather = "clear"
call room("main_room")

View File

@ -1507,7 +1507,7 @@ label cho_quid_E12:
$ hooch.equip(hoo_accessory_broom_dildo)
$ cho.equip(cho_outfit_quidditch_gryffindor)
$ states.env.gold = 1984
$ game.day = 666
$ states.env.day = 666
$ states.env.daytime = True
$ game.weather = "clear"
$ hooch_chibi.zoom = 0.38

View File

@ -178,7 +178,7 @@ label her_maid_job:
label her_maid_job_return:
python:
progress_factor = math.log(states.her.tier + states.cho.tier + states.ton.tier + states.lun.tier + game.day)
progress_factor = math.log(states.her.tier + states.cho.tier + states.ton.tier + states.lun.tier + states.env.day)
payment = int(progress_factor * random_gold)
$ hermione.equip(her_outfit_maid)

View File

@ -80,11 +80,11 @@ label day_start:
states.sus.mood = max(states.sus.mood-val, 0)
# Game flags
game.day += 1
states.env.day += 1
game.weather = "random"
states.env.daytime = True
cupboard_OBJ.foreground = Transform(Text(str((game.day % 30) + 1), color="#fff", outlines=[(1, "#000", 0, 0)]), pos=(40, 100))
cupboard_OBJ.foreground = Transform(Text(str((states.env.day % 30) + 1), color="#fff", outlines=[(1, "#000", 0, 0)]), pos=(40, 100))
# Randomisers
random_gold = renpy.random.randint(8, 40)
@ -92,7 +92,7 @@ label day_start:
door_randomobj.seed()
# Send salary every 7th day
if game.day % 7 == 0:
if states.env.day % 7 == 0:
if states.paperwork_reports >= 1:
letter_work_report.send()
if not states.twi.ev.cardgame.first_random:

View File

@ -49,7 +49,7 @@ label start_wt:
label genie_intro_E1:
$ game.weather = "clear"
$ states.env.daytime = False
$ game.day = 0
$ states.env.day = 0
call send_letters
stop background
@ -88,7 +88,7 @@ label genie_intro_E1:
# Swap to day seamlessly
$ states.env.daytime = True
$ game.day = 1
$ states.env.day = 1
$ mailbox.tick()
with d9

View File

@ -119,7 +119,7 @@ label potions_intro_E0:
"\"What's the Wi-Fi password?\"":
sna "Sorry?" ("snape_05")
#check day counter
if game.day > 35:
if states.env.day > 35:
gen "I've been here for ages and I still don't know the password..." ("base", xpos="far_left", ypos="head")
else:
gen "I know I've only been here for a little bit. But it's boring up there." ("base", xpos="far_left", ypos="head")

View File

@ -14,7 +14,7 @@ label quests:
# DAY-BASED EVENTS
#
if game.day >= 1:
if states.env.day >= 1:
if states.env.daytime:
if not states.gen.ev.intro.e2_complete and states.gen.ev.intro.bird_examined and states.gen.ev.intro.desk_examined and states.gen.ev.intro.cupboard_examined and states.gen.ev.intro.door_examined and states.gen.ev.intro.fireplace_examined:
jump genie_intro_E2
@ -22,7 +22,7 @@ label quests:
if not states.sna.ev.intro.e1_complete:
jump snape_intro_E1
if game.day >= 2:
if states.env.day >= 2:
if states.env.daytime:
if not states.gen.ev.intro.e3_complete:
jump genie_intro_E3
@ -31,7 +31,7 @@ label quests:
# Snape's second visit.
jump snape_intro_E2
if game.day >= 3:
if states.env.day >= 3:
if states.env.daytime:
if not states.gen.ev.intro.e4_complete:
jump genie_intro_E4
@ -41,7 +41,7 @@ label quests:
jump snape_intro_E3
if game.day >= 4:
if states.env.day >= 4:
if states.env.daytime:
pass
else:
@ -49,13 +49,13 @@ label quests:
# You bother decide to just "roll with it"... Snape summon unlocked.
jump snape_intro_E5
if game.day >= 5:
if states.env.day >= 5:
if states.env.daytime:
if hg_event_pause == 0 and not states.her.ev.intro.e1_complete:
# Hermione shows up for the first time.
jump hermione_intro_E1
if game.day >= 6:
if states.env.day >= 6:
if states.env.daytime:
if hg_event_pause == 0 and states.sna.ev.hangouts.hermione_e1 and not states.her.ev.intro.e2_complete:
# Second visit from Hermione. Says she sent a letter to the Ministry.
@ -63,7 +63,7 @@ label quests:
else:
pass
if game.day >= 7:
if states.env.day >= 7:
if states.env.daytime:
pass
else:
@ -72,7 +72,7 @@ label quests:
# Hermione might have failed a test...
jump hermione_intro_E3
if game.day >= 8:
if states.env.day >= 8:
if states.env.daytime:
pass
else:
@ -80,13 +80,13 @@ label quests:
# She failed a test and cries.
jump hermione_intro_E4
if game.day >= 9:
if states.env.day >= 9:
if states.env.daytime:
if hg_event_pause == 0 and states.her.ev.intro.e4_complete and not states.her.ev.intro.e5_complete:
# Hermione asks to be tutored. Summon unlocked!
jump hermione_intro_E5
if game.day >= 10:
if states.env.day >= 10:
if states.env.daytime:
if nt_event_pause == 0 and states.her.ev.intro.e5_complete and not states.ton.ev.intro.e1_complete:
# Tonks visits for the first time.
@ -96,7 +96,7 @@ label quests:
# Tonks has found no evidence so far.
jump tonks_intro_E2
if game.day >= 11:
if states.env.day >= 11:
if states.env.daytime:
pass
else:
@ -104,7 +104,7 @@ label quests:
# Tonks becomes a teacher. Summon unlocked!
jump tonks_intro_E3
if game.day >= 13:
if states.env.day >= 13:
if states.env.daytime:
if hg_event_pause == 0 and states.her.ev.intro.e5_complete and states.sna.ev.hangouts.tonks_e1 and states.her.ev.intro.convinced and not states.her.ev.intro.e6_complete:
# Hermione wants to buy favours. Favours unlocked!

View File

@ -69,7 +69,7 @@ init python:
branches = tuple(self.dictionary[str(x)] for x in branches)
entry = [entry[0], entry[1].format(*branches)]
self.contents.append(["Day {}\n{}".format(game.day, entry[0]), str(entry[1]), id])
self.contents.append(["Day {}\n{}".format(states.env.day, entry[0]), str(entry[1]), id])
self.pages = len(self.contents)-1
return

View File

@ -14,7 +14,7 @@ init python:
contents[i] += "🌕"
elif (i % 7 == 3):
contents[i] += "🌓"
# elif (game.day % 60 == 30) # Blood moon
# elif (states.env.day % 60 == 30) # Blood moon
forecast = Weather.forecast(span)
for i, v in forecast.items():
@ -34,13 +34,13 @@ init python:
# Add letters
letters = mailbox.get_letters(True)
for i in letters:
if (day := game.day+i.wait) < span+1:
if (day := states.env.day+i.wait) < span+1:
contents[day] += "✉️"
# Add parcels
parcels = mailbox.get_parcels(True)
for i in parcels:
if (day := game.day+i.wait) < span+1:
if (day := states.env.day+i.wait) < span+1:
contents[day] += "📦"
return contents
@ -48,7 +48,7 @@ init python:
@staticmethod
def get_weekday(n=None):
if n is None:
n = game.day
n = states.env.day
return Calendar.weekdays[n % 7]
@ -56,7 +56,7 @@ init python:
def get_period(n=None):
if n is None:
n = game.day
n = states.env.day
return Calendar.periods[(n // 30) % 4]
@ -85,7 +85,7 @@ screen calendar:
xysize (64, 64)
if i > 29:
add "#888888"
elif i == (game.day % 30):
elif i == (states.env.day % 30):
add "#ff0000ff"
else:
add "#fff"

View File

@ -411,7 +411,7 @@ label .hermione_skip_intro:
$ firewhisky_ITEM.owned = 5
$ states.cupboard_rummaged_times = 6
$ game.day = 13
$ states.env.day = 13
$ achievements.unlock("start", True)
@ -505,8 +505,8 @@ label .hermione_skip_intro:
# ### Cho ###
# label .cho_skip_intro:
# if game.day < 16:
# $ game.day = 16
# if states.env.day < 16:
# $ states.env.day = 16
# $ states.cho.ev.intro.e1_complete = True
# $ states.cho.ev.intro.e2_complete = True
# $ states.sna.ev.hangouts.cho_e1 = True

View File

@ -3,7 +3,7 @@
label points_changes: # Gets called every day/night.
python hide:
progress_factor = max(1, int(math.log(game.day) * 5))
progress_factor = max(1, int(math.log(states.env.day) * 5))
# Bonuses based on Tonks and Snape friendship stat
# Tonks' is lower since you can do events with her directly to increase points.

View File

@ -41,7 +41,7 @@ init python:
def calc_reports_gold():
global reports_gold
progress_factor = math.log(game.day)
progress_factor = math.log(states.env.day)
progress_flat = (states.her.tier + states.cho.tier + states.ton.tier + states.lun.tier) * 16
# Note: random_gold global var is set at the start of the day and evening

View File

@ -365,7 +365,7 @@ screen stats_menuitem(current_category, current_item, stats_flags):
use text_stat("Bird petted:")
use text_stat("- ", " times -", states.bird_petted_times)
use text_stat("You missed feeding your bird for:")
use text_stat("- ", " days...", (game.day - states.bird_fed_times) )
use text_stat("- ", " days...", (states.env.day - states.bird_fed_times) )
use text_stat("If you were a Quidditch player, you'd be a:")
use text_stat("- \"", "\" -", states.gen.stats.quidditch_position)

View File

@ -42,7 +42,7 @@ screen ui_top_bar():
use ui_points
# Don't display buttons in certain rooms or on the first day
if states.room == "main_room" and game.day > 1:
if states.room == "main_room" and states.env.day > 1:
# Menu button
imagebutton:
xpos 0
@ -173,7 +173,7 @@ screen ui_stats():
hbox:
xpos 40 ypos 11
text "{size=-4}[game.day]{/size}"
text "{size=-4}[states.env.day]{/size}"
hbox:
xpos 140 ypos 11
# Display tokens in token shop
@ -212,14 +212,14 @@ screen ui_menu():
ypos 15
textbutton "Save" action ShowMenu("save") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ]
textbutton "Load" action ShowMenu("load") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ]
if states.env.cheats and states.env.difficulty <= 2 and game.day > 1:
if states.env.cheats and states.env.difficulty <= 2 and states.env.day > 1:
textbutton "Cheats" action [SetScreenVariable("toggle_menu", False), Jump("cheats")] background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ]
if game.day > 1 and renpy.android:
if states.env.day > 1 and renpy.android:
textbutton "Preferences" action ShowMenu("preferences") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ]
if game.day > 1 and persistent.game_complete:
if states.env.day > 1 and persistent.game_complete:
textbutton "Gallery" action [SetScreenVariable("toggle_menu", False), Jump("scene_gallery")] background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ]
#if game.day > 1 and config.developer:
#if states.env.day > 1 and config.developer:
# textbutton "{size=-11}Show Chars{/size}" action [SetScreenVariable("toggle_menu", False), Jump("summon_characters")] background "#000"
hbox:

View File

@ -35,8 +35,8 @@ init python:
def set_weather(value=None):
if value is None or value == "random":
period = Calendar.get_period()
weights = Weather._interpolate_weights(game.day, period)
rand = renpy.random.Random(seed=game.day)
weights = Weather._interpolate_weights(states.env.day, period)
rand = renpy.random.Random(seed=states.env.day)
value = rand.choices(Weather.weather_types, weights=weights)[0]
elif value not in Weather.weather_types:
@ -50,7 +50,7 @@ init python:
@staticmethod
def forecast(span=35):
forecast = {}
start_day = game.day - (game.day % 30)
start_day = states.env.day - (states.env.day % 30)
period = Calendar.get_period()
for i in range(span):

View File

@ -13,7 +13,7 @@ label an_odd_circumstance:
stop weather
$ states.env.daytime = False
$ game.weather = "clear"
$ game.day = 69
$ states.env.day = 69
$ states.env.gold = 420
$ hermione.equip(her_outfit_default)
call room("main_room")

Some files were not shown because too many files have changed in this diff Show More