67 lines
2.2 KiB
Markdown

# Configurable Reactions
**Configurable Reactions** is a Foundry VTT 14 module for configurable automatic reactions assigned to actors or concrete token instances.
The module is designed as a generic reaction engine:
```text
Trigger -> Conditions -> Consumption -> Actions
```
## Current scope
This repository is an initial module skeleton. It includes:
- World-level reaction storage
- World-level assignment storage
- A GM configuration app opened through Foundry module settings
- A graphical drag-and-drop builder for trigger and action JSON blocks
- Assignment of a configured reaction to selected tokens
- Linked-token handling: linked tokens assign the reaction to the Actor
- Unlinked-token handling: unlinked tokens assign the reaction to the TokenDocument
- Managed flags and optional managed ActiveEffects
- A reaction engine skeleton
- A damage-received trigger skeleton for dnd5e
- Action handlers for:
- applying statuses
- teleporting a token
- opening/using an inventory item placeholder
- casting a spell placeholder
## Important design rules
For teleport actions:
- `askOwner === true`: the owner should choose the target, then the GM validates it.
- `askOwner === false`: the GM chooses a random valid target.
- The target must always be reachable.
- The target must never be blocked by movement walls.
- The target must never be occupied by another token.
- The target must remain inside scene bounds.
- If no valid random target is found within `maxAttempts`, the teleport fails.
- `consumeOnFailure` is configurable.
## Installation during development
Clone or copy this repository into Foundry's `Data/modules` directory:
```bash
cd /path/to/FoundryVTT/Data/modules
git clone <your-remote-url> configurable-reactions
```
Restart Foundry and enable **Configurable Reactions** in the world. The configuration dialog is available under **Configure Settings → Module Settings → Configurable Reactions → Configure**.
## Development workflow
This repository is initialized as a Git repository. You can set a remote URL afterwards:
```bash
git remote add origin <your-remote-url>
git push -u origin main
```
## Status
Initial development scaffold. Not yet a production-ready automation module.