Adding skills & isac talent updates

This commit is contained in:
jb
2026-07-29 20:56:22 -04:00
parent f1b473ffa8
commit 65a4987cad
68 changed files with 5486 additions and 569 deletions
+39 -4
View File
@@ -1,5 +1,6 @@
import { connect } from '@tursodatabase/database';
import { describe, expect, it } from 'vitest';
import type { ConditionalMechanicDraftV1 } from '$lib/calculations/mechanic-editor';
import {
conditionalRuleDraftFromRows,
loadConditionalRuleDraft,
@@ -174,7 +175,7 @@ describe('conditional mechanic persistence adapter', () => {
stat_attribute_id TEXT, value REAL, value_expression_json TEXT, value_basis TEXT,
value_scaling TEXT, unit TEXT, damage_basis TEXT, application_phase TEXT,
combat_timing TEXT, resource_kind TEXT, delivery_mode TEXT,
delivery_duration_seconds REAL, min_state_value REAL, max_state_value REAL,
delivery_duration_seconds REAL, targeting_json TEXT, min_state_value REAL, max_state_value REAL,
description_slot INTEGER, sort_order INTEGER, created_at TEXT, updated_at TEXT
)`);
@@ -189,13 +190,24 @@ describe('conditional mechanic persistence adapter', () => {
scope: 'target',
initial: 0,
min: 0,
max: 1
max: 1,
expiresAfterSecondsVariants: {
I: 12,
II: 18
}
} as ConditionalMechanicDraftV1['pools'][number] & {
expiresAfterSecondsVariants: Record<string, number>;
}],
clauses: [{
key: 'weapon-kill',
label: 'Weapon kill',
event: 'enemy_killed',
if: { kind: 'true' },
if: {
kind: 'compare',
left: { source: 'combat', path: 'currentHealthPercent', timing: 'current' },
operator: 'lt',
right: 75
},
reducer: { kind: 'none' },
mutations: [{
kind: 'set',
@@ -213,6 +225,7 @@ describe('conditional mechanic persistence adapter', () => {
basis: 'flat',
delivery: 'continuous',
durationSeconds: 3,
targeting: { kind: 'within_radius', population: 'allies', radiusMeters: 40 },
variants: {
I: { value: 240 },
II: { value: 336 }
@@ -275,6 +288,17 @@ describe('conditional mechanic persistence adapter', () => {
{ delivery_mode: 'continuous', delivery_duration_seconds: 3 },
{ delivery_mode: 'instant', delivery_duration_seconds: null }
]);
expect(await (await database.prepare(
'SELECT duration_seconds,parameters_json FROM conditional_effect_state_pools'
)).get()).toEqual({
duration_seconds: null,
parameters_json: JSON.stringify({
expiresAfterSecondsVariants: {
I: 12,
II: 18
}
})
});
const loaded = await loadConditionalRuleDraft(
database,
'talent',
@@ -284,15 +308,26 @@ describe('conditional mechanic persistence adapter', () => {
expect(loaded?.clauses[0].outcomes[0]).toMatchObject({
delivery: 'continuous',
durationSeconds: 3,
targeting: { kind: 'within_radius', population: 'allies', radiusMeters: 40 },
variants: {
I: { value: 240 },
II: { value: 336 }
}
});
expect(loaded?.clauses[0].if).toEqual({
kind: 'compare',
left: { source: 'combat', path: 'currentHealthPercent', timing: 'current' },
operator: 'lt',
right: 75
});
expect(loaded?.pools[0]).toMatchObject({
key: 'marked-target',
stateKind: 'target_mark',
scope: 'target'
scope: 'target',
expiresAfterSecondsVariants: {
I: 12,
II: 18
}
});
expect(loaded?.clauses[0].mutations).toEqual([{
kind: 'set',