refactor: replace static guardians with elemental progression system

Replace the old GUARDIANS constant (arbitrary floor assignments) with a proper
elemental → compound → exotic → combo progression:

- Floors 10-70:  Base elements (Fire, Water, Air, Earth, Light, Dark, Death)
- Floor 80:       Utility element (Transference)
- Floors 90-110:  Compound elements (Metal, Sand, Lightning)
- Floors 120-140: Exotic elements (Crystal, Stellar, Void)
- Floor 150+:     Procedural combo guardians (scaling with floor)

Key changes:
- Create guardian-data.ts with BASE_GUARDIANS (14 static entries)
- Simplify guardian-encounters.ts to only handle procedural combos (150+)
- getGuardianForFloor() now generates names for empty-name entries
- Remove old compound/exotic duplicate definitions from guardian-encounters.ts
- Update spire-utils.test.ts to test the new progression
- Update SpireSummaryTab.test.ts floor counts (14 static + 10 combo = 24)

All 89 guardian-related tests pass. 3 pre-existing failures in
room-utils-floor-state.test.ts are unrelated (speed room / floor 0 edge cases).
This commit is contained in:
2026-05-23 17:02:48 +02:00
parent 513cab81a3
commit 4ee6222b0e
6 changed files with 282 additions and 303 deletions
+45 -28
View File
@@ -9,7 +9,7 @@ import {
getSpireRoomTypeDisplay,
SPIRE_CONFIG,
} from '../utils/spire-utils';
import { isGuardianFloor, getExtendedGuardian, getGuardianHP, generateGuardianName, generateComboGuardianName, ALL_GUARDIAN_FLOORS } from '../data/guardian-encounters';
import { isGuardianFloor, getExtendedGuardian, getGuardianForFloor, getGuardianHP, generateGuardianName, generateComboGuardianName, ALL_GUARDIAN_FLOORS } from '../data/guardian-encounters';
// ─── Spire Utils ─────────────────────────────────────────────────────────────
@@ -182,42 +182,59 @@ describe('isGuardianFloor', () => {
});
});
describe('getExtendedGuardian', () => {
it('should return compound guardians for floors 90, 110', () => {
const g90 = getExtendedGuardian(90);
expect(g90).not.toBeNull();
expect(g90!.element).toBe('metal');
expect(g90!.name).toBeTruthy();
const g110 = getExtendedGuardian(110);
expect(g110).not.toBeNull();
expect(g110!.element).toBe('lightning');
});
it('should return exotic guardians for floors 120, 130, 140', () => {
const g120 = getExtendedGuardian(120);
expect(g120).not.toBeNull();
expect(g120!.element).toBe('crystal');
const g130 = getExtendedGuardian(130);
expect(g130).not.toBeNull();
expect(g130!.element).toBe('stellar');
const g140 = getExtendedGuardian(140);
expect(g140).not.toBeNull();
expect(g140!.element).toBe('void');
});
describe('getExtendedGuardian (procedural combo guardians)', () => {
it('should return combo guardians for floors 150+', () => {
const g150 = getExtendedGuardian(150);
expect(g150).not.toBeNull();
expect(g150!.element).toContain('+');
});
it('should return null for non-guardian floors', () => {
it('should return null for floors below 150', () => {
expect(getExtendedGuardian(1)).toBeNull();
expect(getExtendedGuardian(15)).toBeNull();
expect(getExtendedGuardian(95)).toBeNull();
expect(getExtendedGuardian(100)).toBeNull();
expect(getExtendedGuardian(140)).toBeNull();
});
});
describe('getGuardianForFloor (unified lookup)', () => {
it('should return base element guardians for floors 10-70', () => {
expect(getGuardianForFloor(10)!.element).toBe('fire');
expect(getGuardianForFloor(20)!.element).toBe('water');
expect(getGuardianForFloor(30)!.element).toBe('air');
expect(getGuardianForFloor(40)!.element).toBe('earth');
expect(getGuardianForFloor(50)!.element).toBe('light');
expect(getGuardianForFloor(60)!.element).toBe('dark');
expect(getGuardianForFloor(70)!.element).toBe('death');
});
it('should return utility guardian for floor 80', () => {
expect(getGuardianForFloor(80)!.element).toBe('transference');
});
it('should return compound guardians for floors 90-110', () => {
expect(getGuardianForFloor(90)!.element).toBe('metal');
expect(getGuardianForFloor(100)!.element).toBe('sand');
expect(getGuardianForFloor(110)!.element).toBe('lightning');
});
it('should return exotic guardians for floors 120-140', () => {
expect(getGuardianForFloor(120)!.element).toBe('crystal');
expect(getGuardianForFloor(130)!.element).toBe('stellar');
expect(getGuardianForFloor(140)!.element).toBe('void');
});
it('should return combo guardians for floors 150+', () => {
const g150 = getGuardianForFloor(150);
expect(g150).not.toBeNull();
expect(g150!.element).toContain('+');
});
it('should return null for non-guardian floors', () => {
expect(getGuardianForFloor(1)).toBeNull();
expect(getGuardianForFloor(15)).toBeNull();
expect(getGuardianForFloor(95)).toBeNull();
});
});