fix: align item battle progression with legacy

This commit is contained in:
2026-07-25 07:04:58 +00:00
parent 7ed1b5df7f
commit 828dceae13
5 changed files with 112 additions and 15 deletions
@@ -25,14 +25,20 @@ export const itemModule: ItemModule = {
context: GeneralActionContext | WarActionContext,
statName: GeneralStatName | WarStatName,
value: number | [number, number],
_aux?: unknown
aux?: unknown
): number | [number, number] {
let newValue: number | [number, number] = value;
if (statName === 'leadership' && typeof value === 'number') {
newValue = value + STAT_VALUE;
}
if (statName === 'warAvoidRatio' && typeof newValue === 'number') {
const { leadership } = context.general.stats;
const leadership =
typeof aux === 'object' &&
aux !== null &&
'leadership' in aux &&
typeof aux.leadership === 'number'
? aux.leadership
: context.general.stats.leadership + STAT_VALUE;
const crewL = context.general.crew / 100;
const boost = (1 - crewL / leadership) * 0.5;
return newValue + Math.min(Math.max(boost, 0), 0.5);
@@ -1,9 +1,22 @@
import { che_저지, che_저지_시도 } from '@sammo-ts/logic/war/triggers/che_저지.js';
import { WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
import { TriggerPriority } from '@sammo-ts/logic/triggers/core.js';
import { che_저지 } from '@sammo-ts/logic/war/triggers/che_저지.js';
import { BaseWarUnitTrigger, WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
import type { WarUnit } from '@sammo-ts/logic/war/units.js';
import type { ItemModule } from './types.js';
const ITEM_KEY = 'che_저지_삼황내문';
class ActivateItemHalt extends BaseWarUnitTrigger {
constructor(unit: WarUnit) {
super(unit, TriggerPriority.Pre);
}
protected actionWar(self: WarUnit): boolean {
self.activateSkill('특수', '저지');
return true;
}
}
export const itemModule: ItemModule = {
key: ITEM_KEY,
rawName: '삼황내문',
@@ -28,10 +41,10 @@ export const itemModule: ItemModule = {
if (haltCount >= 2) {
return null;
}
if (haltCount === 1 && unit.getPhase() === 0 && !unit.rng.nextBool(0.5)) {
if (haltCount === 1 && unit.getPhase() === 0 && unit.rng.nextBool(0.5)) {
return null;
}
return new WarTriggerCaller(new che_저지_시도(unit), new che_저지(unit));
return new WarTriggerCaller(new ActivateItemHalt(unit), new che_저지(unit));
},
};