Metadata-Version: 2.4
Name: richeradventurelib
Version: 2.0.0
Summary: A minimal library for writing text adventure games in Python 3, now with rich text!
License-File: LICENSE
Author: Paya Maroufi
Author-email: h2o.Drop2010+hackclub@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Education
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Education
Classifier: Topic :: Games/Entertainment
Requires-Dist: rich (>=14.0.0,<15.0.0)
Description-Content-Type: text/markdown

# RicherAdventureLib

> [`adventurelib`](https://github.com/lordmauve/adventurelib) provides basic functionality for writing text-based adventure
>games, with the aim of making it easy enough for young teenagers to do.
>
>\- @lordmauve

`richeradventurelib` expands upon this by allowing programmers to implement colours and styles into their games using the [`rich` library](https://rich.readthedocs.io/)

Use bbcode-like syntax in your games (`[bold italic orange3 on blue]You are in the bedroom[/]`) and even add emojis (`:fire: You cast fireball :fire:`)!

Furthermore, `richeradventurelib` places the entire story interface inside a rich terminal layout, allowing the user to view the status of the game and their inventory, with many more configurable possibilities!

![Screenshot of demo gameplay](./demo_game_screenshot.png)

The foundation of adventurelib is the ability to define functions that are
called in response to commands. For example, you could write a function to
be called when the user types commands like "take hat":

```py
@when('take THING')
def take(thing):
	print(f'You take the {thing}.')
	inventory.append(thing)
```

It also includes the foundations needed to write games involving rooms, items,
characters and more... but users will have to implement these features for
themselves as they explore Python programming concepts.

## Usage

The usage of `richeradventurelib` is almost identical to that of the original `adventurelib` with a few additions:

Usually in an adventurelib game, you would have this at the very bottom of your file:

```python
look()
adv.start()
```

However, the introduction of the sidecar UI complicates this a bit more.
Firstly, you must define two variables: one for the state and one for the UI.

```python
import richeradventurelib as adv


TITLE = 'Moonfall Trail'

state = adv.GameState(title=TITLE, location_name='Lantern Cabin', tracked_vars={"health": 100, "strength": 10})
ui = adv.SidecarUI(title=TITLE, state=state)
```

Then at the very bottom of your file, you must start the UI, sync the state, and start the game with the UI provided.

```python
ui.start()
sync_state()
look()
adv.start(help=False, ui=ui)
```

Throughout the game, whenever you need to update a tracked variable, use `state.set_var(var, value)`

For example, when updating the health:

```python
state.set_var('health', 100)
```

## AI Acknowledgement

I used GitHub Copilot for a lot of the code in this project, namely the demo game and most of the implementation
of the sidecar layout. The exact amount could be found through this project's hackatime (reviewers have access I think?).

As of this commit, the AI usage for this project remains under 30% of the total time.

