feat: expand ISAC content modeling
Validate and deploy production / validate (push) Canceled after 0s
Validate and deploy production / deploy (push) Canceled after 0s
Validate and deploy staging / validate (push) Successful in 28s
Validate and deploy staging / deploy (push) Successful in 1m3s

This commit is contained in:
jb
2026-08-03 01:23:20 -04:00
parent d9924a95b9
commit 57068b61cd
90 changed files with 9635 additions and 1270 deletions
+32 -3
View File
@@ -90,6 +90,7 @@ const outcomeMetadataColumns = [
'delivery_mode',
'delivery_duration_seconds',
'targeting_json',
'probability_percent',
'state_pool_id',
'min_state_value',
'max_state_value',
@@ -205,6 +206,10 @@ export function conditionalRuleDraftFromRows(
.filter((row) => row.rule_id === rule.id && Number(row.active ?? 1) === 1)
.sort((left, right) => Number(left.sort_order) - Number(right.sort_order))
.map((row): ConditionalMechanicClauseDraft => {
const parameters = parseJson<Record<string, unknown>>(
row.recipe_parameters_json,
{},
);
const grouped = new Map<string, OutcomeRow[]>();
for (const outcome of rowsByClause.get(String(row.id)) ?? []) {
const key = String(outcome.effect_key);
@@ -268,6 +273,10 @@ export function conditionalRuleDraftFromRows(
...(first.targeting_json
? { targeting: parseJson(first.targeting_json, undefined) }
: {}),
...(first.probability_percent === null ||
first.probability_percent === undefined
? {}
: { probabilityPercent: Number(first.probability_percent) }),
...(first.stat_attribute_id
? { attributeId: String(first.stat_attribute_id) }
: {}),
@@ -329,6 +338,15 @@ export function conditionalRuleDraftFromRows(
),
}
: {}),
...(typeof parameters.procChancePercent === 'number'
? { procChancePercent: parameters.procChancePercent }
: {}),
...(typeof parameters.requiresAssignedAbilityActive === 'boolean'
? {
requiresAssignedAbilityActive:
parameters.requiresAssignedAbilityActive,
}
: {}),
...(row.cooldown_seconds === null || row.cooldown_seconds === undefined
? {}
: { cooldownSeconds: Number(row.cooldown_seconds) }),
@@ -495,7 +513,17 @@ export async function saveConditionalRuleInTransaction(
clause.label || clause.key,
clause.event,
clause.recipeKey ?? null,
'{}',
JSON.stringify({
...(clause.procChancePercent === undefined
? {}
: { procChancePercent: clause.procChancePercent }),
...(clause.requiresAssignedAbilityActive === undefined
? {}
: {
requiresAssignedAbilityActive:
clause.requiresAssignedAbilityActive,
}),
}),
JSON.stringify(clause.if ?? { kind: 'true' }),
JSON.stringify(clause.reducer),
clause.weight === undefined ? null : JSON.stringify(clause.weight),
@@ -518,9 +546,9 @@ export async function saveConditionalRuleInTransaction(
application_kind,effect_scope,stat_attribute_id,value,value_expression_json,
value_basis,value_scaling,unit,damage_basis,application_phase,combat_timing,
resource_kind,delivery_mode,delivery_duration_seconds,
targeting_json,min_state_value,max_state_value,description_slot,sort_order,
targeting_json,probability_percent,min_state_value,max_state_value,description_slot,sort_order,
created_at,updated_at)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`)
).run(
randomUUID(),
ruleId,
@@ -552,6 +580,7 @@ export async function saveConditionalRuleInTransaction(
outcome.targeting === undefined
? null
: JSON.stringify(outcome.targeting),
outcome.probabilityPercent ?? null,
outcome.minStacks ?? null,
outcome.maxStacks ?? null,
outcome.descriptionSlot ?? null,