Completely remove legacy skill system and tests

This commit is contained in:
2026-05-16 11:20:11 +02:00
parent 1a688394e4
commit fe0f2a079c
125 changed files with 7 additions and 14459 deletions
@@ -1,83 +0,0 @@
// ─── Skill Upgrade Selection Hook ────────────────────────
// Hook for managing milestone upgrade selection state in SkillsTab
import { useState, useMemo, useCallback, SetStateAction, Dispatch } from 'react';
import type { SkillUpgradeChoice } from '@/lib/game/types';
import { getUpgradesForSkillAtMilestone } from '@/lib/game/skill-evolution';
export interface UseSkillUpgradeSelectionResult {
pendingSelections: string[];
setPendingSelections: Dispatch<SetStateAction<string[]>>;
toggleUpgrade: (upgradeId: string, available: SkillUpgradeChoice[], alreadySelected: string[]) => void;
handleConfirm: (upgradeDialogSkill: string | null, upgradeDialogMilestone: 5 | 10, commitSkillUpgrades: (skillId: string, selections: string[], milestone: 5 | 10) => void, onClose: () => void) => void;
handleCancel: (onClose: () => void) => void;
}
/**
* Check if skill has milestone available (also exported for use in SkillRow/CategorySkillsList)
*/
export function hasMilestoneUpgrade(
skillId: string,
level: number,
skillTiers: Record<string, number>,
skillUpgrades: Record<string, string[]>
): { milestone: 5 | 10; hasUpgrades: boolean; selectedCount: number } | null {
// Check level 5 milestone
if (level >= 5) {
const upgrades5 = getUpgradesForSkillAtMilestone(skillId, 5, skillTiers);
const selected5 = (skillUpgrades[skillId] || []).filter((id) => id.includes('_l5'));
if (upgrades5.length > 0 && selected5.length < 2) {
return { milestone: 5, hasUpgrades: true, selectedCount: selected5.length };
}
}
// Check level 10 milestone
if (level >= 10) {
const upgrades10 = getUpgradesForSkillAtMilestone(skillId, 10, skillTiers);
const selected10 = (skillUpgrades[skillId] || []).filter((id) => id.includes('_l10'));
if (upgrades10.length > 0 && selected10.length < 2) {
return { milestone: 10, hasUpgrades: true, selectedCount: selected10.length };
}
}
return null;
}
/**
* Hook for managing skill upgrade selection state in the SkillsTab milestone upgrade dialog.
* Manages pending selections across the dialog open/close cycle.
*/
export function useSkillUpgradeSelection(): UseSkillUpgradeSelectionResult {
const [pendingSelections, setPendingSelections] = useState<string[]>([]);
const toggleUpgrade = useCallback((upgradeId: string, available: SkillUpgradeChoice[], alreadySelected: string[]) => {
const currentSelections = pendingSelections.length > 0 ? pendingSelections : alreadySelected;
if (currentSelections.includes(upgradeId)) {
setPendingSelections(currentSelections.filter(id => id !== upgradeId));
} else if (currentSelections.length < 2) {
setPendingSelections([...currentSelections, upgradeId]);
}
}, [pendingSelections]);
const handleConfirm = useCallback((upgradeDialogSkill: string | null, upgradeDialogMilestone: 5 | 10, commitSkillUpgrades: (skillId: string, selections: string[], milestone: 5 | 10) => void, onClose: () => void) => {
const currentSelections = pendingSelections.length > 0 ? pendingSelections : [];
if (currentSelections.length === 2 && upgradeDialogSkill) {
commitSkillUpgrades(upgradeDialogSkill, currentSelections, upgradeDialogMilestone);
}
setPendingSelections([]);
onClose();
}, [pendingSelections]);
const handleCancel = useCallback((onClose: () => void) => {
setPendingSelections([]);
onClose();
}, []);
return useMemo(() => ({
pendingSelections,
setPendingSelections,
toggleUpgrade,
handleConfirm,
handleCancel,
}), [pendingSelections, toggleUpgrade, handleConfirm, handleCancel]);
}