fix: 장수 런타임 레벨 상한을 Ref 기준으로 복구

가입 능력치 배분 상한과 런타임 레벨 상한을 분리하고, Ref 기본값 255를 공유 상수로 통합한다. 모병 후 레벨 유지와 국가 장수 목록의 고레벨 표시를 회귀 테스트로 고정한다.
This commit is contained in:
2026-08-21 08:37:38 +00:00
parent bba0d3b5c0
commit deb01f7f2b
21 changed files with 124 additions and 49 deletions
+6 -13
View File
@@ -8,7 +8,7 @@ import type {
TurnCommandEnv,
UnitSetDefinition,
} from '@sammo-ts/logic';
import { evaluateConstraints } from '@sammo-ts/logic';
import { evaluateConstraints, LEGACY_DEFAULT_MAX_LEVEL } from '@sammo-ts/logic';
import type { ConstraintContext } from '@sammo-ts/logic';
import { GAME_TICKS_PER_TURN, LiteHashDRBG, RandUtil } from '@sammo-ts/common';
import { simpleSerialize } from '@sammo-ts/logic/war/utils.js';
@@ -872,17 +872,14 @@ export class GeneralAI {
? resolveLegacyAiStatsWithModules(
candidate,
this.nation,
this.commandEnv.maxStatLevel ?? this.scenarioConfig.stat.max,
this.commandEnv.maxStatLevel ?? LEGACY_DEFAULT_MAX_LEVEL,
this.commandEnv.generalActionModules,
this.worldRef,
this.world,
this.startYear
).fullLeadership
: resolveLegacyAiStats(
candidate,
this.nation,
this.commandEnv.maxStatLevel ?? this.scenarioConfig.stat.max
).fullLeadership;
: resolveLegacyAiStats(candidate, this.nation, this.commandEnv.maxStatLevel ?? LEGACY_DEFAULT_MAX_LEVEL)
.fullLeadership;
if (fullLeadership >= this.nationPolicy.minNpcWarLeadership) {
npcWarGenerals[candidate.id] = candidate;
} else {
@@ -1055,17 +1052,13 @@ export class GeneralAI {
? resolveLegacyAiStatsWithModules(
this.general,
this.nation,
this.commandEnv.maxStatLevel ?? this.scenarioConfig.stat.max,
this.commandEnv.maxStatLevel ?? LEGACY_DEFAULT_MAX_LEVEL,
this.commandEnv.generalActionModules,
this.worldRef,
this.world,
this.startYear
)
: resolveLegacyAiStats(
this.general,
this.nation,
this.commandEnv.maxStatLevel ?? this.scenarioConfig.stat.max
);
: resolveLegacyAiStats(this.general, this.nation, this.commandEnv.maxStatLevel ?? LEGACY_DEFAULT_MAX_LEVEL);
this.general.meta = {
...this.general.meta,
...stats,
@@ -1,5 +1,6 @@
import type { GeneralAI } from '../core.js';
import { GeneralActionPipeline } from '@sammo-ts/logic/actionModules/general.js';
import { LEGACY_DEFAULT_MAX_LEVEL } from '@sammo-ts/logic/scenario/constants.js';
import { findCrewTypeById, getTechCost } from '@sammo-ts/logic/world/unitSet.js';
import type { TurnGeneral } from '../../../types.js';
import { asRecord, readMetaNumber, readRequiredMetaNumber } from '../../aiUtils.js';
@@ -72,12 +73,12 @@ const getFullLeadership = (ai: GeneralAI, general: TurnGeneral): number => {
'leadership',
general.stats.leadership
);
const maxStat = ai.commandEnv.maxStatLevel ?? ai.scenarioConfig.stat.max;
const maxStat = ai.commandEnv.maxStatLevel ?? LEGACY_DEFAULT_MAX_LEVEL;
return Math.trunc(Math.max(0, Math.min(Number(adjusted), maxStat)));
}
const nationLevel = ai.nation?.level ?? 0;
const officerBonus = general.officerLevel === 12 ? nationLevel * 2 : general.officerLevel >= 5 ? nationLevel : 0;
const maxStat = ai.commandEnv.maxStatLevel ?? ai.scenarioConfig.stat.max;
const maxStat = ai.commandEnv.maxStatLevel ?? LEGACY_DEFAULT_MAX_LEVEL;
return Math.max(0, Math.min(general.stats.leadership + officerBonus, maxStat));
};