fix: NPC 불가침 제의 수명주기를 보정
원조 기반 제의의 서신 만료 tick을 영속화하고 거절 상대를 영구 제외한다. 불가침 월별 감소와 만료 전후 선전포고 경계를 통합 회귀로 검증한다.
This commit is contained in:
@@ -253,6 +253,37 @@ export const respondToDiplomaticMessage = async (options: {
|
||||
}
|
||||
|
||||
if (!response) {
|
||||
let declinedAidProposalNationId: number | null = null;
|
||||
if (action === 'noAggression') {
|
||||
await db.$queryRaw`
|
||||
SELECT id
|
||||
FROM nation
|
||||
WHERE id = ${proposerNationId}
|
||||
FOR UPDATE
|
||||
`;
|
||||
const proposerNation = await db.nation.findUnique({ where: { id: proposerNationId } });
|
||||
if (proposerNation) {
|
||||
const proposerMeta = asRecord(proposerNation.meta);
|
||||
const respAssistTry = asRecord(proposerMeta.resp_assist_try);
|
||||
const assistKey = `n${actorNationId}`;
|
||||
if (Object.prototype.hasOwnProperty.call(respAssistTry, assistKey)) {
|
||||
const respAssistDeclined = asRecord(proposerMeta.resp_assist_declined);
|
||||
await db.nation.update({
|
||||
where: { id: proposerNationId },
|
||||
data: {
|
||||
meta: {
|
||||
...proposerMeta,
|
||||
resp_assist_declined: {
|
||||
...respAssistDeclined,
|
||||
[assistKey]: [actorNationId, world.currentYear * 12 + world.currentMonth - 1],
|
||||
},
|
||||
} as InputJsonValue,
|
||||
},
|
||||
});
|
||||
declinedAidProposalNationId = proposerNationId;
|
||||
}
|
||||
}
|
||||
}
|
||||
const actorLogger = new ActionLogger({ generalId: actor.id });
|
||||
const proposerLogger = new ActionLogger({ generalId: proposerGeneralId });
|
||||
const receiverNationName = message.payload.dest.nationName;
|
||||
@@ -278,7 +309,7 @@ export const respondToDiplomaticMessage = async (options: {
|
||||
reason: 'success',
|
||||
affectedMailboxes: [MESSAGE_MAILBOX_NATIONAL_BASE + actorNationId],
|
||||
affectedGeneralRecordIds: [actor.id, proposerGeneralId],
|
||||
affectedNationIds: [],
|
||||
affectedNationIds: declinedAidProposalNationId === null ? [] : [declinedAidProposalNationId],
|
||||
affectedCityIds: [],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user