package cz.jzitnik.game.handlers.tooluse.handlers;

import cz.jzitnik.game.Game;
import cz.jzitnik.game.annotations.Flamable;
import cz.jzitnik.game.annotations.ToolUse;
import cz.jzitnik.game.entities.Block;
import cz.jzitnik.game.entities.items.ItemType;
import cz.jzitnik.game.handlers.tooluse.ToolUseHandler;

@ToolUse(ItemType.FLINT_AND_STEEL)
public class FlintAndSteelUse implements ToolUseHandler {

    @Override
    public void handle(Game game, int x, int y) {
        var blocks = game.getWorld()[y][x];

        for (Block block : blocks) {
            if (block.getClass().isAnnotationPresent(Flamable.class)) {
                block.setOnFire(true);
            }
        }
    }
}
