Merge branch 'main' into feature/nation-seizure-npc-message-parity

This commit is contained in:
2026-07-26 06:06:12 +00:00
39 changed files with 706 additions and 329 deletions
@@ -14,7 +14,7 @@ import type { TurnCommandEnv } from '@sammo-ts/logic/actions/turn/commandEnv.js'
import { defaultActionContextBuilder } from '@sammo-ts/logic/actions/turn/actionContext.js';
import { tryApplyUniqueLottery } from '@sammo-ts/logic/rewards/uniqueLottery.js';
import type { GeneralTurnCommandSpec } from './index.js';
import { JosaUtil } from '@sammo-ts/common';
import { JosaUtil, LEGACY_RANK_DATA_TYPES, rankDataMetaKey } from '@sammo-ts/common';
export interface RetireArgs {}
@@ -22,7 +22,6 @@ const ACTION_NAME = '은퇴';
const ACTION_KEY = 'che_은퇴';
const REQ_AGE = 60;
const reqGeneralValue = (): Constraint => ({
name: 'reqGeneralValue',
requires: (ctx) => [{ kind: 'general', id: ctx.actorId }],
@@ -51,46 +50,8 @@ export class ActionResolver<
}
nextMeta.specAge = 0;
nextMeta.specAge2 = 0;
nextMeta.firenum = 0;
for (const key of [
'warnum',
'killnum',
'deathnum',
'killcrew',
'deathcrew',
'ttw',
'ttd',
'ttl',
'ttg',
'ttp',
'tlw',
'tld',
'tll',
'tlg',
'tlp',
'tsw',
'tsd',
'tsl',
'tsg',
'tsp',
'tiw',
'tid',
'til',
'tig',
'tip',
'betwin',
'betgold',
'betwingold',
'killcrew_person',
'deathcrew_person',
'occupied',
'inherit_earned',
'inherit_spent',
'inherit_earned_dyn',
'inherit_earned_act',
'inherit_spent_dyn',
]) {
nextMeta[`rank_${key}`] = 0;
for (const type of LEGACY_RANK_DATA_TYPES) {
nextMeta[rankDataMetaKey(type)] = 0;
}
const josaYi = JosaUtil.pick(general.name, '이');
+5 -2
View File
@@ -124,8 +124,11 @@ export const parsePercent = (value: string): number | null => {
export type CompareOperator = '>' | '>=' | '==' | '<=' | '<' | '!=' | '===' | '!==';
export const compareValues = (target: unknown, op: CompareOperator, source: unknown): boolean => {
const lhs = target as any;
const rhs = source as any;
// The cast is type-only: JavaScript still applies its native relational
// coercion rules to the original runtime values, matching the legacy
// constraint evaluator without opting the whole comparison into `any`.
const lhs = target as number;
const rhs = source as number;
switch (op) {
case '<':
return lhs < rhs;
+2 -6
View File
@@ -196,10 +196,7 @@ const resolveUnitReport = (unit: WarUnit): WarUnitReport => {
};
};
const buildTraceUnitSnapshot = (
unit: WarUnit,
defenderCity: City
): WarBattleTraceUnitSnapshot => {
const buildTraceUnitSnapshot = (unit: WarUnit, defenderCity: City): WarBattleTraceUnitSnapshot => {
const common = {
kind: unit instanceof WarUnitGeneral ? ('general' as const) : ('city' as const),
id: unit instanceof WarUnitGeneral ? unit.getGeneral().id : (unit as WarUnitCity).getCityId(),
@@ -339,7 +336,6 @@ export const resolveWarBattle = <TriggerState extends GeneralTriggerState = Gene
);
const iter = defenderUnits.values();
let defender: WarUnit<TriggerState> | null = null;
const getNextDefender = (
_prevDefender: WarUnit<TriggerState> | null,
@@ -359,7 +355,7 @@ export const resolveWarBattle = <TriggerState extends GeneralTriggerState = Gene
return candidate;
};
defender = getNextDefender(null, true);
let defender = getNextDefender(null, true);
let conquerCity = false;
let logWritten = false;
let traceSeq = 0;