package org.project.entity.enemies;
import org.project.entity.Entity;
import org.project.item.weapons.Weapon;
import java.util.Random;

public class Dragon extends Enemy{
    // Reduces incoming damage by 10 points.
    private final int armorDefense = 10;
    private final Random random = new Random();

    public Dragon(Weapon weapon) {
        //Massive HP and MP pool to suit its Boss role.
        super(350, 100, weapon);
    }

    @Override
    public void attack(Entity target) {
        int baseDamage = weapon.getDamage();

        //25% chance to perform "Fire Breath" which deals double damage
        if (random.nextInt(100) < 25) {
            System.out.println("Dragon uses Fire Breath!"); // Visual feedback for boss ability
            target.takeDamage(baseDamage * 2);
        } else {
            target.takeDamage(baseDamage);
        }
    }

    @Override
    public void takeDamage(int damage) {
        // Minimum damage received is always 1 unless damage is 0.
        int effectiveDamage = Math.max(1, damage - armorDefense);

        if (damage <= 0) effectiveDamage = 0;

        super.takeDamage(effectiveDamage);
    }
}
