refactor: Replace natural-regen disciplines with mana conversion speed disciplines
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m25s

- Add conversionRate + sourceManaTypes fields to DisciplineDefinition
- Rewrite elemental-regen.ts: 8 base disciplines now convert raw→element
- Rewrite elemental-regen-advanced.ts: 6 composite/exotic disciplines with proper source recipes
- Update discipline-effects.ts: produce conversion entries instead of regen bonuses
- Update gameStore.ts tick: drain source mana types, add to target element
- Update discipline-slice.ts: gate activation on source mana type access
- Update discipline-math.ts: resolve mana type IDs to 'X mana' display names
- Update DisciplinesTab.tsx: show conversion info, source requirements, and lock state
- Update DisciplineDebugSection.tsx: pass elements to activate()
- Update effects.ts: remove regen_{element} merge (no longer produced)
This commit is contained in:
2026-05-26 20:40:11 +02:00
parent 1c1bbf8017
commit 46013a15c8
12 changed files with 430 additions and 263 deletions
+35 -12
View File
@@ -263,22 +263,45 @@ export const useGameStore = create<GameCoordinatorStore>()(
rawMana = disciplineResult.rawMana;
elements = disciplineResult.elements;
// Apply per-element regen from discipline effects (regen_{element})
for (const [key, value] of Object.entries(disciplineEffects.bonuses)) {
if (key.startsWith('regen_') && key !== 'regenBonus') {
const element = key.replace('regen_', '');
if (elements[element]) {
elements[element] = {
...elements[element],
current: Math.min(
elements[element].max,
elements[element].current + value * HOURS_PER_TICK,
),
// Apply discipline conversions: drain source mana, add to target element
for (const [targetElem, conv] of Object.entries(disciplineEffects.conversions)) {
const conversionAmount = conv.rate * HOURS_PER_TICK;
// Check that all source mana types are available (unlocked and have enough)
let canConvert = true;
for (const srcType of conv.sourceManaTypes) {
if (srcType === 'raw') {
if (rawMana < conversionAmount) {
canConvert = false;
break;
}
} else if (!elements[srcType] || !elements[srcType].unlocked || elements[srcType].current < conversionAmount) {
canConvert = false;
break;
}
}
if (!canConvert) continue;
// Drain source mana types
for (const srcType of conv.sourceManaTypes) {
if (srcType === 'raw') {
rawMana -= conversionAmount;
} else if (elements[srcType]) {
elements[srcType] = {
...elements[srcType],
current: elements[srcType].current - conversionAmount,
};
}
}
// Add to target element
if (elements[targetElem]) {
elements[targetElem] = {
...elements[targetElem],
current: Math.min(
elements[targetElem].max,
elements[targetElem].current + conversionAmount,
),
};
}
}
// Unlock enchantment effects from newly unlocked discipline perks
if (disciplineResult.unlockedEffects.length > 0) {
useCraftingStore.getState().unlockEffects(disciplineResult.unlockedEffects);