feat: run persisted monthly events

This commit is contained in:
2026-07-25 08:23:59 +00:00
parent 88afcb5465
commit fb1074c5e8
10 changed files with 494 additions and 35 deletions
+16
View File
@@ -40,6 +40,22 @@ Indexes: `(target, priority, id)` for dispatch ordering. Both `condition` and
Events are used inside the monthly pipeline and in special moments like
city occupation (`EventTarget::OCCUPY_CITY`, called by some commands).
### Rewrite runtime status
`app/game-engine/src/turn/monthlyEventHandler.ts` now dispatches persisted
`event` rows for `pre_month` and `month`. It preserves the legacy
`priority DESC, id ASC` order, evaluates `Date`, `DateRelative`, `RemainNation`,
and the boolean logic operators, and records `DeleteEvent` through the normal
turn dirty-state transaction.
The calendar calls `pre_month` before changing the world date and `month`
after changing it. Action names are resolved through an explicit registry.
An unported action stops the turn with its action name and event id instead of
being silently ignored. The runtime registry currently covers
`ProcessIncome`, `NoticeToHistoryLog`, `NewYear`, and `ResetOfficerLock`;
the remaining legacy action catalog must be migrated before full event-action
parity can be claimed.
## Condition and Action DSL
`Event\Condition::build()` and `Event\Action::build()` decode JSON arrays into
+5 -1
View File
@@ -23,7 +23,11 @@ Move items into the main docs once they are finalized.
- [AI suggestion] Implement command continuation/alternate flow (LastTurn/term stack/pre/post requirements/next_execute) and integrate into reserved turn processing.
- [AI suggestion] Integrate trigger preprocessing + attempt/execute phases into turn resolution (parity with legacy trigger composition).
- [AI suggestion] Add AI/autorun and inactivity (killturn/block) handling with NPC takeover/deletion policies.
- [AI suggestion] Add an event execution pipeline (initial + monthly + conditional) tied to tick/month transitions with deterministic RNG seeding.
- [AI suggestion] Complete the event action registry beyond the implemented
`pre_month`/`month` dispatcher (`ProcessIncome`, `NoticeToHistoryLog`,
`NewYear`, `ResetOfficerLock`). Add initial and non-month targets plus the
remaining NPC, invader, disaster, supply, nation-level, betting, and
inheritance actions with legacy-compatible deterministic RNG.
- [AI suggestion] Add monthly economy/city/nation updates and hook them into the turn calendar handler.
- [AI suggestion] Implement diplomacy/state transitions and monthly/command-based updates beyond read-only maps.
- [AI suggestion] Integrate war/battle pipeline into turn processing (troop movement/war resolution hooks, not just isolated sim jobs).