# 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(현재_단계_비용 × 2)G` - **재련 성공 확률**: - 0→4강: 100% ~ 90% - 4→5강: **5%** (급락) - 5→10강: 4% ~ 1% - 11→20강: **0.1%** (신화) - 21→25강: **0.01%** (기적) - **전투 보상**: `(패배자_단계_비용 × (패배자_레벨/승리자_레벨) × 2.0) × (0.8~1.2 랜덤)` - **최대 단계**: **25강** (Lvl 25) - **전투 규칙**: - 0강 무기 소유자는 전투를 걸 수 없으며, 공격 대상으로 지정될 수도 없습니다. - 전투 참여 시(공격/방어 모두) 내구도 -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.** ### 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