package thb.jeanluc.adventure.command.impl;

import thb.jeanluc.adventure.command.Command;
import thb.jeanluc.adventure.game.GameContext;
import thb.jeanluc.adventure.io.text.MapView;
import thb.jeanluc.adventure.map.MapLayout;

import java.util.List;

/** Shows the fog-of-war map of explored rooms. Usage: {@code map}. */
public class MapCommand implements Command {

    @Override
    public void execute(GameContext ctx, List<String> args) {
        MapView view = MapLayout.compute(
                ctx.getWorld(),
                ctx.getPlayer().getVisitedRoomIds(),
                ctx.getPlayer().getCurrentRoom());
        ctx.getIo().showMap(view);
    }

    @Override
    public String help() {
        return "map  -  show the map of explored rooms";
    }
}
