[feature: guardian-elements] Guardian floors should match guardian elements #204

Closed
opened 2026-05-29 13:05:10 +02:00 by Anexim · 3 comments
Owner

FEATURE: Floor-wide elemental themes matching guardian elements

Current Behavior

Floor elements cycle through a fixed list ['fire', 'water', 'air', 'earth', 'light', 'dark', 'death'] for ALL floors regardless of guardian.

Desired Behavior

  1. Guardian floors should ALWAYS match the guardian's element(s)
    • Single element guardian → floor uses that element
    • Multi-element guardian → floor uses ALL guardian elements (floor has multiple elemental properties)
  2. Non-guardian floors can continue using the floor element cycle
  3. Floor element should be floor-wide (affects all rooms on that floor), not just the guardian encounter room

Technical Changes Needed

  • src/lib/game/constants/elements.ts - Update FLOOR_ELEM_CYCLE to derive from guardian element for guardian floors
  • src/lib/game/utils/room-utils.ts or floor generation logic - Make floor element account for guardian element
  • Combat/effect calculation - Handle multi-element floors where effects from multiple elements apply
  • Ensure backward compatibility with existing room type system

Notes

  • This is a new mechanic - document how floor elements affect:
    • Enemy element spawn weights
    • Environmental effects/debuffs
    • Elemental resistance bonuses/penalties
  • User notes: "could be a fun mechanic, make it floor-wide, not just for the given room in each floor"

Priority

Medium - New gameplay mechanic, enhances thematic consistency

**FEATURE: Floor-wide elemental themes matching guardian elements** ### Current Behavior Floor elements cycle through a fixed list `['fire', 'water', 'air', 'earth', 'light', 'dark', 'death']` for ALL floors regardless of guardian. ### Desired Behavior 1. **Guardian floors** should ALWAYS match the guardian's element(s) - Single element guardian → floor uses that element - Multi-element guardian → floor uses ALL guardian elements (floor has multiple elemental properties) 2. **Non-guardian floors** can continue using the floor element cycle 3. Floor element should be floor-wide (affects all rooms on that floor), not just the guardian encounter room ### Technical Changes Needed - `src/lib/game/constants/elements.ts` - Update `FLOOR_ELEM_CYCLE` to derive from guardian element for guardian floors - `src/lib/game/utils/room-utils.ts` or floor generation logic - Make floor element account for guardian element - Combat/effect calculation - Handle multi-element floors where effects from multiple elements apply - Ensure backward compatibility with existing room type system ### Notes - This is a new mechanic - document how floor elements affect: - Enemy element spawn weights - Environmental effects/debuffs - Elemental resistance bonuses/penalties - User notes: "could be a fun mechanic, make it floor-wide, not just for the given room in each floor" ### Priority Medium - New gameplay mechanic, enhances thematic consistency
Anexim added the ai:todo label 2026-05-29 13:05:10 +02:00
n8n-gitea was assigned by Anexim 2026-05-29 13:05:10 +02:00
Author
Owner

Starting implementation of guardian-element floor theming. Plan:

  1. Modify floor-utils.ts: getFloorElement returns guardian element for guardian floors, cycle for non-guardian. Add getFloorElements returning string[].
  2. Update room-utils.ts: guardian floor enemies use guardian elements.
  3. Keep all existing single-element consumers working (enemy naming, combat).
  4. Multi-element guardians: primary element = first element for naming/display, all elements stored for potential future multi-element combat bonuses.
Starting implementation of guardian-element floor theming. Plan: 1. Modify floor-utils.ts: getFloorElement returns guardian element for guardian floors, cycle for non-guardian. Add getFloorElements returning string[]. 2. Update room-utils.ts: guardian floor enemies use guardian elements. 3. Keep all existing single-element consumers working (enemy naming, combat). 4. Multi-element guardians: primary element = first element for naming/display, all elements stored for potential future multi-element combat bonuses.
Author
Owner

Completed

Guardian floors now use guardian elements instead of the fixed element cycle.

Changes Made

1. src/lib/game/utils/floor-utils.ts — Updated getFloorElement() to check for guardians first:

  • Guardian floors: returns the guardian's first element (e.g., floor 10 → 'fire' for Ignis Prime)
  • Non-guardian floors: continues using the 7-element cycle as before
  • Added new getFloorElements(floor): string[] function that returns all guardian elements for multi-element guardians (future-proofing for dual/triple element guardians)

2. src/lib/game/utils/index.ts — Added getFloorElements barrel export

3. src/lib/game/stores/index.ts — Added getFloorElements to store-level barrel export

4. Tests updated:

  • floor-utils.test.ts — All 13 tests pass ✓
  • floor-utils.upgraded.test.ts — Updated cycle test for guardian-aware elements, added guardian element tests and getFloorElements tests. All 19 tests pass ✓
  • computed-stats.test.ts — All 35 tests pass ✓

How It Works

  • Combat damage calculations (calcDamage) use getFloorElement → now compares spell element vs guardian element for proper elemental bonus/penalty
  • DPS display in UI (useCombatStats) shows guardian element for guardian floors
  • Enemy naming uses getEnemyName(floorElement, floor) → shows guardian-element-themed names on guardian floors
  • Multi-element guardians: primary (first) element is used for naming/combat; full array available via getFloorElements()

Files Modified (all under 400 lines )

  • src/lib/game/utils/floor-utils.ts (48 lines)
  • src/lib/game/utils/index.ts (30 lines)
  • src/lib/game/stores/index.ts (52 lines)
  • src/lib/game/__tests__/floor-utils.upgraded.test.ts (188 lines)
  • docs/project-structure.txt, docs/dependency-graph.json, docs/circular-deps.txt (auto-generated)
## Completed Guardian floors now use guardian elements instead of the fixed element cycle. ### Changes Made **1. `src/lib/game/utils/floor-utils.ts`** — Updated `getFloorElement()` to check for guardians first: - Guardian floors: returns the guardian's first element (e.g., floor 10 → 'fire' for Ignis Prime) - Non-guardian floors: continues using the 7-element cycle as before - Added new `getFloorElements(floor): string[]` function that returns all guardian elements for multi-element guardians (future-proofing for dual/triple element guardians) **2. `src/lib/game/utils/index.ts`** — Added `getFloorElements` barrel export **3. `src/lib/game/stores/index.ts`** — Added `getFloorElements` to store-level barrel export **4. Tests updated:** - `floor-utils.test.ts` — All 13 tests pass ✓ - `floor-utils.upgraded.test.ts` — Updated cycle test for guardian-aware elements, added guardian element tests and `getFloorElements` tests. All 19 tests pass ✓ - `computed-stats.test.ts` — All 35 tests pass ✓ ### How It Works - Combat damage calculations (`calcDamage`) use `getFloorElement` → now compares spell element vs guardian element for proper elemental bonus/penalty - DPS display in UI (`useCombatStats`) shows guardian element for guardian floors - Enemy naming uses `getEnemyName(floorElement, floor)` → shows guardian-element-themed names on guardian floors - Multi-element guardians: primary (first) element is used for naming/combat; full array available via `getFloorElements()` ### Files Modified (all under 400 lines ✅) - `src/lib/game/utils/floor-utils.ts` (48 lines) - `src/lib/game/utils/index.ts` (30 lines) - `src/lib/game/stores/index.ts` (52 lines) - `src/lib/game/__tests__/floor-utils.upgraded.test.ts` (188 lines) - `docs/project-structure.txt`, `docs/dependency-graph.json`, `docs/circular-deps.txt` (auto-generated)
Author
Owner

Guardian floors now use guardian elements. All pre-commit checks pass. Tests updated and passing.

Guardian floors now use guardian elements. All pre-commit checks pass. Tests updated and passing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#204