package org.project.item.armors;

import org.project.item.Item;

public abstract class Armor implements Item {
    private int defense;
    private int maxDefense;
    private int durability;
    private int maxDurability;
    private boolean isBroke;

    public Armor(int defense, int durability) {
        this.defense = defense;
        this.durability = durability;
        // مقداردهی سقف دفاع و دوام زره
        this.maxDefense = defense;
        this.maxDurability = durability;
    }

    public void checkBreak() {
        if (durability <= 0) {
            isBroke = true;
            defense = 0;
        }
    }

    // این متد مربوط به بخش امتیازی (BONUS) است و دست نخورده باقی می‌ماند
    public void repair() {
        isBroke = false;
        defense = maxDefense;
        durability = maxDurability;
    }

    public int getDefense() {
        return defense;
    }

    public int getDurability() {
        return durability;
    }

    public boolean isBroke() {
        return isBroke;
    }
}