fix: 사령턴 이후 자율행동 상태를 갱신한다
This commit is contained in:
@@ -488,6 +488,23 @@ export class GeneralAI {
|
||||
return message;
|
||||
}
|
||||
|
||||
syncGeneralAfterNationAction(general: TurnGeneral): void {
|
||||
const meta = { ...general.meta } as Record<string, unknown>;
|
||||
for (const key of [
|
||||
'fullLeadership',
|
||||
'fullStrength',
|
||||
'fullIntelligence',
|
||||
'effectiveLeadership',
|
||||
'effectiveStrength',
|
||||
'effectiveIntelligence',
|
||||
]) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.general.meta, key)) {
|
||||
meta[key] = this.general.meta[key];
|
||||
}
|
||||
}
|
||||
this.general = { ...general, meta: meta as TurnGeneral['meta'] };
|
||||
}
|
||||
|
||||
chooseGeneralTurn(reservedTurn: ReservedTurnEntry): AiCommandCandidate | null {
|
||||
this.updateInstance();
|
||||
if (!this.worldRef) {
|
||||
|
||||
@@ -1994,6 +1994,10 @@ export const createReservedTurnHandler = async (options: {
|
||||
// The following general command therefore observes and adds to
|
||||
// those fractions before the turn's final persistence boundary.
|
||||
worldOverlay?.syncGeneral(currentGeneral);
|
||||
// Ref keeps one mutable General object across nation/general AI
|
||||
// selection. Core uses immutable patches, so carry the executed
|
||||
// nation action back into the shared AI without resetting its RNG.
|
||||
sharedAi?.syncGeneralAfterNationAction(currentGeneral);
|
||||
if (
|
||||
worldView &&
|
||||
(process.env.CORE_AI_TRACE_GENERAL_IDS?.split(',') ?? []).includes(String(currentGeneral.id))
|
||||
|
||||
Reference in New Issue
Block a user