feat: unify guardian system — merge static GUARDIANS with extended procedural guardians in Pacts tab
- guardian-encounters.ts: add getGuardianForFloor() and getAllGuardianFloors() unified lookup functions that merge static GUARDIANS (floors 10-100) with extended system (compound 110, exotic 120-140, combo 150+) - GuardianPactsTab.tsx: use unified system, update tiers to cover all floors (Early 10-40, Mid 50-80, Late 90-100, Compound 110, Exotic 120-140, Transcendent 150+) - guardian-pacts-components.tsx: handle combo guardians with dual-element display (symbols + names + '✦ Combo' badge) - docs/circular-deps.txt, docs/dependency-graph.json: auto-generated updates - craftingStore.ts: extract initial equipment instances to crafting-initial-state.ts
This commit is contained in:
@@ -264,11 +264,36 @@ export function getExtendedGuardian(floor: number): GuardianDef | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
// All guardian floors (extended)
|
||||
// ─── Unified Guardian System ─────────────────────────────────────────────────
|
||||
// Merges the static GUARDIANS constant (floors 10–100) with the extended
|
||||
// procedural system (compound 110, exotic 120–140, combo 150+).
|
||||
// For floors 90–100 the static definitions take precedence (canonical names).
|
||||
|
||||
import { GUARDIANS } from '../constants/guardians';
|
||||
|
||||
/** Get the guardian for any floor, merging static and extended systems. */
|
||||
export function getGuardianForFloor(floor: number): GuardianDef | null {
|
||||
// Static GUARDIANS take precedence for floors 10–100 (canonical definitions)
|
||||
if (GUARDIANS[floor]) {
|
||||
return { ...GUARDIANS[floor] };
|
||||
}
|
||||
// Extended system for floors beyond 100 (and compound floors not in GUARDIANS)
|
||||
return getExtendedGuardian(floor);
|
||||
}
|
||||
|
||||
/** All guardian floors — merged from static + extended. */
|
||||
export function getAllGuardianFloors(): number[] {
|
||||
const staticFloors = Object.keys(GUARDIANS).map(Number);
|
||||
const extendedFloors = [110, 120, 130, 140, ...Array.from({ length: 10 }, (_, i) => 150 + i * 10)];
|
||||
const all = new Set([...staticFloors, ...extendedFloors]);
|
||||
return Array.from(all).sort((a, b) => a - b);
|
||||
}
|
||||
|
||||
// All guardian floors (extended — kept for backwards compatibility)
|
||||
export const ALL_GUARDIAN_FLOORS: number[] = [
|
||||
10, 20, 30, 40, 50, 60, 80, 100, // Original
|
||||
90, 110, // Compound
|
||||
120, 130, 140, // Exotic
|
||||
10, 20, 30, 40, 50, 60, 80, 90, 100, // Original (all static floors)
|
||||
110, // Compound (90,100 already in static)
|
||||
120, 130, 140, // Exotic
|
||||
...Array.from({ length: 10 }, (_, i) => 150 + i * 10), // Combo
|
||||
].sort((a, b) => a - b);
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
// ─── Crafting Store Initial State ─────────────────────────────────────────────
|
||||
// Helper to generate the starting equipment instances for new games.
|
||||
|
||||
import * as CraftingUtils from '../crafting-utils';
|
||||
|
||||
export function createInitialEquipmentInstances() {
|
||||
const staffId = CraftingUtils.generateInstanceId();
|
||||
const staffInstance = {
|
||||
instanceId: staffId,
|
||||
typeId: 'basicStaff',
|
||||
name: 'Basic Staff',
|
||||
enchantments: [{ effectId: 'spell_manaBolt', stacks: 1, actualCost: 50 }],
|
||||
usedCapacity: 50,
|
||||
totalCapacity: 50,
|
||||
rarity: 'common',
|
||||
quality: 100,
|
||||
tags: [],
|
||||
};
|
||||
|
||||
const shirtId = CraftingUtils.generateInstanceId();
|
||||
const shirtInstance = {
|
||||
instanceId: shirtId,
|
||||
typeId: 'civilianShirt',
|
||||
name: 'Civilian Shirt',
|
||||
enchantments: [],
|
||||
usedCapacity: 0,
|
||||
totalCapacity: 30,
|
||||
rarity: 'common',
|
||||
quality: 100,
|
||||
tags: [],
|
||||
};
|
||||
|
||||
const shoesId = CraftingUtils.generateInstanceId();
|
||||
const shoesInstance = {
|
||||
instanceId: shoesId,
|
||||
typeId: 'civilianShoes',
|
||||
name: 'Civilian Shoes',
|
||||
enchantments: [],
|
||||
usedCapacity: 0,
|
||||
totalCapacity: 15,
|
||||
rarity: 'common',
|
||||
quality: 100,
|
||||
tags: [],
|
||||
};
|
||||
|
||||
return {
|
||||
instances: {
|
||||
[staffId]: staffInstance,
|
||||
[shirtId]: shirtInstance,
|
||||
[shoesId]: shoesInstance,
|
||||
} as Record<string, typeof staffInstance>,
|
||||
equippedInstances: {
|
||||
mainHand: staffId,
|
||||
offHand: null,
|
||||
head: null,
|
||||
body: shirtId,
|
||||
hands: null,
|
||||
feet: shoesId,
|
||||
accessory1: null,
|
||||
accessory2: null,
|
||||
} as Record<string, string | null>,
|
||||
};
|
||||
}
|
||||
@@ -17,49 +17,12 @@ import { equipItem as equipItemAction, unequipItem as unequipItemAction } from '
|
||||
import { ErrorCode } from '../utils/result';
|
||||
import { createSafeStorage } from '../utils/safe-persist';
|
||||
import type { Result } from '../utils/result';
|
||||
import { createInitialEquipmentInstances } from './crafting-initial-state';
|
||||
|
||||
export const useCraftingStore = create<CraftingStore>()(
|
||||
persist(
|
||||
(set, get) => {
|
||||
const staffId = CraftingUtils.generateInstanceId();
|
||||
const staffInstance = {
|
||||
instanceId: staffId,
|
||||
typeId: 'basicStaff',
|
||||
name: 'Basic Staff',
|
||||
enchantments: [{ effectId: 'spell_manaBolt', stacks: 1, actualCost: 50 }],
|
||||
usedCapacity: 50,
|
||||
totalCapacity: 50,
|
||||
rarity: 'common',
|
||||
quality: 100,
|
||||
tags: [],
|
||||
};
|
||||
|
||||
const shirtId = CraftingUtils.generateInstanceId();
|
||||
const shirtInstance = {
|
||||
instanceId: shirtId,
|
||||
typeId: 'civilianShirt',
|
||||
name: 'Civilian Shirt',
|
||||
enchantments: [],
|
||||
usedCapacity: 0,
|
||||
totalCapacity: 30,
|
||||
rarity: 'common',
|
||||
quality: 100,
|
||||
tags: [],
|
||||
};
|
||||
|
||||
const shoesId = CraftingUtils.generateInstanceId();
|
||||
const shoesInstance = {
|
||||
instanceId: shoesId,
|
||||
typeId: 'civilianShoes',
|
||||
name: 'Civilian Shoes',
|
||||
enchantments: [],
|
||||
usedCapacity: 0,
|
||||
totalCapacity: 15,
|
||||
rarity: 'common',
|
||||
quality: 100,
|
||||
tags: [],
|
||||
};
|
||||
|
||||
const initial = createInitialEquipmentInstances();
|
||||
return {
|
||||
// Initial state
|
||||
designProgress: null,
|
||||
@@ -69,21 +32,8 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
equipmentCraftingProgress: null,
|
||||
enchantmentDesigns: [],
|
||||
unlockedEffects: [],
|
||||
equippedInstances: {
|
||||
mainHand: staffId,
|
||||
offHand: null,
|
||||
head: null,
|
||||
body: shirtId,
|
||||
hands: null,
|
||||
feet: shoesId,
|
||||
accessory1: null,
|
||||
accessory2: null,
|
||||
},
|
||||
equipmentInstances: {
|
||||
[staffId]: staffInstance,
|
||||
[shirtId]: shirtInstance,
|
||||
[shoesId]: shoesInstance,
|
||||
},
|
||||
equippedInstances: initial.equippedInstances,
|
||||
equipmentInstances: initial.instances,
|
||||
lootInventory: {
|
||||
materials: {},
|
||||
blueprints: [],
|
||||
|
||||
Reference in New Issue
Block a user