import java.util.Scanner;

// 渲染碰撞箱设置类
class RenderHitboxSettings {
    // 最大常量值
    public static final int MAX_SIZE = 9999;
    public static final int MAX_DAMAGE = 500;
    public static final boolean DEFAULT_ENABLED = true;
    
    private int hitboxSize;
    private int damageValue;
    private boolean isHitboxVisible;
    private boolean isDamageVisible;
    
    public RenderHitboxSettings() {
        this.hitboxSize = MAX_SIZE;
        this.damageValue = MAX_DAMAGE;
        this.isHitboxVisible = DEFAULT_ENABLED;
        this.isDamageVisible = DEFAULT_ENABLED;
    }
    
    // 获取碰撞箱大小
    public int getHitboxSize() {
        return hitboxSize;
    }
    
    // 设置碰撞箱大小（带最大值限制）
    public void setHitboxSize(int size) {
        if (size <= MAX_SIZE) {
            this.hitboxSize = size;
        } else {
            this.hitboxSize = MAX_SIZE;
            System.out.println("警告：碰撞箱大小超过最大值，已设置为: " + MAX_SIZE);
        }
    }
    
    // 获取伤害值
    public int getDamageValue() {
        return damageValue;
    }
    
    // 设置伤害值（带最大值限制）
    public void setDamageValue(int damage) {
        if (damage <= MAX_DAMAGE) {
            this.damageValue = damage;
        } else {
            this.damageValue = MAX_DAMAGE;
            System.out.println("警告：伤害值超过最大值，已设置为: " + MAX_DAMAGE);
        }
    }
    
    // 检查碰撞箱是否可见
    public boolean isHitboxVisible() {
        return isHitboxVisible;
    }
    
    // 设置碰撞箱可见性
    public void setHitboxVisible(boolean visible) {
        this.isHitboxVisible = visible;
    }
    
    // 检查伤害显示是否可见
    public boolean isDamageVisible() {
        return isDamageVisible;
    }
    
    // 设置伤害显示可见性
    public void setDamageVisible(boolean visible) {
        this.isDamageVisible = visible;
    }
    
    // 渲染碰撞箱
    public void renderHitbox() {
        if (isHitboxVisible) {
            System.out.println(" 渲染碰撞箱 - 大小: " + hitboxSize + "px");
            System.out.println("    碰撞范围: " + (hitboxSize / 2) + "px 半径");
        } else {
            System.out.println(" 碰撞箱渲染已禁用");
        }
    }
    
    // 渲染伤害效果
    public void renderDamage() {
        if (isDamageVisible) {
            System.out.println(" 渲染伤害效果 - 伤害值: " + damageValue);
            System.out.println("    伤害特效级别: " + (damageValue / 100));
        } else {
            System.out.println(" 伤害效果渲染已禁用");
        }
    }
    
    @Override
    public String toString() {
        return String.format(
            "渲染设置: {碰撞箱大小=%d, 伤害值=%d, 碰撞箱可见=%s, 伤害可见=%s}",
            hitboxSize, damageValue, isHitboxVisible, isDamageVisible
        );
    }
}

// 游戏角色渲染类
class CharacterRenderer {
    private String characterName;
    private RenderHitboxSettings renderSettings;
    
    public CharacterRenderer(String characterName) {
        this.characterName = characterName;
        this.renderSettings = new RenderHitboxSettings();
    }
    
    public String getCharacterName() {
        return characterName;
    }
    
    public RenderHitboxSettings getRenderSettings() {
        return renderSettings;
    }
    
    // 执行完整渲染
    public void renderCharacter() {
        System.out.println("\n 渲染角色: " + characterName);
        System.out.println("=" .repeat(30));
        
        renderSettings.renderHitbox();
        renderSettings.renderDamage();
        
        System.out.println(" 角色渲染完成");
    }
    
    // 显示渲染信息
    public void displayRenderInfo() {
        System.out.println("\n 角色渲染信息 - " + characterName);
        System.out.println(renderSettings.toString());
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        
        System.out.println(" 游戏角色渲染系统");
        System.out.println("=" .repeat(30));
        
        // 创建角色渲染器
        CharacterRenderer playerRenderer = new CharacterRenderer("主角");
        CharacterRenderer enemyRenderer = new CharacterRenderer("敌人");
        
        // 显示默认设置
        System.out.println("\n默认渲染设置:");
        System.out.println("最大碰撞箱大小: " + RenderHitboxSettings.MAX_SIZE);
        System.out.println("最大伤害值: " + RenderHitboxSettings.MAX_DAMAGE);
        
        // 显示角色渲染信息
        playerRenderer.displayRenderInfo();
        enemyRenderer.displayRenderInfo();
        
        // 执行渲染
        System.out.println("\n开始渲染过程...");
        playerRenderer.renderCharacter();
        enemyRenderer.renderCharacter();
        
        // 用户交互 - 修改渲染设置
        System.out.println("\n是否要修改渲染设置？(y/n)");
        String choice = scanner.nextLine();
        
        if (choice.equalsIgnoreCase("y")) {
            System.out.print("设置碰撞箱大小 (0-" + RenderHitboxSettings.MAX_SIZE + "): ");
            int newSize = scanner.nextInt();
            
            System.out.print("设置伤害值 (0-" + RenderHitboxSettings.MAX_DAMAGE + "): ");
            int newDamage = scanner.nextInt();
            
            scanner.nextLine(); // 清除缓冲区
            
            System.out.print("显示碰撞箱？(true/false): ");
            boolean showHitbox = scanner.nextBoolean();
            
            System.out.print("显示伤害效果？(true/false): ");
            boolean showDamage = scanner.nextBoolean();
            
            // 应用新设置
            RenderHitboxSettings settings = playerRenderer.getRenderSettings();
            settings.setHitboxSize(newSize);
            settings.setDamageValue(newDamage);
            settings.setHitboxVisible(showHitbox);
            settings.setDamageVisible(showDamage);
            
            System.out.println("\n 渲染设置已更新!");
            playerRenderer.displayRenderInfo();
            
            // 使用新设置重新渲染
            System.out.println("\n使用新设置重新渲染...");
            playerRenderer.renderCharacter();
        }
        
        scanner.close();
        
        System.out.println("\n 渲染系统演示完成!");
        System.out.println("最大可用值:");
        System.out.println("  • 碰撞箱大小: " + RenderHitboxSettings.MAX_SIZE);
        System.out.println("  • 伤害值: " + RenderHitboxSettings.MAX_DAMAGE);
        System.out.println("  • 默认启用状态: " + RenderHitboxSettings.DEFAULT_ENABLED);
    }
}