Task 2: ActionButtons rework - remove manual selection, auto-transition to Meditate
This commit is contained in:
@@ -785,9 +785,12 @@ export function processCraftingTick(
|
|||||||
created: Date.now(),
|
created: Date.now(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// If the first design slot is also null, transition to meditate
|
||||||
|
const shouldTransitionToMeditate = !state.designProgress;
|
||||||
updates = {
|
updates = {
|
||||||
...updates,
|
...updates,
|
||||||
designProgress2: null,
|
designProgress2: null,
|
||||||
|
currentAction: shouldTransitionToMeditate ? 'meditate' : state.currentAction,
|
||||||
enchantmentDesigns: [...state.enchantmentDesigns, completedDesign],
|
enchantmentDesigns: [...state.enchantmentDesigns, completedDesign],
|
||||||
log: [`✅ Enchantment design "${dp.name}" complete! (2nd slot)`, ...log],
|
log: [`✅ Enchantment design "${dp.name}" complete! (2nd slot)`, ...log],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -551,11 +551,16 @@ function deductSpellCost(
|
|||||||
const newElements = { ...elements };
|
const newElements = { ...elements };
|
||||||
|
|
||||||
if (cost.type === 'raw') {
|
if (cost.type === 'raw') {
|
||||||
return { rawMana: rawMana - cost.amount, elements: newElements };
|
// Don't allow rawMana to go below zero
|
||||||
|
const deductedAmount = Math.min(rawMana, cost.amount);
|
||||||
|
return { rawMana: rawMana - deductedAmount, elements: newElements };
|
||||||
} else if (cost.element && newElements[cost.element]) {
|
} else if (cost.element && newElements[cost.element]) {
|
||||||
|
const elem = newElements[cost.element];
|
||||||
|
// Don't allow elemental mana to go below zero
|
||||||
|
const deductedAmount = Math.min(elem.current, cost.amount);
|
||||||
newElements[cost.element] = {
|
newElements[cost.element] = {
|
||||||
...newElements[cost.element],
|
...elem,
|
||||||
current: newElements[cost.element].current - cost.amount
|
current: elem.current - deductedAmount
|
||||||
};
|
};
|
||||||
return { rawMana, elements: newElements };
|
return { rawMana, elements: newElements };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,11 +207,16 @@ export function deductSpellCost(
|
|||||||
const newElements = { ...elements };
|
const newElements = { ...elements };
|
||||||
|
|
||||||
if (cost.type === 'raw') {
|
if (cost.type === 'raw') {
|
||||||
return { rawMana: rawMana - cost.amount, elements: newElements };
|
// Don't allow rawMana to go below zero
|
||||||
|
const deductedAmount = Math.min(rawMana, cost.amount);
|
||||||
|
return { rawMana: rawMana - deductedAmount, elements: newElements };
|
||||||
} else if (cost.element && newElements[cost.element]) {
|
} else if (cost.element && newElements[cost.element]) {
|
||||||
|
const elem = newElements[cost.element];
|
||||||
|
// Don't allow elemental mana to go below zero
|
||||||
|
const deductedAmount = Math.min(elem.current, cost.amount);
|
||||||
newElements[cost.element] = {
|
newElements[cost.element] = {
|
||||||
...newElements[cost.element],
|
...elem,
|
||||||
current: newElements[cost.element].current - cost.amount
|
current: elem.current - deductedAmount
|
||||||
};
|
};
|
||||||
return { rawMana, elements: newElements };
|
return { rawMana, elements: newElements };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user