diff --git a/packages/logic/src/actions/turn/general/index.ts b/packages/logic/src/actions/turn/general/index.ts index a6bd0f1..3b8c78a 100644 --- a/packages/logic/src/actions/turn/general/index.ts +++ b/packages/logic/src/actions/turn/general/index.ts @@ -2,13 +2,15 @@ export type GeneralTurnCommandKey = | 'che_상업투자' | 'che_화계' | 'che_인재탐색' - | 'che_의병모집'; + | 'che_의병모집' + | '휴식'; export type GeneralTurnCommandModule = | typeof import('./che_상업투자.js') | typeof import('./che_화계.js') | typeof import('./che_인재탐색.js') - | typeof import('./che_의병모집.js'); + | typeof import('./che_의병모집.js') + | typeof import('./휴식.js'); export type GeneralTurnCommandImporter = () => Promise; @@ -20,6 +22,7 @@ const defaultImporters: Record< che_화계: async () => import('./che_화계.js'), che_인재탐색: async () => import('./che_인재탐색.js'), che_의병모집: async () => import('./che_의병모집.js'), + 휴식: async () => import('./휴식.js'), }; export class GeneralTurnCommandLoader { @@ -61,3 +64,7 @@ export { ActionResolver as VolunteerRecruitActionResolver, CommandResolver as VolunteerRecruitCommandResolver, } from './che_의병모집.js'; +export { + ActionDefinition as RestActionDefinition, + ActionResolver as RestActionResolver, +} from './휴식.js'; diff --git a/packages/logic/src/actions/turn/general/휴식.ts b/packages/logic/src/actions/turn/general/휴식.ts new file mode 100644 index 0000000..77ee379 --- /dev/null +++ b/packages/logic/src/actions/turn/general/휴식.ts @@ -0,0 +1,68 @@ +import type { + GeneralTriggerState, +} from '../../../domain/entities.js'; +import type { + Constraint, + ConstraintContext, +} from '../../../constraints/types.js'; +import type { GeneralActionDefinition } from '../../definition.js'; +import type { + GeneralActionOutcome, + GeneralActionResolveContext, +} from '../../engine.js'; +import { createLogEffect } from '../../engine.js'; +import { LogCategory, LogFormat, LogScope } from '../../../logging/types.js'; + +export interface RestArgs {} + +const ACTION_NAME = '휴식'; + +export class ActionResolver< + TriggerState extends GeneralTriggerState = GeneralTriggerState +> { + resolve( + _context: GeneralActionResolveContext, + _args: RestArgs + ): GeneralActionOutcome { + void _context; + void _args; + return { + effects: [ + createLogEffect('아무것도 실행하지 않았습니다.', { + scope: LogScope.GENERAL, + category: LogCategory.ACTION, + format: LogFormat.MONTH, + }), + ], + }; + } +} + +export class ActionDefinition< + TriggerState extends GeneralTriggerState = GeneralTriggerState +> implements GeneralActionDefinition { + public readonly key = '휴식'; + public readonly name = ACTION_NAME; + private readonly resolver = new ActionResolver(); + + parseArgs(_raw: unknown): RestArgs | null { + void _raw; + return {}; + } + + buildConstraints( + _ctx: ConstraintContext, + _args: RestArgs + ): Constraint[] { + void _ctx; + void _args; + return []; + } + + resolve( + context: GeneralActionResolveContext, + args: RestArgs + ): GeneralActionOutcome { + return this.resolver.resolve(context, args); + } +}