package cz.jzitnik.game.logic.services.mobs;

import cz.jzitnik.game.Game;
import cz.jzitnik.game.annotations.CustomLogic;
import cz.jzitnik.game.entities.items.registry.mobs.Zombie;
import cz.jzitnik.game.logic.CustomLogicInterface;
import cz.jzitnik.tui.ScreenRenderer;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@CustomLogic
public class ZombieHurtLogic implements CustomLogicInterface {
    @Override
    public void nextIteration(Game game, ScreenRenderer screenRenderer) {
        var world = game.getWorld();
        var playerCords = game.getPlayerCordsPoint();

        if (world[playerCords.y][playerCords.x].stream().anyMatch(block -> block.getClass().equals(Zombie.class))) {
            game.getPlayer().dealDamage(game, screenRenderer);
        }
    }
}
