fix general movement command parity
This commit is contained in:
@@ -17,7 +17,7 @@ import { tryApplyUniqueLottery } from '@sammo-ts/logic/rewards/uniqueLottery.js'
|
||||
import type { GeneralTurnCommandSpec } from './index.js';
|
||||
import type { MapDefinition } from '@sammo-ts/logic/world/types.js';
|
||||
import type { ActionContextBuilder } from '@sammo-ts/logic/actions/turn/actionContext.js';
|
||||
import { parseArgsWithSchema } from '../parseArgs.js';
|
||||
import { normalizeLegacyIntegerArg, parseArgsWithSchema } from '../parseArgs.js';
|
||||
|
||||
export interface ForcedMoveResolveContext<
|
||||
TriggerState extends GeneralTriggerState = GeneralTriggerState,
|
||||
@@ -30,7 +30,7 @@ export interface ForcedMoveResolveContext<
|
||||
const ACTION_NAME = '강행';
|
||||
const ACTION_KEY = 'che_강행';
|
||||
const ARGS_SCHEMA = z.object({
|
||||
destCityId: z.number(),
|
||||
destCityId: z.preprocess(normalizeLegacyIntegerArg, z.number().int()),
|
||||
});
|
||||
export type ForcedMoveArgs = z.infer<typeof ARGS_SCHEMA>;
|
||||
|
||||
|
||||
@@ -57,7 +57,10 @@ export class ActionResolver<
|
||||
// Logic: specific officer levels return to their assigned city
|
||||
// 2 (Chief?), 3 (Staff?), 4 (Governor/Taishu)
|
||||
if (officerLevel >= 2 && officerLevel <= 4) {
|
||||
const officerCity = readMetaNumberFromUnknown(general.meta, 'officer_city');
|
||||
const officerCity =
|
||||
readMetaNumberFromUnknown(general.meta, 'officer_city') ??
|
||||
readMetaNumberFromUnknown(general.meta, 'officerCity') ??
|
||||
readMetaNumberFromUnknown(general.meta, 'officerCityId');
|
||||
if (officerCity) {
|
||||
destCityId = officerCity;
|
||||
}
|
||||
@@ -180,9 +183,7 @@ export class ActionDefinition<
|
||||
export const actionContextBuilder: ActionContextBuilder = (base, options) => {
|
||||
return {
|
||||
...base,
|
||||
// We effectively need all cities to find the destination name if it's not the capital.
|
||||
// Or at least nation cities.
|
||||
nationCities: options.worldRef?.listCities().filter((c) => c.nationId === base.nation?.id) ?? [],
|
||||
nationCities: options.worldRef?.listCities() ?? [],
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -80,13 +80,13 @@ export class ActionResolver<
|
||||
const josaUl = JosaUtil.pick(nation.name, '을');
|
||||
context.addLog(`<Y>${general.name}</>${josaYi} 방랑의 길을 떠납니다.`, {
|
||||
scope: LogScope.SYSTEM,
|
||||
category: LogCategory.ACTION,
|
||||
format: LogFormat.RAWTEXT,
|
||||
category: LogCategory.SUMMARY,
|
||||
format: LogFormat.MONTH,
|
||||
});
|
||||
context.addLog(`<R><b>【방랑】</b></><D><b>${general.name}</b></>${josaUn} <R>방랑</>의 길을 떠납니다.`, {
|
||||
scope: LogScope.SYSTEM,
|
||||
category: LogCategory.HISTORY,
|
||||
format: LogFormat.RAWTEXT,
|
||||
format: LogFormat.YEAR_MONTH,
|
||||
});
|
||||
context.addLog(`<D><b>${nation.name}</b></>${josaUl} 버리고 방랑`, {
|
||||
scope: LogScope.GENERAL,
|
||||
|
||||
@@ -662,6 +662,10 @@ export const notCapital = (checkCurrentCity = false): Constraint => ({
|
||||
}
|
||||
|
||||
if (targetCityId === nation.capitalCityId) {
|
||||
const general = readGeneral(ctx, view);
|
||||
if (checkCurrentCity && general && general.officerLevel >= 2 && general.officerLevel <= 4) {
|
||||
return allow();
|
||||
}
|
||||
return { kind: 'deny', reason: '수도입니다.' };
|
||||
}
|
||||
return allow();
|
||||
|
||||
Reference in New Issue
Block a user