package org.project.item.armors;

import org.project.item.Item;

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

    public Armor(int defense, int durability) {
        this.defense = defense;
        this.maxDefense = defense;
        this.durability = durability;
        this.maxDurability = durability;
    }

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

    public void repair() {
        isBroke = false;
        defense = maxDefense;
        durability = maxDurability;
    }

    public int getDefense() { return defense; }
    public int getDurability() { return durability; }
    public boolean isBroke() { return isBroke; }
}