Files
Mana-Loop/src/lib/game/data/fabricator-recipes.ts
T
n8n-gitea 5e76fe7145
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m21s
feat: add wizard and physical gear branches to Fabricator
- Split fabricator-recipes.ts into 4 files (all under 400 lines):
  - fabricator-recipes.ts: core/elemental equipment recipes + helpers
  - fabricator-wizard-recipes.ts: 7 wizard branch recipes (staffs, circlet, robe, catalyst, pendant)
  - fabricator-physical-recipes.ts: 9 physical branch recipes (blades, helm, robe, boots, gauntlets, shields)
  - fabricator-material-recipes.ts: 12 material crafting recipes
- Added branch filter UI (All/Elemental/Wizard/Physical) to FabricatorSubTab
- All 902 tests pass
2026-05-27 15:22:16 +02:00

218 lines
7.4 KiB
TypeScript

// ─── Fabricator Equipment Recipes ──────────────────────────────────────────────
// Core and elemental recipes. Branch recipes are in separate files.
// Material recipes are in fabricator-material-recipes.ts.
import type { FabricatorRecipe } from './fabricator-recipe-types';
export type { FabricatorRecipe, MANA_TYPE_LABELS } from './fabricator-recipe-types';
export { MATERIAL_RECIPES } from './fabricator-material-recipes';
export { WIZARD_BRANCH_RECIPES } from './fabricator-wizard-recipes';
export { PHYSICAL_BRANCH_RECIPES } from './fabricator-physical-recipes';
import { WIZARD_BRANCH_RECIPES } from './fabricator-wizard-recipes';
import { PHYSICAL_BRANCH_RECIPES } from './fabricator-physical-recipes';
export const FABRICATOR_RECIPES: FabricatorRecipe[] = [
// ─── Earth Gear (Compacted Earth — high defense) ──────────────────────
{
id: 'earthHelm',
name: 'Earthen Helm',
description: 'A sturdy helm carved from compacted stone.',
manaType: 'earth',
equipmentTypeId: 'wizardHat',
slot: 'head',
materials: { manaCrystalDust: 4, earthShard: 2 },
manaCost: 200,
craftTime: 3,
rarity: 'uncommon',
gearTrait: '+25 Earth Mana Capacity',
},
{
id: 'earthChest',
name: 'Stoneguard Armor',
description: 'Heavy stone plates layered over leather. Slow but nearly impenetrable.',
manaType: 'earth',
equipmentTypeId: 'scholarRobe',
slot: 'body',
materials: { manaCrystalDust: 8, earthShard: 4, elementalCore: 1 },
manaCost: 500,
craftTime: 6,
rarity: 'rare',
gearTrait: '+50 Earth Mana Capacity, +10% Earth Mana Regen',
},
{
id: 'earthBoots',
name: 'Stonegreaves',
description: 'Boots reinforced with compacted earth. Firm footing in any battle.',
manaType: 'earth',
equipmentTypeId: 'travelerBoots',
slot: 'feet',
materials: { manaCrystalDust: 3, earthShard: 1 },
manaCost: 150,
craftTime: 2,
rarity: 'uncommon',
gearTrait: '+20 Earth Mana Capacity',
},
// ─── Metal Gear (Fire+Earth — balanced offense/defense) ──────────────
{
id: 'metalBlade',
name: 'Metal Blade',
description: 'A blade forged from condensed metal mana. Sharp and durable.',
manaType: 'metal',
equipmentTypeId: 'steelBlade',
slot: 'mainHand',
materials: { manaCrystalDust: 6, metalShard: 3, elementalCore: 2 },
manaCost: 400,
craftTime: 5,
rarity: 'rare',
gearTrait: '+15% Enchantment Power, +20 Metal Mana Capacity',
},
{
id: 'metalShield',
name: 'Metal Spell Focus',
description: 'A metal orb that amplifies spellcasting. Boosts enchantment power.',
manaType: 'metal',
equipmentTypeId: 'metalSpellFocus',
slot: 'offHand',
materials: { manaCrystalDust: 7, metalShard: 4, elementalCore: 1 },
manaCost: 450,
craftTime: 5,
rarity: 'rare',
gearTrait: '+15% Enchantment Capacity',
},
{
id: 'metalGloves',
name: 'Metalweave Gauntlets',
description: 'Gauntlets woven with metal mana threads. Protective yet dexterous.',
manaType: 'metal',
equipmentTypeId: 'spellweaveGloves',
slot: 'hands',
materials: { manaCrystalDust: 4, metalShard: 2 },
manaCost: 250,
craftTime: 3,
rarity: 'uncommon',
gearTrait: '+10% Enchantment Power, +15 Metal Mana Capacity',
},
// ─── Crystal Gear (Sand+Sand+Light — high enchantment capacity) ──────
{
id: 'crystalWand',
name: 'Crystal Focus Wand',
description: 'A wand with a pure crystal core. Exceptional mana conductivity.',
manaType: 'crystal',
equipmentTypeId: 'crystalWand',
slot: 'mainHand',
materials: { manaCrystalDust: 10, crystalShard: 5, elementalCore: 3 },
manaCost: 600,
craftTime: 6,
rarity: 'epic',
gearTrait: '+40% enchantment capacity',
},
{
id: 'crystalRing',
name: 'Crystal Ring',
description: 'A ring set with a mana crystal. Amplifies enchantment effects.',
manaType: 'crystal',
equipmentTypeId: 'silverRing',
slot: 'accessory1',
materials: { manaCrystalDust: 5, crystalShard: 3, elementalCore: 1 },
manaCost: 350,
craftTime: 3,
rarity: 'rare',
gearTrait: '+15% enchantment capacity',
},
{
id: 'crystalAmulet',
name: 'Crystal Pendant',
description: 'An amulet housing a crystal shard. Enhances all enchantments worn.',
manaType: 'crystal',
equipmentTypeId: 'silverAmulet',
slot: 'accessory2',
materials: { manaCrystalDust: 6, crystalShard: 3, elementalCore: 2 },
manaCost: 400,
craftTime: 4,
rarity: 'rare',
gearTrait: '+10% all enchantment effects',
},
// ─── Sand Gear (Earth+Water — lightweight, agile) ────────────────────
{
id: 'sandBoots',
name: 'Sandstrider Boots',
description: 'Boots infused with sand mana. Light as air, silent as dust.',
manaType: 'sand',
equipmentTypeId: 'travelerBoots',
slot: 'feet',
materials: { manaCrystalDust: 3, sandShard: 1 },
manaCost: 120,
craftTime: 2,
rarity: 'uncommon',
gearTrait: '+15% cast speed, +10% evasion',
},
{
id: 'sandGloves',
name: 'Sandweave Gloves',
description: 'Gloves woven from sand mana. Nimble fingers for delicate enchanting.',
manaType: 'sand',
equipmentTypeId: 'spellweaveGloves',
slot: 'hands',
materials: { manaCrystalDust: 3, sandShard: 2 },
manaCost: 140,
craftTime: 2,
rarity: 'uncommon',
gearTrait: '+10% cast speed',
},
{
id: 'sandVest',
name: 'Sandcloth Vest',
description: 'A light vest woven from sand mana. Offers minimal protection but maximum mobility.',
manaType: 'sand',
equipmentTypeId: 'scholarRobe',
slot: 'body',
materials: { manaCrystalDust: 5, sandShard: 2, elementalCore: 1 },
manaCost: 300,
craftTime: 4,
rarity: 'rare',
gearTrait: '+20% cast speed, +5% evasion',
},
// ─── Branch recipes ───────────────────────────────────────────────────
...WIZARD_BRANCH_RECIPES,
...PHYSICAL_BRANCH_RECIPES,
];
// ─── Helpers ──────────────────────────────────────────────────────────────────
export function getRecipesByManaType(manaType: string): FabricatorRecipe[] {
return FABRICATOR_RECIPES.filter(r => r.manaType === manaType);
}
export function getRecipeById(id: string): FabricatorRecipe | undefined {
return FABRICATOR_RECIPES.find(r => r.id === id);
}
export function canCraftRecipe(
recipe: FabricatorRecipe,
materials: Record<string, number>,
manaAmount: number,
manaType?: string,
): { canCraft: boolean; missingMaterials: Record<string, number>; missingMana: number } {
const missingMaterials: Record<string, number> = {};
let canCraft = true;
for (const [matId, required] of Object.entries(recipe.materials)) {
const available = materials[matId] || 0;
if (available < required) {
missingMaterials[matId] = required - available;
canCraft = false;
}
}
const missingMana = Math.max(0, recipe.manaCost - manaAmount);
if (missingMana > 0) {
canCraft = false;
}
return { canCraft, missingMaterials, missingMana };
}