fix: align scenario 2400 monthly parity
This commit is contained in:
@@ -494,7 +494,11 @@ export const resolveWarAftermath = <TriggerState extends GeneralTriggerState = G
|
||||
const defenderNation = input.defenderNation;
|
||||
const cityKilled = cityReport?.killed ?? 0;
|
||||
|
||||
if ((cityReport?.dead ?? 0) > 0) {
|
||||
// Ref branches on WarUnitCity::getPhase(), not accumulated city
|
||||
// casualties. A city can retain dead casualties from earlier battles
|
||||
// while being conquered before its wall receives a phase.
|
||||
const cityPhase = cityReport?.phase ?? ((cityReport?.dead ?? 0) > 0 ? 1 : 0);
|
||||
if (cityPhase > 0) {
|
||||
const crewTypeIndex = buildCrewTypeIndex(input.unitSet);
|
||||
const crewType = crewTypeIndex.get(input.config.castleCrewTypeId);
|
||||
const riceCoef = crewType?.rice ?? 1;
|
||||
|
||||
@@ -165,6 +165,7 @@ const resolveUnitReport = (unit: WarUnit): WarUnitReport => {
|
||||
isAttacker: unit.isAttacker(),
|
||||
killed: unit.getKilled(),
|
||||
dead: unit.getDead(),
|
||||
phase: unit.getPhase(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -176,6 +177,7 @@ const resolveUnitReport = (unit: WarUnit): WarUnitReport => {
|
||||
isAttacker: unit.isAttacker(),
|
||||
killed: unit.getKilled(),
|
||||
dead: unit.getDead(),
|
||||
phase: unit.getPhase(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -186,6 +188,7 @@ const resolveUnitReport = (unit: WarUnit): WarUnitReport => {
|
||||
isAttacker: unit.isAttacker(),
|
||||
killed: unit.getKilled(),
|
||||
dead: unit.getDead(),
|
||||
phase: unit.getPhase(),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -112,6 +112,8 @@ export interface WarUnitReport {
|
||||
isAttacker: boolean;
|
||||
killed: number;
|
||||
dead: number;
|
||||
/** Number of battle phases consumed by this unit. */
|
||||
phase?: number;
|
||||
}
|
||||
|
||||
export interface WarBattleMetrics {
|
||||
|
||||
@@ -112,10 +112,6 @@ export class WarUnitGeneral<
|
||||
super.setOppose(oppose);
|
||||
increaseMetaNumber(this.general.meta, RANK_WARNUM, 1);
|
||||
|
||||
if (!oppose) {
|
||||
return;
|
||||
}
|
||||
|
||||
const baseTurnTime = this.isAttacker()
|
||||
? this.general.turnTime
|
||||
: oppose instanceof WarUnitGeneral
|
||||
@@ -126,6 +122,16 @@ export class WarUnitGeneral<
|
||||
}
|
||||
const phase = clamp(this.getRealPhase(), 0, 99);
|
||||
this.general.recentWarTime = new Date(baseTurnTime.getTime());
|
||||
const baseTurnTick = this.isAttacker()
|
||||
? this.general.turnTick
|
||||
: oppose instanceof WarUnitGeneral
|
||||
? oppose.general.turnTick
|
||||
: this.general.turnTick;
|
||||
if (baseTurnTick !== undefined) {
|
||||
this.general.recentWarTick = baseTurnTick - (baseTurnTick % 100) + phase;
|
||||
} else {
|
||||
delete this.general.recentWarTick;
|
||||
}
|
||||
this.general.meta.recent_war_phase = phase;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user