Files
Mana-Loop/docs/specs/attunements/fabricator/fabricator-spec.md
T
n8n-gitea b506f0bcc3
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m18s
feat: implement DoT/debuff runtime system (spec §6, AC-12, AC-13)
- Add ActiveEffect, EffectType types to game.ts; activeEffects + effectiveArmor on EnemyState
- Add SpellOnHitEffect + onHitEffect field to SpellDefinition
- Wire onHitEffect to fire (burn), death (curse), lightning (armor_corrode), frost (freeze), soul (bypassArmor burn)
- Add applyOnHitEffect() — applies on-hit effect on successful spell hit (spec §6.2)
- Add processDoTPhase() — ticks all active effects after weapon/golem attacks (spec §6.3)
- Add bypassArmor/bypassBarrier support in applyEnemyDefenses() (AC-13)
- Export standalone applyEnemyDefenses from combat-tick.ts for DoT pipeline
- Split DoT runtime into separate dot-runtime.ts (135 lines) to keep combat-actions.ts under 400 lines
- Update all enemy generation sites with activeEffects/effectiveArmor defaults
- Fix test helpers for new required fields

All 921 tests pass (45 test files)
2026-06-03 18:38:01 +02:00

265 lines
7.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Fabricator Attunement — Design Spec
> Describes the Fabricator attunement: identity, unlock flow, mana behavior, full
> discipline list with stats/perks, systems unlocked, and attunement level interactions.
---
## 1. Objective
The Fabricator is the crafting and golemancy attunement. It provides access to
Earth-based disciplines that unlock equipment fabrication recipes, golem summoning,
and crafting cost reduction. The Fabricator is the primary source of custom
equipment and the golem combat system.
---
## 2. Identity
| Property | Value |
|---|---|
| **ID** | `fabricator` |
| **Slot** | `leftHand` |
| **Icon** | `⚒️` |
| **Color** | `#F4A261` (Earth) |
| **Primary Mana** | `earth` |
| **Raw Mana Regen** | +0.4/hour (base, scales with `1.5^(level-1)`) |
| **Conversion Rate** | 0.25 raw→earth/hour (base, scales with `1.5^(level-1)`) |
| **Unlock** | Prove crafting worth |
| **Capabilities** | `['golemCrafting', 'gearCrafting', 'earthShaping']` |
| **Skill Categories** | `['fabrication', 'golemancy']` |
---
## 3. Unlock Condition and Flow
**Condition:** Prove your worth as a crafter.
**Unlock flow:**
1. Meet the crafting-related unlock condition
2. Fabricator becomes available for activation
3. Player activates Fabricator → initialized at `{ active: true, level: 1, experience: 0 }`
4. Fabricator disciplines become available (5 total)
The unlock condition is stored as a descriptive string:
`"Prove your worth as a crafter"`
---
## 4. Raw Mana Regen Contribution
Base regen: **+0.4/hour** (at level 1). Scales exponentially:
```
effectiveRegen = 0.4 × 1.5^(level - 1)
```
| Level | Raw Regen |
|---|---|
| 1 | 0.400/hr |
| 5 | 2.025/hr |
| 10 | 15.377/hr |
---
## 5. Mana Conversion Behavior
The Fabricator converts raw mana to Earth:
```
effectiveConversionRate = 0.25 × 1.5^(level - 1)
```
At level 10, the Fabricator converts **9.61 raw→earth/hour**.
---
## 6. Disciplines
The Fabricator's discipline pool contains **5 disciplines**.
### 6.1 Golem Crafting (`golem-crafting`)
| Field | Value |
|---|---|
| **Mana Type** | `earth` |
| **Base Cost** | 10 |
| **Stat Bonus** | `golemCapacity` +2 (base) |
| **Scaling Factor** | 80 |
| **Difficulty Factor** | 150 |
| **Drain Base** | 4 |
**Perks:**
| Perk ID | Type | Threshold | Bonus |
|---|---|---|---|
| `golem-1` | `once` | 200 | Unlock golem summoning |
| `golem-2` | `capped` | 500 | +1 Golem Capacity per tier, interval 500 XP, max 2 tiers |
### 6.2 Crafting Efficiency (`crafting-efficiency`)
| Field | Value |
|---|---|
| **Mana Type** | `earth` |
| **Base Cost** | 12 |
| **Stat Bonus** | `craftingCostReduction` +15 (base) |
| **Scaling Factor** | 90 |
| **Difficulty Factor** | 180 |
| **Drain Base** | 6 |
**Perks:**
| Perk ID | Type | Threshold | Bonus |
|---|---|---|---|
| `efficiency-1` | `once` | 300 | +10% Crafting Cost Reduction |
### 6.3 Study Fabricator Recipes (`study-fabricator-recipes`)
| Field | Value |
|---|---|
| **Mana Type** | `earth` |
| **Base Cost** | 10 |
| **Stat Bonus** | `enchantPower` +3 (base) |
| **Scaling Factor** | 80 |
| **Difficulty Factor** | 100 |
| **Drain Base** | 2 |
**Perks:**
| Perk ID | Type | Threshold | Unlocks |
|---|---|---|---|
| `fabricator-earth` | `once` | 50 | `earthHelm`, `earthChest`, `earthBoots` |
| `fabricator-metal` | `once` | 100 | `metalBlade`, `metalShield`, `metalGloves` |
| `fabricator-sand` | `once` | 150 | `sandBoots`, `sandGloves`, `sandVest` |
| `fabricator-crystal` | `once` | 200 | `crystalWand`, `crystalRing`, `crystalAmulet` |
### 6.4 Study Wizard Equipment (`study-wizard-branch`)
| Field | Value |
|---|---|
| **Mana Type** | `earth` |
| **Base Cost** | 15 |
| **Requires** | `study-fabricator-recipes` |
| **Stat Bonus** | `enchantPower` +5 (base) |
| **Scaling Factor** | 100 |
| **Difficulty Factor** | 150 |
| **Drain Base** | 3 |
**Perks:**
| Perk ID | Type | Threshold | Unlocks |
|---|---|---|---|
| `wizard-oak` | `once` | 50 | `oakStaff` |
| `wizard-arcanist-staff` | `once` | 100 | `arcanistStaff` |
| `wizard-battlestaff` | `once` | 150 | `battlestaff` |
| `wizard-arcanist-gear` | `once` | 200 | `arcanistCirclet`, `arcanistRobe` |
| `wizard-void-catalyst` | `once` | 250 | `voidCatalyst` |
| `wizard-arcanist-pendant` | `once` | 300 | `arcanistPendant` |
### 6.5 Study Physical Equipment (`study-physical-branch`)
| Field | Value |
|---|---|
| **Mana Type** | `earth` |
| **Base Cost** | 15 |
| **Requires** | `study-fabricator-recipes` |
| **Stat Bonus** | `enchantPower` +5 (base) |
| **Scaling Factor** | 100 |
| **Difficulty Factor** | 150 |
| **Drain Base** | 3 |
**Perks:**
| Perk ID | Type | Threshold | Unlocks |
|---|---|---|---|
| `physical-crystal-blade` | `once` | 50 | `crystalBlade` |
| `physical-arcanist-blade` | `once` | 100 | `arcanistBlade` |
| `physical-void-blade` | `once` | 150 | `voidBlade` |
| `physical-battle-gear` | `once` | 200 | `battleHelm`, `battleRobe` |
| `physical-battle-boots` | `once` | 250 | `battleBoots` |
| `physical-combat-gauntlets` | `once` | 300 | `combatGauntlets` |
---
## 7. Systems Unlocked
The Fabricator attunement gates two systems:
1. **Golemancy** (see `golemancy-spec.md`): Summon and maintain golems for spire combat
2. **Item Fabrication** (see `item-fabrication-spec.md`): Craft equipment and materials from recipes
---
## 8. Puzzle Room Behavior
In the spire, every 7th floor has a puzzle room. When the room type is
`fabricator_trial`, progress scales at 2.53% per tick per Fabricator level.
---
## 9. Attunement Level Interactions
Higher Fabricator level affects:
1. **Raw mana regen**: `0.4 × 1.5^(level-1)` per hour
2. **Earth conversion rate**: `0.25 × 1.5^(level-1)` per hour
3. **Golem slots**: `floor(fabricatorLevel / 2)` — Fabricator level directly determines golem capacity
| Fabricator Level | Golem Slots |
|---|---|
| 1 | 0 |
| 23 | 1 |
| 45 | 2 |
| 67 | 3 |
| 89 | 4 |
| 10 | 5 |
---
## 10. Discipline Dependency Chain
```
golem-crafting (root)
crafting-efficiency (root)
study-fabricator-recipes (root)
└── study-wizard-branch
└── study-physical-branch
```
3 root disciplines. Maximum dependency depth: 2.
---
## 11. Acceptance Criteria
| # | Criterion |
|---|---|
| AC-1 | Fabricator is locked until the unlock condition is met. |
| AC-2 | All 5 Fabricator disciplines are available when Fabricator is active. |
| AC-3 | `study-wizard-branch` and `study-physical-branch` require `study-fabricator-recipes`. |
| AC-4 | Golem summoning is unlocked at Golem Crafting discipline threshold 200 XP. |
| AC-5 | Golem capacity is 2 (base) + up to 2 (from capped perk) = max 4 from disciplines. |
| AC-6 | Golem slots from attunement level: `floor(fabricatorLevel / 2)`, max 5 at level 10. |
| AC-7 | All recipe unlock perks fire at the correct discipline XP thresholds. |
| AC-8 | Crafting Efficiency discipline reduces material costs by 15% (base) + 10% (perk). |
| AC-9 | Fabricator `fabricator_trial` puzzle rooms grant bonus progress per Fabricator level. |
| AC-10 | Fabricator level scales raw regen and earth conversion by `1.5^(level-1)`. |
---
## 12. Files Reference
| File | Role |
|---|---|
| `src/lib/game/data/attunements.ts` | Fabricator definition |
| `src/lib/game/data/disciplines/fabricator.ts` | Fabricator disciplines (5) |
| `src/lib/game/data/golems/` | Golem definitions (10 golems) |
| `src/lib/game/crafting-fabricator.ts` | Fabrication crafting logic |
| `src/lib/game/data/fabricator-recipes.ts` | Core equipment recipes |
| `src/lib/game/data/fabricator-material-recipes.ts` | Material recipes |
| `src/lib/game/data/fabricator-physical-recipes.ts` | Physical branch recipes |
| `src/lib/game/data/fabricator-wizard-recipes.ts` | Wizard branch recipes |
| `src/components/game/tabs/GolemancyTab.tsx` | Golemancy UI |
| `docs/specs/attunements/fabricator/systems/golemancy-spec.md` | Golemancy system spec |
| `docs/specs/attunements/fabricator/systems/item-fabrication-spec.md` | Item fabrication spec |