From 0c7a562b00cb827a1e36f3665bc9f4767425eec4 Mon Sep 17 00:00:00 2001 From: artbiit Date: Mon, 30 Mar 2026 17:30:29 +0900 Subject: [PATCH] feat: update weapon refinement cost formula and add durability and destruction mechanics --- Docs/Plans/MiniGame_Refinement_Plan.md | 10 +++++++--- src/services/RefinementService.ts | 7 ++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Docs/Plans/MiniGame_Refinement_Plan.md b/Docs/Plans/MiniGame_Refinement_Plan.md index 8efef6f..a5e01df 100644 --- a/Docs/Plans/MiniGame_Refinement_Plan.md +++ b/Docs/Plans/MiniGame_Refinement_Plan.md @@ -8,9 +8,13 @@ The Refinement mini-game allows users to strengthen their virtual weapons, parti ## Core Features ### 1. Weapon Refinement -- **Progression**: Level 0 to Level 20. -- **Cost**: Increases exponentially with level (`level^2 * 100 G`). -- **Success Rate**: Decreases as the level increases. +- **Progression**: Level- **재련 비용**: `floor(10 × 1.6^level)G` (레벨별 기하급수적 증가) +- **판매 가격**: `floor(현재_단계_비용 × 2)G` +- **내구도**: 전투 참여 시(공격/방어 모두) 내구도 -1. +- **파괴 조건**: + - 재련 실패 시 낮은 확률로 파괴 (0단계 회귀). + - 내구도가 0인 상태에서 전투 시도(공격) 시 전투 후 무기 파괴. +as the level increases. - **Risk**: Failure at higher levels can lead to weapon destruction (reset to level 0). - **Durability**: Each battle reduces durability. **Success and Level Up fully restores durability.** diff --git a/src/services/RefinementService.ts b/src/services/RefinementService.ts index a8dc1fa..ed60e2c 100644 --- a/src/services/RefinementService.ts +++ b/src/services/RefinementService.ts @@ -39,8 +39,8 @@ export class RefinementService { throw new Error(`이미 최대 단계(${this.MAX_LEVEL}강)에 도달했습니다. 무기를 판매하고 다시 시작하세요!`); } - // 비용 계산: level^2 * 100G - const cost = Math.pow(profile.weaponLevel, 2) * 100 || 100; + // 비용 계산: floor(10 * 1.6^level) + const cost = Math.floor(10 * Math.pow(1.6, profile.weaponLevel)); if (profile.gold < cost) { throw new Error('골드가 부족합니다.'); @@ -206,7 +206,8 @@ export class RefinementService { const profile = await this.getOrCreateProfile(userId, guildId); if (profile.weaponLevel === 0) throw new Error('0단계 무기는 판매할 수 없습니다.'); - const price = Math.pow(profile.weaponLevel, 2) * 150; + const currentCost = Math.floor(10 * Math.pow(1.6, profile.weaponLevel)); + const price = Math.floor(currentCost * 2); const updated = await prisma.refinementProfile.update({ where: { userId_guildId: { userId, guildId } },