merge: NPC 이동 로그 도시명 표시 통합
This commit is contained in:
@@ -12,6 +12,7 @@ import { LogCategory, LogFormat } from '@sammo-ts/logic/logging/types.js';
|
||||
import { JosaUtil } from '@sammo-ts/common';
|
||||
import { z } from 'zod';
|
||||
import type { TurnCommandEnv } from '@sammo-ts/logic/actions/turn/commandEnv.js';
|
||||
import type { ActionContextBuilder } from '@sammo-ts/logic/actions/turn/actionContext.js';
|
||||
import type { GeneralTurnCommandSpec } from './index.js';
|
||||
import type { MapDefinition } from '@sammo-ts/logic/world/types.js';
|
||||
import { normalizeLegacyIntegerArg, parseArgsWithSchema } from '../parseArgs.js';
|
||||
@@ -68,11 +69,8 @@ export class ActionResolver<
|
||||
|
||||
const destCityId = args.destCityId;
|
||||
const storedDestCityId = args.storedDestCityId ?? destCityId;
|
||||
let destCityName = `도시(${destCityId})`;
|
||||
if (context.map) {
|
||||
const c = context.map.cities.find((ct) => ct.id === destCityId);
|
||||
if (c) destCityName = c.name;
|
||||
}
|
||||
const destCityName =
|
||||
context.map?.cities.find((city) => city.id === destCityId)?.name ?? '알 수 없는 도시';
|
||||
|
||||
const josaRo = JosaUtil.pick(destCityName, '로');
|
||||
|
||||
@@ -132,6 +130,11 @@ export class ActionDefinition<
|
||||
}
|
||||
}
|
||||
|
||||
export const actionContextBuilder: ActionContextBuilder = (base, options) => ({
|
||||
...base,
|
||||
map: options.map,
|
||||
});
|
||||
|
||||
export const commandSpec: GeneralTurnCommandSpec = {
|
||||
key: 'che_NPC능동',
|
||||
category: '특수', // Valid category? Legacy didn't specify category in static prop usually, handled by mapping. Defaulting to '특수'.
|
||||
|
||||
@@ -68,11 +68,8 @@ export class ActionResolver<
|
||||
const goldCost = develCost * 5;
|
||||
|
||||
// Log destination
|
||||
let destCityName = `도시(${destCityId})`;
|
||||
if (context.map) {
|
||||
const c = context.map.cities.find((ct) => ct.id === destCityId);
|
||||
if (c) destCityName = c.name;
|
||||
}
|
||||
const destCityName =
|
||||
context.map?.cities.find((city) => city.id === destCityId)?.name ?? '알 수 없는 도시';
|
||||
|
||||
const josaRo = JosaUtil.pick(destCityName, '로');
|
||||
|
||||
|
||||
@@ -68,11 +68,8 @@ export class ActionResolver<
|
||||
|
||||
const cost = context.develCost ?? 0;
|
||||
|
||||
let destCityName = `도시(${destCityId})`;
|
||||
if (context.map) {
|
||||
const c = context.map.cities.find((ct) => ct.id === destCityId);
|
||||
if (c) destCityName = c.name;
|
||||
}
|
||||
const destCityName =
|
||||
context.map?.cities.find((city) => city.id === destCityId)?.name ?? '알 수 없는 도시';
|
||||
|
||||
const josaRo = JosaUtil.pick(destCityName, '로');
|
||||
|
||||
|
||||
@@ -421,6 +421,21 @@ integration('general command success matrix', () => {
|
||||
ignoredPathPatterns: ignoredLifecyclePaths,
|
||||
})
|
||||
).toEqual([]);
|
||||
if (action === 'che_이동' || action === 'che_강행') {
|
||||
const actionLogSuffix = action === 'che_이동' ? '이동했습니다.' : '강행했습니다.';
|
||||
expect(
|
||||
semanticLogSignatures(
|
||||
core.after.logs.filter((entry) => String(entry.text).includes(actionLogSuffix))
|
||||
)
|
||||
).toEqual(
|
||||
semanticLogSignatures(
|
||||
addedReferenceLogs(reference.before, reference.after.logs).filter((entry) =>
|
||||
String(entry.text).includes(actionLogSuffix)
|
||||
)
|
||||
)
|
||||
);
|
||||
expect(core.after.logs.some((entry) => String(entry.text).includes('도시('))).toBe(false);
|
||||
}
|
||||
},
|
||||
120_000
|
||||
);
|
||||
@@ -564,6 +579,12 @@ integration('NPC active command boundary parity', () => {
|
||||
ignoredPathPatterns: ignoredLifecyclePaths,
|
||||
})
|
||||
).toEqual([]);
|
||||
if (completed) {
|
||||
expect(semanticLogSignatures(core.after.logs)).toEqual(
|
||||
semanticLogSignatures(addedReferenceLogs(reference.before, reference.after.logs))
|
||||
);
|
||||
expect(core.after.logs.some((entry) => String(entry.text).includes('도시('))).toBe(false);
|
||||
}
|
||||
},
|
||||
120_000
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user