diff --git a/src/lib/v2-pre/data/formatText.spec.ts b/src/lib/v2-pre/data/formatText.spec.ts
index 3ce3197a..3481c3f3 100644
--- a/src/lib/v2-pre/data/formatText.spec.ts
+++ b/src/lib/v2-pre/data/formatText.spec.ts
@@ -37,6 +37,7 @@ describe('formatSubSkillInfo', () => {
expect(result).toBe('전투 중 초기 SP가 40.0 증가하며, 오픈월드에서는 10분에 1회 발동한다.')
})
+
it('prepends 0 if the calculated value below 0', () => {
const params = {
info: '파티원이 출혈 상태의 적 공격 시, 출혈 상태 스택마다 크리티컬률이 #1[f1]% 증가하고, 캐릭터 자신의 물리 대미지가 #2[f1]% 증가한다.',
@@ -52,7 +53,26 @@ describe('formatSubSkillInfo', () => {
const result = formatSubSkillInfo(params)
expect(result).toBe(
- '필살기 꿈 세계 창조는 추가로 SP를 소모해 물리 대미지가 추가 소모 SP*0.70%만큼 증가하고, 크리티컬률이 추가 소모 SP*0.50%만큼 증가한다(최대 추가 소모 SP: 50pt). 해당 효과는 피니쉬가 종료될 때까지 지속되며, 캐릭터가 사망하거나 퇴장 시 해제된다.'
+ '파티원이 출혈 상태의 적 공격 시, 출혈 상태 스택마다 크리티컬률이 0.7% 증가하고, 캐릭터 자신의 물리 대미지가 0.5% 증가한다.'
+ )
+ })
+
+ it('handle integer format', () => {
+ const params = {
+ info: '모든 대미지 #1[i]% 증가. 브로냐가 사용 시 교대기(QTE 포함)의 모든 대미지가 추가로 #2[i]% 증가한다.',
+ maxLv: 1,
+ paramBase1: 0.1,
+ paramBase2: 0.1,
+ paramBase3: 0,
+ paramAdd1: 0,
+ paramAdd2: 0,
+ paramAdd3: 0
+ }
+
+ const result = formatSubSkillInfo(params)
+
+ expect(result).toBe(
+ '모든 대미지 10% 증가. 브로냐가 사용 시 교대기(QTE 포함)의 모든 대미지가 추가로 10% 증가한다.'
)
})
})
diff --git a/src/lib/v2-pre/data/formatText.ts b/src/lib/v2-pre/data/formatText.ts
index 242f5bbb..d8682586 100644
--- a/src/lib/v2-pre/data/formatText.ts
+++ b/src/lib/v2-pre/data/formatText.ts
@@ -105,7 +105,7 @@ function calculateParams(params: {
}
}
-const paramRegex = /#([123])\[f([0-9])\](%)?/
+const paramRegex = /#([123])\[(i|f[0-9])\](%)?/
function replaceParams(
text: string,
params: {
@@ -119,7 +119,7 @@ function replaceParams(
return text
}
const paramNumber = result[1]
- const precision = parseInt(result[2], 10)
+ const precision = result[2] === 'i' ? 0 : parseInt(result[2].slice(1), 10)
const asPercentage = result[3]!!
const value = paramNumber === '1' ? params.param1 : paramNumber === '2' ? params.param2 : params.param3