SnootGame/game/utility.rpy
san7890 ef4764b322 get_ending to not be numerically based, but instead enum-based. (#219)
Co-authored-by: san7890 <the@san7890.com>
Reviewed-on: https://git.cavemanon.xyz/Cavemanon/SnootGame/pulls/219
Co-authored-by: san7890 <san7890@noreply.git.cavemanon.xyz>
Co-committed-by: san7890 <san7890@noreply.git.cavemanon.xyz>
2023-05-07 00:44:59 +00:00

33 lines
1.1 KiB
Text

## Utility functions for game setup, debugging etc.
init python:
from enum import Enum
# Create compile-time macros to more easily track what ending goes to what without the need for magic numbers or strings that can be mistyped
class Endings(Enum):
Shooter = 0
Doomer = 1
Tradwife = 2
Golden = 3
label initstats(anon=0, fang=0, trad=False):
# Sets various game-related global variables
# :param int anon: Anon's score
# :param int fang: Fang's score
# :param bool trad: Tradwife ending flag
$ anonscore = anon
$ fangscore = fang
$ tradwife = trad
return
label get_ending:
# To check what ending we're getting, call this label and then check the value of _return
# Sensible to have this logic defined in only one place for consistency
if anonscore >= 4 and fangscore >= 4 and wingStory:
return(Endings.Golden)
elif anonscore >= 3 and fangscore <=4:
return(Endings.Tradwife)
elif anonscore <= 3 and fangscore >=3:
return(Endings.Doomer)
else:
return(Endings.Shooter)