(node: BlueprintNode, context: unknown)
| 48 | |
| 49 | export class ApplyEffectExecutor implements INodeExecutor { |
| 50 | execute(node: BlueprintNode, context: unknown): ExecutionResult { |
| 51 | const ctx = context as EffectContext; |
| 52 | const effectTypeId = ctx.evaluateInput(node.id, 'effectTypeId', '') as string; |
| 53 | const duration = ctx.evaluateInput(node.id, 'duration', 0) as number; |
| 54 | const sourceId = ctx.evaluateInput(node.id, 'sourceId', '') as string; |
| 55 | |
| 56 | const container = ctx.getEffectContainer(); |
| 57 | if (!container || !effectTypeId) { |
| 58 | return { |
| 59 | outputs: { success: false, instanceId: '' }, |
| 60 | nextExec: 'exec' |
| 61 | }; |
| 62 | } |
| 63 | |
| 64 | // Create a basic effect definition |
| 65 | const definition: IEffectDefinition = { |
| 66 | typeId: effectTypeId, |
| 67 | displayName: effectTypeId, |
| 68 | tags: [], |
| 69 | duration: duration > 0 |
| 70 | ? { type: 'timed', duration, remainingTime: duration } |
| 71 | : { type: 'permanent' }, |
| 72 | stacking: { rule: 'refresh' } |
| 73 | }; |
| 74 | |
| 75 | const instance = container.apply(definition, sourceId || undefined); |
| 76 | |
| 77 | return { |
| 78 | outputs: { |
| 79 | success: instance !== null, |
| 80 | instanceId: instance?.instanceId ?? '' |
| 81 | }, |
| 82 | nextExec: 'exec' |
| 83 | }; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // ============================================================================= |
nothing calls this directly
no test coverage detected