From 0a213edac31f73eb904f722a450735a52ccac286 Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Tue, 23 Apr 2024 19:26:24 +0100 Subject: [PATCH] Calendar + Paperwork + Moon phases * Added simple calendar * Added half-moon phase (Artwork pending) * Made moon phases cyclical rather than random * Refactored paperwork and moon bonuses --- game/scripts/interface/calendar.rpy | 56 +++++++++++++++++++ game/scripts/inventory/game.rpy | 4 +- game/scripts/rooms/main_room/init.rpy | 3 +- game/scripts/rooms/main_room/objects/desk.rpy | 23 +++----- 4 files changed, 66 insertions(+), 20 deletions(-) create mode 100644 game/scripts/interface/calendar.rpy diff --git a/game/scripts/interface/calendar.rpy b/game/scripts/interface/calendar.rpy new file mode 100644 index 00000000..99fc4560 --- /dev/null +++ b/game/scripts/interface/calendar.rpy @@ -0,0 +1,56 @@ +init python: + class Calendar(object): + def __init__(self): + pass + + def get(self, span=35): + contents = {i: "" for i in range(span)} + + # Add moon cycles + for i in range(span): + if (i % 7 == 0): + contents[i] += "🌕" + elif (i % 7 == 3): + contents[i] += "🌓" + # elif (game.day % 60 == 30) # Blood moon + + # Add letters + letters = mailbox.get_letters(True) + for i in letters: + contents[game.day+i.wait] += "✉️" + + # Add parcels + parcels = mailbox.get_parcels(True) + for i in parcels: + contents[game.day+i.wait] += "📦" + + return contents + +default calendar = Calendar() + +label calendar: + call screen calendar + jump main_room_menu + +screen calendar: + default contents = calendar.get().items() + grid 7 5: + style "empty" + align (0.5, 0.5) + + for i, ev in contents: + fixed: + xysize (64, 64) + if i > 29: + add "#888888" + elif i == game.day: + add "#ff0000ff" + else: + add "#fff" + + hbox: + text "[(i % 30) + 1]" size 10 color "#000" + text "[ev]" size 24 + + + textbutton "Close" action Return() align (0.5, 0.9) diff --git a/game/scripts/inventory/game.rpy b/game/scripts/inventory/game.rpy index 6f7fa0cf..d7a512b8 100644 --- a/game/scripts/inventory/game.rpy +++ b/game/scripts/inventory/game.rpy @@ -65,9 +65,7 @@ init -100 python: raise ValueError(f"Unsupported weather type: {value!r}") self._weather = value - - moon_cycle = renpy.random.randint(5, 9) - self.moon = (self.day % moon_cycle == 0) + self.moon = (self.day % 7 == 0) screen gold(old, new): tag gold diff --git a/game/scripts/rooms/main_room/init.rpy b/game/scripts/rooms/main_room/init.rpy index afb553ee..e39ba1d7 100644 --- a/game/scripts/rooms/main_room/init.rpy +++ b/game/scripts/rooms/main_room/init.rpy @@ -8,7 +8,8 @@ default cupboard_OBJ = RoomObject( idle="cupboard_idle", action={ "Open Inventory": (Text("🎒", align=(0.5, 0.5)), Jump("inventory"), "True"), - "Rummage": (Text("🖐️", align=(0.5, 0.5)), Jump("cupboard"), "True") + "Rummage": (Text("🖐️", align=(0.5, 0.5)), Jump("cupboard"), "True"), + "Calendar": (Text("📆", align=(0.5, 0.5)), Jump("calendar"), "True"), }, tooltip="Cupboard" ) diff --git a/game/scripts/rooms/main_room/objects/desk.rpy b/game/scripts/rooms/main_room/objects/desk.rpy index d02a3773..18f21111 100644 --- a/game/scripts/rooms/main_room/objects/desk.rpy +++ b/game/scripts/rooms/main_room/objects/desk.rpy @@ -315,8 +315,11 @@ label paperwork: call paperwork_progress_chapter - if not game.daytime and game.moon: - call paperwork_full_moon + if not game.daytime and (game.day % 7 == 0): + call paperwork_progress_chapter("The Full moon makes you feel vastly more productive.\n", bonus=2) + + if not game.daytime and (game.day % 7 == 3): + call paperwork_progress_chapter("The half moon makes you feel more productive.\n") call gen_chibi("sit_behind_desk") @@ -335,8 +338,8 @@ label paperwork_report_check: return -label paperwork_progress_chapter(message = ""): - $ states.paperwork_chapters += 1 +label paperwork_progress_chapter(message="", bonus=1): + $ states.paperwork_chapters += bonus call notes if states.paperwork_chapters == 1: @@ -347,18 +350,6 @@ label paperwork_progress_chapter(message = ""): call paperwork_report_check return -label paperwork_full_moon: - call paperwork_progress_chapter("The Full moon makes you feel more productive.\n") - return - -label paperwork_concentration: - call paperwork_progress_chapter("You maintain perfect concentration during your work and finish another chapter of the report.\n") - return - -label paperwork_speedwriting: - call paperwork_progress_chapter("You use your Speedwriting skills and finish another chapter of the report.\n") - return - screen gui_tooltip(img=None, xx=335, yy=210): add img xpos xx ypos yy zorder 3