package org.academiadecodigo.bootcamp11.sniperelite;

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

public class SoldierEnemy extends Enemy {
    private double dodge;

    public SoldierEnemy() {
        super(ObjectType.SOLDIER);
        this.dodge = 0.2;
    }

    @Override
    public boolean hit(int damage) {
        boolean shotHit = false;
        if (Math.random() > this.dodge) {
            takeDamage(damage);
            shotHit = true;
        } else {
            changeStatus("--" + this + " dodged bullet --");
        }
        System.out.println(this.getMessage());
        return shotHit;
    }
}
