23a83a04cf
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m17s
- Fixed DisciplinesAttunementType enum usage in discipline data files - Fixed EquipmentSlot import in equipment/types.ts - Fixed enchantment-effects.ts export/import chain - Fixed safe-persist.ts StateStorage type compatibility - Fixed store persist partial return types for all stores - Fixed gameStore.ts ElementState type and error handling - Fixed useGameDerived.ts missing properties on GameCoordinatorStore - Added SkillUpgradeChoice type to types.ts - Fixed ActionButtons.tsx optional currentStudyTarget prop - Fixed GameToast.tsx Toast type compatibility - Fixed EnchantmentDesigner sub-component type mismatches - Fixed SpireCombatPage equippedInstances/equipmentInstances types - Fixed page.tsx computeClickMana argument - Added baseCastTime to SpellDef type - Fixed golem/types.ts and loot-drops.ts import paths - Fixed craftingStore.ts missing lastError in initial state and actions - Fixed store-actions-combat-prestige.test.ts Memory type usage - Fixed floor-utils.upgraded.test.ts array type annotation - Fixed computed-stats.test.ts state type assertions - Fixed activity-log.test.ts state type annotation - Fixed discipline-math.test.ts enum value usage - Fixed game-loop.test.ts vitest mock import - Various other test file type fixes
72 lines
2.7 KiB
TypeScript
72 lines
2.7 KiB
TypeScript
// ─── Enchantment Effects Index ─────────────────────────────────────────
|
|
// Re-exports everything from category-specific files for backward compatibility
|
|
|
|
// Import types
|
|
import type { EnchantmentEffectCategory, EnchantmentEffectDef } from '../enchantment-types'
|
|
import type { EquipmentCategory } from '../equipment'
|
|
|
|
// Import all category-specific effect collections
|
|
import { SPELL_EFFECTS } from './spell-effects'
|
|
import { MANA_EFFECTS } from './mana-effects'
|
|
import { COMBAT_EFFECTS } from './combat-effects'
|
|
import { ELEMENTAL_EFFECTS } from './elemental-effects'
|
|
import { DEFENSE_EFFECTS } from './defense-effects'
|
|
import { UTILITY_EFFECTS } from './utility-effects'
|
|
import { SPECIAL_EFFECTS } from './special-effects'
|
|
|
|
// Merge all effects into a single record for backward compatibility
|
|
export const ENCHANTMENT_EFFECTS: Record<string, EnchantmentEffectDef> = {
|
|
...SPELL_EFFECTS,
|
|
...MANA_EFFECTS,
|
|
...COMBAT_EFFECTS,
|
|
...ELEMENTAL_EFFECTS,
|
|
...DEFENSE_EFFECTS,
|
|
...UTILITY_EFFECTS,
|
|
...SPECIAL_EFFECTS,
|
|
}
|
|
|
|
// ─── Helper Functions ────────────────────────────────────────────────────────
|
|
|
|
export function getEnchantmentEffect(id: string): EnchantmentEffectDef | undefined {
|
|
return ENCHANTMENT_EFFECTS[id];
|
|
}
|
|
|
|
export function getEffectsForEquipment(equipmentCategory: EquipmentCategory): EnchantmentEffectDef[] {
|
|
return Object.values(ENCHANTMENT_EFFECTS).filter(effect =>
|
|
effect.allowedEquipmentCategories.includes(equipmentCategory)
|
|
);
|
|
}
|
|
|
|
export function canApplyEffect(effectId: string, equipmentCategory: EquipmentCategory): boolean {
|
|
const effect = ENCHANTMENT_EFFECTS[effectId];
|
|
if (!effect) return false;
|
|
return effect.allowedEquipmentCategories.includes(equipmentCategory);
|
|
}
|
|
|
|
export function calculateEffectCapacityCost(effectId: string, stacks: number, efficiencyBonus: number = 0): number {
|
|
const effect = ENCHANTMENT_EFFECTS[effectId];
|
|
if (!effect) return 0;
|
|
|
|
let totalCost = 0;
|
|
for (let i = 0; i < stacks; i++) {
|
|
// Each additional stack costs 20% more
|
|
const stackMultiplier = 1 + (i * 0.2);
|
|
totalCost += effect.baseCapacityCost * stackMultiplier;
|
|
}
|
|
|
|
// Apply efficiency bonus (reduces cost)
|
|
return Math.floor(totalCost * (1 - efficiencyBonus));
|
|
}
|
|
|
|
// Re-export category-specific collections for direct access if needed
|
|
export type { EnchantmentEffectCategory, EnchantmentEffectDef } from '../enchantment-types';
|
|
export {
|
|
SPELL_EFFECTS,
|
|
MANA_EFFECTS,
|
|
COMBAT_EFFECTS,
|
|
ELEMENTAL_EFFECTS,
|
|
DEFENSE_EFFECTS,
|
|
UTILITY_EFFECTS,
|
|
SPECIAL_EFFECTS,
|
|
}
|