fix: align scenario 2400 battle replay parity
This commit is contained in:
@@ -1,5 +1,35 @@
|
||||
import type { CrewTypeDefinition } from '@sammo-ts/logic/world/types.js';
|
||||
|
||||
const isWideCodePoint = (codePoint: number): boolean =>
|
||||
codePoint >= 0x1100 &&
|
||||
(codePoint <= 0x115f ||
|
||||
codePoint === 0x2329 ||
|
||||
codePoint === 0x232a ||
|
||||
(codePoint >= 0x2e80 && codePoint <= 0xa4cf && codePoint !== 0x303f) ||
|
||||
(codePoint >= 0xac00 && codePoint <= 0xd7a3) ||
|
||||
(codePoint >= 0xf900 && codePoint <= 0xfaff) ||
|
||||
(codePoint >= 0xfe10 && codePoint <= 0xfe19) ||
|
||||
(codePoint >= 0xfe30 && codePoint <= 0xfe6f) ||
|
||||
(codePoint >= 0xff00 && codePoint <= 0xff60) ||
|
||||
(codePoint >= 0xffe0 && codePoint <= 0xffe6) ||
|
||||
(codePoint >= 0x1b000 && codePoint <= 0x1b001) ||
|
||||
(codePoint >= 0x1f200 && codePoint <= 0x1f251) ||
|
||||
(codePoint >= 0x20000 && codePoint <= 0x3fffd));
|
||||
|
||||
const substringForDisplayWidth = (value: string, width: number): string => {
|
||||
let currentWidth = 0;
|
||||
let result = '';
|
||||
for (const character of value) {
|
||||
const characterWidth = isWideCodePoint(character.codePointAt(0) ?? 0) ? 2 : 1;
|
||||
if (currentWidth + characterWidth > width) {
|
||||
break;
|
||||
}
|
||||
result += character;
|
||||
currentWidth += characterWidth;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
// 전투 계산에 필요한 병종 정보 래퍼.
|
||||
export class WarCrewType {
|
||||
constructor(private readonly definition: CrewTypeDefinition) {}
|
||||
@@ -61,10 +91,9 @@ export class WarCrewType {
|
||||
}
|
||||
|
||||
getShortName(): string {
|
||||
if (this.definition.name.length <= 4) {
|
||||
return this.definition.name;
|
||||
}
|
||||
return this.definition.name.slice(0, 4);
|
||||
// Ref uses mb_strwidth(..., 'UTF-8') and truncates at display width 4.
|
||||
// Korean/CJK characters consume two columns, unlike JS string length.
|
||||
return substringForDisplayWidth(this.definition.name, 4);
|
||||
}
|
||||
|
||||
getAttackCoef(oppose: WarCrewType): number {
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
|
||||
export class che_격노시도 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit, raiseType: number = 0) {
|
||||
super(unit, TriggerPriority.Pre + 300, raiseType);
|
||||
super(unit, TriggerPriority.Body + 400, raiseType);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
@@ -40,7 +40,7 @@ export class che_격노시도 extends BaseWarUnitTrigger {
|
||||
|
||||
export class che_격노발동 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit, raiseType: number = 0) {
|
||||
super(unit, TriggerPriority.Post + 450, raiseType);
|
||||
super(unit, TriggerPriority.Post + 600, raiseType);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
|
||||
@@ -51,7 +51,7 @@ export class che_계략시도 extends BaseWarUnitTrigger {
|
||||
|
||||
const general = self.getGeneral();
|
||||
let trialProbability =
|
||||
(self.getComputedStat('intelligence', general.stats.intelligence) / 100) *
|
||||
(self.getComputedStat('intelligence', general.stats.intelligence, { truncate: false }) / 100) *
|
||||
self.getCrewType().magicCoef;
|
||||
trialProbability = self
|
||||
.getActionPipeline()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { JosaUtil } from '@sammo-ts/common';
|
||||
import { LogFormat } from '@sammo-ts/logic/logging/types.js';
|
||||
import { TriggerPriority } from '@sammo-ts/logic/triggers/core.js';
|
||||
import { BaseWarUnitTrigger } from '@sammo-ts/logic/war/triggers.js';
|
||||
@@ -7,7 +8,7 @@ export class che_반계시도 extends BaseWarUnitTrigger {
|
||||
private readonly prob: number;
|
||||
|
||||
constructor(unit: WarUnit, prob = 0.4) {
|
||||
super(unit, TriggerPriority.Pre + 200);
|
||||
super(unit, TriggerPriority.Body + 300);
|
||||
this.prob = prob;
|
||||
}
|
||||
|
||||
@@ -37,7 +38,7 @@ export class che_반계시도 extends BaseWarUnitTrigger {
|
||||
|
||||
export class che_반계발동 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, TriggerPriority.Post + 150);
|
||||
super(unit, TriggerPriority.Post + 250);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
@@ -56,12 +57,15 @@ export class che_반계발동 extends BaseWarUnitTrigger {
|
||||
}
|
||||
|
||||
const [opposeMagic, damage] = magicData;
|
||||
const particle = JosaUtil.pick(opposeMagic, '을');
|
||||
|
||||
self.getLogger().pushGeneralBattleDetailLog(
|
||||
`<C>반계</>로 상대의 <D>${opposeMagic}</>을 되돌렸다!`,
|
||||
`<C>반계</>로 상대의 <D>${opposeMagic}</>${particle} 되돌렸다!`,
|
||||
LogFormat.PLAIN
|
||||
);
|
||||
oppose.getLogger().pushGeneralBattleDetailLog(`<D>${opposeMagic}</>을 <R>역으로</> 당했다!`, LogFormat.PLAIN);
|
||||
oppose
|
||||
.getLogger()
|
||||
.pushGeneralBattleDetailLog(`<D>${opposeMagic}</>${particle} <R>역으로</> 당했다!`, LogFormat.PLAIN);
|
||||
|
||||
self.multiplyWarPowerMultiply(damage);
|
||||
|
||||
|
||||
@@ -47,8 +47,9 @@ export class che_위압발동 extends BaseWarUnitTrigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
oppose.getLogger().pushGeneralBattleDetailLog('상대에게 <R>위압</>받았다!', LogFormat.PLAIN);
|
||||
self.getLogger().pushGeneralBattleDetailLog('상대에게 <C>위압</>을 줬다!', LogFormat.PLAIN);
|
||||
// Preserve Ref's historical extra closing marker in the rendered log.
|
||||
oppose.getLogger().pushGeneralBattleDetailLog('상대에게 <R>위압</>받았다!</>', LogFormat.PLAIN);
|
||||
self.getLogger().pushGeneralBattleDetailLog('상대에게 <C>위압</>을 줬다!</>', LogFormat.PLAIN);
|
||||
oppose.setWarPowerMultiply(0);
|
||||
if (canAddAtmos(oppose)) {
|
||||
oppose.addAtmos(-5);
|
||||
|
||||
Reference in New Issue
Block a user