feat: add 휴식 (Rest) action for generals
This commit is contained in:
@@ -2,13 +2,15 @@ export type GeneralTurnCommandKey =
|
|||||||
| 'che_상업투자'
|
| 'che_상업투자'
|
||||||
| 'che_화계'
|
| 'che_화계'
|
||||||
| 'che_인재탐색'
|
| 'che_인재탐색'
|
||||||
| 'che_의병모집';
|
| 'che_의병모집'
|
||||||
|
| '휴식';
|
||||||
|
|
||||||
export type GeneralTurnCommandModule =
|
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('./che_인재탐색.js')
|
||||||
| typeof import('./che_의병모집.js');
|
| typeof import('./che_의병모집.js')
|
||||||
|
| typeof import('./휴식.js');
|
||||||
|
|
||||||
export type GeneralTurnCommandImporter = () => Promise<GeneralTurnCommandModule>;
|
export type GeneralTurnCommandImporter = () => Promise<GeneralTurnCommandModule>;
|
||||||
|
|
||||||
@@ -20,6 +22,7 @@ const defaultImporters: Record<
|
|||||||
che_화계: async () => import('./che_화계.js'),
|
che_화계: async () => import('./che_화계.js'),
|
||||||
che_인재탐색: async () => import('./che_인재탐색.js'),
|
che_인재탐색: async () => import('./che_인재탐색.js'),
|
||||||
che_의병모집: async () => import('./che_의병모집.js'),
|
che_의병모집: async () => import('./che_의병모집.js'),
|
||||||
|
휴식: async () => import('./휴식.js'),
|
||||||
};
|
};
|
||||||
|
|
||||||
export class GeneralTurnCommandLoader {
|
export class GeneralTurnCommandLoader {
|
||||||
@@ -61,3 +64,7 @@ export {
|
|||||||
ActionResolver as VolunteerRecruitActionResolver,
|
ActionResolver as VolunteerRecruitActionResolver,
|
||||||
CommandResolver as VolunteerRecruitCommandResolver,
|
CommandResolver as VolunteerRecruitCommandResolver,
|
||||||
} from './che_의병모집.js';
|
} from './che_의병모집.js';
|
||||||
|
export {
|
||||||
|
ActionDefinition as RestActionDefinition,
|
||||||
|
ActionResolver as RestActionResolver,
|
||||||
|
} from './휴식.js';
|
||||||
|
|||||||
@@ -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<TriggerState>,
|
||||||
|
_args: RestArgs
|
||||||
|
): GeneralActionOutcome<TriggerState> {
|
||||||
|
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<TriggerState, RestArgs> {
|
||||||
|
public readonly key = '휴식';
|
||||||
|
public readonly name = ACTION_NAME;
|
||||||
|
private readonly resolver = new ActionResolver<TriggerState>();
|
||||||
|
|
||||||
|
parseArgs(_raw: unknown): RestArgs | null {
|
||||||
|
void _raw;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
buildConstraints(
|
||||||
|
_ctx: ConstraintContext,
|
||||||
|
_args: RestArgs
|
||||||
|
): Constraint[] {
|
||||||
|
void _ctx;
|
||||||
|
void _args;
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(
|
||||||
|
context: GeneralActionResolveContext<TriggerState>,
|
||||||
|
args: RestArgs
|
||||||
|
): GeneralActionOutcome<TriggerState> {
|
||||||
|
return this.resolver.resolve(context, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user