Support live attribute restoration mechanics
This commit is contained in:
@@ -1227,6 +1227,25 @@ if (sourceOwnedClauseColumns.some((column) => column.name === 'trigger_id')) {
|
||||
ON conditional_effect_outcomes(rule_id,variant_key,outcome_key,sort_order)`);
|
||||
}
|
||||
|
||||
// Legacy conditional-mechanic table rebuilds above predate delivery metadata.
|
||||
// Recheck after those migrations so their replacement tables receive the
|
||||
// additive columns too.
|
||||
const postRebuildOutcomeColumns = await (
|
||||
await database.prepare("PRAGMA table_info('conditional_effect_outcomes')")
|
||||
).all();
|
||||
if (!postRebuildOutcomeColumns.some((column) => column.name === 'delivery_mode')) {
|
||||
console.log('Adding outcome delivery modes to conditional mechanics.');
|
||||
await database.exec(`ALTER TABLE conditional_effect_outcomes
|
||||
ADD COLUMN delivery_mode TEXT NOT NULL DEFAULT 'instant'
|
||||
CHECK(delivery_mode IN ('instant','continuous'))`);
|
||||
}
|
||||
if (!postRebuildOutcomeColumns.some((column) => column.name === 'delivery_duration_seconds')) {
|
||||
console.log('Adding continuous-delivery durations to conditional mechanics.');
|
||||
await database.exec(`ALTER TABLE conditional_effect_outcomes
|
||||
ADD COLUMN delivery_duration_seconds REAL
|
||||
CHECK(delivery_duration_seconds IS NULL OR delivery_duration_seconds>0)`);
|
||||
}
|
||||
|
||||
const legacyTalentOutcomes = await (await database.prepare(`
|
||||
SELECT outcome.id,outcome.rule_id,outcome.variant_key,outcome.stat_attribute_id,
|
||||
outcome.effect_key,outcome.description_slot,outcome.sort_order
|
||||
|
||||
Reference in New Issue
Block a user