fix: fabricator recipes now use correct elemental mana type
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m37s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m37s
- fabricator-recipes.ts: add optional manaType param to canCraftRecipe for clarity - FabricatorSubTab.tsx: read elemental mana from store based on recipe manaType instead of always using rawMana - craftingStore.ts: add startFabricatorCrafting action that deducts correct mana type - craftingStore.types.ts: add startFabricatorCrafting to CraftingActions interface - crafting-fabricator.ts: new helper file to keep craftingStore.ts under 400 lines Fixes #155
This commit is contained in:
@@ -206,6 +206,7 @@ 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;
|
||||
@@ -218,6 +219,9 @@ export function canCraftRecipe(
|
||||
}
|
||||
}
|
||||
|
||||
// If manaType is provided, manaAmount is already the correct pool value.
|
||||
// Otherwise fall back to treating manaAmount as raw mana (backward compat).
|
||||
const effectiveManaType = manaType ?? recipe.manaType;
|
||||
const missingMana = Math.max(0, recipe.manaCost - manaAmount);
|
||||
if (missingMana > 0) {
|
||||
canCraft = false;
|
||||
|
||||
Reference in New Issue
Block a user