This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5efb764
commit 5947fd9
Showing
14 changed files
with
526 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.11.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Run FTE", | ||
"type": "python", | ||
"request": "launch", | ||
"module": "FTE", | ||
"console": "integratedTerminal", | ||
"envFile": "${workspaceFolder}/.env", | ||
"justMyCode": true | ||
} | ||
] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
from os import getenv | ||
|
||
from FTE.chapters import chapter_one | ||
from FTE.menus import main_menu | ||
|
||
|
||
if __name__ == '__main__': | ||
if not bool(getenv('DEBUG', False)): | ||
main_menu() | ||
chapter_one() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
from .one import chapter_one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# -*- coding: utf-8 -*- | ||
from time import sleep | ||
|
||
from rich.text import Text | ||
|
||
from FTE.characters import Character, Standing | ||
from FTE.console import console | ||
from FTE.locations import Location | ||
from FTE.settings import DEBUG | ||
from FTE.utils import slow_print, slower_print, story | ||
from FTE.world import World | ||
|
||
def chapter_one() -> None: | ||
bridge = Location('Bridge') | ||
capsules = Location('Capsules') | ||
engine_deck = Location('Engine Deck') | ||
quarters = Location('Quarters') | ||
|
||
roommate = Character('Hevy', quarters, poke='Good to see you.', standing=Standing.GOOD) | ||
capitan = Character('Rex', bridge, poke='Yes sergant? Oh, wait.') | ||
pilot = Character('Mixiu', bridge, poke='What the fuck do you want?') | ||
engineer = Character('Tech', engine_deck, poke='We should invest in twin ion engines.') | ||
|
||
world = World( | ||
all_locations=(bridge, capsules, engine_deck, quarters), | ||
all_characters=(roommate, capitan, pilot, engineer), | ||
starting_location=quarters | ||
) | ||
|
||
console.clear() | ||
console.rule('Chapter I') | ||
console.print(3 * '\n') | ||
for line in [ | ||
'Year: 3015', | ||
'Ship: Epsilon IV', | ||
'Mission: Who cares?' | ||
]: | ||
slow_print(line, end='') | ||
slower_print('...') | ||
sleep(1.0 if DEBUG else 3.0) | ||
|
||
console.clear() | ||
console.rule('Chapter I') | ||
story([ | ||
'You wake up in your bed, someone is trying to talk to you, ' | ||
'but you\'re too sleepy to understand.', | ||
Text.assemble('You recognize them. I\'s your roommate - ', roommate.display_name, '.'), | ||
'He\'s shaking you and after a while you can finally understand him...' | ||
]) | ||
expect = ('no', 'yes') | ||
res = roommate.dialogue('Hey! Man! Are you dead already?') | ||
while res not in expect: | ||
res = roommate.dialogue('...') | ||
char_res = 'Unfortunately no' if res == 'yes' else 'That\'s great' | ||
roommate.monologue(f'{char_res}, now wake up and get a move on, of we\'re screwed.') | ||
roommate.action('Throws you your clothes.') | ||
roommate.monologue('Aight, you ready?') | ||
roommate.action('Claps to you.') | ||
roommate.monologue(Text.assemble( | ||
'We either go to ', | ||
capsules.display_name, | ||
' or to ', | ||
engine_deck.display_name, | ||
', I don\'t trust our engineers tho.' | ||
)) | ||
expect = (capsules, engine_deck) | ||
roommate.poke = 'There\'s no time, let\'s go!' | ||
while res != capsules and res != engine_deck: | ||
res = None | ||
while res is None: | ||
res = world.interaction() | ||
if not isinstance(res, Location): | ||
res = None | ||
if res == capsules: | ||
world.character_enters(roommate) | ||
roommate.monologue('This ship sucks either way...') | ||
else: | ||
engineer.monologue('Hey! What are you doing here?') | ||
world.character_enters(roommate) | ||
roommate.monologue('Don\'t worry, we\'re here to help.') | ||
|
||
story('...more coming soon!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# -*- coding: utf-8 -*- | ||
from enum import IntEnum | ||
from time import sleep | ||
|
||
from rich.style import Style | ||
from rich.text import Text | ||
|
||
from FTE.console import console | ||
from FTE.locations import Location | ||
from FTE.settings import DEBUG | ||
|
||
|
||
class Standing(IntEnum): | ||
GOOD = 10 | ||
NEUTRAL = 0 | ||
BAD = -10 | ||
|
||
|
||
class Character: | ||
def __init__( | ||
self, | ||
name: str, | ||
location: Location, | ||
*, | ||
poke: str = None, | ||
standing: Standing = None, | ||
known: bool = True | ||
) -> None: | ||
self.name: str = name | ||
self.location: Location = location | ||
self.poke: str = poke or '' | ||
self.standing: Standing = standing or Standing.NEUTRAL | ||
self.known: bool = known | ||
|
||
def __eq__(self, other) -> True: | ||
if isinstance(other, Character): | ||
return self.name == other.name | ||
return False | ||
|
||
@property | ||
def display_name(self) -> Text: | ||
return Text.assemble( | ||
self.name if self.known else '???', | ||
style=Style( | ||
bold=True, | ||
color=standing_color(self.standing) | ||
) | ||
) | ||
|
||
@property | ||
def pokable(self) -> bool: | ||
return bool(self.poke) | ||
|
||
def monologue(self, text: str | Text) -> None: | ||
console.print(Text.assemble('[ ', self.display_name, ' ] ', '"', text, '"')) | ||
sleep(0.0 if DEBUG else 1.5) | ||
|
||
def dialogue(self, text: str | Text) -> str: | ||
self.monologue(text) | ||
return console.input('> ').lower() | ||
|
||
def action(self, text: str | Text) -> None: | ||
console.print(Text.assemble( | ||
'[ ', self.display_name, ' ] ', | ||
Text.assemble('*', text, '*', style=Style(italic=True)) | ||
)) | ||
sleep(0.0 if DEBUG else 1.5) | ||
|
||
|
||
def standing_color(standing: Standing) -> str: | ||
if standing >= Standing.GOOD: | ||
return 'green4' | ||
if standing <= Standing.BAD: | ||
return 'red3' | ||
return 'sky_blue3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
from rich.console import Console | ||
|
||
console = Console(highlight=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
from rich.style import Style | ||
from rich.text import Text | ||
|
||
|
||
class Location: | ||
def __init__( | ||
self, | ||
name: str, | ||
*, | ||
known: bool = True | ||
) -> None: | ||
self.name: str = name | ||
self.known: bool = known | ||
|
||
@property | ||
def display_name(self) -> Text: | ||
return Text.assemble( | ||
self.name if self.known else '???', | ||
style=Style( | ||
bold=True, | ||
color='magenta' | ||
) | ||
) | ||
|
||
def __eq__(self, other) -> bool: | ||
if isinstance(other, Location): | ||
return self.name == other.name | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
from rich.style import Style | ||
|
||
from time import sleep | ||
|
||
from FTE.console import console | ||
|
||
def main_menu() -> None: | ||
while True: | ||
console.clear() | ||
console.rule('Main menu') | ||
console.print(''' | ||
_____ ____ __ __ ______ __ __ ___ ___ ____ ____ ____ ____ ___ _____ | ||
| || || | | | || | | / _] / _]| \ / || || \ / _]/ ___/ | ||
| __| | | | | | | || | | / [_ / [_ | _ || __| | | | _ | / [_( \_ | ||
| |_ | | |_ _| |_| |_|| _ || _] | _]| | || | | | | | | || _]\__ | | ||
| _] | | | | | | | | || [_ | [_ | | || |_ | | | | | || [_ / \ | | ||
| | | | | | | | | | | || | | || | || | | | | | || |\ | | ||
|__| |____||__|__| |__| |__|__||_____| |_____||__|__||___,_||____||__|__||_____| \___| | ||
''', | ||
justify='center', | ||
style=Style( | ||
bold=True | ||
)) | ||
console.print('1. Let\'s fix them!') | ||
console.print('2. Maybe later...') | ||
console.print('') | ||
choice = console.input('Your choice? ') | ||
if choice == '1': | ||
break | ||
elif choice == '2': | ||
console.print(':wave: Goodbye!') | ||
sleep(3.0) | ||
exit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
from os import getenv | ||
|
||
|
||
DEBUG: bool = bool(getenv('DEBUG', False)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -*- coding: utf-8 -*- | ||
from time import sleep | ||
|
||
from rich.text import Text | ||
|
||
from FTE.console import console | ||
from FTE.settings import DEBUG | ||
|
||
|
||
def print_with_interval(text: str, interval: float, end: str = '\n') -> None: | ||
for char in text: | ||
if not DEBUG: | ||
sleep(interval) | ||
console.print(char, end='') | ||
if not DEBUG: | ||
sleep(interval) | ||
console.print('', end=end) | ||
|
||
|
||
def slow_print(text: str, end: str = '\n') -> None: | ||
print_with_interval(text, 0.1, end) | ||
|
||
|
||
def slower_print(text: str, end: str = '\n') -> None: | ||
print_with_interval(text, 0.5, end) | ||
|
||
|
||
def story(text: str | Text | list[str | Text]) -> None: | ||
if isinstance(text, list): | ||
for seg in text: | ||
console.print(seg) | ||
if not DEBUG: | ||
sleep(5.0) | ||
else: | ||
console.print(text) |
Oops, something went wrong.