diff --git a/docs/gyms/tiny_sword/buildings/alchemy_tower/README.md b/docs/gyms/tiny_sword/buildings/alchemy_tower/README.md new file mode 100644 index 0000000..d32f141 --- /dev/null +++ b/docs/gyms/tiny_sword/buildings/alchemy_tower/README.md @@ -0,0 +1,55 @@ +# Alchemy Tower + +The Alchemy Tower is a building that passively produces **magic gold** and allows **crafting** other currencies through alchemical recipes. + +## Passive Production + +The tower runs a continuous production cycle. Once a cycle completes, magic gold is added to your balance and the next cycle begins with a slightly longer duration. + +| Data field | Default | Description | +|---|---|---| +| `base_production_time_seconds` | 5.0 | Duration of the first cycle (seconds) | +| `production_time_growth_multiplier` | 1.2 | Each completed cycle multiplies the next cycle's duration by this amount | +| `magic_gold_per_cycle` | 1.0 | Base magic gold produced per cycle | + +Production is only active when at least one worker is assigned and the tower is available in the game state. + +## Workers + +Workers are assigned by spending 1 **worker** currency per worker. Each assigned worker provides a **+10% speed bonus** to production (configurable via `base_worker_speed_bonus`). + +- Max workers: `max_workers` (default 10) +- The speed multiplier formula: `1.0 + (worker_count * base_worker_speed_bonus)` +- This multiplier affects both the rate time advances and the final cycle output + +The UI panel includes a worker counter and an "Assign Worker" button. The button is disabled when you have no workers available or have reached the max. + +## Crafting + +The crafting panel shows recipes from an `AlchemyCraftCatalogue` resource. Each recipe (`AlchemyCraftRecipe`) defines: + +- `id` — unique recipe identifier +- `output_currency` / `output_amount` — what you get +- `cost_entries` — array of `CurrencyCostEntry` resources, each specifying a currency and an amount + +To craft, click the recipe's button. The tower deducts all costs from your balance via `game_state.spend_currency()`. If any cost can't be covered, the craft fails silently and nothing is deducted. On success, the output currency is added to your balance. + +## Signals + +| Signal | Emitted when | +|---|---| +| `production_progress_updated(progress: float)` | Every frame during production; 0.0–1.0 | +| `production_completed(amount: BigNumber)` | A production cycle finishes | +| `magic_gold_balance_updated(amount: BigNumber)` | Magic gold balance changes | + +## Key Files + +| File | Purpose | +|---|---| +| `alchemy_tower.gd` | Main tower logic: production loop, worker management, crafting | +| `alchemy_tower_data.gd` | Configuration resource (`AlchemyTowerData`) | +| `alchemy_craftable_panel.gd` | UI panel (`AlchemyCurrenciesPanel`) for progress bar, balance, workers, and recipe list | +| `alchemy_craftable_panel_tile.gd` | Individual recipe tile in the crafting list | +| `recipes/alchemy_craft_catalogue.gd` | Catalogue resource holding all available recipes | +| `recipes/alchemy_craft_recipe.gd` | Single recipe resource | +| `recipes/currency_cost_entry.gd` | Cost entry for a single currency in a recipe |