Values
Default Number Pattern
A default number pattern describes, for this game, how a set or range of numbers can be described in a string.
Many objects, like Conditions, accept either numbers or a string containing this default number pattern.
This pattern consists of multiple possible notations:
- Simple Number
- Represents a single number
- e.g.: "8", "15", "144"
- Positive Range
- Represents a range of numbers starting from the defined value extending towards positive infinity
- For example in a Condition "4+" would mean, when the value is 4 or higher, it would be fulfilled
- e.g.: "3+", "26+", "843+"
- Negative Range
- Represents a range of numbers starting from the defined value extending towards negative infinity
- For example in a Condition "9-" would mean, when the value is 9 or lower, it would be fulfilled
- e.g.: "6-", "62-", "678-"
- Limited Range
- Represents a range of numbers between two limits
- For example in A Condition "1-10" would mean, when the value is between 1 and 10, including 1 and 10, it would be fulfilled
- e.g.: "3-7", "4-239", "40-49", "384-2"
- The order of numbers is not important. Even if the range starts with the larger value and ends with the smaller value, the game still checks if it is in between both.
Finally, all of those notations can be combined by listing them separated by a ",".
It for example could look like this: "4,35,70-100,1000+".
This example would then be fulfilled when the value is either 4, 35, between 70 and 100 or larger or equal to 1000.
EventStorage
h{pt A class that is designed to manage and store events within the game.}c!pp
class EventStorage(name: str, location: str, *options: Option, fallback: Event = None, fallback_text: str = "There is nothing to do here")
The
EventStorage
class is designed to manage and store events within the game. It provides methods to handle event data, update event states, and manage event conditions.The storage is able to select a single or a set of events based on their conditions and if they are fulfilled.
This Storage type stores the Event based on their select_type.
Parameters:
name: str
- The name of the storage.
- Used to reidentify the Storage
location: str
- The location the Storage should be part of.
- The location is either one of the games map locations or "misc"
- Possible values: "bath", "beach", "cafeteria", "courtyard", "gym", "kiosk", "labs", "office_building", "school_building", "school_dormitory", "sports_field", "staff_lodges", "swimming_pool", "misc"
*options: Option
- A set of options to configure the Storage
- A List of Options can be found here:
fallback: Event (default: None)
- A fallback Event that is called instead, in case none of the Events stored are available
- If fallback is None, a default fallback event is called using the locations background image and the provided fallback text
fallback_text: str (default: "There is nothing to do here.")
- The text that is displayed in case the Storage calls the default fallback event
Methods:
is_fulfilled(**kwargs) -> bool
Returns whether the stats of the character fulfill the condition
Parameters:
- **kwargs
- Additional arguments
- Method possibly checks for key 'char_obj' in kwargs looking for a Character Object
Returns:
- bool
- Whether the condition is fulfilled or not
to_list_text(**kwargs) -> Tuple[str, str] | Tuple[str, str, str] | List[Tuple[str, str] | Tuple[str, str, str]]
Returns the description text for the condition that is displayed in the display list.
If multiple stats are checked, the condition is displayed as a list.
Parameters:
- **kwargs
- Additional arguments
- Method possibly checks for key 'char_obj' in kwargs looking for a Character Object
Returns:
- Tuple[str, str] | Tuple[str, str, str] | List[Tuple[str, str] | Tuple[str, str, str]]
-
The condition text for the display list.
- The first element is the icon, the second element is the value and the third element is the title.
-
The title is optional.
-
Multiple conditions can be returned as a list.
-
to_desc_text(**kwargs) -> str | List[str]
Returns the description text for the condition that is displayed in the description.
If multiple stats are checked, the condition is displayed as a list.
Parameters:
- **kwargs
- Additional arguments
- Method possibly checks for key 'char_obj' in kwargs looking for a Character Object
Returns:
-
str | List[str]
-
The condition text for the description.
-
Multiple conditions can be returned as a list.
-
get_name() -> str
Returns the name of the condition.
If multiple stats are checked, the condition is displayed as a comma separated list.
Returns:
- str
- A List of checked Stats
- Multiple stats are seperated by commas
get_diff(char_obj: Char) -> num
Returns the difference between the condition and the given character.
If the condition difference is lower than -20, the difference is multiplied by 10.
If the condition difference is lower than -10, the difference is multiplied by 5.
If the condition difference is lower than -5, the difference is multiplied by 2.
Otherwise the difference is returned as is.
If the condition difference is lower than -20, the difference is multiplied by 10.
If the condition difference is lower than -10, the difference is multiplied by 5.
If the condition difference is lower than -5, the difference is multiplied by 2.
Otherwise the difference is returned as is.
This method is used to calculate the probability of the PTA approving.
Parameters:
- char_obj: Char
- The character to compare the condition to.
Returns:
- num
- The difference between the condition and the given character
Examples:
StatCondition("school", inhibition = 90)
StatCondition(True, corruption = "20-30")
StatCondition(happiness = "1,2,5,6")
StatCondition(education = "10+", charm = "90-")
StatCondition(reputation = "1,10-20,50+")