# Refinement Mini-Game Implementation Plan This document outlines the design and implementation details of the 'Refinement' (재련) mini-game system for Kord. ## Overview The Refinement mini-game allows users to strengthen their virtual weapons, participate in simple battles, and earn gold. It features a high-risk, high-reward progression system with a community-wide 'Fever Time' bonus. ## Core Features ### 1. Weapon Refinement - **Progression**: Level- **재련 비용**: `floor(10 × 1.6^level)G` (레벨별 기하급수적 증가) - **판매 가격**: `floor(현재_단계_비용 × 보정계수)G` - 0~4강: 비용의 **2배** - 5~25강: 비용의 **(2 + (L-4) × 10)배** (기대값 보정으로 고강화 가치 극대화) - **재련 성공 확률**: - 0→4강: 100% ~ 90% - 4→5강: **5%** (급락) - 11→20강: **0.1%** (신화) - 21→25강: **0.01%** (기적) - **전투 보상**: `(패배자_단계_비용 × (패배자_레벨/승리자_레벨) × 2.0) × (0.8~1.2 랜덤)` - **최대 단계**: **25강** (Lvl 25) - **최대 내구도**: **10 + Level** (강화 단계가 높을수록 내구도가 확장됨) - **전투 규칙**: - 0강 무기 소유자는 전투를 걸 수 없으며, 공격 대상으로 지정될 수도 없습니다. - **일일 공격 제한**: 각 유저는 **하루 최대 10회**만 전투를 신청할 수 있습니다. (00시 초기화) - **승리 확률 페널티**: 상대보다 5강 이상 낮을 경우 승률이 급락하며, 10강 차이부터는 **승률 0%**가 적용됩니다. - 전투 참여 시(공격/방어 모두) 내구도 -1. - 내구도 0인 상태에서 전투를 시도하면 전투 후 무기가 즉시 **파괴**됩니다. - 재련 성공 시 내구도가 새로운 **최대치(10+Level)**로 완전 회복(수리)됩니다. - 내구도가 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.** ### 2. Battle System - **One-way Attack**: Users can attack others without a formal acceptance process. - **Outcome**: Calculated based on weapon levels. - **Rewards**: The winner receives gold based on both participants' levels. - **Weapon Destruction**: If a user attacks while their durability is 0, their weapon is permanently destroyed. ### 3. Fever System - **Dynamic Analysis**: The bot tracks server message activity per hour. - **Activation**: Fever mode activates during the server's peak activity hour (determined by historical data). - **Bonus**: +10% success rate for all refinement attempts during Fever Time. ### 4. Economy & Management - **Gold Sources**: Daily check-ins, winning battles, and selling weapons. - **Check-in**: `/refine checkin` grants a set amount of gold once per day. - **Selling**: Max level weapons must be sold to restart the progression. - **Registry**: Server admins can enable/disable mini-games and restrict them to specific channels via `/minigame`. ## Technical Architecture - **Prisma**: Persists user profiles, server configs, activity logs, and fever states. - **ActivityTrackerService**: Buffers and saves message counts to avoid DB bottleneck. - **FeverService**: Analyzes activity and manages the 1-hour fever window. - **RefinementService**: Contains the core game logic (probabilities, rewards). ## Implementation Progress - [x] Database Schema updates - [x] Infrastructure (Registry, Activity Tracking) - [x] Game Logic (Refinement, Battle, Economy) - [x] Commands and Interaction Handlers - [x] Fever System Integration