feat: integrate unique lottery system into general actions

- Added `tryApplyUniqueLottery` function to various action definitions to apply unique item rewards based on specific actions.
- Enhanced the `uniqueLottery.ts` module to handle unique item acquisition and logging.
- Created unit tests for the unique lottery feature to ensure proper functionality during general commands.
- Updated action definitions to include unique item acquisition for actions such as training, technology research, and item procurement.
This commit is contained in:
2026-02-04 12:03:47 +00:00
parent a2bb667b57
commit 568084927c
30 changed files with 461 additions and 2 deletions
@@ -1,4 +1,5 @@
import type { City, General, Nation, Troop } from '@sammo-ts/logic/domain/entities.js';
import type { UniqueLotteryRunner } from '@sammo-ts/logic/rewards/uniqueLottery.js';
import type { ScenarioConfig } from '@sammo-ts/logic/scenario/types.js';
import type { ScenarioMeta } from '@sammo-ts/logic/world/types.js';
import type { MapDefinition, UnitSetDefinition } from '@sammo-ts/logic/world/types.js';
@@ -18,6 +19,7 @@ export type ActionContextBase = {
city?: City;
nation?: Nation | null;
rng: ActionRandomSource;
uniqueLottery?: UniqueLotteryRunner;
};
export type ActionResolveContext = ActionContextBase & Record<string, unknown>;