Support target-scoped trauma mechanics
This commit is contained in:
@@ -25,6 +25,7 @@ const paramsByAction: Record<TriggerActionKey, unknown> = {
|
||||
]
|
||||
},
|
||||
headshot: {},
|
||||
body_shot: {},
|
||||
headshot_kill: {},
|
||||
weapon_kill: {},
|
||||
target_hit_within_distance: { meters: 15 },
|
||||
@@ -96,6 +97,27 @@ describe('mechanic recipe registry', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('maps head and body shots to authoritative weapon-hit predicates', () => {
|
||||
for (const [action, headshot] of [['headshot', true], ['body_shot', false]] as const) {
|
||||
expect(seedFor(action).clauses[0]).toMatchObject({
|
||||
when: 'weapon_hit',
|
||||
if: {
|
||||
kind: 'all',
|
||||
predicates: [
|
||||
{ kind: 'exists', value: { source: 'event', path: 'targetId' } },
|
||||
{ kind: 'exists', value: { source: 'event', path: 'values.headshot' } },
|
||||
{
|
||||
kind: 'compare',
|
||||
left: { source: 'event', path: 'values.headshot' },
|
||||
operator: 'eq',
|
||||
right: headshot
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it('models firing triggers as explicit lifecycle branches', () => {
|
||||
const continuous = seedFor('continuous_firing_duration');
|
||||
expect(continuous.pools).toEqual([expect.objectContaining({ key: 'firing-active', max: 1 })]);
|
||||
|
||||
Reference in New Issue
Block a user