Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Release v0.2.1 (#4)
Browse files Browse the repository at this point in the history
* Remove redundant check

* Fix interaction fails counter

- Fix counter.
- Add prefix for all interactions.
  • Loading branch information
AnonymousX86 authored Nov 20, 2023
1 parent e157f96 commit bf86d80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 0 additions & 2 deletions FTE/chapters/one.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ def chapter_one() -> None:
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...')
Expand Down
13 changes: 8 additions & 5 deletions FTE/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def __init__(
self._all_locations: tuple[Location] = all_locations
self._all_characters: tuple[Character] = all_characters
self._location: Location = starting_location
self.fails = 0

@property
def location(self) -> Location:
Expand Down Expand Up @@ -196,7 +197,6 @@ def go_to(
# return (True, character.hook)

def interaction(self) -> Character | Location | None:
fails = 0
query = ''
while not query:
try:
Expand All @@ -212,18 +212,21 @@ def interaction(self) -> Character | Location | None:
[command, argument] = query.split(' ', 1)
command = commands.get(command)
if not command:
self.fails += 1
self._prefix()
if fails > 3:
console.print('Psst, you can use `help`')
if self.fails >= 3:
console.print('Psst, you can use `help`.')
else:
console.print('I\'m not sure what do you mean')
fails += 1
console.print('I\'m not sure what do you mean.')
return None
self.fails = 0
match command.name:
case 'exit':
self._prefix()
console.print('Goodbye!')
exit()
case 'help':
self._prefix()
if not argument:
console.print(Text.assemble(
'Available commands',
Expand Down

0 comments on commit bf86d80

Please sign in to comment.