2022-05-16 23:48:22 +00:00
|
|
|
#TODO Move variable defaults to appropriate files, leave common ones here (and rename this file to _Variables_.rpy or something)
|
|
|
|
init offset = -1
|
|
|
|
|
|
|
|
default current_payout = 0
|
|
|
|
|
|
|
|
# House points
|
|
|
|
default slytherin = 35
|
|
|
|
default gryffindor = 122
|
|
|
|
default hufflepuff = 25
|
|
|
|
default ravenclaw = 31
|
|
|
|
|
|
|
|
# Used to pause events/summons for a number of days
|
|
|
|
default ss_event_pause = 0
|
|
|
|
default ss_summon_pause = 0
|
|
|
|
default nt_event_pause = 0
|
|
|
|
default nt_summon_pause = 0
|
|
|
|
default hg_event_pause = 0
|
|
|
|
default hg_summon_pause = 0
|
|
|
|
default cc_event_pause = 0
|
|
|
|
default cc_summon_pause = 0
|
|
|
|
default ll_event_pause = 0
|
|
|
|
default ll_summon_pause = 0
|
|
|
|
default ag_event_pause = 0
|
|
|
|
default ag_summon_pause = 0
|
|
|
|
default sb_event_pause = 0
|
|
|
|
default sb_summon_pause = 0
|
|
|
|
|
|
|
|
# Sprite positioning
|
|
|
|
default nxpos = 0
|
|
|
|
default nypos = 0
|
2024-04-25 18:49:09 +00:00
|
|
|
|
|
|
|
init python:
|
2024-04-26 23:41:38 +00:00
|
|
|
import functools
|
|
|
|
|
2024-04-25 18:49:09 +00:00
|
|
|
class Environment(object):
|
|
|
|
"""Encapsulation for special variables and flags."""
|
|
|
|
|
|
|
|
def __init__(self):
|
2024-04-26 23:41:38 +00:00
|
|
|
# Pseudo-constants
|
|
|
|
self._seed = renpy.random.randint(0, 999999)
|
|
|
|
|
|
|
|
# Protected
|
2024-04-25 18:49:09 +00:00
|
|
|
self._gold = 0
|
2024-04-25 19:39:50 +00:00
|
|
|
self._tokens = 0
|
2024-04-25 18:49:09 +00:00
|
|
|
self._day = 0
|
|
|
|
self._gryf = 0
|
|
|
|
self._slyt = 0
|
|
|
|
self._rave = 0
|
|
|
|
self._huff = 0
|
|
|
|
self._weather = "clear"
|
|
|
|
|
|
|
|
# Normal values
|
|
|
|
self.daytime = True
|
|
|
|
self.difficulty = 2
|
|
|
|
self.cheats = False
|
|
|
|
self.moon = True
|
|
|
|
|
|
|
|
@property
|
|
|
|
def gold(self):
|
|
|
|
return self._gold
|
|
|
|
|
|
|
|
@gold.setter
|
|
|
|
def gold(self, value):
|
|
|
|
old = self._gold
|
|
|
|
self._gold = max(0, min(value, 99999))
|
|
|
|
|
|
|
|
if not renpy.in_rollback() and not _in_replay:
|
2024-04-25 19:39:50 +00:00
|
|
|
renpy.hide_screen("currency")
|
|
|
|
renpy.show_screen("currency", old, self._gold, "💰")
|
|
|
|
|
|
|
|
@property
|
|
|
|
def tokens(self):
|
|
|
|
return self._tokens
|
|
|
|
|
|
|
|
@tokens.setter
|
|
|
|
def tokens(self, value):
|
|
|
|
old = self._tokens
|
|
|
|
self._tokens = max(0, min(value, 99999))
|
|
|
|
|
|
|
|
if not renpy.in_rollback() and not _in_replay:
|
|
|
|
renpy.hide_screen("currency")
|
|
|
|
renpy.show_screen("currency", old, self._tokens, "🪙")
|
2024-04-25 18:49:09 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def day(self):
|
|
|
|
return self._day
|
|
|
|
|
|
|
|
@day.setter
|
|
|
|
def day(self, value):
|
|
|
|
self._day = max(0, value)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def weather(self):
|
2024-04-25 19:39:50 +00:00
|
|
|
return self._weather
|
2024-04-25 18:49:09 +00:00
|
|
|
|
|
|
|
@weather.setter
|
|
|
|
def weather(self, value):
|
2024-04-25 19:39:50 +00:00
|
|
|
self._weather = Weather.set_weather(value)
|
2024-04-25 18:49:09 +00:00
|
|
|
|
2024-04-26 23:41:38 +00:00
|
|
|
@property
|
|
|
|
def seed(self):
|
|
|
|
return self._seed
|
|
|
|
|
|
|
|
@functools.lru_cache(maxsize=35)
|
|
|
|
def _random(self, day):
|
|
|
|
seed = self.seed + day
|
|
|
|
return renpy.random.Random(seed)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def random(self):
|
|
|
|
return self._random(self.day)
|
|
|
|
|
2024-04-25 18:49:09 +00:00
|
|
|
default states.env = Environment()
|