Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max_values and getAll #11

Merged
merged 1 commit into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion game/tool/character_statistics.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ init 9 python:
notify_increase_dict: Optional[dict[str]] = None,
notify_decrease_dict: Optional[dict[str]] = None,
notify_dict: Optional[dict[str, NotifyEx]] = None,
max_values: int = 100,
):

self.memory = {}
self.memory.update(values if values else {})
self.notify_increase_dict = notify_increase_dict if notify_increase_dict else {}
self.notify_decrease_dict = notify_decrease_dict if notify_decrease_dict else {}
self.notify_dict = notify_dict if notify_dict else {}
self.max_values = max_values

def set(self, name: str, value: int) -> None:
"""Wiki: https://github.com/DRincs-Productions/DS-toolkit/wiki/Statistic#set """
Expand All @@ -31,8 +33,10 @@ init 9 python:
del self.memory[name]
return

def improve(self, name: str, amt: int = 1, max=100, min=0, show_notify= True) -> None:
def improve(self, name: str, amt: int = 1, max=None, min=0, show_notify= True) -> None:
"""Wiki: https://github.com/DRincs-Productions/DS-toolkit/wiki/Statistic#improvment """
if max == None:
max = self.max_values
if (self.get(name) != None):
if (amt > 0 and self.memory[name] >= max):
return
Expand Down Expand Up @@ -70,3 +74,11 @@ init 9 python:
elif name in self.notify_dict:
notify(self.notify_dict[name])
return

def getAll(self):
"""Wiki: https://github.com/DRincs-Productions/DS-toolkit/wiki/Statistic#getAll """
return self.memory

def getDefaultMaxValue(self):
"""Wiki: https://github.com/DRincs-Productions/DS-toolkit/wiki/Statistic#getDefaultMaxValue """
return self.max_values
4 changes: 3 additions & 1 deletion game/tool/character_statistics_sentimental.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ init 10 python:
bisexual: bool = False,
polyamorous: bool = False,
against=None,
addiction=None
addiction=None,
max_values: int = 100,
):

self.memory = {}
self.max_values = max_values
# Characteristics
if (gender_attracted != None):
self.improve(name="gender_attracted",
Expand Down