# 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 0 to Level 20. - **Cost**: Increases exponentially with level (`level^2 * 100 G`). - **Success Rate**: Decreases 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