package org.project.item.armors;

// TODO: UPDATE IMPLEMENTATION
public abstract class Armor {

    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.maxDefense = defense;

        this.durability = durability;
        this.maxDurability =durability;

        this.isBroke=false;
    }

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

    // TODO: (BONUS) UPDATE THE REPAIR METHOD
    public void repair() {
        if (!isBroke){
            System.out.println("Armor is not broken.");
            return;
        }

        isBroke = false;
        defense = maxDefense;
        durability = maxDurability;
        System.out.println("Armor repaired!");
    }

    public int getDefense() {
        return defense;
    }

    public int getDurability() {
        return durability;
    }

    public boolean isBroke() {
        return isBroke;
    }
}
