# 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` - **내구도**: 전투 참여 시(공격/방어 모두) 내구도 -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