refactor: Replace natural-regen disciplines with mana conversion speed disciplines
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m25s
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:
@@ -87,10 +87,31 @@ export function canProceedDiscipline(
|
||||
return element && element.current >= drain;
|
||||
}
|
||||
|
||||
// ─── Known mana type names for display ────────────────────────────────────────
|
||||
const MANA_TYPE_NAMES: Record<string, string> = {
|
||||
raw: 'raw',
|
||||
fire: 'fire',
|
||||
water: 'water',
|
||||
air: 'air',
|
||||
earth: 'earth',
|
||||
light: 'light',
|
||||
dark: 'dark',
|
||||
death: 'death',
|
||||
transference: 'transference',
|
||||
metal: 'metal',
|
||||
sand: 'sand',
|
||||
lightning: 'lightning',
|
||||
crystal: 'crystal',
|
||||
stellar: 'stellar',
|
||||
void: 'void',
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if a discipline's prerequisites are met.
|
||||
* For disciplines with sourceManaTypes (conversion disciplines), requires are
|
||||
* mana type IDs that must be unlocked (e.g. fire, earth).
|
||||
* Returns { canProceed: boolean, missingPrereqs: string[] }
|
||||
* where missingPrereqs is a list of prerequisite discipline names that are not yet unlocked.
|
||||
* where missingPrereqs is a list of human-readable prerequisite descriptions.
|
||||
*/
|
||||
export function checkDisciplinePrerequisites(
|
||||
discipline: DisciplineDefinition,
|
||||
@@ -104,11 +125,21 @@ export function checkDisciplinePrerequisites(
|
||||
const missingPrereqs: string[] = [];
|
||||
|
||||
for (const reqId of discipline.requires) {
|
||||
const reqState = allDisciplines[reqId];
|
||||
// A prerequisite is met if the discipline has XP > 0 (has been practiced)
|
||||
if (!reqState || reqState.xp <= 0) {
|
||||
const reqDef = allDefinitions.find((d) => d.id === reqId);
|
||||
missingPrereqs.push(reqDef?.name ?? reqId);
|
||||
// Check if this is a discipline prerequisite (exists in definitions)
|
||||
const reqDef = allDefinitions.find((d) => d.id === reqId);
|
||||
if (reqDef) {
|
||||
const reqState = allDisciplines[reqId];
|
||||
if (!reqState || reqState.xp <= 0) {
|
||||
missingPrereqs.push(reqDef?.name ?? reqId);
|
||||
}
|
||||
} else {
|
||||
// Treat as mana type requirement — display as "<name> mana"
|
||||
const typeName = MANA_TYPE_NAMES[reqId];
|
||||
if (typeName) {
|
||||
missingPrereqs.push(`${typeName} mana`);
|
||||
} else {
|
||||
missingPrereqs.push(reqId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user