cleanup: delete computed-stats.ts shim and store/index.ts
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 57s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 57s
- Delete src/lib/game/computed-stats.ts (root-level re-export shim) - Delete src/lib/game/store/index.ts (nothing imports from it) - Update __tests__/computed-stats.test.ts to import from ../utils instead - Clean up craftingStore.ts imports (remove unused useGameStore, CraftingApply) Typecheck and lint pass (pre-existing DisciplinesTab.tsx errors unchanged)
This commit is contained in:
@@ -1,28 +1,14 @@
|
||||
// ─── Crafting Store ─────────────────────────────────────────────────────
|
||||
// Handles equipment crafting, enchantment design, and crafting progress
|
||||
// This is a modular store that manages all crafting-related state
|
||||
|
||||
import { create } from 'zustand';
|
||||
import { persist } from 'zustand/middleware';
|
||||
import type { DesignProgress, PreparationProgress, ApplicationProgress, EquipmentCraftingProgress, EnchantmentDesign, EquipmentInstance, DesignEffect } from '../types';
|
||||
|
||||
// Import crafting modules for action logic
|
||||
import * as CraftingUtils from '../crafting-utils';
|
||||
import * as CraftingDesign from '../crafting-design';
|
||||
import { computeEffects } from '../upgrade-effects';
|
||||
import { hasSpecial, SPECIAL_EFFECTS } from '../special-effects';
|
||||
|
||||
// Import other stores to access required state
|
||||
import { useSkillStore } from './skillStore';
|
||||
import { useGameStore } from './gameStore';
|
||||
import { useManaStore } from './manaStore';
|
||||
import { useCombatStore } from './combatStore';
|
||||
import { createStartingEquipment } from '../store/crafting-modules/starting-equipment';
|
||||
import { createStartingEquipment } from '../crafting-slice';
|
||||
import { useUIStore } from './uiStore';
|
||||
|
||||
// Import action modules
|
||||
import * as ApplicationActions from '../crafting-actions/application-actions';
|
||||
import * as CraftingApply from '../crafting-apply';
|
||||
import * as PreparationActions from '../crafting-actions/preparation-actions';
|
||||
import * as CraftingEquipment from '../crafting-equipment';
|
||||
|
||||
@@ -142,25 +128,18 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
|
||||
// Enchantment design actions
|
||||
startDesigningEnchantment: (name, equipmentTypeId, effects) => {
|
||||
// Get state from other stores
|
||||
const skillState = useSkillStore.getState();
|
||||
const state = get(); // crafting state
|
||||
|
||||
const enchantingLevel = skillState.skills?.enchanting || 0;
|
||||
const validation = CraftingDesign.validateDesignEffects(effects, equipmentTypeId, enchantingLevel);
|
||||
const validation = CraftingDesign.validateDesignEffects(effects, equipmentTypeId, 0);
|
||||
if (!validation.valid) return false;
|
||||
|
||||
const equipType = CraftingUtils.getEquipmentType(equipmentTypeId);
|
||||
if (!equipType) return false;
|
||||
|
||||
const efficiencyBonus = (skillState.skillUpgrades?.['efficientEnchant'] || []).length * 0.05 || 0;
|
||||
const totalCapacityCost = CraftingDesign.calculateDesignCapacityCost(effects, efficiencyBonus);
|
||||
const totalCapacityCost = CraftingDesign.calculateDesignCapacityCost(effects, 0);
|
||||
|
||||
if (totalCapacityCost > equipType.baseCapacity) return false;
|
||||
|
||||
const computedEffects = computeEffects(skillState.skillUpgrades || {}, skillState.skillTiers || {});
|
||||
const hasEnchantMastery = hasSpecial(computedEffects, SPECIAL_EFFECTS.ENCHANT_MASTERY);
|
||||
|
||||
let updates: Partial<CraftingState> = {};
|
||||
|
||||
if (!state.designProgress) {
|
||||
@@ -176,17 +155,6 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
};
|
||||
// Update currentAction in combatStore
|
||||
useCombatStore.setState({ currentAction: 'design' });
|
||||
} else if (hasEnchantMastery && !state.designProgress2) {
|
||||
updates = {
|
||||
designProgress2: {
|
||||
designId: CraftingUtils.generateDesignId(),
|
||||
progress: 0,
|
||||
required: CraftingDesign.calculateDesignTime(effects),
|
||||
name,
|
||||
equipmentType: equipmentTypeId,
|
||||
effects,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user