package org.project.entity.enemies;

import org.project.entity.Entity;
import org.project.entity.players.Player;
import org.project.item.weapons.Weapon;

public class Dragon extends Enemy{

    private static final double BREATH_DAMAGE_PENETRATION = 0.5;

    public Dragon(Weapon weapon)
    {
        super(200, 0, weapon);
    }

    @Override
    public void attack(Entity target)
    {
        if(!this.isAlive()) return;
        int damage = 25;
        if(super.getWeapon() != null)
        {
            damage += super.getWeapon().getDamage();
        }

        target.takeDamage(damage);
        System.out.println("🐉 Dragon used Fire Breath!");

        if (target instanceof Player)
        {
            Player player = (Player) target;
            if (player.isDefending())
            {
                int penetrationDamage = (int) (damage * BREATH_DAMAGE_PENETRATION);
                player.takeDamage(penetrationDamage);
                System.out.println("🔥 Dragon's fiery breath bypassed the shield!");
                System.out.println("💥 " + player.getName() + " took " + penetrationDamage + " additional damage from fire!");
            }
        }
    }
}
