wip: 바보 젬3플. type 재정의 준비

This commit is contained in:
2026-01-05 18:43:09 +00:00
parent 27f7b8e894
commit 6bddbc3aa0
7 changed files with 254 additions and 167 deletions
+15 -10
View File
@@ -466,8 +466,8 @@ export class WarUnitGeneral<
const baseTurnTime = this.isAttacker()
? getMetaString(this.general.meta, META_TURN_TIME)
: oppose instanceof WarUnitGeneral
? getMetaString(oppose.general.meta, META_TURN_TIME)
: getMetaString(this.general.meta, META_TURN_TIME);
? getMetaString(oppose.general.meta, META_TURN_TIME)
: getMetaString(this.general.meta, META_TURN_TIME);
if (!baseTurnTime) {
return;
}
@@ -480,9 +480,8 @@ export class WarUnitGeneral<
public override getMaxPhase(): number {
const base = this.getCrewType().speed;
const aux = { isAttacker: this.isAttacker() };
const context = this.getActionContext();
const phase = this.actionPipeline.onCalcStat(context, 'initWarPhase', base, aux);
const phase = this.actionPipeline.onCalcStat(context, 'initWarPhase', base, { isAttacker: this.isAttacker() });
return phase + this.bonusPhase;
}
@@ -507,12 +506,16 @@ export class WarUnitGeneral<
return strength;
}
private resolveOpposeStatValue(statName: WarStatName, value: number, aux?: Record<string, unknown>): number {
private resolveOpposeStatValue(statName: WarStatName, value: number, aux?: any): number {
const oppose = this.getOppose();
if (!(oppose instanceof WarUnitGeneral)) {
return value;
}
return oppose.getActionPipeline().onCalcOpposeStat(this.getActionContext(), statName, value, aux);
const result = oppose.getActionPipeline().onCalcOpposeStat(this.getActionContext(), statName, value, aux);
if (typeof result === 'number') {
return result;
}
return value;
}
public override getDex(crewType: WarCrewType): number {
@@ -527,8 +530,10 @@ export class WarUnitGeneral<
};
const statName = toDexStatName(armType);
let dex = this.actionPipeline.onCalcStat(this.getActionContext(), statName, base, aux);
dex = this.resolveOpposeStatValue(statName, dex, aux);
return dex;
if (typeof dex === 'number') {
dex = this.resolveOpposeStatValue(statName, dex, aux);
}
return typeof dex === 'number' ? dex : base;
}
public override getComputedAttack(): number {
@@ -578,8 +583,8 @@ export class WarUnitGeneral<
const mainStat = this.resolveMainStat(armType);
const coef =
armType === this.config.armTypes.wizard ||
armType === this.config.armTypes.siege ||
armType === this.config.armTypes.misc
armType === this.config.armTypes.siege ||
armType === this.config.armTypes.misc
? 0.4
: 0.5;