package org.academiadecodigo.bootcamp11.sniperelite;

/**
 * MIT License
 * (c) 2017 Ricardo Constantino
 */

public class ArmoredEnemy extends Enemy {
    private int armor;

    public ArmoredEnemy() {
        super(ObjectType.ARMORED);
        this.armor = (int) (Math.random() * 4 + 1);
    }

    public boolean hit(int damage) {
        if (this.armor > 0) {
            this.armor--;
            changeStatus("-- armor absorbed bullet --");
        } else {
           takeDamage(damage);
        }
        System.out.println(getMessage());
        return true;
    }
}
