fix: align scenario 2400 monthly parity
This commit is contained in:
@@ -157,6 +157,7 @@ const DEFAULT_WAR_CONFIG = {
|
||||
const DEFAULT_AFTER_CONFIG = {
|
||||
techLevelIncYear: 5,
|
||||
initialAllowedTechLevel: 1,
|
||||
maxTechLevel: 12,
|
||||
defaultCityWall: 1000,
|
||||
baseGold: 0,
|
||||
baseRice: 2000,
|
||||
@@ -235,7 +236,7 @@ export const buildWarAftermathConfig = (
|
||||
['initialAllowedTechLevel'],
|
||||
DEFAULT_AFTER_CONFIG.initialAllowedTechLevel
|
||||
),
|
||||
maxTechLevel: resolveNumber(constValues, ['maxTechLevel'], 0),
|
||||
maxTechLevel: resolveNumber(constValues, ['maxTechLevel'], DEFAULT_AFTER_CONFIG.maxTechLevel),
|
||||
defaultCityWall: resolveNumber(constValues, ['defaultCityWall'], DEFAULT_AFTER_CONFIG.defaultCityWall),
|
||||
baseGold: resolveNumber(constValues, ['baseGold', 'basegold'], DEFAULT_AFTER_CONFIG.baseGold),
|
||||
baseRice: resolveNumber(constValues, ['baseRice', 'baserice'], DEFAULT_AFTER_CONFIG.baseRice),
|
||||
|
||||
@@ -23,6 +23,7 @@ import { tryApplyUniqueLottery } from '@sammo-ts/logic/rewards/uniqueLottery.js'
|
||||
import type { GeneralTurnCommandSpec } from './index.js';
|
||||
import { parseArgsWithSchema } from '../parseArgs.js';
|
||||
import { JosaUtil } from '@sammo-ts/common';
|
||||
import { GeneralActionPipeline } from '@sammo-ts/logic/actionModules/general.js';
|
||||
|
||||
const ACTION_NAME = '임관';
|
||||
const ARGS_SCHEMA = z.object({
|
||||
@@ -43,7 +44,11 @@ export class ActionDefinition<
|
||||
> implements GeneralActionDefinition<TriggerState, AppointmentArgs> {
|
||||
public readonly key = 'che_임관';
|
||||
public readonly name = ACTION_NAME;
|
||||
constructor(private readonly env: TurnCommandEnv) {}
|
||||
private readonly pipeline: GeneralActionPipeline<TriggerState>;
|
||||
|
||||
constructor(private readonly env: TurnCommandEnv) {
|
||||
this.pipeline = new GeneralActionPipeline(env.generalActionModules ?? []);
|
||||
}
|
||||
|
||||
getInheritanceActiveActionAmount(): number {
|
||||
return 1;
|
||||
@@ -116,7 +121,11 @@ export class ActionDefinition<
|
||||
troopId: 0,
|
||||
experience:
|
||||
context.general.experience +
|
||||
(context.destNationGeneralCount < this.env.initialNationGenLimit ? 700 : 100),
|
||||
this.pipeline.onCalcStat(
|
||||
context,
|
||||
'experience',
|
||||
context.destNationGeneralCount < this.env.initialNationGenLimit ? 700 : 100
|
||||
),
|
||||
meta: {
|
||||
...context.general.meta,
|
||||
officer_city: 0,
|
||||
|
||||
@@ -64,6 +64,10 @@ export interface DispatchResolveContext<
|
||||
aftermathConfig: WarAftermathConfig;
|
||||
}
|
||||
|
||||
export const orderDefenderGenerals = <TriggerState extends GeneralTriggerState>(
|
||||
generals: General<TriggerState>[]
|
||||
): General<TriggerState>[] => [...generals].sort((left, right) => left.id - right.id);
|
||||
|
||||
const ACTION_NAME = '출병';
|
||||
const ARGS_SCHEMA = z.object({
|
||||
destCityId: z.number(),
|
||||
@@ -86,7 +90,12 @@ const fixtureNumber = (value: unknown, fallback = 0): number =>
|
||||
typeof value === 'number' && Number.isFinite(value) ? value : fallback;
|
||||
|
||||
const formatFixtureDate = (value: Date | undefined): string =>
|
||||
value ? value.toISOString().replace('T', ' ').replace(/\.\d{3}Z$/u, '') : '1970-01-01 00:00:00';
|
||||
value
|
||||
? value
|
||||
.toISOString()
|
||||
.replace('T', ' ')
|
||||
.replace(/\.\d{3}Z$/u, '')
|
||||
: '1970-01-01 00:00:00';
|
||||
|
||||
const buildBattleGeneralFixture = <TriggerState extends GeneralTriggerState>(general: General<TriggerState>) => {
|
||||
const meta = general.meta;
|
||||
@@ -105,9 +114,7 @@ const buildBattleGeneralFixture = <TriggerState extends GeneralTriggerState>(gen
|
||||
inheritBuff = parsed;
|
||||
} else if (typeof parsed === 'object' && parsed !== null) {
|
||||
inheritBuff = Object.fromEntries(
|
||||
Object.entries(parsed).filter(
|
||||
(entry): entry is [string, number] => typeof entry[1] === 'number'
|
||||
)
|
||||
Object.entries(parsed).filter((entry): entry is [string, number] => typeof entry[1] === 'number')
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
@@ -556,12 +563,14 @@ export class ActionDefinition<
|
||||
defenderCity.meta.term = 3;
|
||||
const defenderNation = defenderCity.nationId > 0 ? (nationMap.get(defenderCity.nationId) ?? null) : null;
|
||||
|
||||
const defenderGenerals = generals.filter(
|
||||
(general) =>
|
||||
general.cityId === defenderCity.id &&
|
||||
general.nationId === defenderCity.nationId &&
|
||||
general.crew > 0 &&
|
||||
(unitSet.crewTypes?.some((crewType) => crewType.id === general.crewTypeId) ?? false)
|
||||
const defenderGenerals = orderDefenderGenerals(
|
||||
generals.filter(
|
||||
(general) =>
|
||||
general.cityId === defenderCity.id &&
|
||||
general.nationId === defenderCity.nationId &&
|
||||
general.crew > 0 &&
|
||||
(unitSet.crewTypes?.some((crewType) => crewType.id === general.crewTypeId) ?? false)
|
||||
)
|
||||
);
|
||||
const traceGeneralIds = new Set(process.env.CORE_AI_TRACE_GENERAL_IDS?.split(',') ?? []);
|
||||
const shouldTraceWar =
|
||||
@@ -647,9 +656,7 @@ export class ActionDefinition<
|
||||
// to deploy. Preserve that ordering before snapshotting city effects.
|
||||
let frontStatePatches: Array<{ id: number; frontState: number }> = [];
|
||||
if (battle.conquered && context.map && context.diplomacy) {
|
||||
const connections = new Map(
|
||||
context.map.cities.map((city) => [city.id, city.connections ?? []] as const)
|
||||
);
|
||||
const connections = new Map(context.map.cities.map((city) => [city.id, city.connections ?? []] as const));
|
||||
const nearbyCityIds = new Set([defenderCity.id, ...(connections.get(defenderCity.id) ?? [])]);
|
||||
const nearbyNationIds = new Set<number>([aftermath.conquest?.conquerNationId ?? attackerNation.id]);
|
||||
for (const city of cities) {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* the value rounded to six significant decimal digits on the next read.
|
||||
* Keep those boundaries separate so later SQL expressions use binary32 state.
|
||||
*/
|
||||
export const storeLegacyCityTrust = (value: number): number => Math.fround(value);
|
||||
import { readLegacyStoredFloat, toLegacyStoredFloat } from '@sammo-ts/logic/compat/legacyFloat.js';
|
||||
|
||||
export const readLegacyCityTrust = (value: number): number => Number(Math.fround(value).toPrecision(6));
|
||||
export const storeLegacyCityTrust = (value: number): number => toLegacyStoredFloat(value);
|
||||
|
||||
export const readLegacyCityTrust = (value: number): number => readLegacyStoredFloat(value);
|
||||
|
||||
Reference in New Issue
Block a user