feat: battle system, state manager enhancements, engine and demo updates

This commit is contained in:
2026-06-14 15:35:31 +08:00
parent 4d066b53bf
commit d0e901bd1f
12 changed files with 515 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ export class StateManager {
variables: Record<string, number> = {}
flags: Set<string> = new Set()
history: ChoiceRecord[] = []
onAfterApply: ((variables: Record<string, number>) => void) | null = null
onAfterApply: Set<((variables: Record<string, number>) => void)> = new Set()
init(initialVars: Record<string, number>) {
this.variables = { ...initialVars }
@@ -73,7 +73,7 @@ export class StateManager {
break
}
}
this.onAfterApply?.(this.variables)
this.onAfterApply.forEach((cb) => cb(this.variables))
}
recordChoice(choice: ChoiceRecord) {