update: state, event, condition, data.event.types

This commit is contained in:
Vick Scarlet
2026-08-16 20:06:16 +08:00
committed by 神戸小鳥
parent e035cdfe90
commit e646492e75
18 changed files with 1216 additions and 793 deletions
+36
View File
@@ -0,0 +1,36 @@
import { expect, test, describe } from 'bun:test'
import { createState } from './state'
import { trigger } from './event'
describe('Event', () => {
const profile = {
times: 0,
talents: new Set([]),
achievements: new Set([]),
events: new Set([]),
}
const allocation = {
charm: 10,
intelligence: 10,
strength: 0,
money: 0,
}
test('10003 branch 0 玉佩', () => {
const result = trigger(
10003,
createState(allocation, [1001, 1002, 1003]),
profile,
)
expect(result.state.life).toBe(1)
expect(result.state.events).toEqual(new Set([10003, 10004]))
expect(result.events).toEqual([10003, 10004])
})
test('10003 branch 1 死了', () => {
const result = trigger(10003, createState(allocation, []), profile)
expect(result.state.life).toBe(0)
expect(result.state.events).toEqual(new Set([10003, 10000]))
expect(result.events).toEqual([10003, 10000])
})
})