26 lines
1.3 KiB
TypeScript
26 lines
1.3 KiB
TypeScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { buildSkillDesc } from '../src/shared/desc/buildSkillDesc';
|
|
import { RecordValue } from '../src/io/recordValue';
|
|
|
|
const skillSet: Record<number, RecordValue> = {
|
|
6301: { kind: 'obj', props: { name: { kind: 'str', value: '护盾' }, kind: { kind: 'enumRef', qualifier: 'SkillKind', member: 'Shield' }, ap: { kind: 'num', value: 4 } } },
|
|
};
|
|
const fieldSet: Record<number, RecordValue> = {
|
|
7015: { kind: 'obj', props: { name: { kind: 'str', value: '死亡强化' }, info: { kind: 'str', value: '死亡触发技能次数+1' } } },
|
|
};
|
|
const hero: RecordValue = { kind: 'obj', props: {
|
|
atked: { kind: 'arr', items: [{ kind: 'obj', props: { s_uuid: { kind: 'num', value: 6301 }, t_num: { kind: 'num', value: 3 }, overrides: { kind: 'obj', props: { ap: { kind: 'num', value: 4 } } } } }] },
|
|
field: { kind: 'arr', items: [{ kind: 'num', value: 7015 }] },
|
|
} };
|
|
|
|
test('renders atked trigger with shield effect', () => {
|
|
const out = buildSkillDesc(hero, skillSet, fieldSet);
|
|
assert.match(out, /受击3次:护盾/);
|
|
assert.match(out, /护盾4次/);
|
|
});
|
|
test('renders field aura', () => {
|
|
const out = buildSkillDesc(hero, skillSet, fieldSet);
|
|
assert.match(out, /场上存活:死亡强化 死亡触发技能次数\+1/);
|
|
});
|