fix: 은퇴 명예 기록과 유산 수명주기 정합성을 복원한다
은퇴·사망·통일의 저장 순서와 명예의 전당 및 명장일람 판정을 Ref 흐름에 맞춘다. 유산 행동을 인증된 daemon transaction으로 통합하고 중복 지급·고유 아이템·로그·오류 경계를 회귀 테스트한다.
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
countOccupiedUniqueItems,
|
||||
resolveUniqueConfig,
|
||||
rollUniqueLottery,
|
||||
rollUniqueLotteryDetailed,
|
||||
} from '../src/rewards/uniqueLottery.js';
|
||||
|
||||
const buildItem = (key: string, slot: ItemModule['slot'], buyable = false): ItemModule => ({
|
||||
@@ -118,6 +119,51 @@ describe('unique lottery', () => {
|
||||
expect(result).toBe('itemB');
|
||||
});
|
||||
|
||||
it('distinguishes no slot, a failed roll, and exhausted supply', () => {
|
||||
const itemRegistry = buildRegistry();
|
||||
const base = {
|
||||
itemRegistry,
|
||||
scenarioId: 200,
|
||||
userCount: 1,
|
||||
currentYear: 200,
|
||||
currentMonth: 1,
|
||||
startYear: 180,
|
||||
initYear: 180,
|
||||
initMonth: 1,
|
||||
};
|
||||
|
||||
expect(
|
||||
rollUniqueLotteryDetailed({
|
||||
...base,
|
||||
rng: new RandUtil(LiteHashDRBG.build('no-slot')),
|
||||
config: buildConfig(),
|
||||
generalItems: { horse: null, weapon: 'itemB', book: null, item: null },
|
||||
occupiedUniqueCounts: new Map([['itemB', 1]]),
|
||||
})
|
||||
).toEqual({ status: 'NO_SLOT' });
|
||||
|
||||
expect(
|
||||
rollUniqueLotteryDetailed({
|
||||
...base,
|
||||
rng: new RandUtil(LiteHashDRBG.build('roll-failed')),
|
||||
config: buildConfig({ uniqueTrialCoef: 0, maxUniqueTrialProb: 0 }),
|
||||
generalItems: { horse: null, weapon: null, book: null, item: null },
|
||||
occupiedUniqueCounts: new Map(),
|
||||
})
|
||||
).toEqual({ status: 'ROLL_FAILED' });
|
||||
|
||||
expect(
|
||||
rollUniqueLotteryDetailed({
|
||||
...base,
|
||||
rng: new RandUtil(LiteHashDRBG.build('no-supply')),
|
||||
config: buildConfig(),
|
||||
generalItems: { horse: null, weapon: null, book: null, item: null },
|
||||
occupiedUniqueCounts: new Map([['itemB', 1]]),
|
||||
acquireType: '건국',
|
||||
})
|
||||
).toEqual({ status: 'NO_SUPPLY' });
|
||||
});
|
||||
|
||||
it('counts only non-buyable equipped items', () => {
|
||||
const itemRegistry = new Map<string, ItemModule>([
|
||||
['uniqueItem', buildItem('uniqueItem', 'weapon', false)],
|
||||
|
||||
Reference in New Issue
Block a user