package org.project.item.armors;

// TODO: UPDATE IMPLEMENTATION
public abstract class Armor {
    private int defense;
    private int maxDefense;
    protected int durability;
    private final int maxDurability=100;

    private boolean isBroke;

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

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

    public void decreacDurability()
    {
        if(durability>30)
            durability-=30;
        else
        {
            durability=0;
            checkBreak();
        }
    }

    public void filldur()
    {
        durability=maxDurability;
    }

    // TODO: (BONUS) UPDATE THE REPAIR METHOD
    public void repair() {
        isBroke = false;
        defense = maxDefense;
        durability = maxDurability;
    }

    public int getDefense() {
        return defense;
    }

    public int getDurability() {
        return durability;
    }

    public boolean isBroke() {
        return isBroke;
    }
}
