Files
Mana-Loop/src/lib/game/data/disciplines/invoker.ts
T
n8n-gitea b7afe7a434
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m22s
feat: Implement Invocation System for Invoker attunement
Implements the full Invocation System as per spec §13 with all 22 acceptance criteria:
- Invocation charge meter with passive fill and active drain
- Auto-activation when charge reaches 100 with living enemies
- Guardian selection by elemental bonus × tierMultiplier scoring
- Spell selection from guardian's full element spellbook (not limited to learned)
- Step-down to affordable spells, auto-end when none affordable
- Charge drain during invocation with spell cost and discipline scaling
- Pact affinity cast speed bonus (diminishing returns, max 50%)
- guardian-invocation discipline with 4 perks (efficiency/speed/sustain/mastery)
- Cost multiplier (base 0.1, min 0.05) and drain multiplier (base 1.0, min 0.7)
- Signal recharged on spire exit and reset on descent
- Invocation Panel UI in SpireCombatPage with charge meter and status
- Compact invocation status indicator in SpireCombatControls

Files changed:
- data/disciplines/invoker.ts: Added guardian-invocation discipline definition
- effects/discipline-effects.ts: Added invocationChargeRateBonus, drainRateMultiplier, invocationCostReduction stat keys
- utils/invocation-utils.ts: NEW - All invocation utility functions (guardian selection, spell selection, charge rate, cost/drain multipliers)
- stores/combat-state.types.ts: Added invocationCharge and activeInvocation fields
- stores/combatStore.ts: Added invocation state defaults, resetInvocationState action, partialize, spire exit reset
- stores/combat-invocation.ts: NEW - Extracted invocation tick processing (charge fill/drain, casting, auto-activate/end)
- stores/combat-melee.ts: NEW - Extracted melee combat processing (keeps combat-actions.ts under 400 lines)
- stores/combat-actions.ts: Integrated invocation and melee modules
- __tests__/invocation-system.test.ts: NEW - 39 comprehensive tests
- SpireCombatPage.tsx: Added InvocationPanel between SpireHeader and RoomDisplay
- SpireCombatControls.tsx: Added compact invocation status indicator

All 1235 tests pass (including 39 new invocation tests).
2026-06-13 13:42:05 +02:00

133 lines
4.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ─── Invoker Discipline Files ─────────────────────────────────────────────────
// Attunement-focused disciplines for Invoker role
// The Invoker forms pacts with guardians and channels their elemental boons.
import { DisciplinesAttunementType } from '../../types/disciplines';
import type { DisciplineDefinition } from '../../types/disciplines';
export const invokerDisciplines: DisciplineDefinition[] = [
{
id: 'guardian-invocation',
name: 'Guardian Invocation',
attunement: DisciplinesAttunementType.INVOKER,
manaType: 'raw',
baseCost: 20,
description:
'Channel the power of pacted guardians in combat. Faster invocation charge, cheaper invocation spells, longer-lasting charge.',
statBonus: { stat: 'invocationChargeRateBonus', baseValue: 0.10, label: 'Invocation Charge Rate' },
difficultyFactor: 250,
scalingFactor: 120,
drainBase: 8,
requires: ['signed_pact'],
perks: [
{
id: 'invocation-efficiency',
type: 'once',
threshold: 100,
value: 0,
description: 'Invocation spells cost 20% less mana (cost multiplier 0.1 → 0.08)',
bonus: { stat: 'invocationCostReduction', amount: 0.02 },
},
{
id: 'invocation-speed',
type: 'infinite',
threshold: 200,
value: 150,
description: 'Every 150 XP: +0.05 invocation charge rate bonus',
bonus: { stat: 'invocationChargeRateBonus', amount: 0.05 },
},
{
id: 'invocation-sustain',
type: 'capped',
threshold: 400,
value: 200,
maxTier: 3,
description: 'Every 200 XP: drain rate multiplier 0.1 (minimum 0.7)',
bonus: { stat: 'drainRateMultiplier', amount: -0.1 },
},
{
id: 'invocation-mastery',
type: 'capped',
threshold: 500,
value: 250,
maxTier: 3,
description: 'Every 250 XP: cost multiplier 0.01 (minimum 0.05)',
bonus: { stat: 'invocationCostReduction', amount: 0.01 },
},
],
},
{
id: 'pact-attunement',
name: 'Pact Attunement',
attunement: DisciplinesAttunementType.INVOKER,
manaType: 'raw',
baseCost: 12,
description:
'Deepen your bond with guardian spirits. Reduces pact signing time and amplifies pact power.',
statBonus: { stat: 'pactAffinityBonus', baseValue: 0.05, label: 'Pact Affinity' },
difficultyFactor: 150,
scalingFactor: 80,
drainBase: 4,
requires: ['signed_pact'],
perks: [
{
id: 'pact-affinity-scaling',
type: 'once',
threshold: 100,
value: 0,
description: 'Unlock pact affinity scaling — pact bonuses grow with XP.',
},
{
id: 'pact-affinity-infinite',
type: 'infinite',
threshold: 200,
value: 100,
description: 'Every 100 XP: +5% pact affinity',
bonus: { stat: 'pactAffinityBonus', amount: 0.05 },
},
{
id: 'pact-power-boost',
type: 'capped',
threshold: 500,
value: 200,
maxTier: 5,
description: 'Every 200 XP: +3% guardian pact boon strength (max +15%)',
bonus: { stat: 'guardianBoonMultiplier', amount: 0.03 },
},
],
},
{
id: 'guardians-boon',
name: "Guardian's Boon",
attunement: DisciplinesAttunementType.INVOKER,
manaType: 'raw',
baseCost: 18,
description:
'Channel the unique blessings of every guardian you have bonded with. Amplifies all guardian unique perks.',
statBonus: { stat: 'guardianBoonMultiplier', baseValue: 0.10, label: 'Guardian Boon Power' },
difficultyFactor: 200,
scalingFactor: 100,
drainBase: 6,
requires: ['signed_pact'],
perks: [
{
id: 'boon-1',
type: 'once',
threshold: 100,
value: 0,
description: 'Active guardian boons gain +10% effectiveness',
bonus: { stat: 'guardianBoonMultiplier', amount: 0.10 },
},
{
id: 'boon-2',
type: 'capped',
threshold: 200,
value: 350,
maxTier: 5,
description: 'Every 350 XP: +5% guardian boon effectiveness (max +25%)',
bonus: { stat: 'guardianBoonMultiplier', amount: 0.05 },
},
],
},
];